From 86c68d427ff54650d007936a9a6ee9fa73cd9acf Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Mon, 17 Jul 2023 20:44:25 -0400 Subject: Timer-catch the left click when under wayland --- timerapplet/src/timerapplet.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'timerapplet/src/timerapplet.c') 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 #include #include +#include #include #include @@ -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"); -- cgit v1.2.1