quartz: Non-implementation of GdkGLContext

This makes sure the Quartz backend returns an error when asked to create
a GL context, rather than crashing because of a NULL vfunc.

https://bugzilla.gnome.org/show_bug.cgi?id=740199
This commit is contained in:
Philip Chimento 2015-04-08 23:31:51 -07:00 committed by Matthias Clasen
parent 33d1bea423
commit 0c4deb656e
4 changed files with 84 additions and 0 deletions

View File

@ -33,6 +33,8 @@ libgdk_quartz_la_SOURCES = \
gdkdnd-quartz.h \
gdkevents-quartz.c \
gdkeventloop-quartz.c \
gdkglcontext-quartz.c \
gdkglcontext-quartz.h \
gdkglobals-quartz.c \
gdkkeys-quartz.c \
gdkprivate-quartz.h \

View File

@ -0,0 +1,39 @@
/* GDK - The GIMP Drawing Kit
*
* gdkglcontext-quartz.c: Quartz specific OpenGL wrappers
*
* Copyright © 2014 Emmanuele Bassi
* Copyright © 2014 Alexander Larsson
* Copyright © 2014 Brion Vibber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkglcontext-quartz.h"
#include "gdkintl.h"
GdkGLContext *
gdk_quartz_window_create_gl_context (GdkWindow *window,
gboolean attached,
GdkGLContext *share,
GError **error)
{
/* FIXME: implement */
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("Not implemented on OS X"));
return NULL;
}

View File

@ -0,0 +1,41 @@
/* GDK - The GIMP Drawing Kit
*
* gdkglcontext-quartz.h: Private Quartz specific OpenGL wrappers
*
* Copyright © 2014 Emmanuele Bassi
* Copyright © 2014 Red Hat, Int
* Copyright © 2014 Brion Vibber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_GL_CONTEXT__
#define __GDK_QUARTZ_GL_CONTEXT__
#include "gdkglcontextprivate.h"
#include "gdkvisual.h"
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkmain.h"
G_BEGIN_DECLS
GdkGLContext * gdk_quartz_window_create_gl_context (GdkWindow *window,
gboolean attach,
GdkGLContext *share,
GError **error);
G_END_DECLS
#endif /* __GDK_QUARTZ_GL_CONTEXT__ */

View File

@ -25,6 +25,7 @@
#include "gdkwindowimpl.h"
#include "gdkprivate-quartz.h"
#include "gdkglcontext-quartz.h"
#include "gdkquartzscreen.h"
#include "gdkquartzcursor.h"
@ -2944,6 +2945,7 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
impl_class->change_property = _gdk_quartz_window_change_property;
impl_class->delete_property = _gdk_quartz_window_delete_property;
impl_class->create_gl_context = gdk_quartz_window_create_gl_context;
impl_quartz_class->get_context = gdk_window_impl_quartz_get_context;
impl_quartz_class->release_context = gdk_window_impl_quartz_release_context;