[gtk/present-toplevel-2: 23/59] toplevel: Add gdk_toplevel_show_window_menu



commit 63a350edef0e96eef3cff0a156fe8ed9894b9d9b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 1 11:03:42 2020 -0800

    toplevel: Add gdk_toplevel_show_window_menu

 gdk/gdktoplevel.c        | 31 +++++++++++++++++++++++++++++++
 gdk/gdktoplevel.h        |  5 +++++
 gdk/gdktoplevelprivate.h |  3 +++
 3 files changed, 39 insertions(+)
---
diff --git a/gdk/gdktoplevel.c b/gdk/gdktoplevel.c
index d74520b0f6..f859e88284 100644
--- a/gdk/gdktoplevel.c
+++ b/gdk/gdktoplevel.c
@@ -46,10 +46,18 @@ gdk_toplevel_default_present (GdkToplevel       *toplevel,
   return FALSE;
 }
 
+static gboolean
+gdk_toplevel_default_show_window_menu (GdkToplevel *toplevel,
+                                       GdkEvent    *event)
+{
+  return FALSE;
+}
+
 static void
 gdk_toplevel_default_init (GdkToplevelInterface *iface)
 {
   iface->present = gdk_toplevel_default_present;
+  iface->show_window_menu = gdk_toplevel_default_show_window_menu;
 
   g_object_interface_install_property (iface,
       g_param_spec_flags ("state",
@@ -226,3 +234,26 @@ gdk_toplevel_set_icon_list (GdkToplevel *toplevel,
 
   g_object_set (toplevel, "icon-list", surfaces, NULL);
 }
+
+/**
+ * gdk_toplevel_show_window_menu:
+ * @toplevel: a #GdkToplevel
+ * @event: a #GdkEvent to show the menu for
+ *
+ * Asks the windowing system to show the window menu.
+ *
+ * The window menu is the menu shown when right-clicking the titlebar
+ * on traditional windows managed by the window manager. This is useful
+ * for windows using client-side decorations, activating it with a
+ * right-click on the window decorations.
+ *
+ * Returns: %TRUE if the window menu was shown and %FALSE otherwise.
+ */
+gboolean
+gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
+                               GdkEvent    *event)
+{
+  g_return_val_if_fail (GDK_IS_TOPLEVEL (toplevel), FALSE);
+
+  return GDK_TOPLEVEL_GET_IFACE (toplevel)->show_window_menu (toplevel, event); 
+}
diff --git a/gdk/gdktoplevel.h b/gdk/gdktoplevel.h
index 90d5e41a7f..7ce4cb4cb5 100644
--- a/gdk/gdktoplevel.h
+++ b/gdk/gdktoplevel.h
@@ -59,6 +59,11 @@ GDK_AVAILABLE_IN_ALL
 void            gdk_toplevel_set_icon_list      (GdkToplevel       *toplevel,
                                                  GList             *surfaces);
 
+GDK_AVAILABLE_IN_ALL
+gboolean        gdk_toplevel_show_window_menu   (GdkToplevel       *toplevel,
+                                                 GdkEvent          *event);
+
+
 G_END_DECLS
 
 #endif /* __GDK_TOPLEVEL_H__ */
diff --git a/gdk/gdktoplevelprivate.h b/gdk/gdktoplevelprivate.h
index 6190a5d6d1..ddd2e53034 100644
--- a/gdk/gdktoplevelprivate.h
+++ b/gdk/gdktoplevelprivate.h
@@ -14,6 +14,9 @@ struct _GdkToplevelInterface
                                          int                width,
                                          int                height,
                                          GdkToplevelLayout *layout);
+
+  gboolean        (* show_window_menu)  (GdkToplevel       *toplevel,
+                                         GdkEvent          *event);
 };
 
 typedef enum {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]