]> Dogcows Code - chaz/openbox/commitdiff
move the pointer while doing a keyboard move/resize
authorDana Jansens <danakj@orodu.net>
Wed, 20 Aug 2003 04:45:55 +0000 (04:45 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 20 Aug 2003 04:45:55 +0000 (04:45 +0000)
openbox/moveresize.c

index 14abd5cd14f4efb8bd7c9b2f1eee4074054ea2db..981a9df25dc30fd73afb4f2919c1776d4756cfec 100644 (file)
@@ -76,6 +76,14 @@ void moveresize_start(ObClient *c, int x, int y, guint b, guint32 cnr)
     corner = cnr;
     button = b;
 
+    /*
+      have to change start_cx and start_cy if going to do this..
+    if (corner == prop_atoms.net_wm_moveresize_move_keyboard ||
+        corner == prop_atoms.net_wm_moveresize_size_keyboard)
+        XWarpPointer(ob_display, None, c->window, 0, 0, 0, 0,
+                     c->area.width / 2, c->area.height / 2);
+    */
+
     if (corner == prop_atoms.net_wm_moveresize_move ||
         corner == prop_atoms.net_wm_moveresize_move_keyboard) {
         cur_x = start_cx;
@@ -262,28 +270,42 @@ void moveresize_event(XEvent *e)
             moveresize_end(FALSE);
         else {
             if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
+                int dx = 0, dy = 0;
+
                 if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
-                    cur_x += MAX(4, moveresize_client->size_inc.width);
+                    dx = MAX(4, moveresize_client->size_inc.width);
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_LEFT))
-                    cur_x -= MAX(4, moveresize_client->size_inc.width);
+                    dx = -MAX(4, moveresize_client->size_inc.width);
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
-                    cur_y += MAX(4, moveresize_client->size_inc.height);
+                    dy = MAX(4, moveresize_client->size_inc.height);
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
-                    cur_y -= MAX(4, moveresize_client->size_inc.height);
+                    dy = -MAX(4, moveresize_client->size_inc.height);
                 else
                     return;
+
+                cur_x += dx;
+                cur_y += dy;
+                XWarpPointer(ob_display, None, None, 0, 0, 0, 0, dx, dy);
+
                 do_resize(FALSE);
             } else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
+                int dx = 0, dy = 0;
+
                 if (e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
-                    cur_x += 4;
+                    dx = 4;
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_LEFT))
-                    cur_x -= 4;
+                    dx = -4;
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_DOWN))
-                    cur_y += 4;
+                    dy = 4;
                 else if (e->xkey.keycode == ob_keycode(OB_KEY_UP))
-                    cur_y -= 4;
+                    dy = -4;
                 else
                     return;
+
+                cur_x += dx;
+                cur_y += dy;
+                XWarpPointer(ob_display, None, None, 0, 0, 0, 0, dx, dy);
+
                 do_move(FALSE);
             }
         }
This page took 0.024617 seconds and 4 git commands to generate.