]> Dogcows Code - chaz/openbox/commitdiff
woa.. let you do mouse actions while in an interactive keyboard action, and let you...
authorDana Jansens <danakj@orodu.net>
Sat, 5 May 2007 00:50:53 +0000 (00:50 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 5 May 2007 00:50:53 +0000 (00:50 +0000)
openbox/event.c
openbox/keyboard.c
openbox/moveresize.c
openbox/moveresize.h

index ff9ea5745b85c314390a1c4e6ddc0932cc5d6228..efef0faa3e1f7c97c5f45f65f436aab9474d0932 100644 (file)
@@ -546,14 +546,16 @@ static void event_process(const XEvent *ec, gpointer data)
         }
 
         if (useevent) {
-            if (!keyboard_process_interactive_grab(e, &client)) {
-                if (moveresize_in_progress) {
-                    moveresize_event(e);
-
+            /* if the keyboard interactive action uses the event then dont
+               use it for bindings. likewise is moveresize uses the event. */
+            if (!keyboard_process_interactive_grab(e, &client) &&
+                !(moveresize_in_progress && moveresize_event(e)))
+            {
+                if (moveresize_in_progress)
                     /* make further actions work on the client being
                        moved/resized */
                     client = moveresize_client;
-                }
+
 
                 menu_can_hide = FALSE;
                 ob_main_loop_timeout_add(ob_main_loop,
index 2c97b93c7ea1ab53fce36a4bc163e64362e991a8..cf56ad8f3b99c60640e273e4b0de9d13fc6d6ede 100644 (file)
@@ -199,10 +199,8 @@ static void keyboard_interactive_end(guint state, gboolean cancel, Time time,
 
     istate.active = FALSE;
 
-    if (ungrab) {
+    if (ungrab)
         grab_keyboard(FALSE);
-        grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
-    }
 }
 
 static void keyboard_interactive_end_client(ObClient *client, gpointer data)
@@ -217,11 +215,8 @@ gboolean keyboard_interactive_grab(guint state, ObClient *client,
     g_assert(action->data.any.interactive);
 
     if (!istate.active) {
-        grab_pointer(TRUE, FALSE, OB_CURSOR_POINTER);
-        if (!grab_keyboard(TRUE)) {
-            grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
+        if (!grab_keyboard(TRUE))
             return FALSE;
-        }
     } else if (action->func != istate.action->func) {
         keyboard_interactive_end(state, FALSE, action->data.any.time, FALSE);
     }
@@ -241,23 +236,26 @@ gboolean keyboard_process_interactive_grab(const XEvent *e, ObClient **client)
     gboolean cancel = FALSE;
 
     if (istate.active) {
-        if ((e->type == KeyRelease && !(istate.state & e->xkey.state)))
+        if ((e->type == KeyRelease && !(istate.state & e->xkey.state))) {
             done = TRUE;
-        else if (e->type == KeyPress) {
+            handled = TRUE;
+        } else if (e->type == KeyPress) {
             /*if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN))
               done = TRUE;
-              else */if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
+              else */if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE)) {
                   cancel = done = TRUE;
+                  handled = TRUE;
+              }
         } else if (e->type == ButtonPress) {
             cancel = FALSE;
             done = TRUE;
+            handled = FALSE;
         }
 
-        if (done) {
+        if (done)
             keyboard_interactive_end(e->xkey.state, cancel, e->xkey.time,TRUE);
 
-            handled = TRUE;
-        } else
+        if (handled)
             *client = istate.client;
     }
 
index eba2106692f729b4ed3db445c0a80827dd2c48d7..afd0de2abbf11086b318599f6a5b533638f289e6 100644 (file)
@@ -395,8 +395,10 @@ static void calc_resize(gboolean resist)
         moveresize_client->frame->size.bottom;
 }
 
-void moveresize_event(XEvent *e)
+gboolean moveresize_event(XEvent *e)
 {
+    gboolean used = FALSE;
+
     g_assert(moveresize_in_progress);
 
     if (e->type == ButtonPress) {
@@ -405,10 +407,12 @@ void moveresize_event(XEvent *e)
             start_y = e->xbutton.y_root;
             button = e->xbutton.button; /* this will end it now */
         }
+        used = TRUE;
     } else if (e->type == ButtonRelease) {
         if (!button || e->xbutton.button == button) {
             moveresize_end(FALSE);
         }
+        used = TRUE;
     } else if (e->type == MotionNotify) {
         if (moving) {
             cur_x = start_cx + e->xmotion.x_root - start_x;
@@ -459,12 +463,19 @@ void moveresize_event(XEvent *e)
             calc_resize(TRUE);
             do_resize();
         }
+        used = TRUE;
     } else if (e->type == KeyPress) {
-        if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
+        if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE)) {
             moveresize_end(TRUE);
-        else if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN))
+            used = TRUE;
+        } else if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN)) {
             moveresize_end(FALSE);
-        else {
+            used = TRUE;
+        } else if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT) ||
+                   e->xkey.keycode == ob_keycode(OB_KEY_LEFT) ||
+                   e->xkey.keycode == ob_keycode(OB_KEY_DOWN) ||
+                   e->xkey.keycode == ob_keycode(OB_KEY_UP))
+        {
             if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
                 gint dx = 0, dy = 0, ox = cur_x, oy = cur_y;
 
@@ -474,10 +485,8 @@ void moveresize_event(XEvent *e)
                     dx = -MAX(4, moveresize_client->size_inc.width);
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
                     dy = MAX(4, moveresize_client->size_inc.height);
-                else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
+                else /* if (e->xkey.keycode == ob_keycode(OB_KEY_UP)) */
                     dy = -MAX(4, moveresize_client->size_inc.height);
-                else
-                    return;
 
                 cur_x += dx;
                 cur_y += dy;
@@ -497,6 +506,8 @@ void moveresize_event(XEvent *e)
                    actually is */
                 start_x += dx - (cur_x - ox);
                 start_y += dy - (cur_y - oy);
+
+                used = TRUE;
             } else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
                 gint dx = 0, dy = 0, ox = cur_x, oy = cur_y;
                 gint opx, px, opy, py;
@@ -507,10 +518,8 @@ void moveresize_event(XEvent *e)
                     dx = -4;
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
                     dy = 4;
-                else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
+                else /* if (e->xkey.keycode == ob_keycode(OB_KEY_UP)) */
                     dy = -4;
-                else
-                    return;
 
                 cur_x += dx;
                 cur_y += dy;
@@ -532,6 +541,8 @@ void moveresize_event(XEvent *e)
                    actually is */
                 start_x += (px - opx) - (cur_x - ox);
                 start_y += (py - opy) - (cur_y - oy);
+
+                used = TRUE;
             }
         }
     }
@@ -540,6 +551,8 @@ void moveresize_event(XEvent *e)
     {
         waiting_for_sync = FALSE; /* we got our sync... */
         do_resize(); /* ...so try resize if there is more change pending */
+        used = TRUE;
     }
 #endif
+    return used;
 }
index 410b554462bd88137c803ebf5482643f7ff9b987..ec5ce10dfe65eb083a7d6a74932066fc221dcfcd 100644 (file)
@@ -40,6 +40,6 @@ void moveresize_start(struct _ObClient *c,
                       gint x, gint y, guint button, guint32 corner);
 void moveresize_end(gboolean cancel);
 
-void moveresize_event(XEvent *e);
+gboolean moveresize_event(XEvent *e);
 
 #endif
This page took 0.031509 seconds and 4 git commands to generate.