summaryrefslogtreecommitdiff
path: root/applets/wncklet/wayland-backend.c
diff options
context:
space:
mode:
authorWilliam Wold <[email protected]>2020-10-16 10:51:15 -0700
committerraveit65 <[email protected]>2020-10-21 20:35:15 +0200
commit6466fd3aaab49d2528800a7960367a496d0ef2b2 (patch)
tree16c453637e622bee388a9be3d3e24b3126d9dfc1 /applets/wncklet/wayland-backend.c
parent06b511f10395f06b4013486ab50506f2d9e7b734 (diff)
downloadmate-panel-6466fd3aaab49d2528800a7960367a496d0ef2b2.tar.bz2
mate-panel-6466fd3aaab49d2528800a7960367a496d0ef2b2.tar.xz
Suppress applet's default context menu for window buttons
Diffstat (limited to 'applets/wncklet/wayland-backend.c')
-rw-r--r--applets/wncklet/wayland-backend.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/applets/wncklet/wayland-backend.c b/applets/wncklet/wayland-backend.c
index e15c28d9..658eb6d3 100644
--- a/applets/wncklet/wayland-backend.c
+++ b/applets/wncklet/wayland-backend.c
@@ -314,6 +314,21 @@ toplevel_task_handle_clicked (GtkButton *button, ToplevelTask *task)
}
}
+static gboolean on_toplevel_button_press (GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ /* Assume event is a button press */
+ if (((GdkEventButton*)event)->button == GDK_BUTTON_SECONDARY)
+ {
+ /* Returning true for secondary clicks suppresses the applet's default context menu,
+ * which we do not want to show up for task buttons */
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
static ToplevelTask *
toplevel_task_new (TasklistManager *tasklist, struct zwlr_foreign_toplevel_handle_v1 *toplevel)
{
@@ -338,6 +353,12 @@ toplevel_task_new (TasklistManager *tasklist, struct zwlr_foreign_toplevel_handl
toplevel_task_key,
task,
(GDestroyNotify)toplevel_task_disconnected_from_widget);
+
+ g_signal_connect (G_OBJECT (task->button),
+ "button-press-event",
+ G_CALLBACK (on_toplevel_button_press),
+ task);
+
return task;
}