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/meson.build b/meson.build index ad26a5a5d..17d65c334 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'sway', 'c', - version: '1.12', + 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/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.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/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