]> Dogcows Code - chaz/openbox/blobdiff - openbox/moveresize.c
Merge branch 'backport' into work
[chaz/openbox] / openbox / moveresize.c
index d89c31ca22ac416ebff735d2713b0dd2bcfedf5c..ec9cb1037cd8c98dc2e33ca043be2c7ef0750624 100644 (file)
@@ -29,8 +29,8 @@
 #include "config.h"
 #include "event.h"
 #include "debug.h"
-#include "render/render.h"
-#include "render/theme.h"
+#include "obrender/render.h"
+#include "obrender/theme.h"
 #include "obt/display.h"
 #include "obt/prop.h"
 #include "obt/keyboard.h"
@@ -304,11 +304,7 @@ void moveresize_end(gboolean cancel)
 
     popup_hide(popup);
 
-    if (moving) {
-        client_move(moveresize_client,
-                    (cancel ? start_cx : cur_x),
-                    (cancel ? start_cy : cur_y));
-    } else {
+    if (!moving) {
 #ifdef SYNC
         /* turn off the alarm */
         if (moveresize_alarm != None) {
@@ -318,15 +314,19 @@ void moveresize_end(gboolean cancel)
 
         obt_main_loop_timeout_remove(ob_main_loop, sync_timeout_func);
 #endif
-
-        client_configure(moveresize_client,
-                         (cancel ? start_cx : cur_x),
-                         (cancel ? start_cy : cur_y),
-                         (cancel ? start_cw : cur_w),
-                         (cancel ? start_ch : cur_h),
-                         TRUE, TRUE, FALSE);
     }
 
+    /* don't use client_move() here, use the same width/height as
+       we've been using during the move, otherwise we get different results
+       when moving maximized windows between monitors of different sizes !
+    */
+    client_configure(moveresize_client,
+                     (cancel ? start_cx : cur_x),
+                     (cancel ? start_cy : cur_y),
+                     (cancel ? start_cw : cur_w),
+                     (cancel ? start_ch : cur_h),
+                     TRUE, TRUE, FALSE);
+
     /* dont edge warp after its ended */
     cancel_edge_warp();
 
@@ -605,13 +605,13 @@ static void move_with_keys(gint keycode, gint state)
         gint x, y;
         ObDirection dir;
 
-        if (keycode == ob_keycode(OB_KEY_RIGHT))
+        if (ob_keycode_match(keycode, OB_KEY_RIGHT))
             dir = OB_DIRECTION_EAST;
-        else if (keycode == ob_keycode(OB_KEY_LEFT))
+        else if (ob_keycode_match(keycode, OB_KEY_LEFT))
             dir = OB_DIRECTION_WEST;
-        else if (keycode == ob_keycode(OB_KEY_DOWN))
+        else if (ob_keycode_match(keycode, OB_KEY_DOWN))
             dir = OB_DIRECTION_SOUTH;
-        else /* if (keycode == ob_keycode(OB_KEY_UP)) */
+        else /* if (ob_keycode_match(keycode, OB_KEY_UP)) */
             dir = OB_DIRECTION_NORTH;
 
         client_find_move_directional(moveresize_client, dir, &x, &y);
@@ -627,13 +627,13 @@ static void move_with_keys(gint keycode, gint state)
         else
             dist = KEY_DIST;
 
-        if (keycode == ob_keycode(OB_KEY_RIGHT))
+        if (ob_keycode_match(keycode, OB_KEY_RIGHT))
             dx = dist;
-        else if (keycode == ob_keycode(OB_KEY_LEFT))
+        else if (ob_keycode_match(keycode, OB_KEY_LEFT))
             dx = -dist;
-        else if (keycode == ob_keycode(OB_KEY_DOWN))
+        else if (ob_keycode_match(keycode, OB_KEY_DOWN))
             dy = dist;
-        else /* if (keycode == ob_keycode(OB_KEY_UP)) */
+        else /* if (ob_keycode_match(keycode, OB_KEY_UP)) */
             dy = -dist;
     }
 
@@ -666,7 +666,7 @@ static void resize_with_keys(gint keycode, gint state)
     ObDirection dir;
 
     /* pick the edge if it needs to move */
-    if (keycode == ob_keycode(OB_KEY_RIGHT)) {
+    if (ob_keycode_match(keycode, OB_KEY_RIGHT)) {
         dir = OB_DIRECTION_EAST;
         if (key_resize_edge != OB_DIRECTION_WEST &&
             key_resize_edge != OB_DIRECTION_EAST)
@@ -674,7 +674,7 @@ static void resize_with_keys(gint keycode, gint state)
             key_resize_edge = OB_DIRECTION_EAST;
             return;
         }
-    } else if (keycode == ob_keycode(OB_KEY_LEFT)) {
+    } else if (ob_keycode_match(keycode, OB_KEY_LEFT)) {
         dir = OB_DIRECTION_WEST;
         if (key_resize_edge != OB_DIRECTION_WEST &&
             key_resize_edge != OB_DIRECTION_EAST)
@@ -682,7 +682,7 @@ static void resize_with_keys(gint keycode, gint state)
             key_resize_edge = OB_DIRECTION_WEST;
             return;
         }
-    } else if (keycode == ob_keycode(OB_KEY_UP)) {
+    } else if (ob_keycode_match(keycode, OB_KEY_UP)) {
         dir = OB_DIRECTION_NORTH;
         if (key_resize_edge != OB_DIRECTION_NORTH &&
             key_resize_edge != OB_DIRECTION_SOUTH)
@@ -690,7 +690,7 @@ static void resize_with_keys(gint keycode, gint state)
             key_resize_edge = OB_DIRECTION_NORTH;
             return;
         }
