- if (moving) {
- client_configure(client, Corner_TopLeft, (cancel ? start_cx : cur_x),
- (cancel ? start_cy : cur_y),
- start_cw, start_ch, TRUE, TRUE);
- } else {
- client_configure(client, lockcorner, client->area.x,
- client->area.y, (cancel ? start_cw : cur_x),
- (cancel ? start_ch : cur_y), TRUE, TRUE);
+ return FALSE; /* don't repeat */
+}
+#endif
+
+static void calc_resize(gboolean keyboard, gint keydist, gint *dw, gint *dh,
+ ObCorner cor)
+{
+ gint resist, x, y, lw, lh, ow, oh, nw, nh;
+
+ ow = cur_w;
+ oh = cur_h;
+ /* resist_size_* needs the frame size */
+ nw = ow + *dw +
+ moveresize_client->frame->size.left +
+ moveresize_client->frame->size.right;
+ nh = oh + *dh +
+ moveresize_client->frame->size.top +
+ moveresize_client->frame->size.bottom;
+
+ if (keyboard) resist = keydist - 1; /* resist for one key press */
+ else resist = config_resist_win;
+ resist_size_windows(moveresize_client, resist, &nw, &nh, cor);
+ if (!keyboard) resist = config_resist_edge;
+ resist_size_monitors(moveresize_client, resist, &nw, &nh, cor);
+
+ nw -= moveresize_client->frame->size.left +
+ moveresize_client->frame->size.right;
+ nh -= moveresize_client->frame->size.top +
+ moveresize_client->frame->size.bottom;
+
+ /* see its actual size */
+ x = 0;
+ y = 0;
+ client_try_configure(moveresize_client, &x, &y, &nw, &nh, &lw, &lh, TRUE);
+
+
+ *dw = nw - ow;
+ *dh = nh - oh;
+}
+
+static gboolean edge_warp_delay_func(gpointer data)
+{
+ guint d;
+
+ d = screen_find_desktop(screen_desktop, edge_warp_dir, TRUE, FALSE);
+ if (d != screen_desktop) screen_set_desktop(d, TRUE);
+
+ edge_warp_dir = -1;
+
+ return FALSE; /* don't repeat */
+}
+
+static void do_edge_warp(gint x, gint y)
+{
+ guint i;
+ ObDirection dir;
+
+ if (!config_mouse_screenedgetime) return;
+
+ dir = -1;
+
+ for (i = 0; i < screen_num_monitors; ++i) {
+ Rect *a = screen_physical_area_monitor(i);
+ if (x == RECT_LEFT(*a)) dir = OB_DIRECTION_WEST;
+ if (x == RECT_RIGHT(*a)) dir = OB_DIRECTION_EAST;
+ if (y == RECT_TOP(*a)) dir = OB_DIRECTION_NORTH;
+ if (y == RECT_BOTTOM(*a)) dir = OB_DIRECTION_SOUTH;
+
+ /* try check for xinerama boundaries */
+ if ((x + 1 == RECT_LEFT(*a) || x - 1 == RECT_RIGHT(*a)) &&
+ (dir == OB_DIRECTION_WEST || dir == OB_DIRECTION_EAST))
+ {
+ dir = -1;
+ }
+ if ((y + 1 == RECT_TOP(*a) || y - 1 == RECT_BOTTOM(*a)) &&
+ (dir == OB_DIRECTION_NORTH || dir == OB_DIRECTION_SOUTH))
+ {
+ dir = -1;
+ }
+ g_free(a);
+ }
+
+ if (dir != edge_warp_dir) {
+ if (dir == (ObDirection)-1)
+ cancel_edge_warp();
+ else
+ ob_main_loop_timeout_add(ob_main_loop,
+ config_mouse_screenedgetime * 1000,
+ edge_warp_delay_func,
+ NULL, NULL, NULL);
+ edge_warp_dir = dir;