[gtk/present-toplevel-2: 30/79] toplevel: Add minimize



commit f0346a000856feb94062b1bceb0ee6bc363e4fa0
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Mar 3 08:41:31 2020 -0800

    toplevel: Add minimize
    
    This only makes sense for toplevel surfaces,
    so it should be here.

 gdk/gdktoplevel.c        | 25 +++++++++++++++++++++++++
 gdk/gdktoplevel.h        |  3 +++
 gdk/gdktoplevelprivate.h |  2 +-
 3 files changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdktoplevel.c b/gdk/gdktoplevel.c
index 3417e4bba5..c3dadb7a43 100644
--- a/gdk/gdktoplevel.c
+++ b/gdk/gdktoplevel.c
@@ -46,6 +46,12 @@ gdk_toplevel_default_present (GdkToplevel       *toplevel,
   return FALSE;
 }
 
+static gboolean
+gdk_toplevel_default_minimize (GdkToplevel *toplevel)
+{
+  return FALSE;
+}
+
 static gboolean
 gdk_toplevel_default_show_window_menu (GdkToplevel *toplevel,
                                        GdkEvent    *event)
@@ -57,6 +63,7 @@ static void
 gdk_toplevel_default_init (GdkToplevelInterface *iface)
 {
   iface->present = gdk_toplevel_default_present;
+  iface->minimize = gdk_toplevel_default_minimize;
   iface->show_window_menu = gdk_toplevel_default_show_window_menu;
 
   g_object_interface_install_property (iface,
@@ -153,6 +160,24 @@ gdk_toplevel_present (GdkToplevel       *toplevel,
   return GDK_TOPLEVEL_GET_IFACE (toplevel)->present (toplevel, width, height, layout);
 }
 
+/**
+ * gdk_toplevel_minimize:
+ * @toplevel: a #GdkToplevel
+ *
+ * Asks to minimize the @toplevel.
+ *
+ * The windowing system may choose to ignore the request.
+ *
+ * Returns: %TRUE if the surface was minimized
+ */
+gboolean
+gdk_toplevel_minimize (GdkToplevel *toplevel)
+{
+  g_return_val_if_fail (GDK_IS_TOPLEVEL (toplevel), FALSE);
+
+  return GDK_TOPLEVEL_GET_IFACE (toplevel)->minimize (toplevel);
+}
+
 /**
  * gdk_toplevel_get_state:
  * @toplevel: a #GdkToplevel
diff --git a/gdk/gdktoplevel.h b/gdk/gdktoplevel.h
index 9643947fe6..fdb17f4fc8 100644
--- a/gdk/gdktoplevel.h
+++ b/gdk/gdktoplevel.h
@@ -40,6 +40,9 @@ gboolean        gdk_toplevel_present            (GdkToplevel       *toplevel,
                                                  int                height,
                                                  GdkToplevelLayout *layout);
 
+GDK_AVAILABLE_IN_ALL
+gboolean        gdk_toplevel_minimize           (GdkToplevel       *toplevel);
+
 GDK_AVAILABLE_IN_ALL
 GdkSurfaceState gdk_toplevel_get_state          (GdkToplevel       *toplevel);
 
diff --git a/gdk/gdktoplevelprivate.h b/gdk/gdktoplevelprivate.h
index e27a8980a7..f3d22880f0 100644
--- a/gdk/gdktoplevelprivate.h
+++ b/gdk/gdktoplevelprivate.h
@@ -14,7 +14,7 @@ struct _GdkToplevelInterface
                                          int                width,
                                          int                height,
                                          GdkToplevelLayout *layout);
-
+  gboolean      (* minimize)            (GdkToplevel       *toplevel);
   gboolean      (* show_window_menu)    (GdkToplevel       *toplevel,
                                          GdkEvent          *event);
 };


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