- int oldx, oldy, oldw, oldh;
-
- dispatch_move(moveresize_client, &cur_x, &cur_y);
-
- oldx = moveresize_client->frame->area.x;
- oldy = moveresize_client->frame->area.y;
- oldw = moveresize_client->frame->area.width;
- oldh = moveresize_client->frame->area.height;
- /* get where the client should be */
- frame_frame_gravity(moveresize_client->frame, &cur_x, &cur_y);
- client_configure(moveresize_client, OB_CORNER_TOPLEFT, cur_x, cur_y,
- start_cw, start_ch, TRUE, FALSE);
- /* draw the new one */
- if (moveresize_client->frame->area.x != oldx ||
- moveresize_client->frame->area.y != oldy ||
- moveresize_client->frame->area.width != oldw ||
- moveresize_client->frame->area.height != oldh) {
- if (!config_opaque_move)
- XDrawRectangle(ob_display, opaque_window.win, opaque_gc,
- moveresize_client->frame->area.x,
- moveresize_client->frame->area.y,
- moveresize_client->frame->area.width - 1,
- moveresize_client->frame->area.height - 1);
- /* erase the old one */
- if (!config_opaque_move && !first_draw)
- XDrawRectangle(ob_display, opaque_window.win, opaque_gc,
- oldx, oldy, oldw - 1, oldh - 1);
- first_draw = FALSE;
+#ifdef SYNC
+ if (config_resize_redraw && extensions_sync &&
+ moveresize_client->sync_request && moveresize_client->sync_counter)
+ {
+ XEvent ce;
+ XSyncValue val;
+ gint x, y, w, h, lw, lh;
+
+ /* are we already waiting for the sync counter to catch up? */
+ if (waiting_for_sync)
+ return;
+
+ /* see if it is actually going to resize */
+ x = 0;
+ y = 0;
+ w = cur_x;
+ h = cur_y;
+ client_try_configure(moveresize_client, &x, &y, &w, &h,
+ &lw, &lh, TRUE);
+ if (w == moveresize_client->area.width &&
+ h == moveresize_client->area.height)
+ {
+ return;
+ }
+
+ /* increment the value we're waiting for */
+ ++moveresize_client->sync_counter_value;
+ XSyncIntToValue(&val, moveresize_client->sync_counter_value);
+
+ /* tell the client what we're waiting for */
+ ce.xclient.type = ClientMessage;
+ ce.xclient.message_type = prop_atoms.wm_protocols;
+ ce.xclient.display = ob_display;
+ ce.xclient.window = moveresize_client->window;
+ ce.xclient.format = 32;
+ ce.xclient.data.l[0] = prop_atoms.net_wm_sync_request;
+ ce.xclient.data.l[1] = event_curtime;
+ ce.xclient.data.l[2] = XSyncValueLow32(val);
+ ce.xclient.data.l[3] = XSyncValueHigh32(val);
+ ce.xclient.data.l[4] = 0l;
+ XSendEvent(ob_display, moveresize_client->window, FALSE,
+ NoEventMask, &ce);
+
+ waiting_for_sync = TRUE;
+ }
+#endif
+
+ {
+ gint x, y;
+ get_resize_position(&x, &y, FALSE);
+ client_configure(moveresize_client, x, y, cur_x, cur_y, TRUE, FALSE);