aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Bürk <admin@airblader.de>2020-04-09 16:41:43 +0200
committerGitHub <noreply@github.com>2020-04-09 16:41:43 +0200
commitc611b9e0e09052035dcc6f0575841c8a2ae7ebc1 (patch)
treec567158cb221120c0d8d739702231ecb2d39e582
parent26cbca3d279d698a92e907d5cb95b32a7941f3fc (diff)
parent6fa2cd32a0cd35840dc9fccf3580b9e8b363f563 (diff)
downloadi3-c611b9e0e09052035dcc6f0575841c8a2ae7ebc1.tar.gz
i3-c611b9e0e09052035dcc6f0575841c8a2ae7ebc1.zip
Merge pull request #4000 from orestisfl/revert-3983-resize-behind-fullscreen
Correctly handle mouse resize in fullscreen containers
-rw-r--r--include/click.h2
-rw-r--r--src/click.c55
2 files changed, 30 insertions, 27 deletions
diff --git a/include/click.h b/include/click.h
index 0d57abf7..898f1870 100644
--- a/include/click.h
+++ b/include/click.h
@@ -19,4 +19,4 @@
* Then, route_click is called on the appropriate con.
*
*/
-int handle_button_press(xcb_button_press_event_t *event);
+void handle_button_press(xcb_button_press_event_t *event);
diff --git a/src/click.c b/src/click.c
index f038f290..7a3fde36 100644
--- a/src/click.c
+++ b/src/click.c
@@ -48,7 +48,11 @@ static bool tiling_resize_for_border(Con *con, border_t border, xcb_button_press
bool res = resize_find_tiling_participants(&first, &second, search_direction, false);
if (!res) {
- LOG("No second container in this direction found.\n");
+ DLOG("No second container in this direction found.\n");
+ return false;
+ }
+ if (first->fullscreen_mode != second->fullscreen_mode) {
+ DLOG("Avoiding resize between containers with different fullscreen modes, %d != %d\n", first->fullscreen_mode, second->fullscreen_mode);
return false;
}
@@ -147,7 +151,7 @@ static bool tiling_resize(Con *con, xcb_button_press_event_t *event, const click
* functions for resizing/dragging.
*
*/
-static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod_pressed, const click_destination_t dest) {
+static void route_click(Con *con, xcb_button_press_event_t *event, const bool mod_pressed, const click_destination_t dest) {
DLOG("--> click properties: mod = %d, destination = %d\n", mod_pressed, dest);
DLOG("--> OUTCOME = %p\n", con);
DLOG("type = %d, name = %s\n", con->type, con->name);
@@ -174,7 +178,7 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
xcb_flush(conn);
command_result_free(result);
- return 0;
+ return;
}
}
@@ -233,7 +237,7 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
/* 4: floating_modifier plus left mouse button drags */
if (mod_pressed && event->detail == XCB_BUTTON_CLICK_LEFT) {
floating_drag_window(floatingcon, event, false);
- return 1;
+ return;
}
/* 5: resize (floating) if this was a (left or right) click on the
@@ -242,7 +246,7 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
if (mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) {
DLOG("floating resize due to floatingmodifier\n");
floating_resize_window(floatingcon, proportional, event);
- return 1;
+ return;
}
if (!in_stacked && dest == CLICK_DECORATION &&
@@ -256,34 +260,31 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
if (dest == CLICK_DECORATION && event->detail == XCB_BUTTON_CLICK_RIGHT) {
DLOG("floating resize due to decoration right click\n");
floating_resize_window(floatingcon, proportional, event);
- return 1;
+ return;
}
if (dest == CLICK_BORDER && is_left_or_right_click) {
DLOG("floating resize due to border click\n");
floating_resize_window(floatingcon, proportional, event);
- return 1;
+ return;
}
/* 6: dragging, if this was a click on a decoration (which did not lead
* to a resize) */
if (dest == CLICK_DECORATION && event->detail == XCB_BUTTON_CLICK_LEFT) {
floating_drag_window(floatingcon, event, !was_focused);
- return 1;
+ return;
}
goto done;
}
- if (fs) {
- /* Fullscreen container exists, avoid resizes */
- goto done;
- }
-
/* 7: floating modifier pressed, initiate a resize */
if (dest == CLICK_INSIDE && mod_pressed && event->detail == XCB_BUTTON_CLICK_RIGHT) {
- if (floating_mod_on_tiled_client(con, event))
- return 1;
+ floating_mod_on_tiled_client(con, event);
+ /* Avoid propagating events to clients, since the user expects
+ * $mod + click to be handled by i3. */
+ return;
}
/* 8: otherwise, check for border/decoration clicks and resize */
else if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) &&
@@ -300,8 +301,6 @@ done:
xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time);
xcb_flush(conn);
tree_render();
-
- return 0;
}
/*
@@ -312,7 +311,7 @@ done:
* Then, route_click is called on the appropriate con.
*
*/
-int handle_button_press(xcb_button_press_event_t *event) {
+void handle_button_press(xcb_button_press_event_t *event) {
Con *con;
DLOG("Button %d (state %d) %s on window 0x%08x (child 0x%08x) at (%d, %d) (root %d, %d)\n",
event->detail, event->state, (event->response_type == XCB_BUTTON_PRESS ? "press" : "release"),
@@ -324,8 +323,10 @@ int handle_button_press(xcb_button_press_event_t *event) {
const uint32_t mod = (config.floating_modifier & 0xFFFF);
const bool mod_pressed = (mod != 0 && (event->state & mod) == mod);
DLOG("floating_mod = %d, detail = %d\n", mod_pressed, event->detail);
- if ((con = con_by_window_id(event->event)))
- return route_click(con, event, mod_pressed, CLICK_INSIDE);
+ if ((con = con_by_window_id(event->event))) {
+ route_click(con, event, mod_pressed, CLICK_INSIDE);
+ return;
+ }
if (!(con = con_by_frame_id(event->event))) {
/* Run bindings on the root window as well, see #2097. We only run it
@@ -353,15 +354,15 @@ int handle_button_press(xcb_button_press_event_t *event) {
workspace_show(ws);
tree_render();
}
- return 1;
+ return;
}
- return 0;
+ return;
}
ELOG("Clicked into unknown window?!\n");
xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time);
xcb_flush(conn);
- return 0;
+ return;
}
/* Check if the click was on the decoration of a child */
@@ -370,13 +371,15 @@ int handle_button_press(xcb_button_press_event_t *event) {
if (!rect_contains(child->deco_rect, event->event_x, event->event_y))
continue;
- return route_click(child, event, mod_pressed, CLICK_DECORATION);
+ route_click(child, event, mod_pressed, CLICK_DECORATION);
+ return;
}
if (event->child != XCB_NONE) {
DLOG("event->child not XCB_NONE, so this is an event which originated from a click into the application, but the application did not handle it.\n");
- return route_click(con, event, mod_pressed, CLICK_INSIDE);
+ route_click(con, event, mod_pressed, CLICK_INSIDE);
+ return;
}
- return route_click(con, event, mod_pressed, CLICK_BORDER);
+ route_click(con, event, mod_pressed, CLICK_BORDER);
}