]> Dogcows Code - chaz/openbox/commitdiff
take borders into account for figuring clicks
authorDana Jansens <danakj@orodu.net>
Fri, 28 Mar 2003 07:46:17 +0000 (07:46 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 28 Mar 2003 07:46:17 +0000 (07:46 +0000)
plugins/mouse/mouse.c

index 6165744f0b1d299a882751b7cc7203eceb9c5eeb..6ff40d90e5b917b120545ba2b868d163ca9b614c 100644 (file)
@@ -213,6 +213,10 @@ static void event(ObEvent *e, void *foo)
         }
         context = engine_get_context(e->data.x.client,
                                      e->data.x.e->xbutton.window);
+        g_message("press %d frame %d client %d",
+                  context, 
+                  g_quark_try_string("frame"),
+                  g_quark_try_string("client"));
 
         fire_button(MouseAction_Press, context,
                     e->data.x.client, e->data.x.e->xbutton.state,
@@ -228,6 +232,10 @@ static void event(ObEvent *e, void *foo)
     case Event_X_ButtonRelease:
         context = engine_get_context(e->data.x.client,
                                      e->data.x.e->xbutton.window);
+        g_message("release %d frame %d client %d",
+                  context, 
+                  g_quark_try_string("frame"),
+                  g_quark_try_string("client"));
         if (e->data.x.e->xbutton.button == button) {
             /* end drags */
             if (drag) {
@@ -240,22 +248,20 @@ static void event(ObEvent *e, void *foo)
                 lbutton = 0;
             } else {
                 /* clicks are only valid if its released over the window */
-                if (e->data.x.e->xbutton.x >= 0 &&
-                    e->data.x.e->xbutton.y >= 0) {
-                    int junk;
-                    Window wjunk;
-                    guint ujunk, w, h;
-                    XGetGeometry(ob_display, e->data.x.e->xbutton.window,
-                                 &wjunk, &junk, &junk, &w, &h, &ujunk, &ujunk);
-                    if (e->data.x.e->xbutton.x < (signed)w &&
-                        e->data.x.e->xbutton.y < (signed)h) {
-                        click =TRUE;
-                        /* double clicks happen if there were 2 in a row! */
-                        if (lbutton == button &&
-                            e->data.x.e->xbutton.time - 300 <= ltime)
-                            dclick = TRUE;
-                    }
-                    lbutton = button;
+                int junk;
+                Window wjunk;
+                guint ujunk, b, w, h;
+                XGetGeometry(ob_display, e->data.x.e->xbutton.window,
+                             &wjunk, &junk, &junk, &w, &h, &b, &ujunk);
+                if (e->data.x.e->xbutton.x >= (signed)-b &&
+                    e->data.x.e->xbutton.y >= (signed)-b &&
+                    e->data.x.e->xbutton.x < (signed)(w+b) &&
+                    e->data.x.e->xbutton.y < (signed)(h+b)) {
+                    click =TRUE;
+                    /* double clicks happen if there were 2 in a row! */
+                    if (lbutton == button &&
+                        e->data.x.e->xbutton.time - 300 <= ltime)
+                        dclick = TRUE;
                 } else
                     lbutton = 0;
             }
This page took 0.031732 seconds and 4 git commands to generate.