[gtk/wip/otte/gl-hdr] surface: Add a private struct
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/gl-hdr] surface: Add a private struct
- Date: Sun, 3 Oct 2021 20:19:18 +0000 (UTC)
commit ab4b9da9cc857434a5c3cb8a46d33b8c7aa26dae
Author: Benjamin Otte <otte redhat com>
Date: Sun Oct 3 08:20:30 2021 +0200
surface: Add a private struct
Adding a random member to it resulted in a lot of header surgery as a
side effect.
gdk/gdk-private.h | 4 ----
gdk/gdksurface.c | 23 ++++++++++++++++-------
gdk/gdksurfaceprivate.h | 10 ++++++----
gtk/gtkdragicon.c | 3 ++-
gtk/gtknative.c | 4 ++--
gtk/gtktexthandle.c | 21 +++++++++++----------
gtk/gtktooltipwindow.c | 8 ++++----
7 files changed, 41 insertions(+), 32 deletions(-)
---
diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h
index 5b0955e5b8..1100087775 100644
--- a/gdk/gdk-private.h
+++ b/gdk/gdk-private.h
@@ -32,10 +32,6 @@ PangoDirection gdk_unichar_direction (gunichar ch) G_GNUC_CONST;
PangoDirection gdk_find_base_dir (const char *text,
int len);
-void gdk_surface_set_widget (GdkSurface *surface,
- gpointer widget);
-gpointer gdk_surface_get_widget (GdkSurface *surface);
-
typedef struct
{
const char *key;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 53c98c9158..82cb6ecf2f 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -46,8 +46,6 @@
#include <math.h>
-#include <epoxy/gl.h>
-
/**
* GdkSurface:
*
@@ -62,6 +60,13 @@
* types exist, but you will rarely interact with them directly.
*/
+typedef struct _GdkSurfacePrivate GdkSurfacePrivate;
+
+struct _GdkSurfacePrivate
+{
+ gpointer widget;
+};
+
enum {
LAYOUT,
RENDER,
@@ -109,7 +114,7 @@ static void gdk_surface_queue_set_is_mapped (GdkSurface *surface,
static guint signals[LAST_SIGNAL] = { 0 };
static GParamSpec *properties[LAST_PROP] = { NULL, };
-G_DEFINE_ABSTRACT_TYPE (GdkSurface, gdk_surface, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkSurface, gdk_surface, G_TYPE_OBJECT)
static gboolean
gdk_surface_real_beep (GdkSurface *surface)
@@ -994,16 +999,20 @@ gdk_surface_destroy (GdkSurface *surface)
}
void
-gdk_surface_set_widget (GdkSurface *surface,
+gdk_surface_set_widget (GdkSurface *self,
gpointer widget)
{
- surface->widget = widget;
+ GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
+
+ priv->widget = widget;
}
gpointer
-gdk_surface_get_widget (GdkSurface *surface)
+gdk_surface_get_widget (GdkSurface *self)
{
- return surface->widget;
+ GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
+
+ return priv->widget;
}
/**
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index 3ab692e19c..16a6bf8bea 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -48,8 +48,6 @@ struct _GdkSurface
gboolean pending_is_mapped;
gboolean is_mapped;
- gpointer widget;
-
int x;
int y;
@@ -294,8 +292,12 @@ void gdk_surface_get_geometry (GdkSurface *surface,
int *width,
int *height);
-void gdk_surface_freeze_updates (GdkSurface *surface);
-void gdk_surface_thaw_updates (GdkSurface *surface);
+void gdk_surface_set_widget (GdkSurface *self,
+ gpointer widget);
+gpointer gdk_surface_get_widget (GdkSurface *self);
+
+void gdk_surface_freeze_updates (GdkSurface *surface);
+void gdk_surface_thaw_updates (GdkSurface *surface);
typedef enum
diff --git a/gtk/gtkdragicon.c b/gtk/gtkdragicon.c
index a58cf474dc..43c8940e03 100644
--- a/gtk/gtkdragicon.c
+++ b/gtk/gtkdragicon.c
@@ -19,7 +19,6 @@
#include "gtkdragicon.h"
-#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkwidgetprivate.h"
#include "gtkcssstyleprivate.h"
@@ -29,6 +28,8 @@
#include "gtkcssboxesimplprivate.h"
#include "gtkcssnumbervalueprivate.h"
+#include "gdk/gdksurfaceprivate.h"
+
/* for the drag icons */
#include "gtkcolorswatchprivate.h"
#include "gtkimage.h"
diff --git a/gtk/gtknative.c b/gtk/gtknative.c
index 7856d4f486..8a0b74a062 100644
--- a/gtk/gtknative.c
+++ b/gtk/gtknative.c
@@ -21,11 +21,11 @@
#include "gtknativeprivate.h"
#include "gtkwidgetprivate.h"
-#include "gdk/gdk-private.h"
-#include "gtkprivate.h"
#include "gtkintl.h"
#include "gtkcssnodeprivate.h"
+#include "gdk/gdksurfaceprivate.h"
+
typedef struct _GtkNativePrivate
{
gulong update_handler_id;
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 0f92fc74d1..05f6d809aa 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -17,21 +17,22 @@
#include "config.h"
-#include "gtkbinlayout.h"
-#include "gtkgizmoprivate.h"
-#include "gtkprivatetypebuiltins.h"
#include "gtktexthandleprivate.h"
-#include "gtkmarshalers.h"
-#include "gtkprivate.h"
-#include "gtkwindowprivate.h"
-#include "gtkwidgetprivate.h"
-#include "gtkrendericonprivate.h"
+
+#include "gtkbinlayout.h"
#include "gtkcssboxesimplprivate.h"
#include "gtkcssnodeprivate.h"
-#include "gtknativeprivate.h"
+#include "gtkgesturedrag.h"
+#include "gtkgizmoprivate.h"
#include "gtkintl.h"
+#include "gtkmarshalers.h"
+#include "gtknativeprivate.h"
+#include "gtkprivatetypebuiltins.h"
+#include "gtkrendericonprivate.h"
+#include "gtkwidgetprivate.h"
+#include "gtkwindowprivate.h"
-#include <gtk/gtk.h>
+#include "gdk/gdksurfaceprivate.h"
enum {
DRAG_STARTED,
diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c
index a3dbf83db4..d316171600 100644
--- a/gtk/gtktooltipwindow.c
+++ b/gtk/gtktooltipwindow.c
@@ -26,13 +26,11 @@
#include "gtktooltipwindowprivate.h"
-#include "gtkprivate.h"
-#include "gtkintl.h"
-
#include "gtkbox.h"
#include "gtkimage.h"
+#include "gtkintl.h"
#include "gtklabel.h"
-#include "gtkmain.h"
+#include "gtkprivate.h"
#include "gtksettings.h"
#include "gtksizerequest.h"
#include "gtkwindowprivate.h"
@@ -40,6 +38,8 @@
#include "gtknativeprivate.h"
#include "gtkcssboxesimplprivate.h"
+#include "gdk/gdksurfaceprivate.h"
+
struct _GtkTooltipWindow
{
GtkWidget parent_instance;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]