This commit is contained in:
dmitry 2020-07-05 17:51:44 +03:00
commit 025af4c5b7
11 changed files with 102 additions and 39 deletions

View file

@ -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

View file

@ -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,

View file

@ -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: [

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_layer_shell_v1_unstable_v1">
<protocol name="wlr_layer_shell_unstable_v1">
<copyright>
Copyright © 2017 Drew DeVault
@ -25,7 +25,7 @@
THIS SOFTWARE.
</copyright>
<interface name="zwlr_layer_shell_v1" version="1">
<interface name="zwlr_layer_shell_v1" version="3">
<description summary="create surfaces that are layers of the desktop">
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 @@
<entry name="top" value="2"/>
<entry name="overlay" value="3"/>
</enum>
<!-- Version 3 additions -->
<request name="destroy" type="destructor" since="3">
<description summary="destroy the layer_shell object">
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.
</description>
</request>
</interface>
<interface name="zwlr_layer_surface_v1" version="1">
<interface name="zwlr_layer_surface_v1" version="3">
<description summary="layer metadata interface">
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.
</description>
<request name="set_size">
@ -115,7 +125,7 @@
<request name="set_anchor">
<description summary="configures the anchor point of the surface">
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 @@
<request name="set_exclusive_zone">
<description summary="configures the exclusive geometry of this surface">
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 @@
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
</enum>
<!-- Version 2 additions -->
<request name="set_layer" since="2">
<description summary="change the layer of the surface">
Change the layer that the surface is rendered on.
Layer is double-buffered, see wl_surface.commit.
</description>
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
</request>
</interface>
</protocol>

View file

@ -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) {
@ -271,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;
@ -345,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;
}

View file

@ -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 = '_';
}
}

View file

@ -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;
@ -924,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)) {

View file

@ -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);

View file

@ -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);
}

View file

@ -746,6 +746,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
} else if ((class = view_get_class(view)) != NULL) {
wlr_foreign_toplevel_handle_v1_set_app_id(
view->foreign_toplevel, class);
}
}
void view_unmap(struct sway_view *view) {
@ -1170,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);
}
}

View file

@ -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);