surface: Add a private struct

Adding a random member to it resulted in a lot of header surgery as a
side effect.
This commit is contained in:
Benjamin Otte 2021-10-03 08:20:30 +02:00
parent 032eb15079
commit c8204a902c
7 changed files with 41 additions and 32 deletions

View File

@ -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;

View File

@ -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;
}
/**

View File

@ -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

View File

@ -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"

View File

@ -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;

View File

@ -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,

View File

@ -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;