From 1f8dbb320a9fdff9e59fb7641c4b5af56abc7074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bj=C3=A4reholt?= Date: Wed, 24 Jun 2020 07:55:42 +0200 Subject: [PATCH 01/11] tree/view: Make foreign-toplevel app_id fallback to class It is not a part of the foreign-toplevel-management protocol to get the class of a toplevel, only for getting the app_id. For xwayland clients this is an issue because that means that you cannot identify what application the toplevel refers to which is the point of the app_id property. By falling back to class when an app_id does not exist solves this problem. Phoc also uses app_id and class interchangeably in their implementation of foreign-toplevel-management, in fact they always do that and not only for just this protocol. https://source.puri.sm/Librem5/phoc/-/blob/c8d8a4c5440a6c1647b09dbd3bba7999f9cd433c/src/xwayland.c#L236 --- sway/tree/view.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sway/tree/view.c b/sway/tree/view.c index fb397c422..53c11a32e 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -738,10 +738,14 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, input_manager_set_focus(&view->container->node); } - const char *app_id = view_get_app_id(view); - if (app_id != NULL) { + const char *app_id; + const char *class; + if ((app_id = view_get_app_id(view)) != NULL) { wlr_foreign_toplevel_handle_v1_set_app_id( view->foreign_toplevel, app_id); + } else if ((class = view_get_class(view)) != NULL) { + wlr_foreign_toplevel_handle_v1_set_app_id( + view->foreign_toplevel, class); } } From 8b2ff2f1b3c03df9ec5573fe74ed076776869559 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 1 Jul 2020 14:36:29 -0400 Subject: [PATCH 02/11] Update version to v1.5-rc2 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2320c582f..997110601 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'sway', 'c', - version: '1.5-rc1', #release_version + version: 'v1.5-rc2', #release_version license: 'MIT', meson_version: '>=0.53.0', default_options: [ From 105bf23998e76bf88c577aa92b3afd1fe228b1bc Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Tue, 23 Jun 2020 17:10:28 -0400 Subject: [PATCH 03/11] Minor wording changes in Romanian README.md translation --- README.ro.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.ro.md b/README.ro.md index ba9ab34b1..b046bc2e8 100644 --- a/README.ro.md +++ b/README.ro.md @@ -14,12 +14,12 @@ Noile versiuni sunt semnate cu [B22DA89A](http://pgp.mit.edu/pks/lookup?op=vinde ### Din pachete (packages) -sway este valabil în multe distribuții. încercați a instala "sway" pe distribuția voastră. Dacă nu este valabil, uitați-vă în [această pagină wiki](https://github.com/swaywm/sway/wiki/Unsupported-packages) +sway este disponibil în multe distribuții. Încercați să instalați pachetul "sway" pe distribuția voastră. Dacă nu este disponibil, uitați-vă în [această pagină wiki](https://github.com/swaywm/sway/wiki/Unsupported-packages) pentru informații a cum puteți să instalați pentru distribuția voastră. Dacă sunteți interesați in a crea pachete pentru distribuția voastră, informați-ne prin IRC sau contactați prin email pe sir@cmpwn.com pentru ajutor. -### Construire din sursă +### Compilare din sursă Dependențe pentru instalare: @@ -31,9 +31,9 @@ Dependențe pentru instalare: * json-c * pango * cairo -* gdk-pixbuf2 (optional: system tray) -* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (optional: pagini man) \* -* git (optional: info versiune) \* +* gdk-pixbuf2 (opțional, dacă doriți să aveți system tray) +* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (opțional, pentru paginile man) \* +* git (opțional, pentru informații de versiune) \* *Dependențe doar pentru compilare* @@ -45,12 +45,13 @@ Rulați aceste comenzi: sudo ninja -C build install ``` -Pe sisteme fără logind, trebuie făcut următorul: +Pe sisteme fără logind, trebuie să folosiți următoarea comandă pentru a marca binarul de Sway ca suid: ``` sudo chmod a+s /usr/local/bin/sway ``` -Sway o să scape de permisiuni root la puțin timp după lansare. + +Imediat după pornire, Sway va renunța la permisiunile de root. ## Configurare From 92891fb1edef5136ae4eb35fec5b8523f031be81 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Wed, 1 Jul 2020 01:08:04 -0400 Subject: [PATCH 04/11] commands/move: unwrap workspace container on move to new workspace If moving e.g. `T[app app]` into a new workspace with `workspace_layout tabbed`, then post-move the tree in that workspace will be `T[T[app app]]`. This still happens with horizontal or vertical workspace layout, but is less visible since those containers have no decorations. Fixes #5426. --- include/sway/tree/workspace.h | 3 +++ sway/commands/move.c | 10 +++++++--- sway/tree/workspace.c | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index 41b597963..1adbe68a2 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h @@ -105,6 +105,9 @@ struct sway_container *workspace_find_container(struct sway_workspace *ws, */ struct sway_container *workspace_wrap_children(struct sway_workspace *ws); +void workspace_unwrap_children(struct sway_workspace *ws, + struct sway_container *wrap); + void workspace_detach(struct sway_workspace *workspace); void workspace_add_tiling(struct sway_workspace *workspace, diff --git a/sway/commands/move.c b/sway/commands/move.c index cdbad13e1..5851520e9 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -208,9 +208,13 @@ static void container_move_to_workspace(struct sway_container *container, } } else { container_detach(container); - container->width = container->height = 0; - container->width_fraction = container->height_fraction = 0; - workspace_add_tiling(workspace, container); + if (workspace_is_empty(workspace) && container->children) { + workspace_unwrap_children(workspace, container); + } else { + container->width = container->height = 0; + container->width_fraction = container->height_fraction = 0; + workspace_add_tiling(workspace, container); + } container_update_representation(container); } if (container->view) { diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 0fa28951e..3bcba8e54 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -641,6 +641,21 @@ struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { return middle; } +void workspace_unwrap_children(struct sway_workspace *ws, + struct sway_container *wrap) { + if (!sway_assert(workspace_is_empty(ws), + "target workspace must be empty")) { + return; + } + + ws->layout = wrap->layout; + while (wrap->children->length) { + struct sway_container *child = wrap->children->items[0]; + container_detach(child); + workspace_add_tiling(ws, child); + } +} + void workspace_detach(struct sway_workspace *workspace) { struct sway_output *output = workspace->output; int index = list_find(output->workspaces, workspace); From 1bfbf262cc501db7bd94f651ea16aa4af607f548 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 10:59:16 +0200 Subject: [PATCH 05/11] seat: fix segfault in sway_input_method_relay_set_focus sway_input_method_relay_set_focus was called before sway_input_method_relay_init. Closes: https://github.com/swaywm/sway/issues/5503 --- sway/input/seat.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index a54bc2e7d..1e9873604 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -572,14 +572,6 @@ struct sway_seat *seat_create(const char *seat_name) { seat->deferred_bindings = create_list(); - if (!wl_list_empty(&server.input->seats)) { - // Since this is not the first seat, attempt to set initial focus - struct sway_seat *current_seat = input_manager_current_seat(); - struct sway_node *current_focus = - seat_get_focus_inactive(current_seat, &root->node); - seat_set_focus(seat, current_focus); - } - wl_signal_add(&root->events.new_node, &seat->new_node); seat->new_node.notify = handle_new_node; @@ -604,8 +596,17 @@ struct sway_seat *seat_create(const char *seat_name) { sway_input_method_relay_init(seat, &seat->im_relay); + bool first = wl_list_empty(&server.input->seats); wl_list_insert(&server.input->seats, &seat->link); + if (!first) { + // Since this is not the first seat, attempt to set initial focus + struct sway_seat *current_seat = input_manager_current_seat(); + struct sway_node *current_focus = + seat_get_focus_inactive(current_seat, &root->node); + seat_set_focus(seat, current_focus); + } + seatop_begin_default(seat); return seat; From dfccd2a4c483a6ff03350cd4ac5e3fada1f40f2e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 13:48:57 +0200 Subject: [PATCH 06/11] Don't set xwayland cursor when wlr_xwayland failed This causes a NULL pointer dereference. --- sway/input/seat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index 1e9873604..656e3e7e8 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -925,7 +925,7 @@ void seat_configure_xcursor(struct sway_seat *seat) { } #if HAVE_XWAYLAND - if (config->xwayland && (!server.xwayland.xcursor_manager || + if (server.xwayland.wlr_xwayland && (!server.xwayland.xcursor_manager || !xcursor_manager_is_named(server.xwayland.xcursor_manager, cursor_theme) || server.xwayland.xcursor_manager->size != cursor_size)) { From eb4fa183088d0361e2492780e303e2965c5ecae1 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 13:50:24 +0200 Subject: [PATCH 07/11] Unset DISPLAY when wlr_xwayland fails Avoids having applications connect to a leftover DISPLAY when Xwayland fails to initialize. --- sway/server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sway/server.c b/sway/server.c index c036396f3..ff848450d 100644 --- a/sway/server.c +++ b/sway/server.c @@ -202,6 +202,7 @@ bool server_start(struct sway_server *server) { config->xwayland == XWAYLAND_MODE_LAZY); if (!server->xwayland.wlr_xwayland) { sway_log(SWAY_ERROR, "Failed to start Xwayland"); + unsetenv("DISPLAY"); } else { wl_signal_add(&server->xwayland.wlr_xwayland->events.new_surface, &server->xwayland_surface); From b5a35c484f651e25b226c9661669c8a40439f09b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 2 Jul 2020 12:14:52 +0200 Subject: [PATCH 08/11] tree/view: fix segfault in view_update_title xdg-shell doesn't allow clients to set the title to NULL, so we shouldn't need to call wlr_foreign_toplevel_handle_v1_set_title with an empty string to reset the old one. Closes: https://github.com/swaywm/sway/issues/5488 --- sway/tree/view.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/tree/view.c b/sway/tree/view.c index 53c11a32e..ac3147953 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -1171,7 +1171,7 @@ void view_update_title(struct sway_view *view, bool force) { ipc_event_window(view->container, "title"); - if (view->foreign_toplevel) { + if (view->foreign_toplevel && title) { wlr_foreign_toplevel_handle_v1_set_title(view->foreign_toplevel, title); } } From 17ff13fc84fd74ddcee68a302af156d7bf81ed85 Mon Sep 17 00:00:00 2001 From: wb9688 Date: Tue, 31 Dec 2019 18:31:45 +0100 Subject: [PATCH 09/11] Replace unprintable characters in input device id --- sway/input/input-manager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 69342c731..f04a8ce09 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -70,7 +70,8 @@ char *input_device_get_identifier(struct wlr_input_device *device) { char *p = name; for (; *p; ++p) { - if (*p == ' ') { + // There are in fact input devices with unprintable characters in its name + if (*p == ' ' || !isprint(*p)) { *p = '_'; } } From b4a75a1ab2a72842830aeea37733311f85e6f660 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Wed, 1 Jul 2020 03:20:38 -0400 Subject: [PATCH 10/11] commands/move: maintain workspace_layout when moving Fixes #5157. --- sway/commands/move.c | 10 ++++++---- sway/tree/container.c | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sway/commands/move.c b/sway/commands/move.c index 5851520e9..038390832 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -275,12 +275,11 @@ static void workspace_rejigger(struct sway_workspace *ws, return; } container_detach(child); - struct sway_container *new_parent = workspace_wrap_children(ws); + workspace_wrap_children(ws); int index = move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_UP ? 0 : 1; workspace_insert_tiling(ws, child, index); - container_flatten(new_parent); ws->layout = move_dir == WLR_DIRECTION_LEFT || move_dir == WLR_DIRECTION_RIGHT ? L_HORIZ : L_VERT; @@ -349,8 +348,11 @@ static bool container_move_in_direction(struct sway_container *container, container_insert_child(current->parent, container, index + (offs < 0 ? 0 : 1)); } else { - workspace_insert_tiling(current->workspace, container, - index + (offs < 0 ? 0 : 1)); + struct sway_workspace *ws = current->workspace; + workspace_insert_tiling(ws, + container_split(container, + output_get_default_layout(ws->output)), + index + (offs < 0 ? 0 : 1)); } return true; } diff --git a/sway/tree/container.c b/sway/tree/container.c index 4cc42747d..fa1598ef9 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -1329,6 +1329,14 @@ void container_detach(struct sway_container *child) { container_update_representation(old_parent); node_set_dirty(&old_parent->node); } else if (old_workspace) { + // We may have removed the last tiling child from the workspace. If the + // workspace layout was e.g. tabbed, then at this point it may be just + // H[]. So, reset it to the default (e.g. T[]) for next time. + if (!old_workspace->tiling->length) { + old_workspace->layout = + output_get_default_layout(old_workspace->output); + } + workspace_update_representation(old_workspace); node_set_dirty(&old_workspace->node); } From 1d149230ea1fbe7bc5ac906e235db3c1fdc63afa Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 4 Jul 2020 11:29:54 +0000 Subject: [PATCH 11/11] protocols: sync wlr-layer-shell-unstable-v1 with wlroots --- protocols/wlr-layer-shell-unstable-v1.xml | 52 +++++++++++++++++------ 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/protocols/wlr-layer-shell-unstable-v1.xml b/protocols/wlr-layer-shell-unstable-v1.xml index f29eb8796..fa67001df 100644 --- a/protocols/wlr-layer-shell-unstable-v1.xml +++ b/protocols/wlr-layer-shell-unstable-v1.xml @@ -1,5 +1,5 @@ - + Copyright © 2017 Drew DeVault @@ -25,7 +25,7 @@ THIS SOFTWARE. - + Clients can use this interface to assign the surface_layer role to wl_surfaces. Such surfaces are assigned to a "layer" of the output and @@ -82,17 +82,27 @@ + + + + + + This request indicates that the client will not use the layer_shell + object any more. Objects that have been created through this instance + are not affected. + + - + An interface that may be implemented by a wl_surface, for surfaces that are designed to be rendered as a layer of a stacked desktop-like environment. - Layer surface state (size, anchor, exclusive zone, margin, interactivity) - is double-buffered, and will be applied at the time wl_surface.commit of - the corresponding wl_surface is called. + Layer surface state (layer, size, anchor, exclusive zone, + margin, interactivity) is double-buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. @@ -115,7 +125,7 @@ Requests that the compositor anchor the surface to the specified edges - and corners. If two orthoginal edges are specified (e.g. 'top' and + and corners. If two orthogonal edges are specified (e.g. 'top' and 'left'), then the anchor point will be the intersection of the edges (e.g. the top left corner of the output); otherwise the anchor point will be centered on that edge, or in the center if none is specified. @@ -127,19 +137,24 @@ - Requests that the compositor avoids occluding an area of the surface - with other surfaces. The compositor's use of this information is + Requests that the compositor avoids occluding an area with other + surfaces. The compositor's use of this information is implementation-dependent - do not assume that this region will not actually be occluded. - A positive value is only meaningful if the surface is anchored to an - edge, rather than a corner. The zone is the number of surface-local - coordinates from the edge that are considered exclusive. + A positive value is only meaningful if the surface is anchored to one + edge or an edge and both perpendicular edges. If the surface is not + anchored, anchored to only two perpendicular edges (a corner), anchored + to only two parallel edges or anchored to all edges, a positive value + will be treated the same as zero. + + A positive zone is the distance from the edge in surface-local + coordinates to consider exclusive. Surfaces that do not wish to have an exclusive zone may instead specify how they should interact with surfaces that do. If set to zero, the surface indicates that it would like to be moved to avoid occluding - surfaces with a positive excluzive zone. If set to -1, the surface + surfaces with a positive exclusive zone. If set to -1, the surface indicates that it would not like to be moved to accommodate for other surfaces, and the compositor should extend it all the way to the edges it is anchored to. @@ -281,5 +296,16 @@ + + + + + + Change the layer that the surface is rendered on. + + Layer is double-buffered, see wl_surface.commit. + + +