diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-10-10 21:50:29 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-10 21:50:29 +1000 |
commit | ed33d95b6ae8a2d231cdda554f364af7211c2527 (patch) | |
tree | ad2feecb17cadccf71468d4f6b22d2ad6cf27d00 | |
parent | Add mouse_warping container (diff) | |
parent | Merge pull request #2811 from RyanDwyer/fix-floating-click-events (diff) | |
download | sway-ed33d95b6ae8a2d231cdda554f364af7211c2527.tar.gz sway-ed33d95b6ae8a2d231cdda554f364af7211c2527.tar.zst sway-ed33d95b6ae8a2d231cdda554f364af7211c2527.zip |
Merge branch 'master' into mouse-warping-container
-rw-r--r-- | sway/input/cursor.c | 1 | ||||
-rw-r--r-- | sway/input/seat.c | 13 | ||||
-rw-r--r-- | sway/tree/container.c | 12 |
3 files changed, 17 insertions, 9 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 6d57c45f..5c446299 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -877,6 +877,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
877 | while (cont->parent) { | 877 | while (cont->parent) { |
878 | cont = cont->parent; | 878 | cont = cont->parent; |
879 | } | 879 | } |
880 | seat_set_focus_container(seat, cont); | ||
880 | seat_begin_move_floating(seat, cont, button); | 881 | seat_begin_move_floating(seat, cont, button); |
881 | return; | 882 | return; |
882 | } | 883 | } |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 7508d6b9..03ed638e 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -1042,7 +1042,7 @@ void seat_begin_down(struct sway_seat *seat, struct sway_container *con, | |||
1042 | seat->op_moved = false; | 1042 | seat->op_moved = false; |
1043 | 1043 | ||
1044 | // In case the container was not raised by gaining focus, raise on click | 1044 | // In case the container was not raised by gaining focus, raise on click |
1045 | if (con && !config->raise_floating) { | 1045 | if (!config->raise_floating) { |
1046 | container_raise_floating(con); | 1046 | container_raise_floating(con); |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
@@ -1056,6 +1056,12 @@ void seat_begin_move_floating(struct sway_seat *seat, | |||
1056 | seat->operation = OP_MOVE_FLOATING; | 1056 | seat->operation = OP_MOVE_FLOATING; |
1057 | seat->op_container = con; | 1057 | seat->op_container = con; |
1058 | seat->op_button = button; | 1058 | seat->op_button = button; |
1059 | |||
1060 | // In case the container was not raised by gaining focus, raise on click | ||
1061 | if (!config->raise_floating) { | ||
1062 | container_raise_floating(con); | ||
1063 | } | ||
1064 | |||
1059 | cursor_set_image(seat->cursor, "grab", NULL); | 1065 | cursor_set_image(seat->cursor, "grab", NULL); |
1060 | } | 1066 | } |
1061 | 1067 | ||
@@ -1089,6 +1095,11 @@ void seat_begin_resize_floating(struct sway_seat *seat, | |||
1089 | seat->op_ref_con_ly = con->y; | 1095 | seat->op_ref_con_ly = con->y; |
1090 | seat->op_ref_width = con->width; | 1096 | seat->op_ref_width = con->width; |
1091 | seat->op_ref_height = con->height; | 1097 | seat->op_ref_height = con->height; |
1098 | // | ||
1099 | // In case the container was not raised by gaining focus, raise on click | ||
1100 | if (!config->raise_floating) { | ||
1101 | container_raise_floating(con); | ||
1102 | } | ||
1092 | 1103 | ||
1093 | const char *image = edge == WLR_EDGE_NONE ? | 1104 | const char *image = edge == WLR_EDGE_NONE ? |
1094 | "se-resize" : wlr_xcursor_get_resize_name(edge); | 1105 | "se-resize" : wlr_xcursor_get_resize_name(edge); |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 1664514a..f36fe4b0 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -358,7 +358,6 @@ struct sway_container *container_at(struct sway_workspace *workspace, | |||
358 | struct wlr_surface **surface, double *sx, double *sy) { | 358 | struct wlr_surface **surface, double *sx, double *sy) { |
359 | struct sway_container *c; | 359 | struct sway_container *c; |
360 | 360 | ||
361 | // Focused view's popups | ||
362 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 361 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
363 | struct sway_container *focus = seat_get_focused_container(seat); | 362 | struct sway_container *focus = seat_get_focused_container(seat); |
364 | bool is_floating = focus && container_is_floating_or_child(focus); | 363 | bool is_floating = focus && container_is_floating_or_child(focus); |
@@ -370,14 +369,11 @@ struct sway_container *container_at(struct sway_workspace *workspace, | |||
370 | } | 369 | } |
371 | *surface = NULL; | 370 | *surface = NULL; |
372 | } | 371 | } |
373 | // Cast a ray to handle floating windows | 372 | // Floating |
374 | for (int i = workspace->floating->length - 1; i >= 0; --i) { | 373 | if ((c = floating_container_at(lx, ly, surface ,sx ,sy))) { |
375 | struct sway_container *cn = workspace->floating->items[i]; | 374 | return c; |
376 | if (cn->view && (c = surface_at_view(cn, lx, ly, surface, sx, sy))) { | ||
377 | return c; | ||
378 | } | ||
379 | } | 375 | } |
380 | // If focused is tiling, focused view's non-popups | 376 | // Tiling (focused) |
381 | if (focus && focus->view && !is_floating) { | 377 | if (focus && focus->view && !is_floating) { |
382 | if ((c = surface_at_view(focus, lx, ly, surface, sx, sy))) { | 378 | if ((c = surface_at_view(focus, lx, ly, surface, sx, sy))) { |
383 | return c; | 379 | return c; |