sway: tray icon menus broke with 1.9, attached latest fix

This commit is contained in:
Tim Biermann 2024-03-02 13:47:29 +01:00
parent fdf411e00d
commit 9b1426271c
Signed by: tb
GPG Key ID: 42F8B4E30B673606
3 changed files with 121 additions and 197 deletions

View File

@ -1,6 +1,6 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF3/qRl8C0qHZaN2AucueLs4DX1shxgbIYiJP0mKyB6VJRmWvu374YSyuwyzYadPkJ9ibmMVxIrC7EQVgaCHO7RQk=
SHA256 (Pkgfile) = d0aa55dd347380b7c591e1c10be585a235d9f1df2aad09a845b0039496858cce
RWSagIOpLGJF3+NkrNms7PuODBAq09crM5SL12Q8AwljdJmBtmJUtSyspK68KthVhR3Nob3ca/lbLTmE0lQ7LlsMc+byJ/onCAk=
SHA256 (Pkgfile) = da6ba78f3a95c480914b2179941b2619c8b54ee793ff275f1a9fcc0b41c1553b
SHA256 (.footprint) = 76cf242dac27363a8a964536eda5e54f00953e79380ee493090ca249bd688920
SHA256 (sway-1.9.tar.gz) = b6e4e8d74af744278201792bcc4447470fcb91e15bbda475c647d475bf8e7b0b
SHA256 (6249.patch) = 80aa3e8f44f91591e88059172518198ab2ae59c694f8f6762dcd6512bb7657dd
SHA256 (6249.patch) = 3686e3c3784a2119f00d237df8a4380a8c8fc28ae2999daac1c855a1e2a9a3d4

View File

