]> Dogcows Code - chaz/openbox/blobdiff - openbox/keyboard.c
move the pointer while doing a keyboard move/resize
[chaz/openbox] / openbox / keyboard.c
index 607941dda3d643497d25260fa7510b463297493f..bcac0a3c3220ae0d38b8403cf9358371f087d2b3 100644 (file)
@@ -8,6 +8,7 @@
 #include "action.h"
 #include "prop.h"
 #include "timer.h"
+#include "config.h"
 #include "keytree.h"
 #include "keyboard.h"
 #include "translate.h"
@@ -36,6 +37,10 @@ static void grab_for_window(Window win, gboolean grab)
             grab_key(p->key, p->state, win, GrabModeAsync);
             p = p->next_sibling;
         }
+        if (curpos)
+            grab_key(config_keyboard_reset_keycode,
+                     config_keyboard_reset_state,
+                     win, GrabModeAsync);
     }
 }
 
@@ -127,47 +132,47 @@ gboolean keyboard_process_interactive_grab(const XEvent *e,
     if (interactive_grab) {
         *client = grabbed_client;
         *context = grabbed_context;
-    }
 
-    if ((e->type == KeyRelease && 
-         !(grabbed_state & e->xkey.state)))
-        done = TRUE;
-    else if (e->type == KeyPress) {
-        if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN))
+        if ((e->type == KeyRelease && 
+             !(grabbed_state & e->xkey.state)))
             done = TRUE;
-        else if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE)) {
+        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)) {
+                if (grabbed_action->func == action_cycle_windows) {
+                    grabbed_action->data.cycle.cancel = TRUE;
+                }
+                if (grabbed_action->func == action_desktop_dir) {
+                    grabbed_action->data.desktopdir.cancel = TRUE;
+                }
+                if (grabbed_action->func == action_send_to_desktop_dir)
+                {
+                    grabbed_action->data.sendtodir.cancel = TRUE;
+                }
+                done = TRUE;
+            }
+        }
+        if (done) { 
             if (grabbed_action->func == action_cycle_windows) {
-                grabbed_action->data.cycle.cancel = TRUE;
+                grabbed_action->data.cycle.final = TRUE;
             }
             if (grabbed_action->func == action_desktop_dir) {
-                grabbed_action->data.desktopdir.cancel = TRUE;
+                grabbed_action->data.desktopdir.final = TRUE;
             }
-            if (grabbed_action->func == action_send_to_desktop_dir)
-            {
-                grabbed_action->data.sendtodir.cancel = TRUE;
+            if (grabbed_action->func == action_send_to_desktop_dir) {
+                grabbed_action->data.sendtodir.final = TRUE;
             }
-            done = TRUE;
-        }
-    }
-    if (done) { 
-        if (grabbed_action->func == action_cycle_windows) {
-            grabbed_action->data.cycle.final = TRUE;
-        }
-        if (grabbed_action->func == action_desktop_dir) {
-            grabbed_action->data.desktopdir.final = TRUE;
-        }
-        if (grabbed_action->func == action_send_to_desktop_dir) {
-            grabbed_action->data.sendtodir.final = TRUE;
-        }
 
-        grabbed_action->func(&grabbed_action->data);
+            grabbed_action->func(&grabbed_action->data);
 
-        interactive_grab = FALSE;
-        grab_keyboard(FALSE);
-        grab_pointer(FALSE, None);
-        keyboard_reset_chains();
+            interactive_grab = FALSE;
+            grab_keyboard(FALSE);
+            grab_pointer(FALSE, None);
+            keyboard_reset_chains();
 
-        handled = TRUE;
+            handled = TRUE;
+        }
     }
 
     return handled;
@@ -179,6 +184,13 @@ void keyboard_event(ObClient *client, const XEvent *e)
 
     g_assert(e->type == KeyPress);
 
+    if (e->xkey.keycode == config_keyboard_reset_keycode &&
+        e->xkey.state == config_keyboard_reset_state)
+    {
+        keyboard_reset_chains();
+        return;
+    }
+
     if (curpos == NULL)
         p = keyboard_firstnode;
     else
@@ -232,10 +244,8 @@ void keyboard_event(ObClient *client, const XEvent *e)
 
                         if (act->func == action_showmenu)
                         {
-                            act->data.showmenu.x =
-                                e->xkey.x_root;
-                            act->data.showmenu.y =
-                                e->xkey.y_root;
+                            act->data.showmenu.x = e->xkey.x_root;
+                            act->data.showmenu.y = e->xkey.y_root;
                         }
 
                         act->data.any.c = client;
This page took 0.028471 seconds and 4 git commands to generate.