]> Dogcows Code - chaz/openbox/commitdiff
Fixing bug from commit 041d17373e04
authorDana Jansens <danakj@orodu.net>
Tue, 26 Feb 2008 08:12:57 +0000 (03:12 -0500)
committerDana Jansens <danakj@orodu.net>
Tue, 26 Feb 2008 08:12:57 +0000 (03:12 -0500)
Pressing a button and leave/enter would cause the button to show hover mode, not pressed mode.  Change the behaviour back to how it used to be for pressing (the button stays pressed when you move outside of its box) and make it work correctly, as commit 041d17373e04 also did for menus.

Reverting this behaviour because it seems impossible to do the enter/leave stuff correctly for the close button on maximized windows.  Leaving the titlebar contexts doesn't give us an Enter event to go along with it, so even if we check all motion events, the button will flash unpressed when leaving the topright contexts.

openbox/event.c
openbox/frame.h
openbox/mouse.c

index 28c13a2a3656dca9b94e0f7ed666c3bda72edc6d..dca615df8003451e07720631c1ad2c4550e284ef 100644 (file)
@@ -872,7 +872,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
             con = mouse_button_frame_context(con, e->xbutton.button,
                                              e->xbutton.state);
 
-            if (e->type == ButtonRelease && e->xbutton.button == pb)
+            /* button presses on CLIENT_CONTEXTs are not accompanied by a
+               release because they are Replayed to the client */
+            if ((e->type == ButtonRelease || CLIENT_CONTEXT(con, client)) &&
+                e->xbutton.button == pb)
                 pb = 0, px = py = -1, pcon = OB_FRAME_CONTEXT_NONE;
 
             switch (con) {
@@ -968,41 +971,48 @@ static void event_handle_client(ObClient *client, XEvent *e)
         case OB_FRAME_CONTEXT_TLCORNER:
         case OB_FRAME_CONTEXT_TRCORNER:
             /* we've left the button area inside the titlebar */
-            if (client->frame->max_hover || client->frame->desk_hover ||
-                client->frame->shade_hover || client->frame->iconify_hover ||
-                client->frame->close_hover)
-            {
-                client->frame->max_hover = FALSE;
-                client->frame->desk_hover = FALSE;
-                client->frame->shade_hover = FALSE;
-                client->frame->iconify_hover = FALSE;
-                client->frame->close_hover = FALSE;
-                frame_adjust_state(client->frame);
+            client->frame->max_hover = FALSE;
+            client->frame->desk_hover = FALSE;
+            client->frame->shade_hover = FALSE;
+            client->frame->iconify_hover = FALSE;
+            client->frame->close_hover = FALSE;
+            if (e->xcrossing.mode == NotifyGrab) {
+                client->frame->max_press = FALSE;
+                client->frame->desk_press = FALSE;
+                client->frame->shade_press = FALSE;
+                client->frame->iconify_press = FALSE;
+                client->frame->close_press = FALSE;
             }
+            frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_MAXIMIZE:
             client->frame->max_hover = FALSE;
-            client->frame->max_press = FALSE;
+            if (e->xcrossing.mode == NotifyGrab)
+                client->frame->max_press = FALSE;
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_ALLDESKTOPS:
             client->frame->desk_hover = FALSE;
-            client->frame->desk_press = FALSE;
+            if (e->xcrossing.mode == NotifyGrab)
+                client->frame->desk_press = FALSE;
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_SHADE:
             client->frame->shade_hover = FALSE;
-            client->frame->shade_press = FALSE;
+            if (e->xcrossing.mode == NotifyGrab)
+                client->frame->shade_press = FALSE;
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_ICONIFY:
             client->frame->iconify_hover = FALSE;
-            client->frame->iconify_press = FALSE;
+            if (e->xcrossing.mode == NotifyGrab)
+                client->frame->iconify_press = FALSE;
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_CLOSE:
             client->frame->close_hover = FALSE;
-            client->frame->close_press = FALSE;
+            if (e->xcrossing.mode == NotifyGrab)
+                client->frame->close_press = FALSE;
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_FRAME:
@@ -1041,27 +1051,32 @@ static void event_handle_client(ObClient *client, XEvent *e)
         switch (con) {
         case OB_FRAME_CONTEXT_MAXIMIZE:
             client->frame->max_hover = TRUE;
-            client->frame->max_press = (con == pcon);
+            if (e->xcrossing.mode == NotifyUngrab)
+                client->frame->max_press = (con == pcon);
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_ALLDESKTOPS:
             client->frame->desk_hover = TRUE;
-            client->frame->desk_press = (con == pcon);
+            if (e->xcrossing.mode == NotifyUngrab)
+                client->frame->desk_press = (con == pcon);
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_SHADE:
             client->frame->shade_hover = TRUE;
-            client->frame->shade_press = (con == pcon);
+            if (e->xcrossing.mode == NotifyUngrab)
+                client->frame->shade_press = (con == pcon);
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_ICONIFY:
             client->frame->iconify_hover = TRUE;
-            client->frame->iconify_press = (con == pcon);
+            if (e->xcrossing.mode == NotifyUngrab)
+                client->frame->iconify_press = (con == pcon);
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_CLOSE:
             client->frame->close_hover = TRUE;
-            client->frame->close_press = (con == pcon);
+            if (e->xcrossing.mode == NotifyUngrab)
+                client->frame->close_press = (con == pcon);
             frame_adjust_state(client->frame);
             break;
         case OB_FRAME_CONTEXT_FRAME:
index 02be17a004745f4ad69d22a52fc8d210ee81346d..e1b787fe8040ab47d32064e4496ff5a9f6cab1b6 100644 (file)
@@ -56,6 +56,12 @@ typedef enum {
     OB_FRAME_NUM_CONTEXTS
 } ObFrameContext;
 
+#define FRAME_CONTEXT(co, cl) ((cl && cl->type != OB_CLIENT_TYPE_DESKTOP) ? \
+                               co == OB_FRAME_CONTEXT_FRAME : FALSE)
+#define CLIENT_CONTEXT(co, cl) ((cl && cl->type == OB_CLIENT_TYPE_DESKTOP) ? \
+                                co == OB_FRAME_CONTEXT_DESKTOP : \
+                                co == OB_FRAME_CONTEXT_CLIENT)
+
 /*! The decorations the client window wants to be displayed on it */
 typedef enum {
     OB_FRAME_DECOR_TITLEBAR    = 1 << 0, /*!< Display a titlebar */
index 857f6d09e61942b86127edf5e5d85c873fa1773e..f63d2663bd2c35b0dcc0b305f7008f587d1b647b 100644 (file)
@@ -38,12 +38,6 @@ typedef struct {
     GSList *actions[OB_NUM_MOUSE_ACTIONS]; /* lists of Action pointers */
 } ObMouseBinding;
 
-#define FRAME_CONTEXT(co, cl) ((cl && cl->type != OB_CLIENT_TYPE_DESKTOP) ? \
-                               co == OB_FRAME_CONTEXT_FRAME : FALSE)
-#define CLIENT_CONTEXT(co, cl) ((cl && cl->type == OB_CLIENT_TYPE_DESKTOP) ? \
-                                co == OB_FRAME_CONTEXT_DESKTOP : \
-                                co == OB_FRAME_CONTEXT_CLIENT)
-
 /* Array of GSList*s of ObMouseBinding*s. */
 static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS];
 /* TRUE when we have a grab on the pointer and need to replay the pointer event
This page took 0.026688 seconds and 4 git commands to generate.