diff --git a/.builds/alpine.yml b/.builds/alpine.yml index fa693906d..55057fa15 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 + - https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20 tasks: - wlroots: | cd wlroots diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml index 2c8ffcf45..162977e20 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 + - https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20 tasks: - wlroots: | cd wlroots diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index a3df06e6d..8c457b5a3 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 +- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.20 tasks: - setup: | cd sway diff --git a/README.fr.md b/README.fr.md index a751a52cb..c4ef699a4 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 sur la configuration de sway. +documentation pour la configuration de sway. ## Exécution diff --git a/meson.build b/meson.build index 17d65c334..eb97daf7b 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'sway', 'c', - version: '1.13-dev', + version: '1.12-rc3', 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.21.0', '<0.22.0'] +wlroots_version = ['>=0.20.0', '<0.21.0'] subproject( 'wlroots', default_options: ['examples=false'], required: false, version: wlroots_version, ) -wlroots = dependency('wlroots-0.21', version: wlroots_version, fallback: 'wlroots') +wlroots = dependency('wlroots-0.20', 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 0434d637c..83772f52c 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1133,6 +1133,8 @@ 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); @@ -1155,15 +1157,17 @@ 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); @@ -1207,11 +1211,11 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n } // Move sticky containers to new workspace - if (new_workspace && last_workspace - && new_workspace != last_workspace) { - for (int i = 0; i < last_workspace->floating->length; ++i) { + 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) { struct sway_container *floater = - last_workspace->floating->items[i]; + new_output_last_ws->floating->items[i]; if (container_is_sticky(floater)) { container_detach(floater); workspace_add_floating(new_workspace, floater); @@ -1240,9 +1244,13 @@ static void seat_set_workspace_focus(struct sway_seat *seat, struct sway_node *n } } - if (last_workspace) { + if (new_output_last_ws) { + workspace_consider_destroy(new_output_last_ws); + } + if (last_workspace && last_workspace != new_output_last_ws) { 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 af2ed2056..f19c3f18b 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -27,36 +27,14 @@ struct seatop_move_tiling_event { bool split_target; bool insert_after_target; struct wlr_scene_rect *indicator_rect; - struct wl_listener target_node_destroy; // Clears target_node if destroyed mid-drag }; static void handle_end(struct sway_seat *seat) { struct seatop_move_tiling_event *e = seat->seatop_data; - wl_list_remove(&e->target_node_destroy.link); wlr_scene_node_destroy(&e->indicator_rect->node); e->indicator_rect = NULL; } -// Update target_node and its destruction listener -static void set_target_node(struct seatop_move_tiling_event *e, struct sway_node *node) { - if (e->target_node == node) { - return; - } - wl_list_remove(&e->target_node_destroy.link); - e->target_node = node; - if (node) { - wl_signal_add(&node->events.destroy, &e->target_node_destroy); - } else { - wl_list_init(&e->target_node_destroy.link); - } -} - -static void handle_target_node_destroy(struct wl_listener *listener, void *data) { - struct seatop_move_tiling_event *e = - wl_container_of(listener, e, target_node_destroy); - set_target_node(e, NULL); -} - static void handle_motion_prethreshold(struct sway_seat *seat) { struct seatop_move_tiling_event *e = seat->seatop_data; double cx = seat->cursor->cursor->x; @@ -190,14 +168,14 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { if (!node) { // Eg. hovered over a layer surface such as swaybar - set_target_node(e, NULL); + e->target_node = NULL; e->target_edge = WLR_EDGE_NONE; return; } if (node->type == N_WORKSPACE) { // Empty workspace - set_target_node(e, node); + e->target_node = node; e->target_edge = WLR_EDGE_NONE; struct wlr_box drop_box; @@ -210,7 +188,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { struct sway_container *con = node->sway_container; if (workspace_num_tiling_views(e->con->pending.workspace) == 1 && con->pending.workspace == e->con->pending.workspace) { - set_target_node(e, NULL); + e->target_node = NULL; e->target_edge = WLR_EDGE_NONE; return; } @@ -230,9 +208,9 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { // Don't allow dropping over the source container's titlebar // to give users a chance to cancel a drag operation. if (con == e->con) { - set_target_node(e, NULL); + e->target_node = NULL; } else { - set_target_node(e, node); + e->target_node = node; e->split_target = true; } e->target_edge = WLR_EDGE_NONE; @@ -256,31 +234,26 @@ 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) { - set_target_node(e, node_get_parent(&con->node)); - if (e->target_node && (e->target_node == &e->con->node || - node_has_ancestor(e->target_node, &e->con->node))) { - set_target_node(e, node_get_parent(&e->con->node)); + e->target_node = node_get_parent(&con->node); + if (e->target_node == &e->con->node) { + e->target_node = node_get_parent(e->target_node); } e->target_edge = edge; update_indicator(e, &box); @@ -293,7 +266,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { con = node->sway_container; if (!con->view || !con->view->surface || node == &e->con->node || node_has_ancestor(node, &e->con->node)) { - set_target_node(e, NULL); + e->target_node = NULL; e->target_edge = WLR_EDGE_NONE; return; } @@ -324,7 +297,7 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { e->target_edge = WLR_EDGE_NONE; } - set_target_node(e, node); + e->target_node = node; resize_box(&drop_box, e->target_edge, thickness); update_indicator(e, &drop_box); } @@ -449,7 +422,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, static void handle_unref(struct sway_seat *seat, struct sway_container *con) { struct seatop_move_tiling_event *e = seat->seatop_data; if (e->target_node == &con->node) { // Drop target - set_target_node(e, NULL); + e->target_node = NULL; } if (e->con == con) { // The container being moved seatop_begin_default(seat); @@ -490,8 +463,6 @@ void seatop_begin_move_tiling_threshold(struct sway_seat *seat, e->con = con; e->ref_lx = seat->cursor->cursor->x; e->ref_ly = seat->cursor->cursor->y; - wl_list_init(&e->target_node_destroy.link); - e->target_node_destroy.notify = handle_target_node_destroy; seat->seatop_impl = &seatop_impl; seat->seatop_data = e; diff --git a/sway/input/text_input.c b/sway/input/text_input.c index c2c4a5125..e496bff1b 100644 --- a/sway/input/text_input.c +++ b/sway/input/text_input.c @@ -666,8 +666,8 @@ void sway_input_method_relay_set_focus(struct sway_input_method_relay *relay, } else if (text_input->input->focused_surface) { assert(text_input->pending_focused_surface == NULL); if (surface != text_input->input->focused_surface) { - wlr_text_input_v3_send_leave(text_input->input); relay_disable_text_input(relay, text_input); + wlr_text_input_v3_send_leave(text_input->input); } else { sway_log(SWAY_DEBUG, "IM relay set_focus already focused"); continue; diff --git a/sway/server.c b/sway/server.c index ed3468b53..8fe79c06f 100644 --- a/sway/server.c +++ b/sway/server.c @@ -78,7 +78,6 @@ #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; @@ -229,7 +228,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_event *request = data; + struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1_request *request = data; struct sway_view *view = request->toplevel_handle->data; if (view->image_capture_source == NULL) { @@ -397,8 +396,7 @@ 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, - SWAY_XDG_DECORATION_VERSION); + wlr_xdg_decoration_manager_v1_create(server->wl_display); if (!server->xdg_decoration_manager) { sway_log(SWAY_ERROR, "Failed to create XDG decoration manager"); return false; @@ -561,7 +559,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.capture_request, + wl_signal_add(&server->ext_foreign_toplevel_image_capture_source_manager_v1->events.new_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 389b20570..18744a22a 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 - _disabled_. + _enabled_sticky_. *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 c53ca8115..952d243d2 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd @@ -294,10 +294,6 @@ 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, @@ -877,6 +873,10 @@ 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 9d78d7080..23311a456 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_insert_tiling_direct(ws, child, ws->tiling->length); + workspace_add_tiling(ws, child); } } diff --git a/swaybar/ipc.c b/swaybar/ipc.c index c3929a35f..68d8dd32d 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -417,28 +417,6 @@ 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 c2020ff09..e1b0cecac 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -72,6 +72,12 @@ 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 af9b5cde3..12929743b 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 pixel_data_size; // size in bytes, each pixel is 4 bytes - ret = sd_bus_message_read_array(msg, 'y', &pixels, &pixel_data_size); + size_t npixels; + ret = sd_bus_message_read_array(msg, 'y', &pixels, &npixels); if (ret < 0) { sway_log(SWAY_ERROR, "%s %s: %s", sni->watcher_id, prop, strerror(-ret)); goto error; } - if (height > 0 && width == height && (size_t)width * height <= pixel_data_size / 4) { + if (height > 0 && width == height) { 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) + pixel_data_size); + malloc(sizeof(struct swaybar_pixmap) + npixels); pixmap->size = height; // convert from network byte order to host byte order