diff options
author | lukefromdc <[email protected]> | 2023-07-17 20:44:25 -0400 |
---|---|---|
committer | lukefromdc <[email protected]> | 2023-07-18 11:14:02 -0400 |
commit | 86c68d427ff54650d007936a9a6ee9fa73cd9acf (patch) | |
tree | ff2bacc38d00a60672f6a14ed519e1fba1a90431 /timerapplet | |
parent | 08bb8398e0d218daaefdfe95c44940e370802508 (diff) | |
download | mate-applets-86c68d427ff54650d007936a9a6ee9fa73cd9acf.tar.bz2 mate-applets-86c68d427ff54650d007936a9a6ee9fa73cd9acf.tar.xz |
Timer-catch the left click when under wayland
Diffstat (limited to 'timerapplet')
-rw-r--r-- | timerapplet/src/timerapplet.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/timerapplet/src/timerapplet.c b/timerapplet/src/timerapplet.c index 2c397b16..3513c932 100644 --- a/timerapplet/src/timerapplet.c +++ b/timerapplet/src/timerapplet.c @@ -27,6 +27,7 @@ #include <glib.h> #include <glib/gi18n.h> #include <gio/gio.h> +#include <gdk/gdkx.h> #include <gtk/gtk.h> #include <libnotify/notify.h> @@ -353,15 +354,20 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet) } static gboolean -timer_applet_click (TimerApplet *applet) +timer_applet_click (TimerApplet *applet, GdkEventButton *event) { - if (!applet->active && !applet->pause && applet->elapsed) - timer_reset_callback (NULL, applet); - else if (applet->active && !applet->pause) - timer_pause_callback (NULL, applet); - else if (!applet->active || applet->pause) - timer_start_callback (NULL, applet); - return FALSE; + if ( event->button == 1) + { + if (!applet->active && !applet->pause && applet->elapsed) + timer_reset_callback (NULL, applet); + else if (applet->active && !applet->pause) + timer_pause_callback (NULL, applet); + else if (!applet->active || applet->pause) + timer_start_callback (NULL, applet); + return TRUE; + } + else + return FALSE; } static void @@ -424,9 +430,16 @@ timer_applet_fill (MatePanelApplet* applet_widget) G_CALLBACK (timer_applet_destroy), applet); +#ifdef GDK_WINDOWING_X11 + if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) g_signal_connect_swapped (applet->applet, "button-release-event", G_CALLBACK (timer_applet_click), applet); + else +#endif + g_signal_connect_swapped (applet->applet, "button_press_event", + G_CALLBACK (timer_applet_click), + applet); /* set up context menu */ applet->action_group = gtk_action_group_new ("Timer Applet Actions"); |