]> Dogcows Code - chaz/openbox/blobdiff - openbox/event.c
fix up support for moveresize. make keyboard grabs Async so that i can hit escape...
[chaz/openbox] / openbox / event.c
index 7d61c9eb4940b69042a4a098efcf27e2f2df2091..6cc8b1f0625f78d3623a6c80f47c517e88de371d 100644 (file)
@@ -8,6 +8,7 @@
 #include "menu.h"
 #include "framerender.h"
 #include "focus.h"
+#include "moveresize.h"
 #include "stacking.h"
 #include "extensions.h"
 #include "timer.h"
@@ -304,8 +305,10 @@ static gboolean event_ignore(XEvent *e, Client *client)
     case LeaveNotify:
         /* NotifyUngrab occurs when a mouse button is released and the event is
            caused, like when lowering a window */
+        /* NotifyVirtual occurs when ungrabbing the pointer */
         if (e->xcrossing.mode == NotifyGrab ||
-            e->xcrossing.detail == NotifyInferior)
+            e->xcrossing.detail == NotifyInferior ||
+            e->xcrossing.detail == NotifyVirtual)
             return TRUE;
        break;
     }
@@ -327,9 +330,10 @@ static void event_process(XEvent *e)
         return;
 
     /* deal with it in the kernel */
-    if (menu)
+    if (menu) {
         event_handle_menu(menu, e);
-    else if (client)
+        return;
+    } else if (client)
        event_handle_client(client, e);
     else if (window == ob_root)
        event_handle_root(e);
@@ -356,6 +360,14 @@ static void event_process(XEvent *e)
        xerror_set_ignore(FALSE);
     }
 
+    if (moveresize_in_progress)
+        if (e->type == MotionNotify || e->type == ButtonRelease ||
+            e->type == ButtonPress ||
+            e->type == KeyPress || e->type == KeyRelease) {
+            moveresize_event(e);
+            return; /* no dispatch! */
+        }
+
     /* user input (action-bound) events */
     /*
     if (e->type == ButtonPress || e->type == ButtonRelease ||
@@ -650,7 +662,70 @@ static void event_handle_client(Client *client, XEvent *e)
                 client_shade(client, FALSE);
             client_focus(client);
             stacking_raise(client);
-       }
+       } else if (msgtype == prop_atoms.net_wm_moveresize) {
+           g_message("net_wm_moveresize for 0x%lx", client->window);
+            if ((Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_topleft ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_top ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_topright ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_right ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_right ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_bottomright ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_bottom ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_bottomleft ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_left ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_move ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_size_keyboard ||
+                (Atom)e->xclient.data.l[2] ==
+                prop_atoms.net_wm_moveresize_move_keyboard) {
+
+                g_message("client %lx x %d y %d button %d corner %d",
+                          client, e->xclient.data.l[0],                  
+                          e->xclient.data.l[1], e->xclient.data.l[3],    
+                          e->xclient.data.l[2]);
+                moveresize_start(client, e->xclient.data.l[0],
+                                 e->xclient.data.l[1], e->xclient.data.l[3],
+                                 e->xclient.data.l[2]);
+            }
+        } else if (msgtype == prop_atoms.net_moveresize_window) {
+            int oldg = client->gravity;
+            int tmpg, x, y, w, h;
+
+            if (e->xclient.data.l[0] & 0xff)
+                tmpg = e->xclient.data.l[0] & 0xff;
+            else
+                tmpg = oldg;
+
+            if (e->xclient.data.l[0] & 1 << 8)
+                x = e->xclient.data.l[1];
+            else
+                x = client->area.x;
+            if (e->xclient.data.l[0] & 1 << 9)
+                y = e->xclient.data.l[2];
+            else
+                y = client->area.y;
+            if (e->xclient.data.l[0] & 1 << 10)
+                w = e->xclient.data.l[3];
+            else
+                w = client->area.y;
+            if (e->xclient.data.l[0] & 1 << 11)
+                h = e->xclient.data.l[4];
+            else
+                h = client->area.y;
+            client->gravity = tmpg;
+            client_configure(client, Corner_TopLeft, x, y, w, h, TRUE, TRUE);
+            client->gravity = oldg;
+        }
        break;
     case PropertyNotify:
        /* validate cuz we query stuff off the client here */
This page took 0.022951 seconds and 4 git commands to generate.