Move GDK GL flags accessors to the private vtable

This allows us to use the GDK_PRIVATE_CALL macro inside gtk.

https://bugzilla.gnome.org/show_bug.cgi?id=739781
This commit is contained in:
Emmanuele Bassi 2014-11-07 14:27:56 +00:00 committed by Matthias Clasen
parent eedbec2066
commit 585af218a3
6 changed files with 14 additions and 10 deletions

View File

@ -9,6 +9,8 @@ gdk__private__ (void)
gdk_display_open_default, gdk_display_open_default,
gdk_add_option_entries, gdk_add_option_entries,
gdk_pre_parse, gdk_pre_parse,
gdk_gl_get_flags,
gdk_gl_set_flags,
}; };
return &table; return &table;

View File

@ -2,6 +2,7 @@
#define __GDK__PRIVATE_H__ #define __GDK__PRIVATE_H__
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include "gdk/gdkinternals.h"
#define GDK_PRIVATE_CALL(symbol) (gdk__private__ ()->symbol) #define GDK_PRIVATE_CALL(symbol) (gdk__private__ ()->symbol)
@ -16,6 +17,9 @@ void gdk_add_option_entries (GOptionGroup *group);
void gdk_pre_parse (void); void gdk_pre_parse (void);
GdkGLFlags gdk_gl_get_flags (void);
void gdk_gl_set_flags (GdkGLFlags flags);
typedef struct { typedef struct {
/* add all private functions here, initialize them in gdk-private.c */ /* add all private functions here, initialize them in gdk-private.c */
gboolean (* gdk_device_grab_info) (GdkDisplay *display, gboolean (* gdk_device_grab_info) (GdkDisplay *display,
@ -27,6 +31,8 @@ typedef struct {
void (* gdk_add_option_entries) (GOptionGroup *group); void (* gdk_add_option_entries) (GOptionGroup *group);
void (* gdk_pre_parse) (void); void (* gdk_pre_parse) (void);
GdkGLFlags (* gdk_gl_get_flags) (void);
void (* gdk_gl_set_flags) (GdkGLFlags flags);
} GdkPrivateVTable; } GdkPrivateVTable;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL

View File

@ -75,6 +75,7 @@
#include "gdkinternals.h" #include "gdkinternals.h"
#include "gdkintl.h" #include "gdkintl.h"
#include "gdk-private.h"
#include <epoxy/gl.h> #include <epoxy/gl.h>

View File

@ -109,12 +109,6 @@ extern guint _gdk_debug_flags;
extern guint _gdk_gl_flags; extern guint _gdk_gl_flags;
extern GdkRenderingMode _gdk_rendering_mode; extern GdkRenderingMode _gdk_rendering_mode;
/* export these so we can use them from the inspector */
_GDK_EXTERN
GdkGLFlags gdk_gl_get_flags (void);
_GDK_EXTERN
void gdk_gl_set_flags (GdkGLFlags flags);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
#define GDK_NOTE(type,action) G_STMT_START { \ #define GDK_NOTE(type,action) G_STMT_START { \

View File

@ -40,6 +40,7 @@
#include "gdkframeclockidle.h" #include "gdkframeclockidle.h"
#include "gdkwindowimpl.h" #include "gdkwindowimpl.h"
#include "gdkglcontextprivate.h" #include "gdkglcontextprivate.h"
#include "gdk-private.h"
#include <math.h> #include <math.h>

View File

@ -34,7 +34,7 @@
#include "x11/gdkx.h" #include "x11/gdkx.h"
#endif #endif
#include "gdk/gdkinternals.h" #include "gdk/gdk-private.h"
struct _GtkInspectorVisualPrivate struct _GtkInspectorVisualPrivate
{ {
@ -492,7 +492,7 @@ init_gl (GtkInspectorVisual *vis)
{ {
GdkGLFlags flags; GdkGLFlags flags;
flags = gdk_gl_get_flags (); flags = GDK_PRIVATE_CALL (gdk_gl_get_flags) ();
if (flags & GDK_GL_ALWAYS) if (flags & GDK_GL_ALWAYS)
gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "always"); gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "always");
@ -528,14 +528,14 @@ update_gl_flag (GtkSwitch *sw,
{ {
GdkGLFlags flags; GdkGLFlags flags;
flags = gdk_gl_get_flags (); flags = GDK_PRIVATE_CALL (gdk_gl_get_flags) ();
if (gtk_switch_get_active (sw)) if (gtk_switch_get_active (sw))
flags |= flag; flags |= flag;
else else
flags &= ~flag; flags &= ~flag;
gdk_gl_set_flags (flags); GDK_PRIVATE_CALL (gdk_gl_set_flags) (flags);
} }
static void static void