int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_event_t *event) {
LOG("button press!\n");
+ LOG("state = %d\n", event->state);
/* This was either a focus for a client’s parent (= titlebar)… */
Client *client = table_get(&by_child, event->event);
bool border_click = false;
client = table_get(&by_parent, event->event);
border_click = true;
}
+ /* See if this was a click with Mod1. If so, we need to move around
+ * the client if it was floating. if not, we just process as usual. */
+ if ((event->state & XCB_MOD_MASK_1) != 0) {
+ if (client == NULL) {
+ LOG("Not handling, Mod1 was pressed and no client found\n");
+ return 1;
+ }
+ if (client->floating) {
+ floating_drag_window(conn, client, event);
+ return 1;
+ }
+ }
+
if (client == NULL) {
/* The client was neither on a client’s titlebar nor on a client itself, maybe on a stack_window? */
if (button_press_stackwin(conn, event))
1 /* left mouse button */,
XCB_BUTTON_MASK_ANY /* don’t filter for any modifiers */);
+ xcb_grab_button(conn, false, child, XCB_EVENT_MASK_BUTTON_PRESS,
+ XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE,
+ 1 /* left mouse button */, XCB_MOD_MASK_1);
+
/* Get _NET_WM_WINDOW_TYPE (to see if it’s a dock) */
xcb_atom_t *atom;
xcb_get_property_reply_t *preply = xcb_get_property_reply(conn, wm_type_cookie, NULL);