diff --git a/COMPOSITE_TODO b/COMPOSITE_TODO index 45ca357909..d81f0f7a7d 100644 --- a/COMPOSITE_TODO +++ b/COMPOSITE_TODO @@ -44,8 +44,6 @@ KDE 4.0 TODO - taskbar thumbnail [Seli] - we'll go with the hacky one, fix performance problems -- fix inclusion of config-X11.h in installed headers [Seli] - - fix shading - window-specific rules need to apply to unmanaged windows as well (where applicable) - some window-specific rules also related to compositing diff --git a/composite.cpp b/composite.cpp index b2b0bd6cc8..9af9b6b743 100644 --- a/composite.cpp +++ b/composite.cpp @@ -76,7 +76,7 @@ namespace KWin void Workspace::setupCompositing() { -#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) +#ifdef KWIN_HAVE_COMPOSITING if( !options->useCompositing ) { kDebug( 1212 ) << "Compositing is turned off in options"; @@ -120,7 +120,7 @@ void Workspace::setupCompositing() kDebug( 1212 ) << "X compositing"; scene = new SceneBasic( this ); break; // don't fall through (this is a testing one) */ -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING case OpenGLCompositing: kDebug( 1212 ) << "OpenGL compositing"; scene = new SceneOpenGL( this ); @@ -130,16 +130,14 @@ void Workspace::setupCompositing() scene = NULL; // fall through, try XRender #endif -#if defined(HAVE_XRENDER) && defined(HAVE_XFIXES) +#ifdef KWIN_HAVE_XRENDER_COMPOSITING case XRenderCompositing: kDebug( 1212 ) << "XRender compositing"; scene = new SceneXrender( this ); break; #endif default: -// this is the inverse of the two above tests, to have a different message -// it is also used in compositingprefs.cpp -#if !(defined(HAVE_OPENGL) || (defined(HAVE_XRENDER) && defined(HAVE_XFIXES))) +#ifndef KWIN_HAVE_COMPOSITING kDebug( 1212 ) << "Compositing was not available at compile time"; #else kDebug( 1212 ) << "No compositing"; @@ -209,7 +207,7 @@ void Workspace::setupCompositing() void Workspace::finishCompositing() { -#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) +#ifdef KWIN_HAVE_COMPOSITING if( scene == NULL ) return; delete cm_selection; @@ -280,7 +278,7 @@ void Workspace::addRepaintFull() void Workspace::performCompositing() { -#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) +#ifdef KWIN_HAVE_COMPOSITING // 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 // repaints can seriously impact performance of everything else, therefore throttle @@ -403,7 +401,7 @@ void Workspace::destroyOverlay() void Toplevel::setupCompositing() { -#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) +#ifdef KWIN_HAVE_COMPOSITING if( !compositing()) return; if( damage_handle != None ) @@ -417,7 +415,7 @@ void Toplevel::setupCompositing() void Toplevel::finishCompositing() { -#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) +#ifdef KWIN_HAVE_COMPOSITING if( damage_handle == None ) return; if( effect_window->window() == this ) // otherwise it's already passed to Deleted, don't free data @@ -446,7 +444,7 @@ void Toplevel::discardWindowPixmap() Pixmap Toplevel::createWindowPixmap() { -#ifdef HAVE_XCOMPOSITE +#ifdef KWIN_HAVE_COMPOSITING assert( compositing()); grabXServer(); KXErrorHandler err; diff --git a/compositingprefs.cpp b/compositingprefs.cpp index 102775a27b..eda110c91f 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -25,6 +25,7 @@ along with this program. If not, see . #include #include #include +#include namespace KWin @@ -45,7 +46,7 @@ CompositingPrefs::~CompositingPrefs() bool CompositingPrefs::compositingPossible() { -#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) +#ifdef KWIN_HAVE_COMPOSITING Extensions::init(); if( !Extensions::compositeAvailable()) { @@ -57,12 +58,16 @@ bool CompositingPrefs::compositingPossible() kDebug( 1212 ) << "No damage extension available"; return false; } - -#if !(defined(HAVE_OPENGL) || (defined(HAVE_XRENDER) && defined(HAVE_XFIXES))) - kDebug( 1212 ) << "Not compiled with OpenGL/XRender support"; - return false; +#ifdef KWIN_HAVE_OPENGL_COMPOSITING + if( Extensions::glxAvailable()) + return true; #endif - return true; +#ifdef KWIN_HAVE_XRENDER_COMPOSITING + if( Extensions::renderAvailable() && Extensions::fixesAvailable()) + return true; +#endif + kDebug( 1212 ) << "No OpenGL or XRender/XFixes support"; + return false; #else return false; #endif @@ -70,13 +75,32 @@ bool CompositingPrefs::compositingPossible() QString CompositingPrefs::compositingNotPossibleReason() { -#if defined( HAVE_XCOMPOSITE ) && defined( HAVE_XDAMAGE ) && (defined(HAVE_OPENGL) || (defined(HAVE_XRENDER) && defined(HAVE_XFIXES))) +#ifdef KWIN_HAVE_COMPOSITING Extensions::init(); - if( !Extensions::compositeAvailable() || Extensions::damageAvailable()) + if( !Extensions::compositeAvailable() || !Extensions::damageAvailable()) { return i18n("Required X extensions (XComposite and XDamage) are not available."); } - +#if KDE_IS_VERSION( 4, 0, 90 ) +#ifdef __GNUC__ +#warning Uncomment +#endif +#endif +//#if defined( KWIN_HAVE_OPENGL_COMPOSITING ) && !defined( KWIN_HAVE_XRENDER_COMPOSITING ) +// if( !Extensions::glxAvailable()) +// return i18n( "GLX/OpenGL are not available and only OpenGL support is compiled." ); +//#endif +//#elseif !defined( KWIN_HAVE_OPENGL_COMPOSITING ) && defined( KWIN_HAVE_XRENDER_COMPOSITING ) +// if( !Extensions::glxAvailable()) +// return i18n( "XRender/XFixes extensions are not available and only XRender support" +// " is compiled." ); +//#else +// if( !( Extensions::glxAvailable() +// || ( Extensions::renderAvailable() && Extensions::fixesAvailable()))) +// { +// return i18n( "GLX/OpenGL and XRender/XFixes are not available." ); +// } +//#endif return QString(); #else return i18n("Compositing was disabled at compile time.\n" @@ -91,7 +115,7 @@ void CompositingPrefs::detect() return; } -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( !Extensions::glxAvailable()) { kDebug( 1212 ) << "No GLX available"; @@ -129,7 +153,7 @@ void CompositingPrefs::detect() bool CompositingPrefs::createGLXContext() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING KXErrorHandler handler; // Most of this code has been taken from glxinfo.c QVector attribs; @@ -179,7 +203,7 @@ bool CompositingPrefs::createGLXContext() void CompositingPrefs::deleteGLXContext() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING glXDestroyContext( display(), mGLContext ); XDestroyWindow( display(), mGLWindow ); #endif @@ -187,7 +211,7 @@ void CompositingPrefs::deleteGLXContext() void CompositingPrefs::detectDriverAndVersion() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING mGLVendor = QString((const char*)glGetString( GL_VENDOR )); mGLRenderer = QString((const char*)glGetString( GL_RENDERER )); mGLVersion = QString((const char*)glGetString( GL_VERSION )); diff --git a/compositingprefs.h b/compositingprefs.h index ae1c5266eb..27749ea147 100644 --- a/compositingprefs.h +++ b/compositingprefs.h @@ -87,7 +87,7 @@ private: bool mEnableDirectRendering; bool mStrictBinding; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING GLXContext mGLContext; Window mGLWindow; #endif diff --git a/effects.cpp b/effects.cpp index 1231a14d60..e260c6a9ce 100644 --- a/effects.cpp +++ b/effects.cpp @@ -480,7 +480,7 @@ EffectWindow* EffectsHandlerImpl::currentTabBoxWindow() const void EffectsHandlerImpl::pushRenderTarget(GLRenderTarget* target) { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING target->enable(); render_targets.push(target); #endif @@ -488,7 +488,7 @@ void EffectsHandlerImpl::pushRenderTarget(GLRenderTarget* target) GLRenderTarget* EffectsHandlerImpl::popRenderTarget() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING GLRenderTarget* ret = render_targets.pop(); ret->disable(); if( !render_targets.isEmpty() ) @@ -654,7 +654,7 @@ void EffectsHandlerImpl::reserveElectricBorderSwitching( bool reserve ) unsigned long EffectsHandlerImpl::xrenderBufferPicture() { -#if defined(HAVE_XRENDER) && defined(HAVE_XFIXES) +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( SceneXrender* s = dynamic_cast< SceneXrender* >( scene )) return s->bufferPicture(); #endif diff --git a/effects/boxswitch.cpp b/effects/boxswitch.cpp index f79e9a58e7..171de3262f 100644 --- a/effects/boxswitch.cpp +++ b/effects/boxswitch.cpp @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -#include +#include #include "boxswitch.h" @@ -30,7 +30,7 @@ along with this program. If not, see . #include #include -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include #endif @@ -46,7 +46,7 @@ BoxSwitchEffect::BoxSwitchEffect() { frame_margin = 10; highlight_margin = 5; -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING alphaFormat = XRenderFindStandardFormat( display(), PictStandardARGB32 ); #endif color_frame = KColorScheme( QPalette::Active, KColorScheme::Window ).background().color(); @@ -345,7 +345,7 @@ void BoxSwitchEffect::setInactive() } foreach( ItemInfo* i, windows ) { -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { if( i->iconPicture != None ) @@ -449,7 +449,7 @@ void BoxSwitchEffect::calculateItemSizes() void BoxSwitchEffect::paintFrame() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { glPushAttrib( GL_CURRENT_BIT ); @@ -458,7 +458,7 @@ void BoxSwitchEffect::paintFrame() glPopAttrib(); } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { Pixmap pixmap = XCreatePixmap( display(), rootWindow(), @@ -482,7 +482,7 @@ void BoxSwitchEffect::paintFrame() void BoxSwitchEffect::paintHighlight( QRect area ) { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { glPushAttrib( GL_CURRENT_BIT ); @@ -491,7 +491,7 @@ void BoxSwitchEffect::paintHighlight( QRect area ) glPopAttrib(); } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { Pixmap pixmap = XCreatePixmap( display(), rootWindow(), @@ -568,14 +568,14 @@ void BoxSwitchEffect::paintWindowIcon( EffectWindow* w ) if( windows[ w ]->icon.cacheKey() != w->icon().cacheKey()) { // make sure windows[ w ]->icon is the right QPixmap, and rebind windows[ w ]->icon = w->icon(); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { windows[ w ]->iconTexture.load( windows[ w ]->icon ); windows[ w ]->iconTexture.setFilter( GL_LINEAR ); } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { if( windows[ w ]->iconPicture != None ) @@ -589,7 +589,7 @@ void BoxSwitchEffect::paintWindowIcon( EffectWindow* w ) int height = windows[ w ]->icon.height(); int x = windows[ w ]->area.x() + windows[ w ]->area.width() - width - highlight_margin; int y = windows[ w ]->area.y() + windows[ w ]->area.height() - height - highlight_margin; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT ); @@ -620,7 +620,7 @@ void BoxSwitchEffect::paintWindowIcon( EffectWindow* w ) glPopAttrib(); } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { XRenderComposite( display(), diff --git a/effects/boxswitch.h b/effects/boxswitch.h index ade2e2e41f..6b5b345af3 100644 --- a/effects/boxswitch.h +++ b/effects/boxswitch.h @@ -32,7 +32,7 @@ along with this program. If not, see . #include -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING #include #endif @@ -94,7 +94,7 @@ class BoxSwitchEffect int painting_desktop; -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING XRenderPictFormat* alphaFormat; #endif }; @@ -106,10 +106,10 @@ class BoxSwitchEffect::ItemInfo QRegion clickable; QRect thumbnail; QPixmap icon; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING GLTexture iconTexture; #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING Picture iconPicture; #endif }; diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index f45af26019..cf352ee453 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -#include +#include #include "shadow_config.h" #include "presentwindows_config.h" @@ -29,7 +29,7 @@ along with this program. If not, see . #include "thumbnailaside_config.h" #include "zoom_config.h" -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include "invert_config.h" #include "lookingglass_config.h" #include "mousemark_config.h" @@ -62,7 +62,7 @@ KWIN_EFFECT_CONFIG_FACTORY registerPlugin("sharpen"); \ registerPlugin("trackmouse"); \ -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING K_PLUGIN_FACTORY_DEFINITION(EffectFactory, NON_GL_PLUGINS GL_PLUGINS diff --git a/effects/logout.cpp b/effects/logout.cpp index f655d4fb89..b25b6da241 100644 --- a/effects/logout.cpp +++ b/effects/logout.cpp @@ -49,7 +49,7 @@ void LogoutEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Windo if( w != logout_window && progress != 0 ) { // When saturation isn't supported then reduce brightness a bit more -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing && GLTexture::saturationSupported() ) { data.saturation *= ( 1 - progress * 0.8 ); diff --git a/effects/magnifier.cpp b/effects/magnifier.cpp index f5720d954b..638e15217a 100644 --- a/effects/magnifier.cpp +++ b/effects/magnifier.cpp @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -#include // HAVE_OPENGL +#include #include "magnifier.h" @@ -28,7 +28,7 @@ along with this program. If not, see . #include #include -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include #endif @@ -81,7 +81,7 @@ void MagnifierEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da effects->paintScreen( mask, region, data ); // paint normal screen if( zoom != 1.0 ) { // paint magnifier -// ## TODO this should be inside HAVE_OPENGL +// ## TODO this should be inside KWIN_HAVE_OPENGL_COMPOSITING glPushAttrib( GL_ENABLE_BIT ); QRect area = magnifierArea(); glEnable( GL_SCISSOR_TEST ); diff --git a/effects/mousemark.cpp b/effects/mousemark.cpp index 967ffb761c..55c8658a84 100644 --- a/effects/mousemark.cpp +++ b/effects/mousemark.cpp @@ -21,7 +21,7 @@ along with this program. If not, see . #include "mousemark.h" -#include +#include #include #include @@ -32,7 +32,7 @@ along with this program. If not, see . #include -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include #endif diff --git a/effects/presentwindows.cpp b/effects/presentwindows.cpp index 8c9d5a235c..d5b39cd432 100644 --- a/effects/presentwindows.cpp +++ b/effects/presentwindows.cpp @@ -46,7 +46,7 @@ PresentWindowsEffect::PresentWindowsEffect() , mRearranging( 1.0 ) , hasKeyboardGrab( false ) , mHighlightedWindow( NULL ) -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING , filterTexture( NULL ) #endif { @@ -68,7 +68,7 @@ PresentWindowsEffect::PresentWindowsEffect() effects->reserveElectricBorder( borderActivate ); effects->reserveElectricBorder( borderActivateAll ); -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING alphaFormat = XRenderFindStandardFormat( display(), PictStandardARGB32 ); #endif } @@ -137,7 +137,7 @@ void PresentWindowsEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& void PresentWindowsEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) { effects->paintScreen( mask, region, data ); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( filterTexture && region.intersects( filterFrameRect )) { glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT ); @@ -966,7 +966,7 @@ EffectWindow* PresentWindowsEffect::findFirstWindow() const void PresentWindowsEffect::discardFilterTexture() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING delete filterTexture; filterTexture = NULL; #endif @@ -974,7 +974,7 @@ void PresentWindowsEffect::discardFilterTexture() void PresentWindowsEffect::updateFilterTexture() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING discardFilterTexture(); if( windowFilter.isEmpty()) { @@ -1026,14 +1026,14 @@ void PresentWindowsEffect::paintWindowIcon( EffectWindow* w, WindowPaintData& pa // if( data.icon.cacheKey() != w->icon().cacheKey()) { // make sure data.icon is the right QPixmap, and rebind data.icon = w->icon(); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { data.iconTexture.load( data.icon ); data.iconTexture.setFilter( GL_LINEAR ); } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { if( data.iconPicture != None ) @@ -1048,7 +1048,7 @@ void PresentWindowsEffect::paintWindowIcon( EffectWindow* w, WindowPaintData& pa int height = data.icon.height(); int x = w->x() + paintdata.xTranslate + w->width() * paintdata.xScale * 0.95 - width - icon_margin; int y = w->y() + paintdata.yTranslate + w->height() * paintdata.yScale * 0.95 - height - icon_margin; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT ); @@ -1080,7 +1080,7 @@ void PresentWindowsEffect::paintWindowIcon( EffectWindow* w, WindowPaintData& pa glPopAttrib(); } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { XRenderComposite( display(), diff --git a/effects/presentwindows.h b/effects/presentwindows.h index d7f3826ed2..5c77f15996 100644 --- a/effects/presentwindows.h +++ b/effects/presentwindows.h @@ -27,7 +27,7 @@ along with this program. If not, see . #include -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING #include #endif @@ -117,10 +117,10 @@ class PresentWindowsEffect int x, y; // position of the slot in the grid int slot_distance; QPixmap icon; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING GLTexture iconTexture; #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING Picture iconPicture; #endif }; @@ -129,7 +129,7 @@ class PresentWindowsEffect EffectWindow* mHighlightedWindow; QString windowFilter; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING GLTexture* filterTexture; QRect filterTextureRect; QRect filterFrameRect; @@ -138,7 +138,7 @@ class PresentWindowsEffect ElectricBorder borderActivate; ElectricBorder borderActivateAll; -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING XRenderPictFormat* alphaFormat; #endif }; diff --git a/effects/showfps.cpp b/effects/showfps.cpp index f99d7e7eba..19b815c4fc 100644 --- a/effects/showfps.cpp +++ b/effects/showfps.cpp @@ -20,16 +20,16 @@ along with this program. If not, see . #include "showfps.h" -#include +#include #include #include #include -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING #include #include #endif @@ -115,14 +115,14 @@ void ShowFpsEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ++fps; // count all frames in the last second if( fps > MAX_TIME ) fps = MAX_TIME; // keep it the same height -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing) { paintGL( fps ); glFinish(); // make sure all rendering is done } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing) { paintXrender( fps ); @@ -133,7 +133,7 @@ void ShowFpsEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data void ShowFpsEffect::paintGL( int fps ) { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING int x = this->x; int y = this->y; glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT ); @@ -189,7 +189,7 @@ void ShowFpsEffect::paintGL( int fps ) */ void ShowFpsEffect::paintXrender( int fps ) { -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING Pixmap pixmap = XCreatePixmap( display(), rootWindow(), FPS_WIDTH, MAX_TIME, 32 ); XRenderPictFormat* format = XRenderFindStandardFormat( display(), PictStandardARGB32 ); Picture p = XRenderCreatePicture( display(), pixmap, format, 0, NULL ); @@ -277,7 +277,7 @@ void ShowFpsEffect::paintDrawSizeGraph(int x, int y) void ShowFpsEffect::paintGraph( int x, int y, QList values, QList lines, bool colorize) { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing) { glColor4f( 0, 0, 0, alpha ); // black @@ -310,7 +310,7 @@ void ShowFpsEffect::paintGraph( int x, int y, QList values, QList line glEnd(); } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing) { Pixmap pixmap = XCreatePixmap( display(), rootWindow(), values.count(), MAX_TIME, 32 ); diff --git a/effects/showpaint.cpp b/effects/showpaint.cpp index cf0ae00720..8987022195 100644 --- a/effects/showpaint.cpp +++ b/effects/showpaint.cpp @@ -20,12 +20,12 @@ along with this program. If not, see . #include "showpaint.h" -#include +#include -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING #include #include #endif @@ -51,11 +51,11 @@ void ShowPaintEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da { painted = QRegion(); effects->paintScreen( mask, region, data ); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing) paintGL(); #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing) paintXrender(); #endif @@ -72,7 +72,7 @@ void ShowPaintEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi // TODO I think we need some kind of generic paintRect() void ShowPaintEffect::paintGL() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT ); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); @@ -94,7 +94,7 @@ void ShowPaintEffect::paintGL() void ShowPaintEffect::paintXrender() { -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING XRenderColor col; int alpha = 0.2; const QColor& color = colors[ color_index ]; diff --git a/effects/trackmouse.cpp b/effects/trackmouse.cpp index f447813135..5905949734 100644 --- a/effects/trackmouse.cpp +++ b/effects/trackmouse.cpp @@ -20,14 +20,14 @@ along with this program. If not, see . #include "trackmouse.h" -#include +#include #include #include #include -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #include #endif @@ -65,7 +65,7 @@ void TrackMouseEffect::paintScreen( int mask, QRegion region, ScreenPaintData& d effects->paintScreen( mask, region, data ); // paint normal screen if( !active ) return; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( texture ) { glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT ); @@ -140,7 +140,7 @@ QRect TrackMouseEffect::starRect( int num ) const void TrackMouseEffect::loadTexture() { -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING QString file = KGlobal::dirs()->findResource( "appdata", "trackmouse.png" ); if( file.isEmpty()) return; diff --git a/effects/videorecord.cpp b/effects/videorecord.cpp index 7790cf9b9e..f9ca0d35a7 100644 --- a/effects/videorecord.cpp +++ b/effects/videorecord.cpp @@ -41,8 +41,6 @@ along with this program. If not, see . */ -#include - #include "videorecord.h" #include diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 3f515e2123..1ef95e039a 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,4 +1,5 @@ +configure_file(kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kwinconfig.h ) ########### next target ############### diff --git a/lib/kwineffects.cpp b/lib/kwineffects.cpp index 8b8285c186..73e56bef1a 100644 --- a/lib/kwineffects.cpp +++ b/lib/kwineffects.cpp @@ -35,7 +35,7 @@ along with this program. If not, see . #include -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER #include #endif @@ -321,7 +321,7 @@ bool EffectsHandler::paintText( const QString& text, const QPoint& center, int m QRect area( center.x() - textrect.width() / 2, center.y() - textrect.height() / 2, textrect.width(), textrect.height() ); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { GLTexture textTexture( textPixmap, GL_TEXTURE_RECTANGLE_ARB ); @@ -349,7 +349,7 @@ bool EffectsHandler::paintText( const QString& text, const QPoint& center, int m return true; } #endif -#ifdef HAVE_XRENDER +#ifdef KWIN_HAVE_XRENDER_COMPOSITING if( effects->compositingType() == XRenderCompositing ) { static XRenderPictFormat* alphaFormat = 0; @@ -379,7 +379,7 @@ bool EffectsHandler::paintTextWithBackground( const QString& text, const QPoint& QRect area( center.x() - textrect.width() / 2, center.y() - textrect.height() / 2, textrect.width(), textrect.height() ); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( effects->compositingType() == OpenGLCompositing ) { glColor4f( bgcolor.redF(), bgcolor.greenF(), bgcolor.blueF(), bgcolor.alphaF() ); diff --git a/lib/kwineffects.h b/lib/kwineffects.h index a8a718164c..75f427412a 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -23,6 +23,7 @@ along with this program. If not, see . #ifndef KWINEFFECTS_H #define KWINEFFECTS_H +#include #include #include diff --git a/lib/kwinglobals.h b/lib/kwinglobals.h index 1c636db02a..e1a1a8a360 100644 --- a/lib/kwinglobals.h +++ b/lib/kwinglobals.h @@ -30,6 +30,8 @@ along with this program. If not, see . #include #include +#include + namespace KWin { diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 7fa0b101e7..b6fc33e75e 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -20,7 +20,7 @@ along with this program. If not, see . #include "kwinglutils.h" -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL #include "kwinglobals.h" #include "kwineffects.h" diff --git a/lib/kwinglutils.h b/lib/kwinglutils.h index 43bfb59b97..e754b2261a 100644 --- a/lib/kwinglutils.h +++ b/lib/kwinglutils.h @@ -21,9 +21,9 @@ along with this program. If not, see . #ifndef KWIN_GLUTILS_H #define KWIN_GLUTILS_H -#include // HAVE_OPENGL +#include // KWIN_HAVE_OPENGL -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL #include #include diff --git a/lib/kwinglutils_funcs.cpp b/lib/kwinglutils_funcs.cpp index 25acf254f0..aa9c3af1f0 100644 --- a/lib/kwinglutils_funcs.cpp +++ b/lib/kwinglutils_funcs.cpp @@ -32,7 +32,7 @@ along with this program. If not, see . if( !function ) \ function = (function ## _func)getProcAddress( #backup ); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL namespace KWin { diff --git a/lib/kwinglutils_funcs.h b/lib/kwinglutils_funcs.h index be62a60086..9c8824c202 100644 --- a/lib/kwinglutils_funcs.h +++ b/lib/kwinglutils_funcs.h @@ -25,9 +25,9 @@ along with this program. If not, see . #define KWIN_EXPORT KDE_EXPORT -#include // HAVE_OPENGL +#include // KWIN_HAVE_OPENGL -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL // gcc-3.3.3 apparently cannot resolve KWin's namespaced versions properly, // so hide possible global functions diff --git a/lib/kwinshadereffect.cpp b/lib/kwinshadereffect.cpp index c57d645055..743707488f 100644 --- a/lib/kwinshadereffect.cpp +++ b/lib/kwinshadereffect.cpp @@ -52,7 +52,7 @@ ShaderEffect::~ShaderEffect() bool ShaderEffect::loadData(const QString& shadername) { -#ifndef HAVE_OPENGL +#ifndef KWIN_HAVE_OPENGL_COMPOSITING return false; #else // If NPOT textures are not supported, use nearest power-of-two sized @@ -100,7 +100,7 @@ bool ShaderEffect::loadData(const QString& shadername) bool ShaderEffect::supported() { -#ifndef HAVE_OPENGL +#ifndef KWIN_HAVE_OPENGL_COMPOSITING return false; #else return GLRenderTarget::supported() && @@ -129,7 +129,7 @@ GLShader* ShaderEffect::shader() const void ShaderEffect::prePaintScreen( ScreenPrePaintData& data, int time ) { mTime += time / 1000.0f; -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( mValid && mEnabled ) { data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS; @@ -146,7 +146,7 @@ void ShaderEffect::postPaintScreen() // Call the next effect. effects->postPaintScreen(); -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING if( mValid && mEnabled ) { // Disable render texture diff --git a/scene_opengl.cpp b/scene_opengl.cpp index d94e11880a..ff0b0b1e7e 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -82,7 +82,7 @@ Sources and other compositing managers: // normally only few of them are enabled //#define CHECK_GL_ERROR -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING namespace KWin { diff --git a/scene_opengl.h b/scene_opengl.h index dfa21dfeb6..92afe0f7c2 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -25,7 +25,7 @@ along with this program. If not, see . #include "kwinglutils.h" -#ifdef HAVE_OPENGL +#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef HAVE_XSHM #include diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 91060bbab7..6a20c537df 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -39,7 +39,7 @@ along with this program. If not, see . #include "scene_xrender.h" -#if defined(HAVE_XRENDER) && defined(HAVE_XFIXES) +#ifdef KWIN_HAVE_XRENDER_COMPOSITING #include "toplevel.h" #include "client.h" diff --git a/scene_xrender.h b/scene_xrender.h index 0a81c4cab0..854bb48711 100644 --- a/scene_xrender.h +++ b/scene_xrender.h @@ -25,7 +25,7 @@ along with this program. If not, see . #include "scene.h" -#if defined(HAVE_XRENDER) && defined(HAVE_XFIXES) +#ifdef KWIN_HAVE_XRENDER_COMPOSITING #include #include diff --git a/utils.cpp b/utils.cpp index 0bee5cff7f..695d6abaa2 100644 --- a/utils.cpp +++ b/utils.cpp @@ -42,28 +42,6 @@ along with this program. If not, see . #include #include -#ifdef HAVE_XRENDER -#include -#endif -#ifdef HAVE_XFIXES -#include -#endif -#ifdef HAVE_XDAMAGE -#include -#endif -#ifdef HAVE_XRANDR -#include -#endif -#ifdef HAVE_XCOMPOSITE -#include -#endif -#ifdef HAVE_OPENGL -#include -#endif -#ifdef HAVE_XSYNC -#include -#endif - #include #include "atoms.h" diff --git a/utils.h b/utils.h index 09b7bb5206..a2ac034432 100644 --- a/utils.h +++ b/utils.h @@ -26,6 +26,8 @@ along with this program. If not, see . #include #include +#include + #include #include