[gtk/matthiasc/for-master: 1/2] Remove GdkGeometry from public API



commit 617a76d80f55e9daee36f84dfe2a9c2b684d9150
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Apr 18 22:48:02 2020 -0400

    Remove GdkGeometry from public API
    
    The api to configure surfaces is now GdkToplevelLayout
    and GdkPopupLayout. Unfortunately, there's still quite
    a bit of internal use of GdkGeometry that will take some
    time to clean up, so move it go gdkinternals.h for now.

 docs/reference/gdk/gdk4-sections.txt |   3 -
 gdk/broadway/gdksurface-broadway.h   |   1 +
 gdk/gdkinternals.h                   |  35 +++++++++
 gdk/gdksurface.h                     | 137 -----------------------------------
 gdk/x11/gdksurface-x11.h             |   1 +
 5 files changed, 37 insertions(+), 140 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index e4e0689cdb..12128deb49 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -171,8 +171,6 @@ gdk_rgba_get_type
 <TITLE>GdkSurface</TITLE>
 <FILE>gdksurface</FILE>
 GdkSurface
-GdkSurfaceHints
-GdkGeometry
 GdkGravity
 GdkSurfaceEdge
 GdkSurfaceTypeHint
@@ -190,7 +188,6 @@ gdk_surface_get_height
 gdk_surface_translate_coordinates
 gdk_surface_begin_resize_drag
 gdk_surface_begin_move_drag
-gdk_surface_constrain_size
 gdk_surface_beep
 gdk_surface_get_scale_factor
 gdk_surface_set_opaque_region
diff --git a/gdk/broadway/gdksurface-broadway.h b/gdk/broadway/gdksurface-broadway.h
index 33ef70eb03..0ca144fc80 100644
--- a/gdk/broadway/gdksurface-broadway.h
+++ b/gdk/broadway/gdksurface-broadway.h
@@ -27,6 +27,7 @@
 
 #include <gdk/gdksurfaceprivate.h>
 #include "gdkbroadwaysurface.h"