-    } else /* if (keycode == ob_keycode(OB_KEY_DOWN)) */ {
+    } else /* if (ob_keycode_match(keycode, OB_KEY_DOWN)) */ {
         dir = OB_DIRECTION_SOUTH;
         if (key_resize_edge != OB_DIRECTION_NORTH &&
             key_resize_edge != OB_DIRECTION_SOUTH)
@@ -704,13 +704,13 @@ static void resize_with_keys(gint keycode, gint state)
     if (state & obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_SHIFT)) {
         gint x, y, w, h;
 
-        if (keycode == ob_keycode(OB_KEY_RIGHT))
+        if (ob_keycode_match(keycode, OB_KEY_RIGHT))
             dir = OB_DIRECTION_EAST;
-        else if (keycode == ob_keycode(OB_KEY_LEFT))
+        else if (ob_keycode_match(keycode, OB_KEY_LEFT))
             dir = OB_DIRECTION_WEST;
-        else if (keycode == ob_keycode(OB_KEY_DOWN))
+        else if (ob_keycode_match(keycode, OB_KEY_DOWN))
             dir = OB_DIRECTION_SOUTH;
-        else /* if (keycode == ob_keycode(OB_KEY_UP)) */
+        else /* if (ob_keycode_match(keycode, OB_KEY_UP)) */
             dir = OB_DIRECTION_NORTH;
 
         client_find_resize_directional(moveresize_client, key_resize_edge,
@@ -912,16 +912,16 @@ gboolean moveresize_event(XEvent *e)
         }
         used = TRUE;
     } else if (e->type == KeyPress) {
-        if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE)) {
+        if (ob_keycode_match(e->xkey.keycode, OB_KEY_ESCAPE)) {
             moveresize_end(TRUE);
             used = TRUE;
-        } else if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN)) {
+        } else if (ob_keycode_match(e->xkey.keycode, OB_KEY_RETURN)) {
             moveresize_end(FALSE);
             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))
+        } else if (ob_keycode_match(e->xkey.keycode, OB_KEY_RIGHT) ||
+                   ob_keycode_match(e->xkey.keycode, OB_KEY_LEFT) ||
+                   ob_keycode_match(e->xkey.keycode, OB_KEY_DOWN) ||
+                   ob_keycode_match(e->xkey.keycode, OB_KEY_UP))
         {
             if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD)) {
                 resize_with_keys(e->xkey.keycode, e->xkey.state);
This page took 0.025367 seconds and 4 git commands to generate.