Add build checks for XComposite, XDamage, XRender, OpenGL, and XShm.
KWin should now build and run with/without any or all of the above. svn path=/branches/work/kwin_composite/; revision=633387
This commit is contained in:
parent
8f8c6d049b
commit
8299541652
11 changed files with 94 additions and 13 deletions
|
@ -66,11 +66,16 @@ set(kwin_KDEINIT_SRCS
|
||||||
effects/zoom.cpp
|
effects/zoom.cpp
|
||||||
effects/test_input.cpp
|
effects/test_input.cpp
|
||||||
effects/presentwindows.cpp
|
effects/presentwindows.cpp
|
||||||
effects/wavywindows.cpp
|
|
||||||
effects/minimizeanimation.cpp
|
effects/minimizeanimation.cpp
|
||||||
effects/desktopchangeslide.cpp
|
effects/desktopchangeslide.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(HAVE_OPENGL)
|
||||||
|
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
|
||||||
|
effects/wavywindows.cpp
|
||||||
|
)
|
||||||
|
endif(HAVE_OPENGL)
|
||||||
|
|
||||||
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWinInternal::Workspace )
|
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWinInternal::Workspace )
|
||||||
|
|
||||||
kde4_automoc(kwin ${kwin_KDEINIT_SRCS})
|
kde4_automoc(kwin ${kwin_KDEINIT_SRCS})
|
||||||
|
@ -79,9 +84,11 @@ kde4_automoc(kwin ${kwin_KDEINIT_SRCS})
|
||||||
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
|
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
|
||||||
|
|
||||||
target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} kdecorations ${X11_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY} )
|
target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} kdecorations ${X11_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY} )
|
||||||
target_link_libraries(kdeinit_kwin -lGL)
|
if(OPENGL_FOUND)
|
||||||
# -ldl used by OpenGL code
|
target_link_libraries(kdeinit_kwin ${OPENGL_gl_LIBRARY})
|
||||||
target_link_libraries(kdeinit_kwin -ldl)
|
# -ldl used by OpenGL code
|
||||||
|
target_link_libraries(kdeinit_kwin -ldl)
|
||||||
|
endif(OPENGL_FOUND)
|
||||||
if (X11_Xrandr_FOUND)
|
if (X11_Xrandr_FOUND)
|
||||||
target_link_libraries(kdeinit_kwin ${X11_Xrandr_LIB})
|
target_link_libraries(kdeinit_kwin ${X11_Xrandr_LIB})
|
||||||
endif (X11_Xrandr_FOUND)
|
endif (X11_Xrandr_FOUND)
|
||||||
|
|
|
@ -49,9 +49,9 @@ namespace KWinInternal
|
||||||
// Workspace
|
// Workspace
|
||||||
//****************************************
|
//****************************************
|
||||||
|
|
||||||
#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE )
|
|
||||||
void Workspace::setupCompositing()
|
void Workspace::setupCompositing()
|
||||||
{
|
{
|
||||||
|
#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE )
|
||||||
if( !options->useTranslucency )
|
if( !options->useTranslucency )
|
||||||
return;
|
return;
|
||||||
if( !Extensions::compositeAvailable() || !Extensions::damageAvailable())
|
if( !Extensions::compositeAvailable() || !Extensions::damageAvailable())
|
||||||
|
@ -70,13 +70,20 @@ void Workspace::setupCompositing()
|
||||||
{
|
{
|
||||||
case 'B':
|
case 'B':
|
||||||
scene = new SceneBasic( this );
|
scene = new SceneBasic( this );
|
||||||
|
kDebug( 1212 ) << "X compositing" << endl;
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAVE_XRENDER
|
||||||
case 'X':
|
case 'X':
|
||||||
scene = new SceneXrender( this );
|
scene = new SceneXrender( this );
|
||||||
|
kDebug( 1212 ) << "XRender compositing" << endl;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
case 'O':
|
case 'O':
|
||||||
scene = new SceneOpenGL( this );
|
scene = new SceneOpenGL( this );
|
||||||
|
kDebug( 1212 ) << "OpenGL compositing" << endl;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
kDebug( 1212 ) << "No compositing" << endl;
|
kDebug( 1212 ) << "No compositing" << endl;
|
||||||
return;
|
return;
|
||||||
|
@ -112,12 +119,6 @@ void Workspace::setupCompositing()
|
||||||
compositeTimer.start( compositeRate );
|
compositeTimer.start( compositeRate );
|
||||||
lastCompositePaint.start();
|
lastCompositePaint.start();
|
||||||
XCompositeRedirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
|
XCompositeRedirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
|
||||||
if( dynamic_cast< SceneOpenGL* >( scene ))
|
|
||||||
kDebug( 1212 ) << "OpenGL compositing" << endl;
|
|
||||||
else if( dynamic_cast< SceneXrender* >( scene ))
|
|
||||||
kDebug( 1212 ) << "XRender compositing" << endl;
|
|
||||||
else if( dynamic_cast< SceneBasic* >( scene ))
|
|
||||||
kDebug( 1212 ) << "X compositing" << endl;
|
|
||||||
new EffectsHandler(); // sets also the 'effects' pointer
|
new EffectsHandler(); // sets also the 'effects' pointer
|
||||||
addRepaintFull();
|
addRepaintFull();
|
||||||
foreach( Client* c, clients )
|
foreach( Client* c, clients )
|
||||||
|
@ -134,10 +135,12 @@ void Workspace::setupCompositing()
|
||||||
scene->windowAdded( c );
|
scene->windowAdded( c );
|
||||||
delete popup; // force re-creation of the Alt+F3 popup (opacity option)
|
delete popup; // force re-creation of the Alt+F3 popup (opacity option)
|
||||||
popup = NULL;
|
popup = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::finishCompositing()
|
void Workspace::finishCompositing()
|
||||||
{
|
{
|
||||||
|
#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE )
|
||||||
if( scene == NULL )
|
if( scene == NULL )
|
||||||
return;
|
return;
|
||||||
delete cm_selection;
|
delete cm_selection;
|
||||||
|
@ -176,6 +179,7 @@ void Workspace::finishCompositing()
|
||||||
}
|
}
|
||||||
delete popup; // force re-creation of the Alt+F3 popup (opacity option)
|
delete popup; // force re-creation of the Alt+F3 popup (opacity option)
|
||||||
popup = NULL;
|
popup = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::lostCMSelection()
|
void Workspace::lostCMSelection()
|
||||||
|
@ -207,6 +211,7 @@ void Workspace::addRepaintFull()
|
||||||
|
|
||||||
void Workspace::performCompositing()
|
void Workspace::performCompositing()
|
||||||
{
|
{
|
||||||
|
#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE )
|
||||||
// The event loop apparently tries to fire a QTimer as often as possible, even
|
// The event loop apparently tries to fire a QTimer as often as possible, even
|
||||||
// at the expense of not processing many X events. This means that the composite
|
// at the expense of not processing many X events. This means that the composite
|
||||||
// repaints can seriously impact performance of everything else, therefore throttle
|
// repaints can seriously impact performance of everything else, therefore throttle
|
||||||
|
@ -258,6 +263,7 @@ void Workspace::performCompositing()
|
||||||
compositeTimer.start( compositeRate - paintTime );
|
compositeTimer.start( compositeRate - paintTime );
|
||||||
}
|
}
|
||||||
lastCompositePaint.start();
|
lastCompositePaint.start();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Workspace::windowRepaintsPending() const
|
bool Workspace::windowRepaintsPending() const
|
||||||
|
@ -320,6 +326,7 @@ void Workspace::destroyOverlay()
|
||||||
|
|
||||||
void Toplevel::setupCompositing()
|
void Toplevel::setupCompositing()
|
||||||
{
|
{
|
||||||
|
#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE )
|
||||||
if( !compositing())
|
if( !compositing())
|
||||||
return;
|
return;
|
||||||
if( damage_handle != None )
|
if( damage_handle != None )
|
||||||
|
@ -328,10 +335,12 @@ void Toplevel::setupCompositing()
|
||||||
damage_region = QRegion( 0, 0, width(), height());
|
damage_region = QRegion( 0, 0, width(), height());
|
||||||
effect_window = new EffectWindow();
|
effect_window = new EffectWindow();
|
||||||
effect_window->setWindow( this );
|
effect_window->setWindow( this );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toplevel::finishCompositing()
|
void Toplevel::finishCompositing()
|
||||||
{
|
{
|
||||||
|
#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE )
|
||||||
if( damage_handle == None )
|
if( damage_handle == None )
|
||||||
return;
|
return;
|
||||||
if( effect_window->window() == this ) // otherwise it's already passed to Deleted, don't free data
|
if( effect_window->window() == this ) // otherwise it's already passed to Deleted, don't free data
|
||||||
|
@ -344,6 +353,7 @@ void Toplevel::finishCompositing()
|
||||||
damage_region = QRegion();
|
damage_region = QRegion();
|
||||||
repaints_region = QRegion();
|
repaints_region = QRegion();
|
||||||
effect_window = NULL;
|
effect_window = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toplevel::discardWindowPixmap()
|
void Toplevel::discardWindowPixmap()
|
||||||
|
@ -357,10 +367,15 @@ void Toplevel::discardWindowPixmap()
|
||||||
|
|
||||||
Pixmap Toplevel::createWindowPixmap() const
|
Pixmap Toplevel::createWindowPixmap() const
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_XCOMPOSITE
|
||||||
assert( compositing());
|
assert( compositing());
|
||||||
return XCompositeNameWindowPixmap( display(), frameId());
|
return XCompositeNameWindowPixmap( display(), frameId());
|
||||||
|
#else
|
||||||
|
return None;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_XDAMAGE
|
||||||
void Toplevel::damageNotifyEvent( XDamageNotifyEvent* e )
|
void Toplevel::damageNotifyEvent( XDamageNotifyEvent* e )
|
||||||
{
|
{
|
||||||
addDamage( e->area.x, e->area.y, e->area.width, e->area.height );
|
addDamage( e->area.x, e->area.y, e->area.width, e->area.height );
|
||||||
|
@ -379,6 +394,7 @@ void Toplevel::damageNotifyEvent( XDamageNotifyEvent* e )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Toplevel::addDamage( const QRect& r )
|
void Toplevel::addDamage( const QRect& r )
|
||||||
{
|
{
|
||||||
|
@ -434,6 +450,4 @@ void Toplevel::resetRepaints( const QRect& r )
|
||||||
repaints_region -= r;
|
repaints_region -= r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -28,7 +28,9 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#include "effects/shakymove.h"
|
#include "effects/shakymove.h"
|
||||||
#include "effects/shiftworkspaceup.h"
|
#include "effects/shiftworkspaceup.h"
|
||||||
#include "effects/showfps.h"
|
#include "effects/showfps.h"
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
#include "effects/wavywindows.h"
|
#include "effects/wavywindows.h"
|
||||||
|
#endif
|
||||||
#include "effects/zoom.h"
|
#include "effects/zoom.h"
|
||||||
|
|
||||||
#include "effects/test_input.h"
|
#include "effects/test_input.h"
|
||||||
|
@ -129,7 +131,9 @@ EffectsHandler::EffectsHandler()
|
||||||
registerEffect("ShowFps", new GenericEffectFactory<ShowFpsEffect>);
|
registerEffect("ShowFps", new GenericEffectFactory<ShowFpsEffect>);
|
||||||
registerEffect("Zoom", new GenericEffectFactory<ZoomEffect>);
|
registerEffect("Zoom", new GenericEffectFactory<ZoomEffect>);
|
||||||
registerEffect("PresentWindows", new GenericEffectFactory<PresentWindowsEffect>);
|
registerEffect("PresentWindows", new GenericEffectFactory<PresentWindowsEffect>);
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
registerEffect("WavyWindows", new GenericEffectFactory<WavyWindowsEffect>);
|
registerEffect("WavyWindows", new GenericEffectFactory<WavyWindowsEffect>);
|
||||||
|
#endif
|
||||||
registerEffect("MinimizeAnimation", new GenericEffectFactory<MinimizeAnimationEffect>);
|
registerEffect("MinimizeAnimation", new GenericEffectFactory<MinimizeAnimationEffect>);
|
||||||
registerEffect("Howto", new GenericEffectFactory<HowtoEffect>);
|
registerEffect("Howto", new GenericEffectFactory<HowtoEffect>);
|
||||||
registerEffect("MakeTransparent", new GenericEffectFactory<MakeTransparentEffect>);
|
registerEffect("MakeTransparent", new GenericEffectFactory<MakeTransparentEffect>);
|
||||||
|
|
|
@ -16,7 +16,9 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#include <scene_opengl.h>
|
#include <scene_opengl.h>
|
||||||
#include <scene_xrender.h>
|
#include <scene_xrender.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWinInternal
|
namespace KWinInternal
|
||||||
{
|
{
|
||||||
|
@ -73,12 +75,14 @@ void ShowFpsEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data
|
||||||
++fps; // count all frames in the last second
|
++fps; // count all frames in the last second
|
||||||
if( fps > MAX_TIME )
|
if( fps > MAX_TIME )
|
||||||
fps = MAX_TIME; // keep it the same height
|
fps = MAX_TIME; // keep it the same height
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
if( dynamic_cast< SceneOpenGL* >( scene ))
|
if( dynamic_cast< SceneOpenGL* >( scene ))
|
||||||
{
|
{
|
||||||
paintGL( fps );
|
paintGL( fps );
|
||||||
glFinish(); // make sure all rendering is done
|
glFinish(); // make sure all rendering is done
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
paintX( fps );
|
paintX( fps );
|
||||||
XSync( display(), False ); // make sure all rendering is done
|
XSync( display(), False ); // make sure all rendering is done
|
||||||
|
@ -87,6 +91,7 @@ void ShowFpsEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data
|
||||||
|
|
||||||
void ShowFpsEffect::paintGL( int fps )
|
void ShowFpsEffect::paintGL( int fps )
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
int x = this->x;
|
int x = this->x;
|
||||||
int y = this->y;
|
int y = this->y;
|
||||||
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
|
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
|
||||||
|
@ -141,6 +146,7 @@ void ShowFpsEffect::paintGL( int fps )
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -150,6 +156,7 @@ void ShowFpsEffect::paintGL( int fps )
|
||||||
*/
|
*/
|
||||||
void ShowFpsEffect::paintX( int fps )
|
void ShowFpsEffect::paintX( int fps )
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_XRENDER
|
||||||
Pixmap pixmap = XCreatePixmap( display(), rootWindow(), NUM_PAINTS + FPS_WIDTH, MAX_TIME, 32 );
|
Pixmap pixmap = XCreatePixmap( display(), rootWindow(), NUM_PAINTS + FPS_WIDTH, MAX_TIME, 32 );
|
||||||
XRenderPictFormat* format = XRenderFindStandardFormat( display(), PictStandardARGB32 );
|
XRenderPictFormat* format = XRenderFindStandardFormat( display(), PictStandardARGB32 );
|
||||||
Picture p = XRenderCreatePicture( display(), pixmap, format, 0, NULL );
|
Picture p = XRenderCreatePicture( display(), pixmap, format, 0, NULL );
|
||||||
|
@ -209,6 +216,7 @@ void ShowFpsEffect::paintX( int fps )
|
||||||
XRenderComposite( display(), alpha != 1.0 ? PictOpOver : PictOpSrc, p, None,
|
XRenderComposite( display(), alpha != 1.0 ? PictOpOver : PictOpSrc, p, None,
|
||||||
static_cast< SceneXrender* >( scene )->bufferPicture(), 0, 0, 0, 0, x, y, FPS_WIDTH + NUM_PAINTS, MAX_TIME );
|
static_cast< SceneXrender* >( scene )->bufferPicture(), 0, 0, 0, 0, x, y, FPS_WIDTH + NUM_PAINTS, MAX_TIME );
|
||||||
XRenderFreePicture( display(), p );
|
XRenderFreePicture( display(), p );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowFpsEffect::postPaintScreen()
|
void ShowFpsEffect::postPaintScreen()
|
||||||
|
|
|
@ -701,8 +701,10 @@ bool Client::windowEvent( XEvent* e )
|
||||||
}
|
}
|
||||||
if( e->xany.window == frameId())
|
if( e->xany.window == frameId())
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_XDAMAGE
|
||||||
if( e->type == Extensions::damageNotifyEvent())
|
if( e->type == Extensions::damageNotifyEvent())
|
||||||
damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e ));
|
damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e ));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1636,8 +1638,10 @@ bool Unmanaged::windowEvent( XEvent* e )
|
||||||
if( scene != NULL )
|
if( scene != NULL )
|
||||||
scene->windowGeometryShapeChanged( this );
|
scene->windowGeometryShapeChanged( this );
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_XDAMAGE
|
||||||
if( e->type == Extensions::damageNotifyEvent())
|
if( e->type == Extensions::damageNotifyEvent())
|
||||||
damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e ));
|
damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e ));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
glutils.cpp
11
glutils.cpp
|
@ -33,6 +33,7 @@ int glTextureUnitsCount;
|
||||||
// Functions
|
// Functions
|
||||||
void initGLX()
|
void initGLX()
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
// Get GLX version
|
// Get GLX version
|
||||||
int major, minor;
|
int major, minor;
|
||||||
glXQueryVersion( display(), &major, &minor );
|
glXQueryVersion( display(), &major, &minor );
|
||||||
|
@ -42,10 +43,14 @@ void initGLX()
|
||||||
display(), DefaultScreen( display()))).split(" ");
|
display(), DefaultScreen( display()))).split(" ");
|
||||||
|
|
||||||
glxResolveFunctions();
|
glxResolveFunctions();
|
||||||
|
#else
|
||||||
|
glXVersion = MAKE_GL_VERSION( 0, 0, 0 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void initGL()
|
void initGL()
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
// Get OpenGL version
|
// Get OpenGL version
|
||||||
QString glversionstring = QString((const char*)glGetString(GL_VERSION));
|
QString glversionstring = QString((const char*)glGetString(GL_VERSION));
|
||||||
QStringList glversioninfo = glversionstring.left(glversionstring.indexOf(' ')).split('.');
|
QStringList glversioninfo = glversionstring.left(glversionstring.indexOf(' ')).split('.');
|
||||||
|
@ -56,6 +61,9 @@ void initGL()
|
||||||
|
|
||||||
// handle OpenGL extensions functions
|
// handle OpenGL extensions functions
|
||||||
glResolveFunctions();
|
glResolveFunctions();
|
||||||
|
#else
|
||||||
|
glVersion = MAKE_GL_VERSION( 0, 0, 0 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasGLVersion(int major, int minor, int release)
|
bool hasGLVersion(int major, int minor, int release)
|
||||||
|
@ -74,6 +82,7 @@ bool hasGLExtension(const QString& extension)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
|
||||||
GLShader::GLShader(const QString& vertexfile, const QString& fragmentfile)
|
GLShader::GLShader(const QString& vertexfile, const QString& fragmentfile)
|
||||||
{
|
{
|
||||||
|
@ -273,4 +282,6 @@ bool GLShader::setAttribute(const QString& name, float value)
|
||||||
return (location >= 0);
|
return (location >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -16,8 +16,10 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "glutils_funcs.h"
|
#include "glutils_funcs.h"
|
||||||
|
|
||||||
|
@ -48,6 +50,7 @@ bool hasGLExtension(const QString& extension);
|
||||||
|
|
||||||
inline bool isPowerOfTwo( int x ) { return (( x & ( x - 1 )) == 0 ); }
|
inline bool isPowerOfTwo( int x ) { return (( x & ( x - 1 )) == 0 ); }
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
|
||||||
class GLShader
|
class GLShader
|
||||||
{
|
{
|
||||||
|
@ -76,6 +79,8 @@ class GLShader
|
||||||
QHash< QString, int >* mVariableLocations;
|
QHash< QString, int >* mVariableLocations;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,8 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
if( !function ) \
|
if( !function ) \
|
||||||
function = (function ## _func)getProcAddress( #backup );
|
function = (function ## _func)getProcAddress( #backup );
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
|
||||||
namespace KWinInternal
|
namespace KWinInternal
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -213,3 +215,4 @@ void glResolveFunctions()
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -11,6 +11,8 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
#ifndef KWIN_GLUTILS_FUNCS_H
|
#ifndef KWIN_GLUTILS_FUNCS_H
|
||||||
#define KWIN_GLUTILS_FUNCS_H
|
#define KWIN_GLUTILS_FUNCS_H
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
|
||||||
namespace KWinInternal
|
namespace KWinInternal
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -164,3 +166,4 @@ extern glGetAttribLocation_func glGetAttribLocation;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -67,6 +67,8 @@ Sources and other compositing managers:
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
|
||||||
namespace KWinInternal
|
namespace KWinInternal
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -93,7 +95,9 @@ bool SceneOpenGL::supports_npot_textures;
|
||||||
bool SceneOpenGL::supports_fbo;
|
bool SceneOpenGL::supports_fbo;
|
||||||
bool SceneOpenGL::supports_saturation;
|
bool SceneOpenGL::supports_saturation;
|
||||||
bool SceneOpenGL::shm_mode;
|
bool SceneOpenGL::shm_mode;
|
||||||
|
#ifdef HAVE_XSHM
|
||||||
XShmSegmentInfo SceneOpenGL::shm;
|
XShmSegmentInfo SceneOpenGL::shm;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// detect OpenGL error (add to various places in code to pinpoint the place)
|
// detect OpenGL error (add to various places in code to pinpoint the place)
|
||||||
|
@ -226,6 +230,7 @@ bool SceneOpenGL::initTfp()
|
||||||
|
|
||||||
bool SceneOpenGL::initShm()
|
bool SceneOpenGL::initShm()
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_XSHM
|
||||||
int major, minor;
|
int major, minor;
|
||||||
Bool pixmaps;
|
Bool pixmaps;
|
||||||
if( !XShmQueryVersion( display(), &major, &minor, &pixmaps ) || !pixmaps )
|
if( !XShmQueryVersion( display(), &major, &minor, &pixmaps ) || !pixmaps )
|
||||||
|
@ -260,13 +265,18 @@ bool SceneOpenGL::initShm()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneOpenGL::cleanupShm()
|
void SceneOpenGL::cleanupShm()
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_XSHM
|
||||||
shmdt( shm.shmaddr );
|
shmdt( shm.shmaddr );
|
||||||
#ifndef __linux__
|
#ifndef __linux__
|
||||||
shmctl( shm.shmid, IPC_RMID, 0 );
|
shmctl( shm.shmid, IPC_RMID, 0 );
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,6 +912,7 @@ void SceneOpenGL::Window::bindTexture()
|
||||||
glXWaitX();
|
glXWaitX();
|
||||||
if( shm_mode )
|
if( shm_mode )
|
||||||
{ // non-tfp case, copy pixmap contents to a texture
|
{ // non-tfp case, copy pixmap contents to a texture
|
||||||
|
#ifdef HAVE_XSHM
|
||||||
findTextureTarget();
|
findTextureTarget();
|
||||||
if( texture == None )
|
if( texture == None )
|
||||||
{
|
{
|
||||||
|
@ -941,6 +952,7 @@ void SceneOpenGL::Window::bindTexture()
|
||||||
texture_y_inverted = true;
|
texture_y_inverted = true;
|
||||||
texture_can_use_mipmaps = true;
|
texture_can_use_mipmaps = true;
|
||||||
toplevel->resetDamage( toplevel->rect());
|
toplevel->resetDamage( toplevel->rect());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if( tfp_mode )
|
else if( tfp_mode )
|
||||||
{ // tfp mode, simply bind the pixmap to texture
|
{ // tfp mode, simply bind the pixmap to texture
|
||||||
|
@ -1370,3 +1382,5 @@ void SceneOpenGL::Window::restoreRenderStates( int mask, WindowPaintData data )
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -15,7 +15,11 @@ License. See the file "COPYING" for the exact licensing terms.
|
||||||
|
|
||||||
#include "glutils.h"
|
#include "glutils.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
|
||||||
|
#ifdef HAVE_XSHM
|
||||||
#include <X11/extensions/XShm.h>
|
#include <X11/extensions/XShm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWinInternal
|
namespace KWinInternal
|
||||||
{
|
{
|
||||||
|
@ -76,7 +80,9 @@ class SceneOpenGL
|
||||||
static bool supports_fbo;
|
static bool supports_fbo;
|
||||||
static bool supports_saturation;
|
static bool supports_saturation;
|
||||||
QMap< Toplevel*, Window > windows;
|
QMap< Toplevel*, Window > windows;
|
||||||
|
#ifdef HAVE_XSHM
|
||||||
static XShmSegmentInfo shm;
|
static XShmSegmentInfo shm;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class SceneOpenGL::Window
|
class SceneOpenGL::Window
|
||||||
|
@ -160,3 +166,5 @@ class SceneOpenGL::Window
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue