+ /* keep the pointer bounded to the screen for move/resize */
+ if (!grab_pointer(FALSE, TRUE, cur))
+ return;
+ if (!grab_keyboard()) {
+ ungrab_pointer();
+ return;
+ }
+
+ frame_end_iconify_animation(c->frame);
+
+ moveresize_client = c;
+ start_cx = c->area.x;
+ start_cy = c->area.y;
+ /* these adjustments for the size_inc make resizing a terminal more
+ friendly. you essentially start the resize in the middle of the
+ increment instead of at 0, so you have to move half an increment
+ either way instead of a full increment one and 1 px the other. and this
+ is one large mother fucking comment. */
+ start_cw = c->area.width + c->size_inc.width / 2;
+ start_ch = c->area.height + c->size_inc.height / 2;
+ start_x = x;
+ start_y = y;
+ 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 (moving) {
+ cur_x = start_cx;
+ cur_y = start_cy;
+ } else {
+ cur_x = start_cw;
+ cur_y = start_ch;
+ }
+
+ moveresize_in_progress = TRUE;
+
+#ifdef SYNC
+ if (config_resize_redraw && !moving && extensions_shape &&
+ moveresize_client->sync_request && moveresize_client->sync_counter)
+ {
+ /* Initialize values for the resize syncing, and create an alarm for
+ the client's xsync counter */
+
+ XSyncValue val;
+ XSyncAlarmAttributes aa;
+
+ /* set the counter to an initial value */
+ XSyncIntToValue(&val, 0);
+ XSyncSetCounter(ob_display, moveresize_client->sync_counter, val);
+
+ /* this will be incremented when we tell the client what we're
+ looking for */
+ moveresize_client->sync_counter_value = 0;
+
+ /* the next sequence we're waiting for with the alarm */
+ XSyncIntToValue(&val, 1);
+
+ /* set an alarm on the counter */
+ aa.trigger.counter = moveresize_client->sync_counter;
+ aa.trigger.wait_value = val;
+ aa.trigger.value_type = XSyncAbsolute;
+ aa.trigger.test_type = XSyncPositiveTransition;
+ aa.events = True;
+ XSyncIntToValue(&aa.delta, 1);
+ moveresize_alarm = XSyncCreateAlarm(ob_display,
+ XSyncCACounter |
+ XSyncCAValue |
+ XSyncCAValueType |
+ XSyncCATestType |
+ XSyncCADelta |
+ XSyncCAEvents,
+ &aa);
+
+ waiting_for_sync = FALSE;
+ }
+#endif