#include "framerender.h"
#include "screen.h"
#include "client.h"
+#include "focus.h"
#include "frame.h"
#include "openbox.h"
#include "resist.h"
static guint32 corner;
static ObDirection edge_warp_dir = -1;
static gboolean edge_warp_odd = FALSE;
+static guint edge_warp_timer = 0;
static ObDirection key_resize_edge = -1;
-#ifdef SYNC
static guint waiting_for_sync;
+#ifdef SYNC
+static guint sync_timer = 0;
#endif
static ObPopup *popup = NULL;
{
if (moveresize_client == client)
moveresize_end(TRUE);
+ if (popup && client == popup->client)
+ popup->client = NULL;
}
void moveresize_startup(gboolean reconfig)
popup_position(popup, gravity, x, y);
}
+ popup->client = c;
popup_show(popup, text);
g_free(text);
}
cur_h = start_ch;
moveresize_in_progress = TRUE;
+ waiting_for_sync = 0;
#ifdef SYNC
if (config_resize_redraw && !moving && obt_display_extension_sync &&
XSyncCADelta |
XSyncCAEvents,
&aa);
-
- waiting_for_sync = 0;
}
#endif
}
ungrab_pointer();
popup_hide(popup);
+ popup->client = NULL;
if (!moving) {
#ifdef SYNC
moveresize_alarm = None;
}
- obt_main_loop_timeout_remove(ob_main_loop, sync_timeout_func);
+ if (sync_timer) g_source_remove(sync_timer);
+ sync_timer = 0;
#endif
}
waiting_for_sync = 1;
- obt_main_loop_timeout_remove(ob_main_loop, sync_timeout_func);
- obt_main_loop_timeout_add(ob_main_loop, G_USEC_PER_SEC * 2,
- sync_timeout_func,
- NULL, NULL, NULL);
+ if (sync_timer) g_source_remove(sync_timer);
+ sync_timer = g_timeout_add(2000, sync_timeout_func, NULL);
}
#endif
++waiting_for_sync; /* we timed out waiting for our sync... */
do_resize(); /* ...so let any pending resizes through */
- if (waiting_for_sync > SYNC_TIMEOUTS)
+ if (waiting_for_sync > SYNC_TIMEOUTS) {
+ sync_timer = 0;
return FALSE; /* don't repeat */
+ }
else
return TRUE; /* keep waiting */
}
a = screen_physical_area_all_monitors();
switch (edge_warp_dir) {
- case OB_DIRECTION_NORTH:
- y = a->height - 1;
- break;
- case OB_DIRECTION_EAST:
- x = a->x;
- break;
- case OB_DIRECTION_SOUTH:
- y = a->y;
- break;
- case OB_DIRECTION_WEST:
- x = a->width - 1;
- break;
- default:
+ case OB_DIRECTION_NORTH:
+ y = a->height - 1;
+ break;
+ case OB_DIRECTION_EAST:
+ x = a->x;
+ break;
+ case OB_DIRECTION_SOUTH:
+ y = a->y;
+ break;
+ case OB_DIRECTION_WEST:
+ x = a->width - 1;
+ break;
+ default:
g_assert_not_reached();
}
for (i = 0; i < screen_num_monitors; ++i) {
const Rect *a = screen_physical_area_monitor(i);
+
+ if (!RECT_CONTAINS(*a, x, y))
+ continue;
+
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;
cancel_edge_warp();
if (dir != (ObDirection)-1) {
edge_warp_odd = TRUE; /* switch on the first timeout */
- obt_main_loop_timeout_add(ob_main_loop,
- config_mouse_screenedgetime * 1000,
- edge_warp_delay_func,
- NULL, NULL, NULL);
+ edge_warp_timer = g_timeout_add(config_mouse_screenedgetime,
+ edge_warp_delay_func, NULL);
}
edge_warp_dir = dir;
}
static void cancel_edge_warp(void)
{
- obt_main_loop_timeout_remove(ob_main_loop, edge_warp_delay_func);
+ if (edge_warp_timer) g_source_remove(edge_warp_timer);
+ edge_warp_timer = 0;
}
static void move_with_keys(KeySym sym, guint state)
used = TRUE;
}
#endif
+
+ if (used && moveresize_client == focus_client)
+ event_update_user_time();
+
return used;
}