]> Dogcows Code - chaz/openbox/commitdiff
fix hovering for corner buttons during full-max
authorDana Jansens <danakj@orodu.net>
Wed, 9 May 2007 23:38:16 +0000 (23:38 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 9 May 2007 23:38:16 +0000 (23:38 +0000)
openbox/event.c
openbox/frame.c

index ef320afd0ae8c3ee2dc81203cac7864dd64d9757..8523f637448db9e9dc18686579d0064b368a2be2 100644 (file)
@@ -730,12 +730,16 @@ static void event_handle_client(ObClient *client, XEvent *e)
     Atom msgtype;
     ObFrameContext con;
     static gint px = -1, py = -1;
+    static guint pb = 0;
      
     switch (e->type) {
     case ButtonPress:
         /* save where the press occured for the first button pressed */
-        if (px == -1) px = e->xbutton.x;
-        if (py == -1) py = e->xbutton.y;
+        if (!pb) {
+            pb = e->xbutton.button;
+            px = e->xbutton.x;
+            py = e->xbutton.y;
+        }
     case ButtonRelease:
         /* Wheel buttons don't draw because they are an instant click, so it
            is a waste of resources to go drawing it.
@@ -751,8 +755,8 @@ static void event_handle_client(ObClient *client, XEvent *e)
             con = frame_context(client, e->xbutton.window, px, py);
             con = mouse_button_frame_context(con, e->xbutton.button);
 
-            if (e->type == ButtonRelease)
-                px = py = -1;
+            if (e->type == ButtonRelease && e->xbutton.button == pb)
+                pb = 0, px = py = -1;
 
             switch (con) {
             case OB_FRAME_CONTEXT_MAXIMIZE:
@@ -781,6 +785,43 @@ static void event_handle_client(ObClient *client, XEvent *e)
             }
         }
         break;
+    case MotionNotify:
+        con = frame_context(client, e->xmotion.window,
+                            e->xmotion.x, e->xmotion.y);
+        switch (con) {
+        case OB_FRAME_CONTEXT_TITLEBAR:
+            /* we've left the button area inside the titlebar */
+            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);
+            break;
+        case OB_FRAME_CONTEXT_MAXIMIZE:
+            client->frame->max_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_ALLDESKTOPS:
+            client->frame->desk_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_SHADE:
+            client->frame->shade_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_ICONIFY:
+            client->frame->iconify_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        case OB_FRAME_CONTEXT_CLOSE:
+            client->frame->close_hover = TRUE;
+            frame_adjust_state(client->frame);
+            break;
+        default:
+            break;
+        }
+        break;
     case LeaveNotify:
         con = frame_context(client, e->xcrossing.window,
                             e->xcrossing.x, e->xcrossing.y);
index 50f0dc61cda6a8465f2c7687d3186996016d60a7..1f45ea8b145217d7d72beaf8c8232dde8e0c1325 100644 (file)
@@ -34,7 +34,7 @@
 #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \
                          ButtonPressMask | ButtonReleaseMask)
 #define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \
-                           ButtonMotionMask | \
+                           ButtonMotionMask | PointerMotionMask | \
                            EnterWindowMask | LeaveWindowMask)
 /* The inner window does not need enter/leave events.
    If it does get them, then it needs its own context for enter events
This page took 0.027902 seconds and 4 git commands to generate.