]> Dogcows Code - chaz/openbox/blobdiff - plugins/mouse/mouse.c
move the openbox engine into librender and the kernel. the theme is loaded and stored...
[chaz/openbox] / plugins / mouse / mouse.c
index 27c536d51594c98d3e94a8738be04855eb1f3f3d..b2173c25156a9a2a3c870a7a59a3cb4cf4b71e67 100644 (file)
@@ -3,9 +3,7 @@
 #include "kernel/action.h"
 #include "kernel/event.h"
 #include "kernel/client.h"
-#include "kernel/frame.h"
 #include "kernel/grab.h"
-#include "kernel/engine.h"
 #include "kernel/parse.h"
 #include "kernel/frame.h"
 #include "translate.h"
@@ -178,7 +176,8 @@ static gboolean fire_motion(MouseAction a, Context context, Client *c,
                 break;
             }
             b->action[a]->data.resize.final = final;
-        }
+        } else
+            g_assert_not_reached();
         b->action[a]->func(&b->action[a]->data);
         return TRUE;
     }
@@ -204,7 +203,7 @@ static void event(ObEvent *e, void *foo)
 {
     static Time ltime;
     static int px, py, cx, cy, cw, ch, dx, dy;
-    static guint button = 0, lbutton = 0;
+    static guint button = 0, state = 0, lbutton = 0;
     static gboolean drag = FALSE, drag_used = FALSE;
     static Corner corner = Corner_TopLeft;
     gboolean click = FALSE;
@@ -239,9 +238,10 @@ static void event(ObEvent *e, void *foo)
                 corner = pick_corner(px, py, cx, cy, cw, ch);
             }
             button = e->data.x.e->xbutton.button;
+            state = e->data.x.e->xbutton.state;
         }
-        context = engine_get_context(e->data.x.client,
-                                     e->data.x.e->xbutton.window);
+        context = frame_context(e->data.x.client->frame,
+                                e->data.x.e->xbutton.window);
 
         fire_button(MouseAction_Press, context,
                     e->data.x.client, e->data.x.e->xbutton.state,
@@ -255,14 +255,13 @@ static void event(ObEvent *e, void *foo)
             break;
 
     case Event_X_ButtonRelease:
-        context = engine_get_context(e->data.x.client,
-                                     e->data.x.e->xbutton.window);
+        context = frame_context(e->data.x.client->frame,
+                                e->data.x.e->xbutton.window);
         if (e->data.x.e->xbutton.button == button) {
             /* end drags */
             if (drag_used) {
                 fire_motion(MouseAction_Motion, context,
-                            e->data.x.client, e->data.x.e->xbutton.state,
-                            e->data.x.e->xbutton.button,
+                            e->data.x.client, state, button,
                             cx, cy, cw, ch, dx, dy, TRUE, corner);
                 drag = drag_used = FALSE;
                 
@@ -291,6 +290,7 @@ static void event(ObEvent *e, void *foo)
             }
 
             button = 0;
+            state = 0;
             ltime = e->data.x.e->xbutton.time;
         }
         fire_button(MouseAction_Release, context,
@@ -314,12 +314,11 @@ static void event(ObEvent *e, void *foo)
                 (ABS(dx) >= threshold || ABS(dy) >= threshold))
                 drag = TRUE;
             if (drag) {
-                context = engine_get_context(e->data.x.client,
-                                             e->data.x.e->xbutton.window);
+                context = frame_context(e->data.x.client->frame,
+                                        e->data.x.e->xbutton.window);
                 drag_used = fire_motion(MouseAction_Motion, context,
                                         e->data.x.client,
-                                        e->data.x.e->xmotion.state,
-                                        button, cx, cy, cw, ch, dx, dy,
+                                        state, button, cx, cy, cw, ch, dx, dy,
                                         FALSE, corner);
             }
         }
This page took 0.026848 seconds and 4 git commands to generate.