diff --git a/.builds/alpine.yml b/.builds/alpine.yml index 55057fa15..fa693906d 100644 --- a/.builds/alpine.yml +++ b/.builds/alpine.yml @@ -25,7 +25,7 @@ packages: - hwdata-dev sources: - https://github.com/swaywm/sway - - https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20 + - https://gitlab.freedesktop.org/wlroots/wlroots.git tasks: - wlroots: | cd wlroots diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml index 162977e20..2c8ffcf45 100644 --- a/.builds/archlinux.yml +++ b/.builds/archlinux.yml @@ -22,7 +22,7 @@ packages: - hwdata sources: - https://github.com/swaywm/sway - - https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20 + - https://gitlab.freedesktop.org/wlroots/wlroots.git tasks: - wlroots: | cd wlroots diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 8c457b5a3..a3df06e6d 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -31,7 +31,7 @@ packages: - misc/hwdata sources: - https://github.com/swaywm/sway -- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20 +- https://gitlab.freedesktop.org/wlroots/wlroots.git tasks: - setup: | cd sway diff --git a/README.fr.md b/README.fr.md index c4ef699a4..a751a52cb 100644 --- a/README.fr.md +++ b/README.fr.md @@ -57,7 +57,7 @@ Si vous utilisez déjà i3, copiez votre configuration i3 vers `~/.config/sway/config` et sway fonctionnera directement. Sinon, copiez l'exemple de fichier de configuration vers `~/.config/sway/config`. Il se trouve généralement dans `/etc/sway/config`. Exécutez `man 5 sway` pour lire la -documentation pour la configuration de sway. +documentation sur la configuration de sway. ## Exécution diff --git a/meson.build b/meson.build index eb97daf7b..17d65c334 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'sway', 'c', - version: '1.12-rc3', + version: '1.13-dev', license: 'MIT', meson_version: '>=1.3', default_options: [ @@ -39,14 +39,14 @@ if is_freebsd endif # Execute the wlroots subproject, if any -wlroots_version = ['>=0.20.0', '<0.21.0'] +wlroots_version = ['>=0.21.0', '<0.22.0'] subproject( 'wlroots', default_options: ['examples=false'], required: false, version: wlroots_version, ) -wlroots = dependency('wlroots-0.20', version: wlroots_version, fallback: 'wlroots') +wlroots = dependency('wlroots-0.21', version: wlroots_version, fallback: 'wlroots') wlroots_features = { 'xwayland': false, 'libinput_backend': false, diff --git a/sway/input/seat.c b/sway/input/seat.c index 83772f52c..0434d637c 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1133,8 +1133,6 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n return; } - struct sway_workspace *last_workspace = seat_get_focused_workspace(seat); - if (node == NULL) { seat_send_unfocus(last_focus, seat); sway_input_method_relay_set_focus(&seat->im_relay, NULL); @@ -1157,17 +1155,15 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n return; } + // Find the output's last workspace, which might have to be removed if empty struct sway_output *new_output = new_workspace ? new_workspace->output : NULL; - + struct sway_workspace *last_workspace = + new_output ? output_get_active_workspace(new_output) : NULL; if (last_workspace != new_workspace && new_output) { node_set_dirty(&new_output->node); } - // find new output's old workspace, which might have to be removed if empty - struct sway_workspace *new_output_last_ws = - new_output ? output_get_active_workspace(new_output) : NULL; - // Unfocus the previous focus if (last_focus) { seat_send_unfocus(last_focus, seat); @@ -1211,11 +1207,11 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n } // Move sticky containers to new workspace - if (new_workspace && new_output_last_ws - && new_workspace != new_output_last_ws) { - for (int i = 0; i < new_output_last_ws->floating->length; ++i) { + if (new_workspace && last_workspace + && new_workspace != last_workspace) { + for (int i = 0; i < last_workspace->floating->length; ++i) { struct sway_container *floater = - new_output_last_ws->floating->items[i]; + last_workspace->floating->items[i]; if (container_is_sticky(floater)) { container_detach(floater); workspace_add_floating(new_workspace, floater); @@ -1244,13 +1240,9 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n } } - if (new_output_last_ws) { - workspace_consider_destroy(new_output_last_ws); - } - if (last_workspace && last_workspace != new_output_last_ws) { + if (last_workspace) { workspace_consider_destroy(last_workspace); } - seat->has_focus = true; if (config->smart_gaps && new_workspace) { diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index f19c3f18b..025197852 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -234,26 +234,31 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { if (layout == L_HORIZ || layout == L_TABBED) { if (cursor->cursor->y < thresh_top) { edge = WLR_EDGE_TOP; + if (thresh_top < box.y) thresh_top = box.y; box.height = thresh_top - box.y; } else if (cursor->cursor->y > thresh_bottom) { edge = WLR_EDGE_BOTTOM; + if (thresh_bottom > box.y + box.height) thresh_bottom = box.y + box.height; box.height = box.y + box.height - thresh_bottom; box.y = thresh_bottom; } } else if (layout == L_VERT || layout == L_STACKED) { if (cursor->cursor->x < thresh_left) { edge = WLR_EDGE_LEFT; + if (thresh_left < box.x) thresh_left = box.x; box.width = thresh_left - box.x; } else if (cursor->cursor->x > thresh_right) { edge = WLR_EDGE_RIGHT; + if (thresh_right > box.x + box.width) thresh_right = box.x + box.width; box.width = box.x + box.width - thresh_right; box.x = thresh_right; } } if (edge) { e->target_node = node_get_parent(&con->node); - if (e->target_node == &e->con->node) { - e->target_node = node_get_parent(e->target_node); + if (e->target_node && (e->target_node == &e->con->node || + node_has_ancestor(e->target_node, &e->con->node))) { + e->target_node = node_get_parent(&e->con->node); } e->target_edge = edge; update_indicator(e, &box); diff --git a/sway/server.c b/sway/server.c index 8fe79c06f..ed3468b53 100644 --- a/sway/server.c +++ b/sway/server.c @@ -78,6 +78,7 @@ #define SWAY_LAYER_SHELL_VERSION 5 #define SWAY_FOREIGN_TOPLEVEL_LIST_VERSION 1 #define SWAY_PRESENTATION_VERSION 2 +#define SWAY_XDG_DECORATION_VERSION 2 bool unsupported_gpu_detected = false; @@ -228,7 +229,7 @@ static void handle_renderer_lost(struct wl_listener *listener, void *data) { } static void handle_new_foreign_toplevel_capture_request(struct wl_listener *listener, void *data) { - struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1_request *request = data; + struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1_request_event *request = data; struct sway_view *view = request->toplevel_handle->data; if (view->image_capture_source == NULL) { @@ -396,7 +397,8 @@ bool server_init(struct sway_server *server) { wl_list_init(&server->decorations); server->xdg_decoration_manager = - wlr_xdg_decoration_manager_v1_create(server->wl_display); + wlr_xdg_decoration_manager_v1_create(server->wl_display, + SWAY_XDG_DECORATION_VERSION); if (!server->xdg_decoration_manager) { sway_log(SWAY_ERROR, "Failed to create XDG decoration manager"); return false; @@ -559,7 +561,7 @@ bool server_init(struct sway_server *server) { return false; } server->new_foreign_toplevel_capture_request.notify = handle_new_foreign_toplevel_capture_request; - wl_signal_add(&server->ext_foreign_toplevel_image_capture_source_manager_v1->events.new_request, + wl_signal_add(&server->ext_foreign_toplevel_image_capture_source_manager_v1->events.capture_request, &server->new_foreign_toplevel_capture_request); server->tearing_control_v1 = diff --git a/sway/sway-input.5.scd b/sway/sway-input.5.scd index 18744a22a..389b20570 100644 --- a/sway/sway-input.5.scd +++ b/sway/sway-input.5.scd @@ -154,7 +154,7 @@ The following commands may only be used in the configuration file. *input* drag_lock enabled|disabled|enabled_sticky Enables or disables drag lock for specified input device. The default is - _enabled_sticky_. + _disabled_. *input* dwt enabled|disabled Enables or disables disable-while-typing for the specified input device. diff --git a/sway/sway.5.scd b/sway/sway.5.scd index 952d243d2..c53ca8115 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd @@ -294,6 +294,10 @@ set|plus|minus|toggle A no operation command that can be used to override default behaviour. The optional comment argument is ignored, but logged for debugging purposes. +*opacity* [set|plus|minus] + Adjusts the opacity of the window between 0 (completely transparent) and + 1 (completely opaque). If the operation is omitted, _set_ will be used. + *reload* Reloads the sway config file and applies any changes. The config file is located at path specified by the command line arguments when started, @@ -873,10 +877,6 @@ The default colors are: Any mark that starts with an underscore will not be drawn even if *show_marks* is yes. The default is _yes_. -*opacity* [set|plus|minus] - Adjusts the opacity of the window between 0 (completely transparent) and - 1 (completely opaque). If the operation is omitted, _set_ will be used. - *tiling_drag* enable|disable|toggle Sets whether or not tiling containers can be dragged with the mouse. If _enabled_ (default), the _floating_mod_ can be used to drag tiling, as well diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 23311a456..9d78d7080 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -920,7 +920,7 @@ void workspace_unwrap_children(struct sway_workspace *ws, while (wrap->pending.children->length) { struct sway_container *child = wrap->pending.children->items[0]; container_detach(child); - workspace_add_tiling(ws, child); + workspace_insert_tiling_direct(ws, child, ws->tiling->length); } } diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 68d8dd32d..c3929a35f 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -417,6 +417,28 @@ void ipc_execute_binding(struct swaybar *bar, struct swaybar_binding *bind) { } bool ipc_initialize(struct swaybar *bar) { + if (!bar->id) { + uint32_t len = 0; + char *res = ipc_single_command(bar->ipc_socketfd, + IPC_GET_BAR_CONFIG, "", &len); + json_object *bars = json_tokener_parse(res); + if (!json_object_is_type(bars, json_type_array) + || json_object_array_length(bars) == 0) { + sway_log(SWAY_ERROR, "No bar configuration found, " + "please configure a bar block in your sway config file."); + json_object_put(bars); + free(res); + return false; + } + json_object *first = json_object_array_get_idx(bars, 0); + bar->id = strdup(json_object_get_string(first)); + json_object_put(bars); + free(res); + sway_log(SWAY_INFO, "Using first bar config: %s. " + "Use --bar_id to manually select a different bar configuration.", + bar->id); + } + uint32_t len = strlen(bar->id); char *res = ipc_single_command(bar->ipc_socketfd, IPC_GET_BAR_CONFIG, bar->id, &len); diff --git a/swaybar/main.c b/swaybar/main.c index e1b0cecac..c2020ff09 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -72,12 +72,6 @@ int main(int argc, char **argv) { sway_log_init(SWAY_INFO, NULL); } - if (!swaybar.id) { - sway_log(SWAY_ERROR, "No bar_id passed. " - "Provide --bar_id or let sway start swaybar"); - return 1; - } - if (!socket_path) { socket_path = get_socketpath(); if (!socket_path) { diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c index 12929743b..af9b5cde3 100644 --- a/swaybar/tray/item.c +++ b/swaybar/tray/item.c @@ -66,17 +66,17 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni, } const void *pixels; - size_t npixels; - ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels); + size_t pixel_data_size; // size in bytes, each pixel is 4 bytes + ret = sd_bus_message_read_array(msg, 'y', &pixels, &pixel_data_size); if (ret < 0) { sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); goto error; } - if (height > 0 && width == height) { + if (height > 0 && width == height && (size_t)width * height <= pixel_data_size / 4) { sway_log(SWAY_DEBUG, "%s %s: found icon w:%d h:%d", sni->watcher_id, prop, width, height); struct swaybar_pixmap *pixmap = - malloc(sizeof(struct swaybar_pixmap) + npixels); + malloc(sizeof(struct swaybar_pixmap) + pixel_data_size); pixmap->size = height; // convert from network byte order to host byte order