Tray: don't invoke dbus menu when tray is disabled

This commit is contained in:
Florian Franzen 2024-03-02 11:19:37 +00:00 committed by Giancarlo Razzolini
parent fffe886a14
commit 56ade4f049
No known key found for this signature in database
GPG key ID: 354AAB6377B981BC
2 changed files with 18 additions and 10 deletions

View file

@ -137,8 +137,9 @@ static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
} }
#if HAVE_TRAY #if HAVE_TRAY
if (dbusmenu_pointer_enter(data, wl_pointer, serial, surface, surface_x, struct swaybar_config *config = seat->bar->config;
surface_y)) { if (!config->tray_hidden && dbusmenu_pointer_enter(data, wl_pointer, serial,
surface, surface_x, surface_y)) {
return; return;
} }
#endif #endif
@ -147,12 +148,14 @@ static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer, static void wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
uint32_t serial, struct wl_surface *surface) { uint32_t serial, struct wl_surface *surface) {
#if HAVE_TRAY #if HAVE_TRAY
if (dbusmenu_pointer_leave(data, wl_pointer, serial, surface)) { 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; return;
} }
#endif #endif
struct swaybar_seat *seat = data;
seat->pointer.current = NULL; seat->pointer.current = NULL;
} }
@ -162,7 +165,9 @@ static void wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
seat->pointer.x = wl_fixed_to_double(surface_x); seat->pointer.x = wl_fixed_to_double(surface_x);
seat->pointer.y = wl_fixed_to_double(surface_y); seat->pointer.y = wl_fixed_to_double(surface_y);
#if HAVE_TRAY #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; return;
} }
#endif #endif
@ -204,8 +209,9 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { uint32_t serial, uint32_t time, uint32_t button, uint32_t state) {
struct swaybar_seat *seat = data; struct swaybar_seat *seat = data;
#if HAVE_TRAY #if HAVE_TRAY
if (dbusmenu_pointer_button(seat, wl_pointer, serial, time, button, struct swaybar_config *config = seat->bar->config;
state)) { if (!config->tray_hidden && dbusmenu_pointer_button(seat, wl_pointer, serial,
time, button, state)) {
return; return;
} }
#endif #endif
@ -327,7 +333,8 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
} }
#if HAVE_TRAY #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; return;
} }
#endif #endif
@ -349,7 +356,8 @@ static void wl_pointer_frame(void *data, struct wl_pointer *wl_pointer) {
struct swaybar_output *output = pointer->current; struct swaybar_output *output = pointer->current;
#if HAVE_TRAY #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; return;
} }
#endif #endif

View file

@ -118,7 +118,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) { uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x) {
struct swaybar_config *config = output->bar->config; 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) { if (list_seq_find(config->tray_outputs, cmp_output, output) == -1) {
return 0; return 0;
} }