From 02aeed3de255274da23fb5b889c73c640288e78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 21 Mar 2008 17:50:59 +0000 Subject: [PATCH] No deprecated. svn path=/trunk/KDE/kdebase/workspace/; revision=788516 --- scene_opengl.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index f13c9f091e..f0400941c7 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -289,22 +289,12 @@ void SceneOpenGL::cleanupShm() #endif } -// TODO replace with just KXErrorHandler::errorCode() for 4.1 -static int xerror = 0; -static bool xerrorhandler( int, int error, unsigned long ) - { - if( xerror == 0 ) - xerror = error; - return true; - } - bool SceneOpenGL::initRenderingContext() { bool direct_rendering = options->glDirect; if( !tfp_mode && !shm_mode ) direct_rendering = false; // fallback doesn't seem to work with direct rendering - xerror = 0; - KXErrorHandler errs1( xerrorhandler ); + KXErrorHandler errs1; ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, direct_rendering ? GL_TRUE : GL_FALSE ); bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer )); @@ -314,22 +304,23 @@ bool SceneOpenGL::initRenderingContext() { if( !direct_rendering ) { - kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (0x" << hex << xerror << ")"; + kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (" + << KXErrorHandler::errorMessage( errs1.errorEvent()) << ")"; return false; } glXMakeCurrent( display(), None, NULL ); if( ctxbuffer != NULL ) glXDestroyContext( display(), ctxbuffer ); direct_rendering = false; // try again - xerror = 0; - KXErrorHandler errs2( xerrorhandler ); + KXErrorHandler errs2; ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, GL_FALSE ); bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer )); if( errs2.error( true )) failed = true; if( failed ) { - kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (0x" << hex << xerror << ")"; + kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (" + << KXErrorHandler::errorMessage( errs2.errorEvent()) << ")"; return false; } }