- dx = e->data.x.e->xmotion.x_root - px;
- dy = e->data.x.e->xmotion.y_root - py;
- if (!drag &&
- (ABS(dx) >= threshold || ABS(dy) >= threshold))
- drag = TRUE;
- if (drag) {
- context = frame_context(e->data.x.client->frame,
- e->data.x.e->xbutton.window);
- drag_used = fire_motion(MouseAction_Motion, context,
- e->data.x.client,
- state, button, cx, cy, cw, ch, dx, dy,
- FALSE, corner);
+ if (ABS(e->data.x.e->xmotion.x_root - px) >= threshold ||
+ ABS(e->data.x.e->xmotion.y_root - py) >= threshold) {
+ guint32 corner;
+
+ context = frame_context(e->data.x.client,
+ e->data.x.e->xmotion.window);
+
+ /* You can't drag on buttons */
+ if (context == Context_Maximize ||
+ context == Context_AllDesktops ||
+ context == Context_Shade ||
+ context == Context_Iconify ||
+ context == Context_Icon ||
+ context == Context_Close)
+ break;
+
+ if (!e->data.x.client)
+ corner = prop_atoms.net_wm_moveresize_size_bottomright;
+ else
+ corner =
+ pick_corner(e->data.x.e->xmotion.x_root,
+ e->data.x.e->xmotion.y_root,
+ e->data.x.client->frame->area.x,
+ e->data.x.client->frame->area.y,
+ /* use the client size because the frame
+ can be differently sized (shaded
+ windows) and we want this based on the
+ clients size */
+ e->data.x.client->area.width +
+ e->data.x.client->frame->size.left +
+ e->data.x.client->frame->size.right,
+ e->data.x.client->area.height +
+ e->data.x.client->frame->size.top +
+ e->data.x.client->frame->size.bottom);
+ fire_motion(MouseAction_Motion, context,
+ e->data.x.client, state, button,
+ e->data.x.e->xmotion.x_root,
+ e->data.x.e->xmotion.y_root, corner);
+ button = 0;
+ state = 0;