summaryrefslogtreecommitdiff
path: root/timerapplet
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2023-07-17 20:44:25 -0400
committerlukefromdc <[email protected]>2023-07-18 11:14:02 -0400
commit86c68d427ff54650d007936a9a6ee9fa73cd9acf (patch)
treeff2bacc38d00a60672f6a14ed519e1fba1a90431 /timerapplet
parent08bb8398e0d218daaefdfe95c44940e370802508 (diff)
downloadmate-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.c29
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");