[gtk+] Add GdkGLContext::profile
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add GdkGLContext::profile
- Date: Thu, 30 Oct 2014 11:43:50 +0000 (UTC)
commit 0eb2fb01fd7a5c92e00daaca4222d1acfa6c49f2
Author: Alexander Larsson <alexl redhat com>
Date: Thu Oct 30 12:42:37 2014 +0100
Add GdkGLContext::profile
gdk/gdkglcontext.c | 47 ++++++++++++++++++++++++++++++++++++
gdk/gdkglcontext.h | 2 +
gdk/wayland/gdkglcontext-wayland.c | 4 +++
gdk/x11/gdkglcontext-x11.c | 2 +
4 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index f64c23d..48f444a 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -81,6 +81,7 @@
typedef struct {
GdkWindow *window;
GdkGLContext *shared_context;
+ GdkGLProfile profile;
guint realized : 1;
guint use_texture_rectangle : 1;
@@ -91,6 +92,7 @@ enum {
PROP_0,
PROP_WINDOW,
+ PROP_PROFILE,
PROP_SHARED_CONTEXT,
LAST_PROP
@@ -154,6 +156,10 @@ gdk_gl_context_set_property (GObject *gobject,
}
break;
+ case PROP_PROFILE:
+ priv->profile = g_value_get_enum (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
@@ -177,6 +183,10 @@ gdk_gl_context_get_property (GObject *gobject,
g_value_set_object (value, priv->shared_context);
break;
+ case PROP_PROFILE:
+ g_value_set_enum (value, priv->profile);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
@@ -204,6 +214,23 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
G_PARAM_STATIC_STRINGS);
/**
+ * GdkGLContext:profile:
+ *
+ * The #GdkGLProfile of the context
+ *
+ * Since: 3.16
+ */
+ obj_pspecs[PROP_PROFILE] =
+ g_param_spec_enum ("profile",
+ P_("Profile"),
+ P_("The GL profile the context was created for"),
+ GDK_TYPE_GL_PROFILE,
+ GDK_GL_PROFILE_DEFAULT,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ /**
* GdkGLContext:shared-context:
*
* The #GdkGLContext that this context is sharing data with, or #NULL
@@ -331,6 +358,26 @@ gdk_gl_context_get_window (GdkGLContext *context)
}
/**
+ * gdk_gl_context_get_profile:
+ * @context: a #GdkGLContext
+ *
+ * Retrieves the #GdkGLProfile that @context was created for.
+ *
+ * Returns: a #GdkGLProfile
+ *
+ * Since: 3.16
+ */
+GdkGLProfile
+gdk_gl_context_get_profile (GdkGLContext *context)
+{
+ GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+
+ g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), GDK_GL_PROFILE_LEGACY);
+
+ return priv->profile;
+}
+
+/**
* gdk_gl_context_get_shared_context:
* @context: a #GdkGLContext
*
diff --git a/gdk/gdkglcontext.h b/gdk/gdkglcontext.h
index 599ec99..e78e9b4 100644
--- a/gdk/gdkglcontext.h
+++ b/gdk/gdkglcontext.h
@@ -44,6 +44,8 @@ GType gdk_gl_context_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_3_16
GdkWindow * gdk_gl_context_get_window (GdkGLContext *context);
+GDK_AVAILABLE_IN_3_16
+GdkGLProfile gdk_gl_context_get_profile (GdkGLContext *context);
GDK_AVAILABLE_IN_3_16
void gdk_gl_context_make_current (GdkGLContext *context);
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index 7af884e..4c80a80 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -326,6 +326,9 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
return NULL;
}
+ if (profile == GDK_GL_PROFILE_DEFAULT)
+ profile = GDK_GL_PROFILE_LEGACY;
+
if (profile == GDK_GL_PROFILE_3_2_CORE &&
!display_wayland->have_egl_khr_create_context)
{
@@ -363,6 +366,7 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
context = g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT,
"window", window,
+ "profile", profile,
"shared-context", share,
NULL);
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index e1a578e..9c2d9a9 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -1043,6 +1043,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window,
/* GDK_GL_PROFILE_DEFAULT is currently
* equivalent to the LEGACY profile
*/
+ profile = GDK_GL_PROFILE_LEGACY;
glx_context = create_gl_context (display, config, share);
}
@@ -1119,6 +1120,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window,
context = g_object_new (GDK_TYPE_X11_GL_CONTEXT,
"window", window,
+ "profile", profile,
"shared-context", share,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]