summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-03-17 01:47:20 +0000
committerDana Jansens <danakj@orodu.net>2003-03-17 01:47:20 +0000
commit432ac0983e058133e03885171f266dc4ba07f488 (patch)
tree960e5f90cc78632b24712c0f0be7b18dc402d331
parent9a3459e983a11d74ec9f5dc415ce0af551c4b74e (diff)
give engines mouse event notifications. make the openbox engine display pressed buttons
-rw-r--r--engines/engineinterface.h9
-rw-r--r--engines/openbox/openbox.c48
-rw-r--r--openbox/engine.c4
-rw-r--r--openbox/engine.h5
-rw-r--r--openbox/event.c13
5 files changed, 79 insertions, 0 deletions
diff --git a/engines/engineinterface.h b/engines/engineinterface.h
index 96796edd..2a364e22 100644
--- a/engines/engineinterface.h
+++ b/engines/engineinterface.h
@@ -50,4 +50,13 @@ typedef void EngineFrameHide(Frame *self);
/* get_context */
typedef GQuark EngineGetContext(Client *client, Window win);
+/* frame_mouse_enter */
+typedef void EngineMouseEnter(Frame *self, Window win);
+/* frame_mouse_leave */
+typedef void EngineMouseLeave(Frame *self, Window win);
+/* frame_mouse_press */
+typedef void EngineMousePress(Frame *self, Window win, int x, int y);
+/* frame_mouse_release */
+typedef void EngineMouseRelease(Frame *self, Window win, int x, int y);
+
#endif
diff --git a/engines/openbox/openbox.c b/engines/openbox/openbox.c
index 8f101917..f92f46a2 100644
--- a/engines/openbox/openbox.c
+++ b/engines/openbox/openbox.c
@@ -865,3 +865,51 @@ GQuark get_context(Client *client, Window win)
return g_quark_try_string("none");
}
+
+void frame_mouse_enter(ObFrame *self, Window win)
+{
+}
+
+void frame_mouse_leave(ObFrame *self, Window win)
+{
+}
+
+void frame_mouse_press(ObFrame *self, Window win, int x, int y)
+{
+ if (win == self->max) {
+ self->max_press = TRUE;
+ render_max(self);
+ }
+ else if (win == self->close) {
+ self->close_press = TRUE;
+ render_close(self);
+ }
+ else if (win == self->iconify) {
+ self->iconify_press = TRUE;
+ render_iconify(self);
+ }
+ else if (win == self->desk) {
+ self->desk_press = TRUE;
+ render_desk(self);
+ }
+}
+
+void frame_mouse_release(ObFrame *self, Window win, int x, int y)
+{
+ if (win == self->max) {
+ self->max_press = FALSE;
+ render_max(self);
+ }
+ else if (win == self->close) {
+ self->close_press = FALSE;
+ render_close(self);
+ }
+ else if (win == self->iconify) {
+ self->iconify_press = FALSE;
+ render_iconify(self);
+ }
+ else if (win == self->desk) {
+ self->desk_press = FALSE;
+ render_desk(self);
+ }
+}
diff --git a/openbox/engine.c b/openbox/engine.c
index 3457da18..f9fd2cf1 100644
--- a/openbox/engine.c
+++ b/openbox/engine.c
@@ -52,6 +52,10 @@ static gboolean load(char *name)
LOADSYM(frame_show, engine_frame_show);
LOADSYM(frame_hide, engine_frame_hide);
LOADSYM(get_context, engine_get_context);
+ LOADSYM(frame_mouse_enter, engine_mouse_enter);
+ LOADSYM(frame_mouse_leave, engine_mouse_leave);
+ LOADSYM(frame_mouse_press, engine_mouse_press);
+ LOADSYM(frame_mouse_release, engine_mouse_release);
if (!estartup())
return FALSE;
diff --git a/openbox/engine.h b/openbox/engine.h
index 067f02fb..d29cf804 100644
--- a/openbox/engine.h
+++ b/openbox/engine.h
@@ -24,4 +24,9 @@ EngineFrameHide *engine_frame_hide;
EngineGetContext *engine_get_context;
+EngineMouseEnter *engine_mouse_enter;
+EngineMouseLeave *engine_mouse_leave;
+EngineMousePress *engine_mouse_press;
+EngineMouseRelease *engine_mouse_release;
+
#endif
diff --git a/openbox/event.c b/openbox/event.c
index 00b2857c..f6a198cc 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -12,6 +12,7 @@
#include "hooks.h"
#include "extensions.h"
#include "timer.h"
+#include "engine.h"
#include <X11/Xlib.h>
#include <X11/keysym.h>
@@ -286,13 +287,25 @@ void event_process(XEvent *e)
/* dispatch Crossing, Pointer and Key events to the hooks */
switch(e->type) {
case EnterNotify:
+ if (client != NULL) engine_mouse_enter(client->frame, window);
HOOKFIRECLIENT(pointerenter, client);
break;
case LeaveNotify:
+ if (client != NULL) engine_mouse_leave(client->frame, window);
HOOKFIRECLIENT(pointerleave, client);
break;
case ButtonPress:
+ if (client != NULL)
+ engine_mouse_press(client->frame, window,
+ e->xbutton.x, e->xbutton.y);
+ pointer_event(e, client);
+ break;
case ButtonRelease:
+ if (client != NULL)
+ engine_mouse_release(client->frame, window,
+ e->xbutton.x, e->xbutton.y);
+ pointer_event(e, client);
+ break;
case MotionNotify:
pointer_event(e, client);
break;