15 #include <xcb/xcb_atom.h>
16 #include <xcb/xcb_icccm.h>
18 #include <X11/XKBlib.h>
29 DLOG(
"border = %d, con = %p\n", border, con);
34 Con *first = NULL, *second = NULL;
35 Con *resize_con = con;
36 while (resize_con->
type != CT_WORKSPACE &&
37 resize_con->
type != CT_FLOATING_CON &&
39 resize_con = resize_con->
parent;
41 DLOG(
"resize_con = %p\n", resize_con);
42 if (resize_con->
type != CT_WORKSPACE &&
43 resize_con->
type != CT_FLOATING_CON &&
47 if (second ==
TAILQ_END(&(first->nodes_head))) {
50 else if (way ==
'p') {
55 DLOG(
"first = %p, second = %p, resize_con = %p\n",
56 first, second, resize_con);
59 if (first == NULL || second == NULL) {
60 DLOG(
"Resize not possible\n");
64 assert(first != second);
69 if (orientation ==
HORIZ)
70 event->root_x = second->rect.x;
71 else event->root_y = second->rect.y;
75 DLOG(
"After resize handler, rendering\n");
92 int to_right = con->
rect.
width -
event->event_x,
93 to_left =
event->event_x,
94 to_top =
event->event_y,
97 DLOG(
"click was %d px to the right, %d px to the left, %d px to top, %d px to bottom\n",
98 to_right, to_left, to_top, to_bottom);
100 if (to_right < to_left &&
102 to_right < to_bottom)
105 if (to_left < to_right &&
110 if (to_top < to_right &&
115 if (to_bottom < to_right &&
116 to_bottom < to_left &&
130 DLOG(
"BORDER x = %d, y = %d for con %p, window 0x%08x\n",
131 event->event_x, event->event_y, con, event->event);
142 Con *check_con = con;
144 check_con = check_con->
parent;
146 if ((check_con->
layout == L_STACKED ||
147 check_con->
layout == L_TABBED ||
150 DLOG(
"Not handling this resize, this container has > 1 child.\n");
156 if (event->event_x >= 0 && event->event_x <= bsr.
x &&
176 DLOG(
"--> click properties: mod = %d, destination = %d\n", mod_pressed, dest);
177 DLOG(
"--> OUTCOME = %p\n", con);
186 const bool proportional = (
event->state &
BIND_SHIFT);
192 (event->detail == XCB_BUTTON_INDEX_4 ||
193 event->detail == XCB_BUTTON_INDEX_5)) {
194 DLOG(
"Scrolling on a window decoration\n");
199 bool scroll_prev_possible = (
TAILQ_PREV(focused, nodes_head, nodes) != NULL);
200 bool scroll_next_possible = (
TAILQ_NEXT(focused, nodes) != NULL);
201 if (event->detail == XCB_BUTTON_INDEX_4 && scroll_prev_possible)
203 else if (event->detail == XCB_BUTTON_INDEX_5 && scroll_next_possible)
214 if (ws != focused_workspace)
222 if (floatingcon != NULL && fs == NULL) {
226 if (mod_pressed && event->detail == XCB_BUTTON_INDEX_1) {
234 if (mod_pressed && event->detail == 3) {
235 DLOG(
"floating resize due to floatingmodifier\n");
242 DLOG(
"tiling resize with fallback\n");
248 DLOG(
"floating resize due to border click\n");
270 if (dest ==
CLICK_INSIDE && mod_pressed && event->detail == 3) {
276 (event->detail == XCB_BUTTON_INDEX_1 ||
277 event->detail == XCB_BUTTON_INDEX_3)) {
278 DLOG(
"Trying to resize (tiling)\n");
283 xcb_allow_events(
conn, XCB_ALLOW_REPLAY_POINTER, event->time);
299 DLOG(
"Button %d pressed on window 0x%08x\n", event->state, event->event);
304 const bool mod_pressed = (mod != 0 && (
event->state & mod) == mod);
305 DLOG(
"floating_mod = %d, detail = %d\n", mod_pressed, event->detail);
310 ELOG(
"Clicked into unknown window?!\n");
311 xcb_allow_events(
conn, XCB_ALLOW_REPLAY_POINTER, event->time);