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 Nick Hu
parent 0fc5d7aed8
commit 03c1442135
No known key found for this signature in database
GPG key ID: 9E35DDA3DF631330
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 (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
@ -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,
uint32_t serial, struct wl_surface *surface) {
#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;
}
#endif
struct swaybar_seat *seat = data;
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.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
@ -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) {
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
@ -327,7 +333,8 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
}
#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
@ -349,7 +356,8 @@ static void wl_pointer_frame(void *data, struct wl_pointer *wl_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

View file

@ -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;
}