+#include "gdkinternals.h"
 
 G_BEGIN_DECLS
 
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 096b89aec5..5357bd6b1b 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -301,6 +301,41 @@ void gdk_surface_get_geometry (GdkSurface *surface,
 
 GdkGLContext *gdk_surface_get_shared_data_gl_context (GdkSurface *surface);
 
+typedef enum
+{
+  GDK_HINT_POS         = 1 << 0,
+  GDK_HINT_MIN_SIZE    = 1 << 1,
+  GDK_HINT_MAX_SIZE    = 1 << 2,
+  GDK_HINT_BASE_SIZE   = 1 << 3,
+  GDK_HINT_ASPECT      = 1 << 4,
+  GDK_HINT_RESIZE_INC  = 1 << 5,
+  GDK_HINT_WIN_GRAVITY = 1 << 6,
+  GDK_HINT_USER_POS    = 1 << 7,
+  GDK_HINT_USER_SIZE   = 1 << 8
+} GdkSurfaceHints;
+
+struct _GdkGeometry
+{
+  gint min_width;
+  gint min_height;
+  gint max_width;
+  gint max_height;
+  gint base_width;
+  gint base_height;
+  gint width_inc;
+  gint height_inc;
+  gdouble min_aspect;
+  gdouble max_aspect;
+  GdkGravity win_gravity;
+};
+
+GDK_AVAILABLE_IN_ALL
+void       gdk_surface_constrain_size      (GdkGeometry    *geometry,
+                                            GdkSurfaceHints  flags,
+                                            gint            width,
+                                            gint            height,
+                                            gint           *new_width,
+                                            gint           *new_height);
 
 /*
  * GdkSeatGrabPrepareFunc:
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index cd11aa368f..75d6d9eba1 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -38,44 +38,6 @@
 
 G_BEGIN_DECLS
 
-/* Size restriction enumeration.
- */
-/**
- * GdkSurfaceHints:
- * @GDK_HINT_POS: indicates that the program has positioned the surface
- * @GDK_HINT_MIN_SIZE: min size fields are set
- * @GDK_HINT_MAX_SIZE: max size fields are set
- * @GDK_HINT_BASE_SIZE: base size fields are set
- * @GDK_HINT_ASPECT: aspect ratio fields are set
- * @GDK_HINT_RESIZE_INC: resize increment fields are set
- * @GDK_HINT_WIN_GRAVITY: surface gravity field is set
- * @GDK_HINT_USER_POS: indicates that the surface’s position was explicitly set
- *  by the user
- * @GDK_HINT_USER_SIZE: indicates that the surface’s size was explicitly set by
- *  the user
- *
- * Used to indicate which fields of a #GdkGeometry struct should be paid
- * attention to. Also, the presence/absence of @GDK_HINT_POS,
- * @GDK_HINT_USER_POS, and @GDK_HINT_USER_SIZE is significant, though they don't
- * directly refer to #GdkGeometry fields. @GDK_HINT_USER_POS will be set
- * automatically by #GtkWindow if you call gtk_window_move().
- * @GDK_HINT_USER_POS and @GDK_HINT_USER_SIZE should be set if the user
- * specified a size/position using a --geometry command-line argument;
- * gtk_window_parse_geometry() automatically sets these flags.
- */
-typedef enum
-{
-  GDK_HINT_POS        = 1 << 0,
-  GDK_HINT_MIN_SIZE    = 1 << 1,
-  GDK_HINT_MAX_SIZE    = 1 << 2,
-  GDK_HINT_BASE_SIZE   = 1 << 3,
-  GDK_HINT_ASPECT      = 1 << 4,
-  GDK_HINT_RESIZE_INC  = 1 << 5,
-  GDK_HINT_WIN_GRAVITY = 1 << 6,
-  GDK_HINT_USER_POS    = 1 << 7,
-  GDK_HINT_USER_SIZE   = 1 << 8
-} GdkSurfaceHints;
-
 /**
  * GdkSurfaceEdge:
  * @GDK_SURFACE_EDGE_NORTH_WEST: the top left corner.
@@ -115,97 +77,6 @@ typedef enum
   GDK_FULLSCREEN_ON_ALL_MONITORS
 } GdkFullscreenMode;
 
-/**
- * GdkGeometry:
- * @min_width: minimum width of surface (or -1 to use requisition, with
- *  #GtkWindow only)
- * @min_height: minimum height of surface (or -1 to use requisition, with
- *  #GtkWindow only)
- * @max_width: maximum width of surface (or -1 to use requisition, with
- *  #GtkWindow only)
- * @max_height: maximum height of surface (or -1 to use requisition, with
- *  #GtkWindow only)
- * @base_width: allowed surface widths are @base_width + @width_inc * N where N
- *  is any integer (-1 allowed with #GtkWindow)
- * @base_height: allowed surface widths are @base_height + @height_inc * N where
- *  N is any integer (-1 allowed with #GtkWindow)
- * @width_inc: width resize increment
- * @height_inc: height resize increment
- * @min_aspect: minimum width/height ratio
- * @max_aspect: maximum width/height ratio
- * @win_gravity: surface gravity, see gtk_window_set_gravity()
- *
- * The #GdkGeometry struct gives the window manager information about
- * a surface’s geometry constraints. Normally you would set these on
- * the GTK+ level using gtk_window_set_geometry_hints(). #GtkWindow
- * then sets the hints on the #GdkSurface it creates.
- *
- * gdk_surface_set_geometry_hints() expects the hints to be fully valid already
- * and simply passes them to the window manager; in contrast,
- * gtk_window_set_geometry_hints() performs some interpretation. For example,
- * #GtkWindow will apply the hints to the geometry widget instead of the
- * toplevel window, if you set a geometry widget. Also, the
- * @min_width/@min_height/@max_width/@max_height fields may be set to -1, and
- * #GtkWindow will substitute the size request of the surface or geometry widget.
- * If the minimum size hint is not provided, #GtkWindow will use its requisition
- * as the minimum size. If the minimum size is provided and a geometry widget is
- * set, #GtkWindow will take the minimum size as the minimum size of the
- * geometry widget rather than the entire surface. The base size is treated
- * similarly.
- *
- * The canonical use-case for gtk_window_set_geometry_hints() is to get a
- * terminal widget to resize properly. Here, the terminal text area should be
- * the geometry widget; #GtkWindow will then automatically set the base size to
- * the size of other widgets in the terminal window, such as the menubar and
- * scrollbar. Then, the @width_inc and @height_inc fields should be set to the
- * size of one character in the terminal. Finally, the base size should be set
- * to the size of one character. The net effect is that the minimum size of the
- * terminal will have a 1x1 character terminal area, and only terminal sizes on
- * the “character grid” will be allowed.
- *
- * Here’s an example of how the terminal example would be implemented, assuming
- * a terminal area widget called “terminal” and a toplevel window “toplevel”:
- *
- * |[<!-- language="C" -->
- *     GdkGeometry hints;
- *
- *     hints.base_width = terminal->char_width;
- *         hints.base_height = terminal->char_height;
- *         hints.min_width = terminal->char_width;
- *         hints.min_height = terminal->char_height;
- *         hints.width_inc = terminal->char_width;
- *         hints.height_inc = terminal->char_height;
- *
- *  gtk_window_set_geometry_hints (GTK_WINDOW (toplevel),
- *                                 GTK_WIDGET (terminal),
- *                                 &hints,
- *                                 GDK_HINT_RESIZE_INC |
- *                                 GDK_HINT_MIN_SIZE |
- *                                 GDK_HINT_BASE_SIZE);
- * ]|
- *
- * The other useful fields are the @min_aspect and @max_aspect fields; these
- * contain a width/height ratio as a floating point number. If a geometry widget
- * is set, the aspect applies to the geometry widget rather than the entire
- * window. The most common use of these hints is probably to set @min_aspect and
- * @max_aspect to the same value, thus forcing the window to keep a constant
- * aspect ratio.
- */
-struct _GdkGeometry
-{
-  gint min_width;
-  gint min_height;
-  gint max_width;
-  gint max_height;
-  gint base_width;
-  gint base_height;
-  gint width_inc;
-  gint height_inc;
-  gdouble min_aspect;
-  gdouble max_aspect;
-  GdkGravity win_gravity;
-};
-
 /**
  * GdkSurfaceState:
  * @GDK_SURFACE_STATE_WITHDRAWN: the surface is not shown
@@ -362,14 +233,6 @@ void       gdk_surface_freeze_updates      (GdkSurface    *surface);
 GDK_AVAILABLE_IN_ALL
 void       gdk_surface_thaw_updates        (GdkSurface    *surface);
 
-GDK_AVAILABLE_IN_ALL
-void       gdk_surface_constrain_size      (GdkGeometry    *geometry,
-                                            GdkSurfaceHints  flags,
-                                            gint            width,
-                                            gint            height,
-                                            gint           *new_width,
-                                            gint           *new_height);
-
 GDK_AVAILABLE_IN_ALL
 void       gdk_surface_set_support_multidevice (GdkSurface *surface,
                                                 gboolean   support_multidevice);
diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h
index 53abd500e5..13f74f66a4 100644
--- a/gdk/x11/gdksurface-x11.h
+++ b/gdk/x11/gdksurface-x11.h
@@ -27,6 +27,7 @@
 
 #include "gdksurfaceprivate.h"
 #include "gdkx11surface.h"
+#include "gdkinternals.h"
 
 #include <X11/Xlib.h>
 


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