@ -1,7 +1,8 @@
diff -Naur sway-1.9-rc1.orig/include/swaybar/bar.h sway-1.9-rc1/include/swaybar/bar.h
--- sway-1.9-rc1.orig/include/swaybar/bar.h 2024-01-28 19:08:45.574503847 +0100
+++ sway-1.9-rc1/include/swaybar/bar.h 2024-01-28 19:09:13.007620155 +0100
@@ -33,6 +33,7 @@
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h
index 197d2190..d0b3dc81 100644
--- a/include/swaybar/bar.h
+++ b/include/swaybar/bar.h
@@ -33,6 +33,7 @@ struct swaybar {
struct zxdg_output_manager_v1 *xdg_output_manager;
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
struct wl_shm *shm;
@ -9,131 +10,10 @@ diff -Naur sway-1.9-rc1.orig/include/swaybar/bar.h sway-1.9-rc1/include/swaybar/
struct swaybar_config *config;
struct status_line *status;
diff -Naur sway-1.9-rc1.orig/include/swaybar/bar.h.orig sway-1.9-rc1/include/swaybar/bar.h.orig
--- sway-1.9-rc1.orig/include/swaybar/bar.h.orig 1970-01-01 01:00:00.000000000 +0100
+++ sway-1.9-rc1/include/swaybar/bar.h.orig 2024-01-26 15:26:37.000000000 +0100
@@ -0,0 +1,118 @@
+#ifndef _SWAYBAR_BAR_H
+#define _SWAYBAR_BAR_H
+#include <wayland-client.h>
+#include "config.h"
+#include "input.h"
+#include "pool-buffer.h"
+#include "cursor-shape-v1-client-protocol.h"
+#include "wlr-layer-shell-unstable-v1-client-protocol.h"
+#include "xdg-output-unstable-v1-client-protocol.h"
+
+struct swaybar_config;
+struct swaybar_output;
+#if HAVE_TRAY
+struct swaybar_tray;
+#endif
+struct swaybar_workspace;
+struct loop;
+
+struct swaybar {
+ char *id;
+ char *mode;
+ bool mode_pango_markup;
+
+ // only relevant when bar is in "hide" mode
+ bool visible_by_modifier;
+ bool visible_by_urgency;
+ bool visible_by_mode;
+ bool visible;
+
+ struct wl_display *display;
+ struct wl_compositor *compositor;
+ struct zwlr_layer_shell_v1 *layer_shell;
+ struct zxdg_output_manager_v1 *xdg_output_manager;
+ struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
+ struct wl_shm *shm;
+
+ struct swaybar_config *config;
+ struct status_line *status;
+
+ struct loop *eventloop;
+
+ int ipc_event_socketfd;
+ int ipc_socketfd;
+
+ struct wl_list outputs; // swaybar_output::link
+ struct wl_list unused_outputs; // swaybar_output::link
+ struct wl_list seats; // swaybar_seat::link
+
+#if HAVE_TRAY
+ struct swaybar_tray *tray;
+#endif
+
+ bool running;
+};
+
+struct swaybar_output {
+ struct wl_list link; // swaybar::outputs
+ struct swaybar *bar;
+ struct wl_output *output;
+ struct zxdg_output_v1 *xdg_output;
+ struct wl_surface *surface;
+ struct zwlr_layer_surface_v1 *layer_surface;
+ uint32_t wl_name;
+
+ struct wl_list workspaces; // swaybar_workspace::link
+ struct wl_list hotspots; // swaybar_hotspot::link
+
+ char *name;
+ char *identifier;
+ bool focused;
+
+ uint32_t width, height;
+ int32_t scale;
+ enum wl_output_subpixel subpixel;
+ struct pool_buffer buffers[2];
+ struct pool_buffer *current_buffer;
+ bool dirty;
+ bool frame_scheduled;
+
+ uint32_t output_height, output_width, output_x, output_y;
+};
+
+struct swaybar_workspace {
+ struct wl_list link; // swaybar_output::workspaces
+ int num;
+ char *name;
+ char *label;
+ bool focused;
+ bool visible;
+ bool urgent;
+};
+
+bool bar_setup(struct swaybar *bar, const char *socket_path);
+void bar_run(struct swaybar *bar);
+void bar_teardown(struct swaybar *bar);
+
+void set_bar_dirty(struct swaybar *bar);
+
+/*
+ * Determines whether the bar should be visible and changes it to be so.
+ * If the current visibility of the bar is the different to what it should be,
+ * then it adds or destroys the layer surface as required,
+ * as well as sending the cont or stop signal to the status command.
+ * If the current visibility of the bar is already what it should be,
+ * then this function is a no-op, unless moving_layer is true, which occurs
+ * when the bar changes from "hide" to "dock" mode or vice versa, and the bar
+ * needs to be destroyed and re-added in order to change its layer.
+ *
+ * Returns true if the bar is now visible, otherwise false.
+ */
+bool determine_bar_visibility(struct swaybar *bar, bool moving_layer);
+void free_workspaces(struct wl_list *list);
+
+void status_in(int fd, short mask, void *data);
+
+void destroy_layer_surface(struct swaybar_output *output);
+
+#endif
diff -Naur sway-1.9-rc1.orig/include/swaybar/input.h sway-1.9-rc1/include/swaybar/input.h
--- sway-1.9-rc1.orig/include/swaybar/input.h 2024-01-28 19:08:45.574503847 +0100
+++ sway-1.9-rc1/include/swaybar/input.h 2024-01-28 19:09:13.007620155 +0100
diff --git a/include/swaybar/input.h b/include/swaybar/input.h
index 8ea88a69..81ccaa98 100644
--- a/include/swaybar/input.h
+++ b/include/swaybar/input.h
@@ -15,6 +15,7 @@
struct swaybar;
@ -142,7 +22,7 @@ diff -Naur sway-1.9-rc1.orig/include/swaybar/input.h sway-1.9-rc1/include/swayba
struct swaybar_pointer {
struct wl_pointer *pointer;
@@ -48,8 +49,8 @@
@@ -48,8 +49,8 @@ struct swaybar_hotspot {
struct wl_list link; // swaybar_output::hotspots
int x, y, width, height;
enum hotspot_event_handling (*callback)(struct swaybar_output *output,
@ -153,9 +33,11 @@ diff -Naur sway-1.9-rc1.orig/include/swaybar/input.h sway-1.9-rc1/include/swayba
void (*destroy)(void *data);
void *data;
};
diff -Naur sway-1.9-rc1.orig/include/swaybar/tray/dbusmenu.h sway-1.9-rc1/include/swaybar/tray/dbusmenu.h
--- sway-1.9-rc1.orig/include/swaybar/tray/dbusmenu.h 1970-01-01 01:00:00.000000000 +0100
+++ sway-1.9-rc1/include/swaybar/tray/dbusmenu.h 2024-01-28 19:09:13.007620155 +0100
diff --git a/include/swaybar/tray/dbusmenu.h b/include/swaybar/tray/dbusmenu.h
new file mode 100644
index 00000000..dc90f6e5
--- /dev/null
+++ b/include/swaybar/tray/dbusmenu.h
@@ -0,0 +1,27 @@
+#ifndef _SWAYBAR_TRAY_DBUSMENU_H
+#define _SWAYBAR_TRAY_DBUSMENU_H
@ -184,10 +66,11 @@ diff -Naur sway-1.9-rc1.orig/include/swaybar/tray/dbusmenu.h sway-1.9-rc1/includ
+bool dbusmenu_pointer_axis(struct swaybar_seat *data, struct wl_pointer *wl_pointer);
+
+#endif
diff -Naur sway-1.9-rc1.orig/include/swaybar/tray/item.h sway-1.9-rc1/include/swaybar/tray/item.h
--- sway-1.9-rc1.orig/include/swaybar/tray/item.h 2024-01-28 19:08:45.574503847 +0100
+++ sway-1.9-rc1/include/swaybar/tray/item.h 2024-01-28 19:09:13.007620155 +0100
@@ -18,6 +18,7 @@
diff --git a/include/swaybar/tray/item.h b/include/swaybar/tray/item.h
index 73937a0c..9a4a00ff 100644
--- a/include/swaybar/tray/item.h
+++ b/include/swaybar/tray/item.h
@@ -18,6 +18,7 @@ struct swaybar_pixmap {
struct swaybar_sni_slot {
struct wl_list link; // swaybar_sni::slots
struct swaybar_sni *sni;
@ -195,7 +78,7 @@ diff -Naur sway-1.9-rc1.orig/include/swaybar/tray/item.h sway-1.9-rc1/include/sw
const char *prop;
const char *type;
void *dest;
@@ -48,6 +49,7 @@
@@ -48,6 +49,7 @@ struct swaybar_sni {
char *icon_theme_path; // non-standard KDE property
struct wl_list slots; // swaybar_sni_slot::link
@ -203,10 +86,11 @@ diff -Naur sway-1.9-rc1.orig/include/swaybar/tray/item.h sway-1.9-rc1/include/sw
};
struct swaybar_sni *create_sni(char *id, struct swaybar_tray *tray);
diff -Naur sway-1.9-rc1.orig/include/swaybar/tray/tray.h sway-1.9-rc1/include/swaybar/tray/tray.h
--- sway-1.9-rc1.orig/include/swaybar/tray/tray.h 2024-01-28 19:08:45.574503847 +0100
+++ sway-1.9-rc1/include/swaybar/tray/tray.h 2024-01-28 19:09:13.007620155 +0100
@@ -32,6 +32,9 @@
diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h
index d2e80a6d..853f17cd 100644
--- a/include/swaybar/tray/tray.h
+++ b/include/swaybar/tray/tray.h
@@ -32,6 +32,9 @@ struct swaybar_tray {
list_t *basedirs; // char *
list_t *themes; // struct swaybar_theme *
@ -216,9 +100,10 @@ diff -Naur sway-1.9-rc1.orig/include/swaybar/tray/tray.h sway-1.9-rc1/include/sw
};
struct swaybar_tray *create_tray(struct swaybar *bar);
diff -Naur sway-1.9-rc1.orig/swaybar/bar.c sway-1.9-rc1/swaybar/bar.c
--- sway-1.9-rc1.orig/swaybar/bar.c 2024-01-28 19:08:45.578503864 +0100
+++ sway-1.9-rc1/swaybar/bar.c 2024-01-28 19:13:44.806046172 +0100
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 021fc3bd..9c83db3e 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -29,6 +29,7 @@
#include "pool-buffer.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
@ -227,16 +112,16 @@ diff -Naur sway-1.9-rc1.orig/swaybar/bar.c sway-1.9-rc1/swaybar/bar.c
void free_workspaces(struct wl_list *list) {
struct swaybar_workspace *ws, *tmp;
@@ -362,6 +363,8 @@
} else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) {
bar->xdg_output_manager = wl_registry_bind(registry, name,
&zxdg_output_manager_v1_interface, 2);
+ } else if (strcmp(interface, xdg_wm_base_interface.name) == 0) {
+ bar->wm_base = wl_registry_bind(registry, name, &xdg_wm_base_interface, 1);
@@ -365,6 +366,8 @@ static void handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, wp_cursor_shape_manager_v1_interface.name) == 0) {
bar->cursor_shape_manager = wl_registry_bind(registry, name,
&wp_cursor_shape_manager_v1_interface, 1);
@@ -539,6 +542,7 @@
+ } else if (strcmp(interface, xdg_wm_base_interface.name) == 0) {
+ bar->wm_base = wl_registry_bind(registry, name, &xdg_wm_base_interface, 1);
}
}
@@ -539,6 +542,7 @@ void bar_teardown(struct swaybar *bar) {
#if HAVE_TRAY
destroy_tray(bar->tray);
#endif
@ -244,9 +129,10 @@ diff -Naur sway-1.9-rc1.orig/swaybar/bar.c sway-1.9-rc1/swaybar/bar.c
free_outputs(&bar->outputs);
free_outputs(&bar->unused_outputs);
free_seats(&bar->seats);
diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
--- sway-1.9-rc1.orig/swaybar/input.c 2024-01-28 19:08:45.578503864 +0100
+++ sway-1.9-rc1/swaybar/input.c 2024-01-28 19:12:59.419072660 +0100
diff --git a/swaybar/input.c b/swaybar/input.c
index ada4bc86..54e1d5cd 100644
--- a/swaybar/input.c
+++ b/swaybar/input.c
@@ -10,6 +10,10 @@
#include "swaybar/input.h"
#include "swaybar/ipc.h"
@ -258,32 +144,49 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
void free_hotspots(struct wl_list *list) {
struct swaybar_hotspot *hotspot, *tmp;
wl_list_for_each_safe(hotspot, tmp, list, link) {
@@ -130,6 +134,12 @@
} else {
@@ -131,11 +135,27 @@ static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
pointer->serial = serial;
update_cursor(seat);
}
+
+#if HAVE_TRAY
+ if (dbusmenu_pointer_enter(data, wl_pointer, serial, surface, surface_x,
+ surface_y)) {
+ struct swaybar_config *config = seat->bar->config;
+ if (!config->tray_hidden && dbusmenu_pointer_enter(data, wl_pointer, serial,
+ surface, surface_x, surface_y)) {
+ return;
+ }
+#endif
}
}
@@ -144,6 +154,11 @@
static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
uint32_t serial, struct wl_surface *surface) {
+#if HAVE_TRAY
struct swaybar_seat *seat = data;
+ struct swaybar_config *config = seat->bar->config;
+ if (!config->tray_hidden && dbusmenu_pointer_leave(data, wl_pointer, serial,
+ surface)) {
+ return;
+ }
+#endif
+
seat->pointer.current = NULL;
}
@@ -144,6 +164,13 @@ static void wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
struct swaybar_seat *seat = data;
seat->pointer.x = wl_fixed_to_double(surface_x);
seat->pointer.y = wl_fixed_to_double(surface_y);
+#if HAVE_TRAY
+ if (dbusmenu_pointer_motion(data, wl_pointer, time, surface_x, surface_y)) {
+ struct swaybar_config *config = seat->bar->config;
+ if (!config->tray_hidden && dbusmenu_pointer_motion(data, wl_pointer, time,
+ surface_x, surface_y)) {
+ return;
+ }
+#endif
}
static bool check_bindings(struct swaybar *bar, uint32_t button,
@@ -160,6 +175,7 @@
@@ -160,6 +187,7 @@ static bool check_bindings(struct swaybar *bar, uint32_t button,
}
static bool process_hotspots(struct swaybar_output *output,
@ -291,7 +194,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
double x, double y, uint32_t button, uint32_t state) {
bool released = state == WL_POINTER_BUTTON_STATE_RELEASED;
struct swaybar_hotspot *hotspot;
@@ -167,7 +183,7 @@
@@ -167,7 +195,7 @@ static bool process_hotspots(struct swaybar_output *output,
if (x >= hotspot->x && y >= hotspot->y
&& x < hotspot->x + hotspot->width
&& y < hotspot->y + hotspot->height) {
@ -300,13 +203,14 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
button, released, hotspot->data)) {
return true;
}
@@ -180,13 +196,19 @@
@@ -180,13 +208,20 @@ static bool process_hotspots(struct swaybar_output *output,
static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
uint32_t serial, uint32_t time, uint32_t button, uint32_t state) {
struct swaybar_seat *seat = data;
+#if HAVE_TRAY
+ if (dbusmenu_pointer_button(seat, wl_pointer, serial, time, button,
+ state)) {
+ struct swaybar_config *config = seat->bar->config;
+ if (!config->tray_hidden && dbusmenu_pointer_button(seat, wl_pointer, serial,
+ time, button, state)) {
+ return;
+ }
+#endif
@ -321,7 +225,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
return;
}
@@ -240,7 +262,7 @@
@@ -240,7 +275,7 @@ static void process_discrete_scroll(struct swaybar_seat *seat,
struct swaybar_output *output, struct swaybar_pointer *pointer,
uint32_t axis, wl_fixed_t value) {
uint32_t button = wl_axis_to_button(axis, value);
@ -330,12 +234,13 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
// (Currently hotspots don't do anything on release events, so no need to emit one)
return;
}
@@ -297,6 +319,12 @@
@@ -297,6 +332,13 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
return;
}
+#if HAVE_TRAY
+ if (dbusmenu_pointer_axis(data, wl_pointer)) {
+ struct swaybar_config *config = seat->bar->config;
+ if (!config->tray_hidden && dbusmenu_pointer_axis(data, wl_pointer)) {
+ return;
+ }
+#endif
@ -343,12 +248,13 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
// If there's a while since the last scroll event,
// set 'value' to zero as if to reset the "virtual scroll wheel"
if (seat->axis[axis].discrete_steps == 0 &&
@@ -313,6 +341,12 @@
@@ -313,6 +355,13 @@ static void wl_pointer_frame(void *data, struct wl_pointer *wl_pointer) {
struct swaybar_pointer *pointer = &seat->pointer;
struct swaybar_output *output = pointer->current;
+#if HAVE_TRAY
+ if (dbusmenu_pointer_frame(data, wl_pointer)) {
+ struct swaybar_config *config = seat->bar->config;
+ if (!config->tray_hidden && dbusmenu_pointer_frame(data, wl_pointer)) {
+ return;
+ }
+#endif
@ -356,7 +262,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
if (output == NULL) {
return;
}
@@ -420,7 +454,7 @@
@@ -420,7 +469,7 @@ static void wl_touch_up(void *data, struct wl_touch *wl_touch,
}
if (time - slot->time < 500) {
// Tap, treat it like a pointer click
@ -365,10 +271,11 @@ diff -Naur sway-1.9-rc1.orig/swaybar/input.c sway-1.9-rc1/swaybar/input.c
// (Currently hotspots don't do anything on release events, so no need to emit one)
}
slot->output = NULL;
diff -Naur sway-1.9-rc1.orig/swaybar/meson.build sway-1.9-rc1/swaybar/meson.build
--- sway-1.9-rc1.orig/swaybar/meson.build 2024-01-28 19:08:45.578503864 +0100
+++ sway-1.9-rc1/swaybar/meson.build 2024-01-28 19:09:13.007620155 +0100
@@ -3,7 +3,8 @@
diff --git a/swaybar/meson.build b/swaybar/meson.build
index e5f1811e..fef1ee77 100644
--- a/swaybar/meson.build
+++ b/swaybar/meson.build
@@ -3,7 +3,8 @@ tray_files = have_tray ? [
'tray/icon.c',
'tray/item.c',
'tray/tray.c',
@ -378,10 +285,11 @@ diff -Naur sway-1.9-rc1.orig/swaybar/meson.build sway-1.9-rc1/swaybar/meson.buil
] : []
swaybar_deps = [
diff -Naur sway-1.9-rc1.orig/swaybar/render.c sway-1.9-rc1/swaybar/render.c
--- sway-1.9-rc1.orig/swaybar/render.c 2024-01-28 19:08:45.578503864 +0100
+++ sway-1.9-rc1/swaybar/render.c 2024-01-28 19:09:13.007620155 +0100
@@ -160,6 +160,7 @@
diff --git a/swaybar/render.c b/swaybar/render.c
index 1113ca44..7769063d 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -160,6 +160,7 @@ static void render_sharp_line(cairo_t *cairo, uint32_t color,
static enum hotspot_event_handling block_hotspot_callback(
struct swaybar_output *output, struct swaybar_hotspot *hotspot,
@ -389,7 +297,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/render.c sway-1.9-rc1/swaybar/render.c
double x, double y, uint32_t button, bool released, void *data) {
struct i3bar_block *block = data;
struct status_line *status = output->bar->status;
@@ -599,6 +600,7 @@
@@ -599,6 +600,7 @@ static uint32_t render_binding_mode_indicator(struct render_context *ctx,
static enum hotspot_event_handling workspace_hotspot_callback(
struct swaybar_output *output, struct swaybar_hotspot *hotspot,
@ -397,9 +305,11 @@ diff -Naur sway-1.9-rc1.orig/swaybar/render.c sway-1.9-rc1/swaybar/render.c
double x, double y, uint32_t button, bool released, void *data) {
if (button != BTN_LEFT) {
return HOTSPOT_PROCESS;
diff -Naur sway-1.9-rc1.orig/swaybar/tray/dbusmenu.c sway-1.9-rc1/swaybar/tray/dbusmenu.c
--- sway-1.9-rc1.orig/swaybar/tray/dbusmenu.c 1970-01-01 01:00:00.000000000 +0100
+++ sway-1.9-rc1/swaybar/tray/dbusmenu.c 2024-01-28 19:09:13.008620160 +0100
diff --git a/swaybar/tray/dbusmenu.c b/swaybar/tray/dbusmenu.c
new file mode 100644
index 00000000..423abc42
--- /dev/null
+++ b/swaybar/tray/dbusmenu.c
@@ -0,0 +1,1367 @@
+#define _POSIX_C_SOURCE 200809L
+#include <linux/input-event-codes.h>
@ -995,7 +905,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/tray/dbusmenu.c sway-1.9-rc1/swaybar/tray/d
+ cairo_surface_destroy(recorder);
+ return;
+ }
+ int surface_x, surface_y, surface_width, surface_height;
+ int surface_x, surface_y, surface_width, surface_height = 0;
+ draw_menu_items(cairo, menu, &surface_x, &surface_y, &surface_width,
+ &surface_height, open);
+
@ -1768,9 +1678,10 @@ diff -Naur sway-1.9-rc1.orig/swaybar/tray/dbusmenu.c sway-1.9-rc1/swaybar/tray/d
+
+ return false;
+}
diff -Naur sway-1.9-rc1.orig/swaybar/tray/item.c sway-1.9-rc1/swaybar/tray/item.c
--- sway-1.9-rc1.orig/swaybar/tray/item.c 2024-01-28 19:08:45.578503864 +0100
+++ sway-1.9-rc1/swaybar/tray/item.c 2024-01-28 19:09:13.008620160 +0100
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c
index 1f18b8bb..d159640f 100644
--- a/swaybar/tray/item.c
+++ b/swaybar/tray/item.c
@@ -8,6 +8,7 @@
#include "swaybar/bar.h"
#include "swaybar/config.h"
@ -1779,7 +1690,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/tray/item.c sway-1.9-rc1/swaybar/tray/item.
#include "swaybar/tray/host.h"
#include "swaybar/tray/icon.h"
#include "swaybar/tray/item.h"
@@ -333,8 +334,9 @@
@@ -333,8 +334,9 @@ void destroy_sni(struct swaybar_sni *sni) {
free(sni);
}
@ -1791,7 +1702,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/tray/item.c sway-1.9-rc1/swaybar/tray/item.
const char *method = NULL;
struct tray_binding *binding = NULL;
wl_list_for_each(binding, &sni->tray->bar->config->tray_bindings, link) {
@@ -365,7 +367,11 @@
@@ -365,7 +367,11 @@ static void handle_click(struct swaybar_sni *sni, int x, int y,
method = "ContextMenu";
}
@ -1804,7 +1715,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/tray/item.c sway-1.9-rc1/swaybar/tray/item.
char dir = method[strlen("Scroll")];
char *orientation = (dir == 'U' || dir == 'D') ? "vertical" : "horizontal";
int sign = (dir == 'U' || dir == 'L') ? -1 : 1;
@@ -385,6 +391,7 @@
@@ -385,6 +391,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) {
static enum hotspot_event_handling icon_hotspot_callback(
struct swaybar_output *output, struct swaybar_hotspot *hotspot,
@ -1812,7 +1723,7 @@ diff -Naur sway-1.9-rc1.orig/swaybar/tray/item.c sway-1.9-rc1/swaybar/tray/item.
double x, double y, uint32_t button, bool released, void *data) {
sway_log(SWAY_DEBUG, "Clicked on %s", (char *)data);
@@ -406,7 +413,8 @@
@@ -406,7 +413,8 @@ static enum hotspot_event_handling icon_hotspot_callback(
(int) output->output_height - config->gaps.bottom - y);
sway_log(SWAY_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y);
@ -1822,3 +1733,16 @@ diff -Naur sway-1.9-rc1.orig/swaybar/tray/item.c sway-1.9-rc1/swaybar/tray/item.
return HOTSPOT_IGNORE;
} else {
sway_log(SWAY_DEBUG, "but it doesn't exist");
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index b0545f4a..e4a68034 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -110,7 +110,7 @@ static int cmp_output(const void *item, const void *cmp_to) {
uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x) {
struct swaybar_config *config = output->bar->config;
- if (config->tray_outputs) {
+ if (config->tray_outputs && !config->tray_hidden) {
if (list_seq_find(config->tray_outputs, cmp_output, output) == -1) {
return 0;
}

View File

@ -6,7 +6,7 @@
name=sway
version=1.9
release=1
release=2
source=(https://github.com/swaywm/sway/archive/$version/$name-$version.tar.gz
6249.patch)