From 5e9c61ac23fff1185100a19b36803380441b3e81 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Mon, 8 Oct 2018 18:49:55 -0400 Subject: Only consider tiling views for gaps outer --- sway/tree/workspace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sway/tree') diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index b357d83d..d7650560 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -624,7 +624,10 @@ void workspace_add_gaps(struct sway_workspace *ws) { if (config->smart_gaps) { struct sway_seat *seat = input_manager_get_default_seat(input_manager); struct sway_container *focus = - seat_get_focus_inactive_view(seat, &ws->node); + seat_get_focus_inactive_tiling(seat, ws); + if (focus && !focus->view) { + focus = seat_get_focus_inactive_view(seat, &focus->node); + } if (focus && focus->view && view_is_only_visible(focus->view)) { return; } -- cgit v1.2.3 From fd645a2a883d96aecb7fa4664d1d000950f47a3a Mon Sep 17 00:00:00 2001 From: mwenzkowski <29407878+mwenzkowski@users.noreply.github.com> Date: Tue, 9 Oct 2018 20:10:45 +0200 Subject: Fix undesirable height change of floating views In view_autoconfigure the height of the view is adjusted if the parent container has a tabbed/stacked layout. Previously this height change would also be applied to floating views, although it is not needed for them. --- sway/tree/view.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sway/tree') diff --git a/sway/tree/view.c b/sway/tree/view.c index 1f00452d..e613ac0b 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -243,10 +243,10 @@ void view_autoconfigure(struct sway_view *view) { // title area. We have to offset the surface y by the height of the title, // bar, and disable any top border because we'll always have the title bar. enum sway_container_layout layout = container_parent_layout(con); - if (layout == L_TABBED) { + if (layout == L_TABBED && !container_is_floating(con)) { y_offset = container_titlebar_height(); view->border_top = false; - } else if (layout == L_STACKED) { + } else if (layout == L_STACKED && !container_is_floating(con)) { list_t *siblings = container_get_siblings(con); y_offset = container_titlebar_height() * siblings->length; view->border_top = false; -- cgit v1.2.3 From 416bb7a214d6f140a4eb7a1b8b0581fc78d71cda Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 10 Oct 2018 16:58:32 +1000 Subject: Fix floating click events * Set focus to a floating container when clicking its title bar. * Raise floating when user clicks title bar or decorations (in the seat_begin functions). * In container_at, it only returned a floating container if the user had clicked the surface. This makes it use floating_container_at instead. --- sway/input/cursor.c | 1 + sway/input/seat.c | 13 ++++++++++++- sway/tree/container.c | 12 ++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) (limited to 'sway/tree') 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, while (cont->parent) { cont = cont->parent; } + seat_set_focus_container(seat, cont); seat_begin_move_floating(seat, cont, button); return; } diff --git a/sway/input/seat.c b/sway/input/seat.c index f418785d..daf5b160 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1038,7 +1038,7 @@ void seat_begin_down(struct sway_seat *seat, struct sway_container *con, seat->op_moved = false; // In case the container was not raised by gaining focus, raise on click - if (con && !config->raise_floating) { + if (!config->raise_floating) { container_raise_floating(con); } } @@ -1052,6 +1052,12 @@ void seat_begin_move_floating(struct sway_seat *seat, seat->operation = OP_MOVE_FLOATING; seat->op_container = con; seat->op_button = button; + + // In case the container was not raised by gaining focus, raise on click + if (!config->raise_floating) { + container_raise_floating(con); + } + cursor_set_image(seat->cursor, "grab", NULL); } @@ -1085,6 +1091,11 @@ void seat_begin_resize_floating(struct sway_seat *seat, seat->op_ref_con_ly = con->y; seat->op_ref_width = con->width; seat->op_ref_height = con->height; + // + // In case the container was not raised by gaining focus, raise on click + if (!config->raise_floating) { + container_raise_floating(con); + } const char *image = edge == WLR_EDGE_NONE ? "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, struct wlr_surface **surface, double *sx, double *sy) { struct sway_container *c; - // Focused view's popups struct sway_seat *seat = input_manager_current_seat(input_manager); struct sway_container *focus = seat_get_focused_container(seat); bool is_floating = focus && container_is_floating_or_child(focus); @@ -370,14 +369,11 @@ struct sway_container *container_at(struct sway_workspace *workspace, } *surface = NULL; } - // Cast a ray to handle floating windows - for (int i = workspace->floating->length - 1; i >= 0; --i) { - struct sway_container *cn = workspace->floating->items[i]; - if (cn->view && (c = surface_at_view(cn, lx, ly, surface, sx, sy))) { - return c; - } + // Floating + if ((c = floating_container_at(lx, ly, surface ,sx ,sy))) { + return c; } - // If focused is tiling, focused view's non-popups + // Tiling (focused) if (focus && focus->view && !is_floating) { if ((c = surface_at_view(focus, lx, ly, surface, sx, sy))) { return c; -- cgit v1.2.3