diff options
Diffstat (limited to 'plugins/gtkui/gtkglext-gtk3/gdk/x11')
17 files changed, 0 insertions, 2856 deletions
diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglconfig-x11.c b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglconfig-x11.c deleted file mode 100644 index 03b4d5b2..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglconfig-x11.c +++ /dev/null @@ -1,559 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include <string.h> - -#include "gdkglx.h" -#include "gdkglprivate-x11.h" -#include "gdkglconfig-x11.h" -#include "gdkglwindow-x11.h" - -#include <gdk/gdk.h> - -#ifdef HAVE_LIBXMU - -#include <X11/Xatom.h> /* for XA_RGB_DEFAULT_MAP atom */ - -#ifdef HAVE_XMU_STDCMAP_H -#include <Xmu/StdCmap.h> /* for XmuLookupStandardColormap */ -#else -#include <X11/Xmu/StdCmap.h> /* for XmuLookupStandardColormap */ -#endif - -#endif /* HAVE_LIBXMU */ - -static Display *_gdk_x11_gl_config_impl_get_xdisplay (GdkGLConfig *glconfig); -static int _gdk_x11_gl_config_impl_get_screen_number (GdkGLConfig *glconfig); -static XVisualInfo *_gdk_x11_gl_config_impl_get_xvinfo (GdkGLConfig *glconfig); -static GdkGLWindow *_gdk_x11_gl_config_impl_create_gl_window (GdkGLConfig *glconfig, - GdkWindow *window, - const int *attrib_list); -static GdkScreen *_gdk_x11_gl_config_impl_get_screen (GdkGLConfig *glconfig); -static gboolean _gdk_x11_gl_config_impl_get_attrib (GdkGLConfig *glconfig, - int attribute, - int *value); -static GdkVisual *_gdk_x11_gl_config_impl_get_visual (GdkGLConfig *glconfig); -static gint _gdk_x11_gl_config_impl_get_depth (GdkGLConfig *glconfig); - -G_DEFINE_TYPE (GdkGLConfigImplX11, \ - gdk_gl_config_impl_x11, \ - GDK_TYPE_GL_CONFIG_IMPL) - -static void -gdk_gl_config_impl_x11_init (GdkGLConfigImplX11 *self) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - self->xdisplay = NULL; - self->screen_num = 0; - self->xvinfo = NULL; - self->screen = 0; -} - -static void -gdk_gl_config_impl_x11_finalize (GObject *object) -{ - GdkGLConfigImplX11 *x11_impl = GDK_GL_CONFIG_IMPL_X11 (object); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - XFree (x11_impl->xvinfo); - - G_OBJECT_CLASS (gdk_gl_config_impl_x11_parent_class)->finalize (object); -} - -static void -gdk_gl_config_impl_x11_class_init (GdkGLConfigImplX11Class *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - klass->get_xdisplay = _gdk_x11_gl_config_impl_get_xdisplay; - klass->get_screen_number = _gdk_x11_gl_config_impl_get_screen_number; - klass->get_xvinfo = _gdk_x11_gl_config_impl_get_xvinfo; - - klass->parent_class.create_gl_window = _gdk_x11_gl_config_impl_create_gl_window; - klass->parent_class.get_screen = _gdk_x11_gl_config_impl_get_screen; - klass->parent_class.get_attrib = _gdk_x11_gl_config_impl_get_attrib; - klass->parent_class.get_visual = _gdk_x11_gl_config_impl_get_visual; - klass->parent_class.get_depth = _gdk_x11_gl_config_impl_get_depth; - - object_class->finalize = gdk_gl_config_impl_x11_finalize; -} - -static void -gdk_x11_gl_config_impl_init_attrib (GdkGLConfig *glconfig) -{ - GdkGLConfigImplX11 *x11_impl; - int value; - - x11_impl = GDK_GL_CONFIG_IMPL_X11 (glconfig->impl); - -#define _GET_CONFIG(__attrib) \ - glXGetConfig (x11_impl->xdisplay, x11_impl->xvinfo, __attrib, &value) - - /* RGBA mode? */ - _GET_CONFIG (GLX_RGBA); - glconfig->impl->is_rgba = value ? TRUE : FALSE; - - /* Layer plane. */ - _GET_CONFIG (GLX_LEVEL); - glconfig->impl->layer_plane = value; - - /* Double buffering is supported? */ - _GET_CONFIG (GLX_DOUBLEBUFFER); - glconfig->impl->is_double_buffered = value ? TRUE : FALSE; - - /* Stereo is supported? */ - _GET_CONFIG (GLX_STEREO); - glconfig->impl->is_stereo = value ? TRUE : FALSE; - - /* Number of aux buffers */ - _GET_CONFIG (GLX_AUX_BUFFERS); - glconfig->impl->n_aux_buffers = value; - - /* Has alpha bits? */ - _GET_CONFIG (GLX_ALPHA_SIZE); - glconfig->impl->has_alpha = value ? TRUE : FALSE; - - /* Has depth buffer? */ - _GET_CONFIG (GLX_DEPTH_SIZE); - glconfig->impl->has_depth_buffer = value ? TRUE : FALSE; - - /* Has stencil buffer? */ - _GET_CONFIG (GLX_STENCIL_SIZE); - glconfig->impl->has_stencil_buffer = value ? TRUE : FALSE; - - /* Has accumulation buffer? */ - _GET_CONFIG (GLX_ACCUM_RED_SIZE); - glconfig->impl->has_accum_buffer = value ? TRUE : FALSE; - - /* Number of multisample buffers (not supported yet) */ - glconfig->impl->n_sample_buffers = 0; - -#undef _GET_CONFIG -} - -static int * -glx_attrib_list_from_attrib_list (const gint *attrib_list, gsize n_attribs) -{ - static const guchar has_param[] = - { - [GDK_GL_BUFFER_SIZE] = 1, - [GDK_GL_LEVEL] = 1, - [GDK_GL_AUX_BUFFERS] = 1, - [GDK_GL_RED_SIZE] = 1, - [GDK_GL_GREEN_SIZE] = 1, - [GDK_GL_BLUE_SIZE] = 1, - [GDK_GL_ALPHA_SIZE] = 1, - [GDK_GL_DEPTH_SIZE] = 1, - [GDK_GL_STENCIL_SIZE] = 1, - [GDK_GL_ACCUM_RED_SIZE] = 1, - [GDK_GL_ACCUM_GREEN_SIZE] = 1, - [GDK_GL_ACCUM_BLUE_SIZE] = 1, - [GDK_GL_ACCUM_ALPHA_SIZE] = 1 - }; - - static const int glx_attrib_of_attrib[] = - { - [GDK_GL_USE_GL] = GLX_USE_GL, - [GDK_GL_BUFFER_SIZE] = GLX_BUFFER_SIZE, - [GDK_GL_LEVEL] = GLX_LEVEL, - [GDK_GL_RGBA] = GLX_RGBA, - [GDK_GL_DOUBLEBUFFER] = GLX_DOUBLEBUFFER, - [GDK_GL_STEREO] = GLX_STEREO, - [GDK_GL_AUX_BUFFERS] = GLX_AUX_BUFFERS, - [GDK_GL_RED_SIZE] = GLX_RED_SIZE, - [GDK_GL_GREEN_SIZE] = GLX_GREEN_SIZE, - [GDK_GL_BLUE_SIZE] = GLX_BLUE_SIZE, - [GDK_GL_ALPHA_SIZE] = GLX_ALPHA_SIZE, - [GDK_GL_DEPTH_SIZE] = GLX_DEPTH_SIZE, - [GDK_GL_STENCIL_SIZE] = GLX_STENCIL_SIZE, - [GDK_GL_ACCUM_RED_SIZE] = GLX_ACCUM_RED_SIZE, - [GDK_GL_ACCUM_GREEN_SIZE] = GLX_ACCUM_GREEN_SIZE, - [GDK_GL_ACCUM_BLUE_SIZE] = GLX_ACCUM_BLUE_SIZE, - [GDK_GL_ACCUM_ALPHA_SIZE] = GLX_ACCUM_ALPHA_SIZE - }; - - int *glx_attrib_list; - gsize attrib_index; - gsize glx_attrib_index; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - glx_attrib_list = g_malloc( sizeof(*glx_attrib_list)*(n_attribs+3) ); - - if (!glx_attrib_list) - goto err_g_malloc; - - for (attrib_index = 0, glx_attrib_index = 0; (attrib_index < n_attribs) && attrib_list[attrib_index]; ++attrib_index) - { - switch (attrib_list[attrib_index]) - { - case GDK_GL_USE_GL: - /* legacy from GLX 1.2 and always true; will be removed */ - case GDK_GL_RGBA: - /* not supported anymore */ - break; - - default: - glx_attrib_list[glx_attrib_index++] = glx_attrib_of_attrib[attrib_list[attrib_index]]; - if ( has_param[attrib_list[attrib_index]] ) - { - ++attrib_index; - if (attrib_index == n_attribs) - goto err_n_attribs; - glx_attrib_list[glx_attrib_index++] = attrib_list[attrib_index]; - } - break; - } - } - - glx_attrib_list[glx_attrib_index++] = GLX_RGBA; - glx_attrib_list[glx_attrib_index++] = GLX_USE_GL; - glx_attrib_list[glx_attrib_index++] = None; - - return glx_attrib_list; - -err_n_attribs: - g_free(glx_attrib_list); -err_g_malloc: - return NULL; -} - -static GdkGLConfig * -gdk_x11_gl_config_impl_new_common (GdkGLConfig *glconfig, - GdkScreen *screen, - const int *attrib_list, - gsize n_attribs) -{ - GdkGLConfigImplX11 *x11_impl; - - Display *xdisplay; - int screen_num; - int *glx_attrib_list; - XVisualInfo *xvinfo; - int is_rgba; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - xdisplay = GDK_SCREEN_XDISPLAY (screen); - screen_num = GDK_SCREEN_XNUMBER (screen); - - GDK_GL_NOTE (MISC, _gdk_x11_gl_print_glx_info (xdisplay, screen_num)); - - /* - * Find an OpenGL-capable visual. - */ - - glx_attrib_list = glx_attrib_list_from_attrib_list(attrib_list, n_attribs); - - if (glx_attrib_list == NULL) - goto err_glx_attrib_list_from_attrib_list; - - GDK_GL_NOTE_FUNC_IMPL ("glXChooseVisual"); - - xvinfo = glXChooseVisual (xdisplay, screen_num, glx_attrib_list); - - if (xvinfo == NULL) - goto err_glXChooseVisual; - - GDK_GL_NOTE (MISC, - g_message (" -- glXChooseVisual: screen number = %d", xvinfo->screen)); - GDK_GL_NOTE (MISC, - g_message (" -- glXChooseVisual: visual id = 0x%lx", xvinfo->visualid)); - - /* - * Instantiate the GdkGLConfigImplX11 object. - */ - - x11_impl = g_object_new (GDK_TYPE_GL_CONFIG_IMPL_X11, NULL); - - x11_impl->xdisplay = xdisplay; - x11_impl->screen_num = screen_num; - x11_impl->xvinfo = xvinfo; - - x11_impl->screen = screen; - - /* RGBA mode? */ - glXGetConfig (xdisplay, xvinfo, GLX_RGBA, &is_rgba); - - /* - * Init GdkGLConfig - */ - glconfig->impl = GDK_GL_CONFIG_IMPL (x11_impl); - - /* - * Init configuration attributes. - */ - - gdk_x11_gl_config_impl_init_attrib (glconfig); - - g_free(glx_attrib_list); - - return glconfig; - -err_glXChooseVisual: - g_free(glx_attrib_list); -err_glx_attrib_list_from_attrib_list: - return NULL; -} - -GdkGLConfig * -_gdk_x11_gl_config_impl_new (GdkGLConfig *glconfig, - const int *attrib_list, - gsize n_attribs) -{ - GdkScreen *screen; - - GDK_GL_NOTE_FUNC (); - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG(glconfig), NULL); - g_return_val_if_fail (attrib_list != NULL, NULL); - - screen = gdk_screen_get_default (); - - return gdk_x11_gl_config_impl_new_common (glconfig, screen, attrib_list, n_attribs); -} - -GdkGLConfig * -_gdk_x11_gl_config_impl_new_for_screen (GdkGLConfig *glconfig, - GdkScreen *screen, - const int *attrib_list, - gsize n_attribs) -{ - GDK_GL_NOTE_FUNC (); - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG(glconfig), NULL); - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - g_return_val_if_fail (attrib_list != NULL, NULL); - - return gdk_x11_gl_config_impl_new_common (glconfig, screen, attrib_list, n_attribs); -} - -/* - * XVisualInfo returned by this function should be freed by XFree (). - */ -static XVisualInfo * -gdk_x11_gl_get_xvinfo (Display *xdisplay, - int screen_num, - VisualID xvisualid) -{ - XVisualInfo xvinfo_template; - XVisualInfo *xvinfo_list; - int nitems_return; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - xvinfo_template.visualid = xvisualid; - xvinfo_template.screen = screen_num; - - xvinfo_list = XGetVisualInfo (xdisplay, - VisualIDMask | VisualScreenMask, - &xvinfo_template, - &nitems_return); - - /* Returned XVisualInfo needs to be unique */ - g_assert (xvinfo_list != NULL && nitems_return == 1); - - return xvinfo_list; -} - -static GdkGLConfig * -gdk_x11_gl_config_impl_new_from_visualid_common (GdkGLConfig *glconfig, - GdkScreen *screen, - VisualID xvisualid) -{ - GdkGLConfigImplX11 *x11_impl; - - Display *xdisplay; - int screen_num; - XVisualInfo *xvinfo; - int is_rgba; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - xdisplay = GDK_SCREEN_XDISPLAY (screen); - screen_num = GDK_SCREEN_XNUMBER (screen); - - GDK_GL_NOTE (MISC, - g_message (" -- GLX_VENDOR : %s", - glXGetClientString (xdisplay, GLX_VENDOR))); - GDK_GL_NOTE (MISC, - g_message (" -- GLX_VERSION : %s", - glXGetClientString (xdisplay, GLX_VERSION))); - GDK_GL_NOTE (MISC, - g_message (" -- GLX_EXTENSIONS : %s", - glXGetClientString (xdisplay, GLX_EXTENSIONS))); - - /* - * Get XVisualInfo. - */ - - xvinfo = gdk_x11_gl_get_xvinfo (xdisplay, screen_num, xvisualid); - if (xvinfo == NULL) - return NULL; - - GDK_GL_NOTE (MISC, - g_message (" -- gdk_x11_gl_get_xvinfo: screen number = %d", xvinfo->screen)); - GDK_GL_NOTE (MISC, - g_message (" -- gdk_x11_gl_get_xvinfo: visual id = 0x%lx", xvinfo->visualid)); - - /* - * Instantiate the GdkGLConfigImplX11 object. - */ - - x11_impl = g_object_new (GDK_TYPE_GL_CONFIG_IMPL_X11, NULL); - - g_return_val_if_fail(x11_impl != NULL, NULL); - - x11_impl->xdisplay = xdisplay; - x11_impl->screen_num = screen_num; - x11_impl->xvinfo = xvinfo; - x11_impl->screen = screen; - - /* RGBA mode? */ - glXGetConfig (xdisplay, xvinfo, GLX_RGBA, &is_rgba); - - /* - * Init GdkGLConfig - */ - - glconfig->impl = GDK_GL_CONFIG_IMPL (x11_impl); - - /* - * Init configuration attributes. - */ - - gdk_x11_gl_config_impl_init_attrib (glconfig); - - return glconfig; -} - -GdkGLConfig * -_gdk_x11_gl_config_impl_new_from_visualid_for_screen (GdkGLConfig *glconfig, - GdkScreen *screen, - VisualID xvisualid) -{ - GDK_GL_NOTE_FUNC (); - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG(glconfig), NULL); - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return gdk_x11_gl_config_impl_new_from_visualid_common (glconfig, screen, xvisualid); -} - -static Display * -_gdk_x11_gl_config_impl_get_xdisplay (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - - return GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->xdisplay; -} - -static int -_gdk_x11_gl_config_impl_get_screen_number (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), 0); - - return GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->screen_num; -} - -static XVisualInfo * -_gdk_x11_gl_config_impl_get_xvinfo (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - - return GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->xvinfo; -} - -static GdkGLWindow * -_gdk_x11_gl_config_impl_create_gl_window (GdkGLConfig *glconfig, - GdkWindow *window, - const int *attrib_list) -{ - GdkGLWindow *glwindow; - GdkGLWindow *impl; - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - - glwindow = g_object_new (GDK_TYPE_X11_GL_WINDOW, NULL); - - g_return_val_if_fail(glwindow != NULL, NULL); - - impl = _gdk_x11_gl_window_impl_new(glwindow, - glconfig, - window, - attrib_list); - if (impl == NULL) - g_object_unref(glwindow); - - g_return_val_if_fail(impl != NULL, NULL); - - return glwindow; -} - -static GdkScreen * -_gdk_x11_gl_config_impl_get_screen (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - - return GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->screen; -} - -static gboolean -_gdk_x11_gl_config_impl_get_attrib (GdkGLConfig *glconfig, - int attribute, - int *value) -{ - GdkGLConfigImplX11 *x11_impl; - int ret; - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), FALSE); - - x11_impl = GDK_GL_CONFIG_IMPL_X11 (glconfig->impl); - - ret = glXGetConfig (x11_impl->xdisplay, x11_impl->xvinfo, attribute, value); - - return (ret == Success); -} - -static GdkVisual * -_gdk_x11_gl_config_impl_get_visual (GdkGLConfig *glconfig) -{ - GdkGLConfigImplX11 *x11_impl; - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - - x11_impl = GDK_GL_CONFIG_IMPL_X11 (glconfig->impl); - - return gdk_x11_screen_lookup_visual(x11_impl->screen, x11_impl->xvinfo->visualid); -} - -static gint -_gdk_x11_gl_config_impl_get_depth (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), 0); - - return GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->xvinfo->depth; -} diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglconfig-x11.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglconfig-x11.h deleted file mode 100644 index daf6b7cc..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglconfig-x11.h +++ /dev/null @@ -1,74 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __GDK_GL_CONFIG_X11_H__ -#define __GDK_GL_CONFIG_X11_H__ - -#include <gdk/gdkx.h> - -#include <gdk/gdkglconfig.h> -#include <gdk/gdkglconfigimpl.h> - -G_BEGIN_DECLS - -typedef struct _GdkGLConfigImplX11 GdkGLConfigImplX11; -typedef struct _GdkGLConfigImplX11Class GdkGLConfigImplX11Class; - -#define GDK_TYPE_GL_CONFIG_IMPL_X11 (gdk_gl_config_impl_x11_get_type ()) -#define GDK_GL_CONFIG_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GL_CONFIG_IMPL_X11, GdkGLConfigImplX11)) -#define GDK_GL_CONFIG_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONFIG_IMPL_X11, GdkGLConfigImplX11Class)) -#define GDK_IS_GL_CONFIG_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GL_CONFIG_IMPL_X11)) -#define GDK_IS_GL_CONFIG_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONFIG_IMPL_X11)) -#define GDK_GL_CONFIG_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONFIG_IMPL_X11, GdkGLConfigImplX11Class)) - -struct _GdkGLConfigImplX11 -{ - GdkGLConfigImpl parent_instance; - - Display *xdisplay; - int screen_num; - XVisualInfo *xvinfo; - - GdkScreen *screen; -}; - -struct _GdkGLConfigImplX11Class -{ - GdkGLConfigImplClass parent_class; - - Display* (*get_xdisplay) (GdkGLConfig *glconfig); - int (*get_screen_number) (GdkGLConfig *glconfig); - XVisualInfo* (*get_xvinfo) (GdkGLConfig *glconfig); -}; - -GType gdk_gl_config_impl_x11_get_type (void); - -GdkGLConfig *_gdk_x11_gl_config_impl_new (GdkGLConfig *glconfig, - const int *attrib_list, - gsize n_attribs); -GdkGLConfig *_gdk_x11_gl_config_impl_new_for_screen (GdkGLConfig *glconfig, - GdkScreen *screen, - const int *attrib_list, - gsize n_attribs); -GdkGLConfig *_gdk_x11_gl_config_impl_new_from_visualid_for_screen (GdkGLConfig *glconfig, - GdkScreen *screen, - VisualID xvisualid); - -G_END_DECLS - -#endif /* __GDK_GL_CONFIG_X11_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglcontext-x11.c b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglcontext-x11.c deleted file mode 100644 index 5fc0be54..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglcontext-x11.c +++ /dev/null @@ -1,591 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gdk/gdk.h> /* for gdk_error_trap_(push|pop) () */ - -#include "gdkglx.h" -#include "gdkglprivate-x11.h" -#include "gdkglconfig-x11.h" -#include "gdkglwindow-x11.h" -#include "gdkglcontext-x11.h" - -static void gdk_gl_context_insert (GdkGLContext *glcontext); -static void gdk_gl_context_remove (GdkGLContext *glcontext); -static GdkGLContext *gdk_gl_context_lookup (GLXContext glxcontext); - -static gboolean _gdk_x11_gl_context_impl_copy (GdkGLContext *glcontext, - GdkGLContext *src, - unsigned long mask); -static GdkGLDrawable* _gdk_x11_gl_context_impl_get_gl_drawable (GdkGLContext *glcontext); -static GdkGLConfig* _gdk_x11_gl_context_impl_get_gl_config (GdkGLContext *glcontext); -static GdkGLContext* _gdk_x11_gl_context_impl_get_share_list (GdkGLContext *glcontext); -static gboolean _gdk_x11_gl_context_impl_is_direct (GdkGLContext *glcontext); -static int _gdk_x11_gl_context_impl_get_render_type (GdkGLContext *glcontext); -static gboolean _gdk_x11_gl_context_impl_make_current (GdkGLContext *glcontext, - GdkGLDrawable *draw, - GdkGLDrawable *read); -static GLXContext _gdk_x11_gl_context_impl_get_glxcontext (GdkGLContext *glcontext); - -G_DEFINE_TYPE (GdkGLContextImplX11, \ - gdk_gl_context_impl_x11, \ - GDK_TYPE_GL_CONTEXT_IMPL) - -static void -gdk_gl_context_impl_x11_init (GdkGLContextImplX11 *self) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - self->glxcontext = NULL; - self->share_list = NULL; - self->is_direct = FALSE; - self->render_type = 0; - self->glconfig = NULL; - self->gldrawable = NULL; - self->gldrawable_read = NULL; - self->is_destroyed = 0; - self->is_foreign = 0; -} - -void -_gdk_gl_context_destroy (GdkGLContext *glcontext) -{ - GdkGLContextImplX11 *impl = GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl); - Display *xdisplay; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - if (impl->is_destroyed) - return; - - gdk_gl_context_remove (glcontext); - - xdisplay = GDK_GL_CONFIG_XDISPLAY (impl->glconfig); - - if (impl->glxcontext == glXGetCurrentContext ()) - { - glXWaitGL (); - - GDK_GL_NOTE_FUNC_IMPL ("glXMakeCurrent"); - glXMakeCurrent (xdisplay, None, NULL); - } - - if (!impl->is_foreign) - { - GDK_GL_NOTE_FUNC_IMPL ("glXDestroyContext"); - glXDestroyContext (xdisplay, impl->glxcontext); - impl->glxcontext = NULL; - } - - if (impl->gldrawable != NULL) - { - g_object_remove_weak_pointer (G_OBJECT (impl->gldrawable), - (gpointer *) &(impl->gldrawable)); - impl->gldrawable = NULL; - } - - /* currently unused. */ - /* - if (impl->gldrawable_read != NULL) - { - g_object_remove_weak_pointer (G_OBJECT (impl->gldrawable_read), - (gpointer *) &(impl->gldrawable_read)); - impl->gldrawable_read = NULL; - } - */ - - impl->is_destroyed = TRUE; -} - -static void -gdk_gl_context_impl_x11_finalize (GObject *object) -{ - GdkGLContextImplX11 *impl = GDK_GL_CONTEXT_IMPL_X11 (object); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - _gdk_gl_context_destroy (GDK_GL_CONTEXT (object)); - - g_object_unref (G_OBJECT (impl->glconfig)); - - if (impl->share_list != NULL) - g_object_unref (G_OBJECT (impl->share_list)); - - G_OBJECT_CLASS (gdk_gl_context_impl_x11_parent_class)->finalize (object); -} - -static void -gdk_gl_context_impl_x11_class_init (GdkGLContextImplX11Class *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - klass->get_glxcontext = _gdk_x11_gl_context_impl_get_glxcontext; - - klass->parent_class.copy_gl_context_impl = _gdk_x11_gl_context_impl_copy; - klass->parent_class.get_gl_drawable = _gdk_x11_gl_context_impl_get_gl_drawable; - klass->parent_class.get_gl_config = _gdk_x11_gl_context_impl_get_gl_config; - klass->parent_class.get_share_list = _gdk_x11_gl_context_impl_get_share_list; - klass->parent_class.is_direct = _gdk_x11_gl_context_impl_is_direct; - klass->parent_class.get_render_type = _gdk_x11_gl_context_impl_get_render_type; - klass->parent_class.make_current = _gdk_x11_gl_context_impl_make_current; - klass->parent_class.make_uncurrent = NULL; - - object_class->finalize = gdk_gl_context_impl_x11_finalize; -} - -static GdkGLContextImpl * -gdk_x11_gl_context_impl_new_common (GdkGLContext *glcontext, - GdkGLConfig *glconfig, - GdkGLContext *share_list, - int render_type, - GLXContext glxcontext, - gboolean is_foreign) -{ - GdkGLContextImpl *impl; - GdkGLContextImplX11 *x11_impl; - - Display *xdisplay; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - /* - * Instantiate the GdkGLContextImplX11 object. - */ - - impl = g_object_new (GDK_TYPE_GL_CONTEXT_IMPL_X11, NULL); - x11_impl = GDK_GL_CONTEXT_IMPL_X11 (impl); - - x11_impl->glxcontext = glxcontext; - - if (share_list != NULL && GDK_IS_GL_CONTEXT (share_list)) - { - x11_impl->share_list = share_list; - g_object_ref (G_OBJECT (x11_impl->share_list)); - } - else - { - x11_impl->share_list = NULL; - } - - xdisplay = GDK_GL_CONFIG_XDISPLAY (glconfig); - x11_impl->is_direct = glXIsDirect (xdisplay, glxcontext) ? TRUE : FALSE; - - x11_impl->render_type = render_type; - - x11_impl->glconfig = glconfig; - g_object_ref (G_OBJECT (x11_impl->glconfig)); - - x11_impl->gldrawable = NULL; - x11_impl->gldrawable_read = NULL; - - x11_impl->is_foreign = is_foreign; - - x11_impl->is_destroyed = FALSE; - - glcontext->impl = impl; - - /* - * Insert into the GL context hash table. - */ - - gdk_gl_context_insert (glcontext); - - return impl; -} - -/*< private >*/ -GdkGLContextImpl * -_gdk_x11_gl_context_impl_new (GdkGLContext *glcontext, - GdkGLDrawable *gldrawable, - GdkGLContext *share_list, - gboolean direct, - int render_type) -{ - GdkGLConfig *glconfig; - GdkGLContextImplX11 *share_impl = NULL; - GLXContext share_glxcontext = NULL; - - Display *xdisplay; - XVisualInfo *xvinfo; - GLXContext glxcontext; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - /* - * Create an OpenGL rendering context. - */ - - glconfig = gdk_gl_drawable_get_gl_config (gldrawable); - - xdisplay = GDK_GL_CONFIG_XDISPLAY (glconfig); - xvinfo = GDK_GL_CONFIG_XVINFO (glconfig); - - if (share_list != NULL && GDK_IS_GL_CONTEXT (share_list)) - { - share_impl = GDK_GL_CONTEXT_IMPL_X11 (share_list->impl); - share_glxcontext = share_impl->glxcontext; - } - - GDK_GL_NOTE_FUNC_IMPL ("glXCreateContext"); - - if (_gdk_gl_context_force_indirect) - { - GDK_GL_NOTE (MISC, g_message (" -- Force indirect")); - - glxcontext = glXCreateContext (xdisplay, - xvinfo, - share_glxcontext, - False); - } - else - { - glxcontext = glXCreateContext (xdisplay, - xvinfo, - share_glxcontext, - (direct == TRUE) ? True : False); - } - if (glxcontext == NULL) - return NULL; - - GDK_GL_NOTE (MISC, - g_message (" -- Context: screen number = %d", xvinfo->screen)); - GDK_GL_NOTE (MISC, - g_message (" -- Context: visual id = 0x%lx", xvinfo->visualid)); - - /* - * Instantiate the GdkGLContextImplX11 object. - */ - - return gdk_x11_gl_context_impl_new_common (glcontext, - glconfig, - share_list, - render_type, - glxcontext, - FALSE); -} - -GdkGLContextImpl * -_gdk_x11_gl_context_impl_new_from_glxcontext (GdkGLContext *glcontext, - GdkGLConfig *glconfig, - GdkGLContext *share_list, - GLXContext glxcontext) -{ - GDK_GL_NOTE_FUNC (); - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - g_return_val_if_fail (glxcontext != NULL, NULL); - - /* - * Instantiate the GdkGLContextImplX11 object. - */ - - return gdk_x11_gl_context_impl_new_common (glcontext, - glconfig, - share_list, - GDK_GL_RGBA_TYPE, - glxcontext, - TRUE); -} - -static gboolean -_gdk_x11_gl_context_impl_copy (GdkGLContext *glcontext, - GdkGLContext *src, - unsigned long mask) -{ - GLXContext dst_glxcontext, src_glxcontext; - GdkGLConfig *glconfig; - - GDK_GL_NOTE_FUNC (); - - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), FALSE); - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (src), FALSE); - - dst_glxcontext = GDK_GL_CONTEXT_GLXCONTEXT (glcontext); - if (dst_glxcontext == NULL) - return FALSE; - - src_glxcontext = GDK_GL_CONTEXT_GLXCONTEXT (src); - if (src_glxcontext == NULL) - return FALSE; - - glconfig = GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->glconfig; - - gdk_error_trap_push (); - - glXCopyContext (GDK_GL_CONFIG_XDISPLAY (glconfig), - src_glxcontext, dst_glxcontext, - mask); - - return gdk_error_trap_pop () == Success; -} - -/*< private >*/ -void -_gdk_x11_gl_context_impl_set_gl_drawable (GdkGLContext *glcontext, - GdkGLDrawable *gldrawable) -{ - GdkGLContextImplX11 *impl = GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - if (impl->gldrawable == gldrawable) - return; - - if (impl->gldrawable != NULL) - { - g_object_remove_weak_pointer (G_OBJECT (impl->gldrawable), - (gpointer *) &(impl->gldrawable)); - impl->gldrawable = NULL; - } - - if (gldrawable != NULL && GDK_IS_GL_DRAWABLE (gldrawable)) - { - impl->gldrawable = gldrawable; - g_object_add_weak_pointer (G_OBJECT (impl->gldrawable), - (gpointer *) &(impl->gldrawable)); - } -} - -/*< private >*/ -/* currently unused. */ -/* -void -_gdk_gl_context_set_gl_drawable_read (GdkGLContext *glcontext, - GdkGLDrawable *gldrawable_read) -{ - GdkGLContextImplX11 *impl = GDK_GL_CONTEXT_IMPL_X11 (glcontext); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - if (impl->gldrawable_read == gldrawable_read) - return; - - if (impl->gldrawable_read != NULL) - { - g_object_remove_weak_pointer (G_OBJECT (impl->gldrawable_read), - (gpointer *) &(impl->gldrawable_read)); - impl->gldrawable_read = NULL; - } - - if (gldrawable_read != NULL && GDK_IS_GL_DRAWABLE (gldrawable_read)) - { - impl->gldrawable_read = gldrawable_read; - g_object_add_weak_pointer (G_OBJECT (impl->gldrawable_read), - (gpointer *) &(impl->gldrawable_read)); - } -} -*/ - -static GdkGLDrawable * -_gdk_x11_gl_context_impl_get_gl_drawable (GdkGLContext *glcontext) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), NULL); - - return GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->gldrawable; -} - -static GdkGLConfig * -_gdk_x11_gl_context_impl_get_gl_config (GdkGLContext *glcontext) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), NULL); - - return GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->glconfig; -} - -static GdkGLContext * -_gdk_x11_gl_context_impl_get_share_list (GdkGLContext *glcontext) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), NULL); - - return GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->share_list; -} - -static gboolean -_gdk_x11_gl_context_impl_is_direct (GdkGLContext *glcontext) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), FALSE); - - return GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->is_direct; -} - -static int -_gdk_x11_gl_context_impl_get_render_type (GdkGLContext *glcontext) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), 0); - - return GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->render_type; -} - -static gboolean -_gdk_x11_gl_context_impl_make_current (GdkGLContext *glcontext, - GdkGLDrawable *draw, - GdkGLDrawable *read) -{ - GdkGLWindow *glwindow; - GdkGLWindowImplX11 *x11_impl; - GdkGLConfig *glconfig; - GdkWindow *window; - Window glxwindow; - GLXContext glxcontext; - - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), FALSE); - g_return_val_if_fail (GDK_IS_X11_GL_WINDOW (draw), FALSE); - - glwindow = GDK_GL_WINDOW(draw); - x11_impl = GDK_GL_WINDOW_IMPL_X11 (glwindow->impl); - glconfig = x11_impl->glconfig; - window = gdk_gl_window_get_window(glwindow); - glxwindow = x11_impl->glxwindow; - glxcontext = GDK_GL_CONTEXT_GLXCONTEXT (glcontext); - - if (glxwindow == None || glxcontext == NULL) - return FALSE; - - GDK_GL_NOTE (MISC, - g_message (" -- Window: screen number = %d", - GDK_SCREEN_XNUMBER (gdk_window_get_screen (window)))); - GDK_GL_NOTE (MISC, - g_message (" -- Window: visual id = 0x%lx", - GDK_VISUAL_XVISUAL (gdk_window_get_visual (window))->visualid)); - - GDK_GL_NOTE_FUNC_IMPL ("glXMakeCurrent"); - - if (!glXMakeCurrent (GDK_GL_CONFIG_XDISPLAY (glconfig), glxwindow, glxcontext)) - { - g_warning ("glXMakeCurrent() failed"); - _gdk_x11_gl_context_impl_set_gl_drawable (glcontext, NULL); - /* currently unused. */ - /* _gdk_gl_context_set_gl_drawable_read (glcontext, NULL); */ - return FALSE; - } - - _gdk_x11_gl_context_impl_set_gl_drawable (glcontext, draw); - /* currently unused. */ - /* _gdk_gl_context_set_gl_drawable_read (glcontext, read); */ - - if (_GDK_GL_CONFIG_AS_SINGLE_MODE (glconfig)) - { - /* We do this because we are treating a double-buffered frame - buffer as a single-buffered frame buffer because the system - does not appear to export any suitable single-buffered - visuals (in which the following are necessary). */ - glDrawBuffer (GL_FRONT); - glReadBuffer (GL_FRONT); - } - - GDK_GL_NOTE (MISC, _gdk_gl_print_gl_info ()); - - return TRUE; -} - -GdkGLContext * -_gdk_x11_gl_context_impl_get_current (void) -{ - static GdkGLContext *current = NULL; - GLXContext glxcontext; - - GDK_GL_NOTE_FUNC (); - - glxcontext = glXGetCurrentContext (); - - if (glxcontext == NULL) - return NULL; - - if (current && GDK_GL_CONTEXT_GLXCONTEXT (current) == glxcontext) - return current; - - current = gdk_gl_context_lookup (glxcontext); - - return current; -} - -GLXContext -_gdk_x11_gl_context_impl_get_glxcontext (GdkGLContext *glcontext) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), NULL); - - return GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->glxcontext; -} - -/* - * GdkGLContext hash table. - */ - -static GHashTable *gl_context_ht = NULL; - -static void -gdk_gl_context_insert (GdkGLContext *glcontext) -{ - GdkGLContextImplX11 *impl; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - if (gl_context_ht == NULL) - { - GDK_GL_NOTE (MISC, g_message (" -- Create GL context hash table.")); - - /* We do not know the storage type of GLXContext from the GLX - specification. We assume that it is a pointer as NULL values - are specified for this type---this is consistent with the SGI - and Mesa GLX implementations. */ - gl_context_ht = g_hash_table_new (g_direct_hash, - g_direct_equal); - } - - impl = GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl); - - g_hash_table_insert (gl_context_ht, impl->glxcontext, glcontext); -} - -static void -gdk_gl_context_remove (GdkGLContext *glcontext) -{ - GdkGLContextImplX11 *impl; - - GDK_GL_NOTE_FUNC_PRIVATE (); - - if (gl_context_ht == NULL) - return; - - impl = GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl); - - g_hash_table_remove (gl_context_ht, impl->glxcontext); - - if (g_hash_table_size (gl_context_ht) == 0) - { - GDK_GL_NOTE (MISC, g_message (" -- Destroy GL context hash table.")); - g_hash_table_destroy (gl_context_ht); - gl_context_ht = NULL; - } -} - -static GdkGLContext * -gdk_gl_context_lookup (GLXContext glxcontext) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - if (gl_context_ht == NULL) - return NULL; - - return g_hash_table_lookup (gl_context_ht, glxcontext); -} diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglcontext-x11.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglcontext-x11.h deleted file mode 100644 index bb21cd93..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglcontext-x11.h +++ /dev/null @@ -1,85 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __GDK_GL_CONTEXT_X11_H__ -#define __GDK_GL_CONTEXT_X11_H__ - -#include <GL/glx.h> - -#include <gdk/gdkglcontext.h> -#include <gdk/gdkglcontextimpl.h> - -G_BEGIN_DECLS - -typedef struct _GdkGLContextImplX11 GdkGLContextImplX11; -typedef struct _GdkGLContextImplX11Class GdkGLContextImplX11Class; - -#define GDK_TYPE_GL_CONTEXT_IMPL_X11 (gdk_gl_context_impl_x11_get_type ()) -#define GDK_GL_CONTEXT_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GL_CONTEXT_IMPL_X11, GdkGLContextImplX11)) -#define GDK_GL_CONTEXT_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT_IMPL_X11, GdkGLContextImplX11Class)) -#define GDK_IS_GL_CONTEXT_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GL_CONTEXT_IMPL_X11)) -#define GDK_IS_GL_CONTEXT_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT_IMPL_X11)) -#define GDK_GL_CONTEXT_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT_IMPL_X11, GdkGLContextImplX11Class)) - -struct _GdkGLContextImplX11 -{ - GdkGLContextImpl parent_instance; - - GLXContext glxcontext; - GdkGLContext *share_list; - gboolean is_direct; - int render_type; - - GdkGLConfig *glconfig; - - GdkGLDrawable *gldrawable; - GdkGLDrawable *gldrawable_read; /* currently unused. */ - - guint is_destroyed : 1; - guint is_foreign : 1; -}; - -struct _GdkGLContextImplX11Class -{ - GdkGLContextImplClass parent_class; - - GLXContext (*get_glxcontext) (GdkGLContext *glcontext); -}; - -GType gdk_gl_context_impl_x11_get_type (void); - -GdkGLContextImpl *_gdk_x11_gl_context_impl_new (GdkGLContext *glcontext, - GdkGLDrawable *gldrawable, - GdkGLContext *share_list, - gboolean direct, - int render_type); - -GdkGLContextImpl *_gdk_x11_gl_context_impl_new_from_glxcontext (GdkGLContext *glcontext, - GdkGLConfig *glconfig, - GdkGLContext *share_list, - GLXContext glxcontext); - -void _gdk_x11_gl_context_impl_set_gl_drawable (GdkGLContext *glcontext, - GdkGLDrawable *gldrawable); - -GdkGLContext * -_gdk_x11_gl_context_impl_get_current (void); - -G_END_DECLS - -#endif /* __GDK_GL_CONTEXT_X11_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglprivate-x11.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglprivate-x11.h deleted file mode 100644 index 3beed7a3..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglprivate-x11.h +++ /dev/null @@ -1,39 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __GDK_GL_PRIVATE_X11_H__ -#define __GDK_GL_PRIVATE_X11_H__ - -#include <gdk/gdkprivate.h> - -#include <gdk/gdkglprivate.h> - -G_BEGIN_DECLS - -void _gdk_x11_gl_print_glx_info (Display *xdisplay, - int screen_num); - -#define GDK_GL_CONTEXT_IS_DESTROYED(glcontext) \ - ( ((GdkGLContextImplX11 *) (glcontext->impl))->is_destroyed ) - -#define GDK_GL_WINDOW_IS_DESTROYED(glwindow) \ - ( ((GdkGLWindowImplX11 *) (glwindow->impl))->is_destroyed ) - -G_END_DECLS - -#endif /* __GDK_GL_PRIVATE_X11_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglquery-x11.c b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglquery-x11.c deleted file mode 100644 index d2ac7ae3..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglquery-x11.c +++ /dev/null @@ -1,417 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include <string.h> - -#ifdef __APPLE__ -#include <mach-o/dyld.h> -#else /* __APPLE__ */ -#include <gmodule.h> -#endif /* __APPLE__ */ - -#include <gdk/gdk.h> - -#include "gdkglx.h" -#include "gdkglprivate-x11.h" -#include "gdkglconfig-x11.h" -#include "gdkglquery.h" - -#include "gdkglquery-x11.h" - -gboolean -_gdk_x11_gl_query_extension_for_display (GdkDisplay *display) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); - - return glXQueryExtension (GDK_DISPLAY_XDISPLAY (display), - NULL, NULL); -} - -gboolean -_gdk_x11_gl_query_version_for_display (GdkDisplay *display, - int *major, - int *minor) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); - - return glXQueryVersion (GDK_DISPLAY_XDISPLAY (display), - major, minor); -} - -/* - * This code is based on __glutIsSupportedByGLX(). - */ - -/** - * gdk_x11_gl_query_glx_extension: - * @glconfig: a #GdkGLConfig. - * @extension: name of GLX extension. - * - * Determines whether a given GLX extension is supported. - * - * Return value: TRUE if the GLX extension is supported, FALSE if not - * supported. - **/ -gboolean -gdk_x11_gl_query_glx_extension (GdkGLConfig *glconfig, - const char *extension) -{ - static const char *extensions = NULL; - const char *start; - char *where, *terminator; - int major, minor; - - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), FALSE); - - /* Extension names should not have spaces. */ - where = strchr (extension, ' '); - if (where || *extension == '\0') - return FALSE; - - if (extensions == NULL) - { - /* Be careful not to call glXQueryExtensionsString if it - looks like the server doesn't support GLX 1.1. - Unfortunately, the original GLX 1.0 didn't have the notion - of GLX extensions. */ - - glXQueryVersion (GDK_GL_CONFIG_XDISPLAY (glconfig), - &major, &minor); - - if ((major == 1 && minor < 1) || (major < 1)) - return FALSE; - - extensions = glXQueryExtensionsString (GDK_GL_CONFIG_XDISPLAY (glconfig), - GDK_GL_CONFIG_SCREEN_XNUMBER (glconfig)); - } - - /* It takes a bit of care to be fool-proof about parsing - the GLX extensions string. Don't be fooled by - sub-strings, etc. */ - start = extensions; - for (;;) - { - where = strstr (start, extension); - if (where == NULL) - break; - - terminator = where + strlen (extension); - - if (where == start || *(where - 1) == ' ') - if (*terminator == ' ' || *terminator == '\0') - { - GDK_GL_NOTE (MISC, g_message (" - %s - supported", extension)); - return TRUE; - } - - start = terminator; - } - - GDK_GL_NOTE (MISC, g_message (" - %s - not supported", extension)); - - return FALSE; -} - -GdkGLProc -_gdk_x11_gl_get_proc_address (const char *proc_name) -{ -#ifdef __APPLE__ - - #define _GDK_GL_LIBGL_PATH "/usr/X11R6/lib/libGL.1.dylib" - #define _GDK_GL_LIBGLU_PATH "/usr/X11R6/lib/libGLU.1.dylib" - - typedef GdkGLProc (*__glXGetProcAddressProc) (const GLubyte *); - static __glXGetProcAddressProc glx_get_proc_address = (__glXGetProcAddressProc) -1; - const char *image_name; - static const struct mach_header *libgl_image = NULL; - static const struct mach_header *libglu_image = NULL; - NSSymbol symbol; - char *symbol_name; - GdkGLProc proc_address; - - GDK_GL_NOTE_FUNC (); - - if (strncmp ("glu", proc_name, 3) != 0) - { - /* libGL */ - - if (libgl_image == NULL) - { - image_name = g_getenv ("GDK_GL_LIBGL_PATH"); - if (image_name == NULL) - image_name = _GDK_GL_LIBGL_PATH; - - GDK_GL_NOTE (MISC, g_message (" - Add Mach-O image %s", image_name)); - - libgl_image = NSAddImage (image_name, NSADDIMAGE_OPTION_RETURN_ON_ERROR); - if (libgl_image == NULL) - { - g_warning ("Cannot add Mach-O image %s", image_name); - return NULL; - } - } - - if (glx_get_proc_address == (__glXGetProcAddressProc) -1) - { - /* - * Look up glXGetProcAddress () function. - */ - - symbol = NSLookupSymbolInImage (libgl_image, - "_glXGetProcAddress", - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | - NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); - if (symbol == NULL) - { - symbol = NSLookupSymbolInImage (libgl_image, - "_glXGetProcAddressARB", - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | - NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); - if (symbol == NULL) - { - symbol = NSLookupSymbolInImage (libgl_image, - "_glXGetProcAddressEXT", - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | - NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); - } - } - GDK_GL_NOTE (MISC, g_message (" - glXGetProcAddress () - %s", - symbol ? "supported" : "not supported")); - if (symbol != NULL) - glx_get_proc_address = NSAddressOfSymbol (symbol); - else - glx_get_proc_address = NULL; - } - - /* Try glXGetProcAddress () */ - - if (glx_get_proc_address != NULL) - { - proc_address = glx_get_proc_address ((unsigned char *) proc_name); - GDK_GL_NOTE (IMPL, g_message (" ** glXGetProcAddress () - %s", - proc_address ? "succeeded" : "failed")); - if (proc_address != NULL) - return proc_address; - } - - /* Try Mach-O dyld */ - - symbol_name = g_strconcat ("_", proc_name, NULL); - - symbol = NSLookupSymbolInImage (libgl_image, - symbol_name, - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | - NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); - GDK_GL_NOTE (MISC, g_message (" - NSLookupSymbolInImage () - %s", - symbol ? "succeeded" : "failed")); - - g_free (symbol_name); - - if (symbol != NULL) - return NSAddressOfSymbol (symbol); - } - else - { - /* libGLU */ - - if (libglu_image == NULL) - { - image_name = g_getenv ("GDK_GL_LIBGLU_PATH"); - if (image_name == NULL) - image_name = _GDK_GL_LIBGLU_PATH; - - GDK_GL_NOTE (MISC, g_message (" - Add Mach-O image %s", image_name)); - - libglu_image = NSAddImage (image_name, NSADDIMAGE_OPTION_RETURN_ON_ERROR); - if (libglu_image == NULL) - { - g_warning ("Cannot add Mach-O image %s", image_name); - return NULL; - } - } - - symbol_name = g_strconcat ("_", proc_name, NULL); - - symbol = NSLookupSymbolInImage (libglu_image, - symbol_name, - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | - NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); - GDK_GL_NOTE (MISC, g_message (" - NSLookupSymbolInImage () - %s", - symbol ? "succeeded" : "failed")); - - g_free (symbol_name); - - if (symbol != NULL) - return NSAddressOfSymbol (symbol); - } - - return NULL; - -#else /* __APPLE__ */ - - typedef GdkGLProc (*__glXGetProcAddressProc) (const GLubyte *); - static __glXGetProcAddressProc glx_get_proc_address = (__glXGetProcAddressProc) -1; - gchar *file_name; - GModule *module; - GdkGLProc proc_address = NULL; - - GDK_GL_NOTE_FUNC (); - - if (strncmp ("glu", proc_name, 3) != 0) - { - if (glx_get_proc_address == (__glXGetProcAddressProc) -1) - { - /* - * Look up glXGetProcAddress () function. - */ - - file_name = g_module_build_path (NULL, "GL"); - GDK_GL_NOTE (MISC, g_message (" - Open %s", file_name)); - module = g_module_open (file_name, G_MODULE_BIND_LAZY); - g_free (file_name); - - if (module != NULL) - { - g_module_symbol (module, "glXGetProcAddress", - (gpointer) &glx_get_proc_address); - if (glx_get_proc_address == NULL) - { - g_module_symbol (module, "glXGetProcAddressARB", - (gpointer) &glx_get_proc_address); - if (glx_get_proc_address == NULL) - { - g_module_symbol (module, "glXGetProcAddressEXT", - (gpointer) &glx_get_proc_address); - } - } - GDK_GL_NOTE (MISC, g_message (" - glXGetProcAddress () - %s", - glx_get_proc_address ? "supported" : "not supported")); - g_module_close (module); - } - else - { - g_warning ("Cannot open %s", file_name); - glx_get_proc_address = NULL; - return NULL; - } - } - - /* Try glXGetProcAddress () */ - - if (glx_get_proc_address != NULL) - { - proc_address = glx_get_proc_address ((unsigned char *) proc_name); - GDK_GL_NOTE (IMPL, g_message (" ** glXGetProcAddress () - %s", - proc_address ? "succeeded" : "failed")); - if (proc_address != NULL) - return proc_address; - } - - /* Try g_module_symbol () */ - - /* libGL */ - file_name = g_module_build_path (NULL, "GL"); - GDK_GL_NOTE (MISC, g_message (" - Open %s", file_name)); - module = g_module_open (file_name, G_MODULE_BIND_LAZY); - g_free (file_name); - - if (module != NULL) - { - g_module_symbol (module, proc_name, (gpointer) &proc_address); - GDK_GL_NOTE (MISC, g_message (" - g_module_symbol () - %s", - proc_address ? "succeeded" : "failed")); - g_module_close (module); - } - else - { - g_warning ("Cannot open %s", file_name); - } - - if (proc_address == NULL) - { - /* libGLcore */ - file_name = g_module_build_path (NULL, "GLcore"); - GDK_GL_NOTE (MISC, g_message (" - Open %s", file_name)); - module = g_module_open (file_name, G_MODULE_BIND_LAZY); - g_free (file_name); - - if (module != NULL) - { - g_module_symbol (module, proc_name, (gpointer) &proc_address); - GDK_GL_NOTE (MISC, g_message (" - g_module_symbol () - %s", - proc_address ? "succeeded" : "failed")); - g_module_close (module); - } - } - } - else - { - /* libGLU */ - file_name = g_module_build_path (NULL, "GLU"); - GDK_GL_NOTE (MISC, g_message (" - Open %s", file_name)); - module = g_module_open (file_name, G_MODULE_BIND_LAZY); - g_free (file_name); - - if (module != NULL) - { - g_module_symbol (module, proc_name, (gpointer) &proc_address); - GDK_GL_NOTE (MISC, g_message (" - g_module_symbol () - %s", - proc_address ? "succeeded" : "failed")); - g_module_close (module); - } - else - { - g_warning ("Cannot open %s", file_name); - } - } - - return proc_address; - -#endif /* __APPLE__ */ -} - -/*< private >*/ -void -_gdk_x11_gl_print_glx_info (Display *xdisplay, - int screen_num) -{ - static gboolean done = FALSE; - - if (!done) - { - g_message (" -- Server GLX_VENDOR : %s", - glXQueryServerString (xdisplay, screen_num, GLX_VENDOR)); - g_message (" -- Server GLX_VERSION : %s", - glXQueryServerString (xdisplay, screen_num, GLX_VERSION)); - g_message (" -- Server GLX_EXTENSIONS : %s", - glXQueryServerString (xdisplay, screen_num, GLX_EXTENSIONS)); - - g_message (" -- Client GLX_VENDOR : %s", - glXGetClientString (xdisplay, GLX_VENDOR)); - g_message (" -- Client GLX_VERSION : %s", - glXGetClientString (xdisplay, GLX_VERSION)); - g_message (" -- Client GLX_EXTENSIONS : %s", - glXGetClientString (xdisplay, GLX_EXTENSIONS)); - - done = TRUE; - } -} diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglquery-x11.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglquery-x11.h deleted file mode 100644 index 23154099..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglquery-x11.h +++ /dev/null @@ -1,39 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __GDK_GL_QUERY_X11_H__ -#define __GDK_GL_QUERY_X11_H__ - -#include "gdkglquery.h" - -G_BEGIN_DECLS - -gboolean -_gdk_x11_gl_query_extension_for_display (GdkDisplay *display); - -gboolean -_gdk_x11_gl_query_version_for_display (GdkDisplay *display, - int *major, - int *minor); - -GdkGLProc -_gdk_x11_gl_get_proc_address (const char *proc_name); - -G_END_DECLS - -#endif /* __GDK_GL_QUERY_X11_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglwindow-x11.c b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglwindow-x11.c deleted file mode 100644 index 91e00383..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglwindow-x11.c +++ /dev/null @@ -1,262 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include <string.h> - -#include "gdkglx.h" -#include "gdkglprivate-x11.h" -#include "gdkglconfig-x11.h" -#include "gdkglcontext-x11.h" -#include "gdkglwindow-x11.h" - -#include <gdk/gdkglquery.h> - -static GdkGLContext *_gdk_x11_gl_window_impl_create_gl_context (GdkGLWindow *glwindow, - GdkGLContext *share_list, - gboolean direct, - int render_type); -static gboolean _gdk_x11_gl_window_impl_is_double_buffered (GdkGLWindow *glwindow); -static void _gdk_x11_gl_window_impl_swap_buffers (GdkGLWindow *glwindow); -static void _gdk_x11_gl_window_impl_wait_gl (GdkGLWindow *glwindow); -static void _gdk_x11_gl_window_impl_wait_gdk (GdkGLWindow *glwindow); -static GdkGLConfig *_gdk_x11_gl_window_impl_get_gl_config (GdkGLWindow *glwindow); -static Window _gdk_x11_gl_window_impl_get_glxwindow (GdkGLWindow *glwindow); - -G_DEFINE_TYPE (GdkGLWindowImplX11, - gdk_gl_window_impl_x11, - GDK_TYPE_GL_WINDOW_IMPL); - -static void -gdk_gl_window_impl_x11_init (GdkGLWindowImplX11 *self) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - self->glxwindow = None; - self->glconfig = NULL; - self->is_destroyed = 0; -} - -static void -_gdk_x11_gl_window_impl_destroy (GdkGLWindow *glwindow) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - GdkGLWindowImplX11 *x11_impl = GDK_GL_WINDOW_IMPL_X11 (glwindow->impl); - Display *xdisplay; - Bool (APIENTRY *ReleaseBuffersMESA) (Display*, GLXDrawable); - - if (x11_impl->is_destroyed) - return; - - xdisplay = GDK_GL_CONFIG_XDISPLAY (x11_impl->glconfig); - - if (x11_impl->glxwindow == glXGetCurrentDrawable ()) - { - glXWaitGL (); - - GDK_GL_NOTE_FUNC_IMPL ("glXMakeCurrent"); - glXMakeCurrent (xdisplay, None, NULL); - } - - if (gdk_x11_gl_query_glx_extension (x11_impl->glconfig, "GLX_MESA_release_buffers")) - { - /* Release buffers if GLX_MESA_release_buffers is supported. */ - - ReleaseBuffersMESA = (Bool (APIENTRY *)(Display*, GLXDrawable)) - gdk_gl_get_proc_address("glXReleaseBuffersMESA"); - - GDK_GL_NOTE_FUNC_IMPL ("glXReleaseBuffersMESA"); - if (ReleaseBuffersMESA) - ReleaseBuffersMESA (xdisplay, x11_impl->glxwindow); - } - - x11_impl->glxwindow = None; - - x11_impl->is_destroyed = TRUE; -} - -static void -gdk_gl_window_impl_x11_finalize (GObject *object) -{ - GdkGLWindowImplX11 *impl = GDK_GL_WINDOW_IMPL_X11 (object); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - _gdk_x11_gl_window_impl_destroy (GDK_GL_WINDOW (object)); - - g_object_unref (G_OBJECT (impl->glconfig)); - - G_OBJECT_CLASS (gdk_gl_window_impl_x11_parent_class)->finalize (object); -} - -static void -gdk_gl_window_impl_x11_class_init (GdkGLWindowImplX11Class *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - klass->get_glxwindow = _gdk_x11_gl_window_impl_get_glxwindow; - - klass->parent_class.create_gl_context = _gdk_x11_gl_window_impl_create_gl_context; - klass->parent_class.is_double_buffered = _gdk_x11_gl_window_impl_is_double_buffered; - klass->parent_class.swap_buffers = _gdk_x11_gl_window_impl_swap_buffers; - klass->parent_class.wait_gl = _gdk_x11_gl_window_impl_wait_gl; - klass->parent_class.wait_gdk = _gdk_x11_gl_window_impl_wait_gdk; - klass->parent_class.get_gl_config = _gdk_x11_gl_window_impl_get_gl_config; - klass->parent_class.destroy_gl_window_impl = _gdk_x11_gl_window_impl_destroy; - - object_class->finalize = gdk_gl_window_impl_x11_finalize; -} - -/* - * attrib_list is currently unused. This must be set to NULL or empty - * (first attribute of None). See GLX 1.3 spec. - */ -GdkGLWindow * -_gdk_x11_gl_window_impl_new (GdkGLWindow *glwindow, - GdkGLConfig *glconfig, - GdkWindow *window, - const int *attrib_list) -{ - GdkGLWindowImplX11 *x11_impl; - - /* GLXWindow glxwindow; */ - Window glxwindow; - - GDK_GL_NOTE_FUNC (); - - g_return_val_if_fail (GDK_IS_X11_GL_WINDOW (glwindow), NULL); - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); - - /* - * Get X Window. - */ - - glxwindow = GDK_WINDOW_XID (window); - - /* - * Instantiate the GdkGLWindowImplX11 object. - */ - - x11_impl = g_object_new (GDK_TYPE_GL_WINDOW_IMPL_X11, NULL); - GDK_GL_NOTE_FUNC (); - - x11_impl->glxwindow = glxwindow; - x11_impl->glconfig = glconfig; - g_object_ref (G_OBJECT (x11_impl->glconfig)); - - x11_impl->is_destroyed = FALSE; - - glwindow->impl = GDK_GL_WINDOW_IMPL(x11_impl); - glwindow->window = window; - g_object_add_weak_pointer (G_OBJECT (glwindow->window), - (gpointer *) &(glwindow->window)); - - return glwindow; -} - -static GdkGLContext * -_gdk_x11_gl_window_impl_create_gl_context (GdkGLWindow *glwindow, - GdkGLContext *share_list, - gboolean direct, - int render_type) -{ - GdkGLContext *glcontext; - GdkGLContextImpl *impl; - - glcontext = g_object_new(GDK_TYPE_X11_GL_CONTEXT, NULL); - - g_return_val_if_fail(glcontext != NULL, NULL); - - impl = _gdk_x11_gl_context_impl_new(glcontext, - GDK_GL_DRAWABLE(glwindow), - share_list, - direct, - render_type); - if (impl == NULL) - g_object_unref(glcontext); - - g_return_val_if_fail(impl != NULL, NULL); - - return glcontext; -} - -static gboolean -_gdk_x11_gl_window_impl_is_double_buffered (GdkGLWindow *glwindow) -{ - g_return_val_if_fail (GDK_IS_X11_GL_WINDOW (glwindow), FALSE); - - return gdk_gl_config_is_double_buffered (GDK_GL_WINDOW_IMPL_X11 (glwindow->impl)->glconfig); -} - -static void -_gdk_x11_gl_window_impl_swap_buffers (GdkGLWindow *glwindow) -{ - Display *xdisplay; - Window glxwindow; - - g_return_if_fail (GDK_IS_X11_GL_WINDOW (glwindow)); - - xdisplay = GDK_GL_CONFIG_XDISPLAY (GDK_GL_WINDOW_IMPL_X11 (glwindow->impl)->glconfig); - glxwindow = GDK_GL_WINDOW_IMPL_X11 (glwindow->impl)->glxwindow; - - if (glxwindow == None) - return; - - GDK_GL_NOTE_FUNC_IMPL ("glXSwapBuffers"); - - glXSwapBuffers (xdisplay, glxwindow); -} - -static void -_gdk_x11_gl_window_impl_wait_gl (GdkGLWindow *glwindow) -{ - g_return_if_fail (GDK_IS_X11_GL_WINDOW (glwindow)); - - glXWaitGL (); -} - -static void -_gdk_x11_gl_window_impl_wait_gdk (GdkGLWindow *glwindow) -{ - g_return_if_fail (GDK_IS_X11_GL_WINDOW (glwindow)); - - glXWaitX (); -} - -static GdkGLConfig * -_gdk_x11_gl_window_impl_get_gl_config (GdkGLWindow *glwindow) -{ - g_return_val_if_fail (GDK_IS_X11_GL_WINDOW (glwindow), NULL); - - return GDK_GL_WINDOW_IMPL_X11 (glwindow->impl)->glconfig; -} - -static Window -_gdk_x11_gl_window_impl_get_glxwindow (GdkGLWindow *glwindow) -{ - g_return_val_if_fail (GDK_IS_X11_GL_WINDOW (glwindow), None); - - return GDK_GL_WINDOW_IMPL_X11 (glwindow->impl)->glxwindow; -} diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglwindow-x11.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglwindow-x11.h deleted file mode 100644 index 8c16517d..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglwindow-x11.h +++ /dev/null @@ -1,68 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __GDK_GL_WINDOW_X11_H__ -#define __GDK_GL_WINDOW_X11_H__ - -#include <gdk/gdkx.h> - -#include <gdk/gdkglwindow.h> -#include <gdk/gdkglwindowimpl.h> - -G_BEGIN_DECLS - -typedef struct _GdkGLWindowImplX11 GdkGLWindowImplX11; -typedef struct _GdkGLWindowImplX11Class GdkGLWindowImplX11Class; - -#define GDK_TYPE_GL_WINDOW_IMPL_X11 (gdk_gl_window_impl_x11_get_type ()) -#define GDK_GL_WINDOW_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GL_WINDOW_IMPL_X11, GdkGLWindowImplX11)) -#define GDK_GL_WINDOW_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_WINDOW_IMPL_X11, GdkGLWindowImplX11Class)) -#define GDK_IS_GL_WINDOW_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GL_WINDOW_IMPL_X11)) -#define GDK_IS_GL_WINDOW_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_WINDOW_IMPL_X11)) -#define GDK_GL_WINDOW_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_WINDOW_IMPL_X11, GdkGLWindowImplX11Class)) - -struct _GdkGLWindowImplX11 -{ - GdkGLWindowImpl parent_instance; - - /* GLXWindow glxwindow; */ - Window glxwindow; - - GdkGLConfig *glconfig; - - guint is_destroyed : 1; -}; - -struct _GdkGLWindowImplX11Class -{ - GdkGLWindowImplClass parent_class; - - Window (*get_glxwindow) (GdkGLWindow *glwindow); -}; - -GType gdk_gl_window_impl_x11_get_type (void); - -GdkGLWindow * -_gdk_x11_gl_window_impl_new (GdkGLWindow *glwindow, - GdkGLConfig *glconfig, - GdkWindow *window, - const int *attrib_list); - -G_END_DECLS - -#endif /* __GDK_GL_WINDOW_X11_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglx.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglx.h deleted file mode 100644 index 2655e67f..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkglx.h +++ /dev/null @@ -1,39 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __GDK_GL_X_H__ -#define __GDK_GL_X_H__ - -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -#include <gdk/gdkx.h> - -#include <GL/gl.h> -#include <GL/glx.h> - -#define __GDKGLX_H_INSIDE__ - -#include <gdk/x11/gdkx11glconfig.h> -#include <gdk/x11/gdkx11glcontext.h> -#include <gdk/x11/gdkx11glquery.h> -#include <gdk/x11/gdkx11glwindow.h> - -#undef __GDKGLX_H_INSIDE__ - -#endif /* __GDK_GL_X_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glconfig.c b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glconfig.c deleted file mode 100644 index 426d28f7..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glconfig.c +++ /dev/null @@ -1,245 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2012 Thomas Zimmermann - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include <gdk/gdkgldebug.h> -#include <gdk/x11/gdkglx.h> - -#include "gdkglconfig-x11.h" - -struct _GdkX11GLConfig -{ - GdkGLConfig parent; -}; - -struct _GdkX11GLConfigClass -{ - GdkGLConfigClass parent_class; -}; - -G_DEFINE_TYPE (GdkX11GLConfig, gdk_x11_gl_config, GDK_TYPE_GL_CONFIG); - -static void -gdk_x11_gl_config_init (GdkX11GLConfig *self) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); -} - -static void -gdk_x11_gl_config_finalize (GObject *object) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - G_OBJECT_CLASS (gdk_x11_gl_config_parent_class)->finalize (object); -} - -static void -gdk_x11_gl_config_class_init (GdkX11GLConfigClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - object_class->finalize = gdk_x11_gl_config_finalize; -} - -/** - * gdk_x11_gl_config_new_for_display: - * @display: display. - * @attrib_list: (array length=n_attribs): the attribute list. - * @n_attribs: the number of attributes and values in attrib_list - * - * Creates a #GdkGLConfig on the given display. - * - * Return value: the new #GdkGLConfig. - **/ -GdkGLConfig * -gdk_x11_gl_config_new_for_display(GdkDisplay *display, const int *attrib_list, gsize n_attribs) -{ - GdkGLConfig *glconfig; - GdkGLConfig *impl; - - g_return_val_if_fail(GDK_IS_X11_DISPLAY(display), NULL); - - glconfig = g_object_new(GDK_TYPE_X11_GL_CONFIG, NULL); - - g_return_val_if_fail(glconfig != NULL, NULL); - - impl = _gdk_x11_gl_config_impl_new(glconfig, attrib_list, n_attribs); - - if (impl == NULL) - g_object_unref(glconfig); - - g_return_val_if_fail(impl != NULL, NULL); - - return glconfig; -} - -/** - * gdk_x11_gl_config_new_for_screen: - * @screen: target screen. - * @attrib_list: (array length=n_attribs): the attribute list. - * @n_attribs: the number of attributes and values in attrib_list - * - * Creates a #GdkGLConfig on the given display. - * - * Return value: the new #GdkGLConfig. - **/ -GdkGLConfig * -gdk_x11_gl_config_new_for_screen(GdkScreen *screen, const int *attrib_list, gsize n_attribs) -{ - GdkGLConfig *glconfig; - GdkGLConfig *impl; - - g_return_val_if_fail(GDK_IS_X11_SCREEN(screen), NULL); - - glconfig = g_object_new(GDK_TYPE_X11_GL_CONFIG, NULL); - - g_return_val_if_fail(glconfig != NULL, NULL); - - impl = _gdk_x11_gl_config_impl_new(glconfig, attrib_list, n_attribs); - - if (impl == NULL) - g_object_unref(glconfig); - - g_return_val_if_fail(impl != NULL, NULL); - - return glconfig; -} - -/** - * gdk_x11_gl_config_new_from_visualid: - * @xvisualid: visual ID. - * - * Creates #GdkGLConfig from given visual ID that specifies the OpenGL-capable - * visual. - * - * Return value: the new #GdkGLConfig. - **/ -GdkGLConfig * -gdk_x11_gl_config_new_from_visualid (VisualID xvisualid) -{ - GdkScreen *screen; - GdkGLConfig *glconfig; - GdkGLConfig *impl; - - GDK_GL_NOTE_FUNC (); - - screen = gdk_screen_get_default (); - - glconfig = g_object_new(GDK_TYPE_X11_GL_CONFIG, NULL); - - g_return_val_if_fail(glconfig != NULL, NULL); - - impl = _gdk_x11_gl_config_impl_new_from_visualid_for_screen (glconfig, - screen, - xvisualid); - if (impl == NULL) - g_object_unref(glconfig); - - g_return_val_if_fail(impl != NULL, NULL); - - return glconfig; -} - -/** - * gdk_x11_gl_config_new_from_visualid_for_screen: - * @screen: target screen. - * @xvisualid: visual ID. - * - * Creates #GdkGLConfig from given visual ID that specifies the OpenGL-capable - * visual. - * - * Return value: the new #GdkGLConfig. - **/ -GdkGLConfig * -gdk_x11_gl_config_new_from_visualid_for_screen (GdkScreen *screen, - VisualID xvisualid) -{ - GdkGLConfig *glconfig; - GdkGLConfig *impl; - - GDK_GL_NOTE_FUNC (); - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - glconfig = g_object_new(GDK_TYPE_X11_GL_CONFIG, NULL); - - g_return_val_if_fail(glconfig != NULL, NULL); - - impl = _gdk_x11_gl_config_impl_new_from_visualid_for_screen (glconfig, - screen, - xvisualid); - if (impl == NULL) - g_object_unref(glconfig); - - g_return_val_if_fail(impl != NULL, NULL); - - return glconfig; -} - -/** - * gdk_x11_gl_config_get_xdisplay: - * @glconfig: a #GdkGLConfig. - * - * Gets X Display. - * - * Return value: pointer to the Display. - **/ -Display * -gdk_x11_gl_config_get_xdisplay (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - - return GDK_GL_CONFIG_IMPL_X11_CLASS (glconfig)->get_xdisplay(glconfig); -} - -/** - * gdk_x11_gl_config_get_screen_number: - * @glconfig: a #GdkGLConfig. - * - * Gets X screen number. - * - * Return value: the screen number. - **/ -int -gdk_x11_gl_config_get_screen_number (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), 0); - - return GDK_GL_CONFIG_IMPL_X11_CLASS (glconfig)->get_screen_number(glconfig); -} - -/** - * gdk_x11_gl_config_get_xvinfo: - * @glconfig: a #GdkGLConfig. - * - * Gets XVisualInfo data. - * - * Return value: pointer to the XVisualInfo data. - **/ -XVisualInfo * -gdk_x11_gl_config_get_xvinfo (GdkGLConfig *glconfig) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONFIG (glconfig), NULL); - - return GDK_GL_CONFIG_IMPL_X11_CLASS (glconfig)->get_xvinfo(glconfig); -} diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glconfig.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glconfig.h deleted file mode 100644 index abebd9f2..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glconfig.h +++ /dev/null @@ -1,82 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#if !defined (__GDKGLX_H_INSIDE__) && !defined (GDK_GL_COMPILATION) -#error "Only <gdk/gdkglx.h> can be included directly." -#endif - -#ifndef __GDK_X11_GL_CONFIG_H__ -#define __GDK_X11_GL_CONFIG_H__ - -#include <gdk/gdkx.h> -#include <gdk/gdkgl.h> - -G_BEGIN_DECLS - -#define GDK_TYPE_X11_GL_CONFIG (gdk_x11_gl_config_get_type ()) -#define GDK_X11_GL_CONFIG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_GL_CONFIG, GdkX11GLConfig)) -#define GDK_X11_GL_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_GL_CONFIG, GdkX11GLConfigClass)) -#define GDK_IS_X11_GL_CONFIG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_GL_CONFIG)) -#define GDK_IS_X11_GL_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_GL_CONFIG)) -#define GDK_X11_GL_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_GL_CONFIG, GdkX11GLConfigClass)) - -#ifdef INSIDE_GDK_GL_X11 -typedef struct _GdkX11GLConfig GdkX11GLConfig; -#else -typedef GdkGLConfig GdkX11GLConfig; -#endif -typedef struct _GdkX11GLConfigClass GdkX11GLConfigClass; - -GType gdk_x11_gl_config_get_type (void); - -GdkGLConfig *gdk_x11_gl_config_new_for_display (GdkDisplay *display, - const int *attrib_list, - gsize n_attribs); - -GdkGLConfig *gdk_x11_gl_config_new_for_screen (GdkScreen *screen, - const int *attrib_list, - gsize n_attribs); - -#ifndef GDK_MULTIHEAD_SAFE -GdkGLConfig *gdk_x11_gl_config_new_from_visualid (VisualID xvisualid); -#endif /* GDK_MULTIHEAD_SAFE */ - -GdkGLConfig *gdk_x11_gl_config_new_from_visualid_for_screen (GdkScreen *screen, - VisualID xvisualid); - -Display *gdk_x11_gl_config_get_xdisplay (GdkGLConfig *glconfig); -int gdk_x11_gl_config_get_screen_number (GdkGLConfig *glconfig); -XVisualInfo *gdk_x11_gl_config_get_xvinfo (GdkGLConfig *glconfig); - -#ifdef INSIDE_GDK_GL_X11 - -#define GDK_GL_CONFIG_XDISPLAY(glconfig) (GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->xdisplay) -#define GDK_GL_CONFIG_SCREEN_XNUMBER(glconfig) (GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->screen_num) -#define GDK_GL_CONFIG_XVINFO(glconfig) (GDK_GL_CONFIG_IMPL_X11 (glconfig->impl)->xvinfo) - -#else - -#define GDK_GL_CONFIG_XDISPLAY(glconfig) (gdk_x11_gl_config_get_xdisplay (glconfig)) -#define GDK_GL_CONFIG_SCREEN_XNUMBER(glconfig) (gdk_x11_gl_config_get_screen_number (glconfig)) -#define GDK_GL_CONFIG_XVINFO(glconfig) (gdk_x11_gl_config_get_xvinfo (glconfig)) - -#endif - -G_END_DECLS - -#endif /* __GDK_X11_GL_CONFIG_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glcontext.c b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glcontext.c deleted file mode 100644 index 5cca77d1..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glcontext.c +++ /dev/null @@ -1,115 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2012 Thomas Zimmermann - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include <gdk/gdkgldebug.h> -#include <gdk/x11/gdkglx.h> - -#include "gdkglcontext-x11.h" - -struct _GdkX11GLContext -{ - GdkGLContext parent; -}; - -struct _GdkX11GLContextClass -{ - GdkGLContextClass parent_class; -}; - -G_DEFINE_TYPE (GdkX11GLContext, gdk_x11_gl_context, GDK_TYPE_GL_CONTEXT); - -static void -gdk_x11_gl_context_init (GdkX11GLContext *self) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); -} - -static void -gdk_x11_gl_context_finalize (GObject *object) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - G_OBJECT_CLASS (gdk_x11_gl_context_parent_class)->finalize (object); -} - -static void -gdk_x11_gl_context_class_init (GdkX11GLContextClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - object_class->finalize = gdk_x11_gl_context_finalize; -} - -/** - * gdk_x11_gl_context_foreign_new: - * @glconfig: #GdkGLConfig that represents the visual the GLXContext uses. - * @share_list: the #GdkGLContext which shares display lists with the - * GLXContext, or NULL. - * @glxcontext: exsisting GLXContext. - * - * Creates #GdkGLContext from existing GLXContext. - * - * Return value: the newly-created #GdkGLContext wrapper. - **/ -GdkGLContext * -gdk_x11_gl_context_foreign_new (GdkGLConfig *glconfig, - GdkGLContext *share_list, - GLXContext glxcontext) -{ - GdkGLContext *glcontext; - GdkGLContextImpl *impl; - - GDK_GL_NOTE_FUNC (); - - glcontext = g_object_new(GDK_TYPE_GL_CONTEXT_IMPL_X11, NULL); - - g_return_val_if_fail(glcontext != NULL, NULL); - - impl = _gdk_x11_gl_context_impl_new_from_glxcontext(glcontext, - glconfig, - share_list, - glxcontext); - if (impl == NULL) - g_object_unref(glcontext); - - g_return_val_if_fail(impl != NULL, NULL); - - return glcontext; -} - -/** - * gdk_x11_gl_context_get_glxcontext: - * @glcontext: a #GdkGLContext. - * - * Gets GLXContext. - * - * Return value: the GLXContext. - **/ -GLXContext -gdk_x11_gl_context_get_glxcontext (GdkGLContext *glcontext) -{ - g_return_val_if_fail (GDK_IS_X11_GL_CONTEXT (glcontext), NULL); - - return GDK_GL_CONTEXT_IMPL_X11_CLASS (glcontext)->get_glxcontext(glcontext); -} diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glcontext.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glcontext.h deleted file mode 100644 index 88c857c7..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glcontext.h +++ /dev/null @@ -1,65 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#if !defined (__GDKGLX_H_INSIDE__) && !defined (GDK_GL_COMPILATION) -#error "Only <gdk/gdkglx.h> can be included directly." -#endif - -#ifndef __GDK_X11_GL_CONTEXT_H__ -#define __GDK_X11_GL_CONTEXT_H__ - -#include <gdk/gdkx.h> -#include <gdk/gdkgl.h> - -G_BEGIN_DECLS - -#define GDK_TYPE_X11_GL_CONTEXT (gdk_x11_gl_context_get_type ()) -#define GDK_X11_GL_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_GL_CONTEXT, GdkX11GLContext)) -#define GDK_X11_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_GL_CONTEXT, GdkX11GLContextClass)) -#define GDK_IS_X11_GL_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_GL_CONTEXT)) -#define GDK_IS_X11_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_GL_CONTEXT)) -#define GDK_X11_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_GL_CONTEXT, GdkX11GLContextClass)) - -#ifdef INSIDE_GDK_GL_X11 -typedef struct _GdkX11GLContext GdkX11GLContext; -#else -typedef GdkGLContext GdkX11GLContext; -#endif -typedef struct _GdkX11GLContextClass GdkX11GLContextClass; - -GType gdk_x11_gl_context_get_type (void); - -GdkGLContext *gdk_x11_gl_context_foreign_new (GdkGLConfig *glconfig, - GdkGLContext *share_list, - GLXContext glxcontext); - -GLXContext gdk_x11_gl_context_get_glxcontext (GdkGLContext *glcontext); - -#ifdef INSIDE_GDK_GL_X11 - -#define GDK_GL_CONTEXT_GLXCONTEXT(glcontext) (GDK_GL_CONTEXT_IMPL_X11 (glcontext->impl)->glxcontext) - -#else - -#define GDK_GL_CONTEXT_GLXCONTEXT(glcontext) (gdk_x11_gl_context_get_glxcontext (glcontext)) - -#endif - -G_END_DECLS - -#endif /* __GDK_GL_GL_CONFIG_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glquery.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glquery.h deleted file mode 100644 index 130f0a68..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glquery.h +++ /dev/null @@ -1,34 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#if !defined (__GDKGLX_H_INSIDE__) && !defined (GDK_GL_COMPILATION) -#error "Only <gdk/gdkglx.h> can be included directly." -#endif - -#ifndef __GDK_X11_GL_QUERY_H__ -#define __GDK_X11_GL_QUERY_H__ - -#include <gdk/gdkgl.h> - -G_BEGIN_DECLS - -gboolean gdk_x11_gl_query_glx_extension (GdkGLConfig *glconfig, - const char *extension); -G_END_DECLS - -#endif /* __GDK_X11_GL_QUERY_H__ */ diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glwindow.c b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glwindow.c deleted file mode 100644 index f4cc8ff0..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glwindow.c +++ /dev/null @@ -1,80 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2012 Thomas Zimmermann - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include <gdk/gdkgldebug.h> -#include <gdk/x11/gdkglx.h> - -#include "gdkglwindow-x11.h" - -struct _GdkX11GLWindow -{ - GdkGLWindow parent; -}; - -struct _GdkX11GLWindowClass -{ - GdkGLWindowClass parent_class; -}; - -G_DEFINE_TYPE (GdkX11GLWindow, - gdk_x11_gl_window, - GDK_TYPE_GL_WINDOW) - -static void -gdk_x11_gl_window_init (GdkX11GLWindow *self) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); -} - -static void -gdk_x11_gl_window_finalize (GObject *object) -{ - GDK_GL_NOTE_FUNC_PRIVATE (); - - G_OBJECT_CLASS (gdk_x11_gl_window_parent_class)->finalize (object); -} - -static void -gdk_x11_gl_window_class_init (GdkX11GLWindowClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GDK_GL_NOTE_FUNC_PRIVATE (); - - object_class->finalize = gdk_x11_gl_window_finalize; -} - -/** - * gdk_x11_gl_window_get_glxwindow: - * @glwindow: a #GdkGLWindow. - * - * Gets X Window. - * - * Return value: the Window. - **/ -Window -gdk_x11_gl_window_get_glxwindow (GdkGLWindow *glwindow) -{ - g_return_val_if_fail (GDK_IS_X11_GL_WINDOW (glwindow), None); - - return GDK_GL_WINDOW_IMPL_X11_CLASS (glwindow->impl)->get_glxwindow(glwindow); -} diff --git a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glwindow.h b/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glwindow.h deleted file mode 100644 index 458a0f76..00000000 --- a/plugins/gtkui/gtkglext-gtk3/gdk/x11/gdkx11glwindow.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GdkGLExt - OpenGL Extension to GDK - * Copyright (C) 2002-2004 Naofumi Yasufuku - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#if !defined (__GDKGLX_H_INSIDE__) && !defined (GDK_GL_COMPILATION) -#error "Only <gdk/gdkglx.h> can be included directly." -#endif - -#ifndef __GDK_X11_GL_WINDOW_H__ -#define __GDK_X11_GL_WINDOW_H__ - -#include <gdk/gdkx.h> - -#include <gdk/gdkgl.h> - -G_BEGIN_DECLS - -#define GDK_TYPE_X11_GL_WINDOW (gdk_x11_gl_window_get_type ()) -#define GDK_X11_GL_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_GL_WINDOW, GdkX11GLWindow)) -#define GDK_X11_GL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_GL_WINDOW, GdkX11GLWindowClass)) -#define GDK_IS_X11_GL_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_GL_WINDOW)) -#define GDK_IS_X11_GL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_GL_WINDOW)) -#define GDK_X11_GL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_GL_WINDOW, GdkX11GLWindowClass)) - -#ifdef INSIDE_GDK_GL_X11 -typedef struct _GdkX11GLWindow GdkX11GLWindow; -#else -typedef GdkGLWindow GdkX11GLWindow; -#endif -typedef struct _GdkX11GLWindowClass GdkX11GLWindowClass; - -GType gdk_x11_gl_window_get_type (void); - -Window gdk_x11_gl_window_get_glxwindow (GdkGLWindow *glwindow); - -#ifdef INSIDE_GDK_GL_X11 - -#define GDK_GL_WINDOW_GLXWINDOW(glwindow) (GDK_GL_WINDOW_IMPL_X11 (glwindow->impl)->glxwindow) - -#else - -#define GDK_GL_WINDOW_GLXWINDOW(glwindow) (gdk_x11_gl_window_get_glxwindow (glwindow)) - -#endif - -G_END_DECLS - -#endif /* __GDK_X11_GL_WINDOW_H__ */ |