]> Dogcows Code - chaz/openbox/commitdiff
give engines mouse event notifications. make the openbox engine display pressed buttons
authorDana Jansens <danakj@orodu.net>
Mon, 17 Mar 2003 01:47:20 +0000 (01:47 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 17 Mar 2003 01:47:20 +0000 (01:47 +0000)
engines/engineinterface.h
engines/openbox/openbox.c
openbox/engine.c
openbox/engine.h
openbox/event.c

index 96796eddf27475dec6dfec0f75f2412aa3052be2..2a364e22558e1609e68edd9716bf1279297a2377 100644 (file)
@@ -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
index 8f1019172afc9f4e164e34a54075aa9a4babe26e..f92f46a2d5a65228b6665629e887d6cf534cbecc 100644 (file)
@@ -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);
+    }
+}
index 3457da1838bd9c9f8e35ae0a5f7b4fb9fbfdd353..f9fd2cf148111bd977bf37b7a7b1be593801b52c 100644 (file)
@@ -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;
index 067f02fb7407f7732dac5286242747b7bbbc0a35..d29cf80418dc696674bf0287154cf3b1c5125aaa 100644 (file)
@@ -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
index 00b2857cc43ff83fa26057f3f0b49a2081a7f96b..f6a198cca826113fc34ceb968d16ba407f7663ec 100644 (file)
@@ -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;
This page took 0.027095 seconds and 4 git commands to generate.