Remove define KWIN_HAVE_COMPOSITING

Building the workspaces requires to have all the build dependencies
which were required for KWIN_HAVE_COMPOSITING to be set. This allows
us to remove all the ifdefs for this and gives us a cleaner code.
This commit is contained in:
Martin Gräßlin 2011-08-13 10:36:50 +02:00
parent 1e5be94954
commit b7d2b16b8d
4 changed files with 7 additions and 58 deletions

View file

@ -28,36 +28,19 @@ if(KWIN_PLASMA_ACTIVE)
set(KWIN_BUILD_WITH_OPENGLES ON) set(KWIN_BUILD_WITH_OPENGLES ON)
endif(KWIN_PLASMA_ACTIVE) endif(KWIN_PLASMA_ACTIVE)
# KWIN_HAVE_COMPOSITING - whether any compositing support is available # KWIN_HAVE_OPENGL_COMPOSITING - always have either OpenGL or OpenGL ES
if( X11_Xcomposite_FOUND AND X11_Xdamage_FOUND ) set( KWIN_HAVE_OPENGL_COMPOSITING 1 )
set( KWIN_HAVE_COMPOSITING 1 )
endif( X11_Xcomposite_FOUND AND X11_Xdamage_FOUND )
# KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available # KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
if( KWIN_HAVE_COMPOSITING AND OPENGL_FOUND ) if( KWIN_BUILD_XRENDER_COMPOSITING )
set( KWIN_HAVE_OPENGL_COMPOSITING 1 )
endif( KWIN_HAVE_COMPOSITING AND OPENGL_FOUND )
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available
if( KWIN_HAVE_COMPOSITING AND X11_Xrender_FOUND AND X11_Xfixes_FOUND AND KWIN_BUILD_XRENDER_COMPOSITING )
set( KWIN_HAVE_XRENDER_COMPOSITING 1 ) set( KWIN_HAVE_XRENDER_COMPOSITING 1 )
endif( KWIN_HAVE_COMPOSITING AND X11_Xrender_FOUND AND X11_Xfixes_FOUND AND KWIN_BUILD_XRENDER_COMPOSITING ) endif( KWIN_BUILD_XRENDER_COMPOSITING )
# KWIN_HAVE_OPENGLES_COMPOSITING - whether OpenGL ES-based compositing support is available # KWIN_HAVE_OPENGLES_COMPOSITING - whether OpenGL ES-based compositing support is available
if( KWIN_HAVE_COMPOSITING AND OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES) if( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES)
set( KWIN_HAVE_OPENGL_COMPOSITING 1)
set( KWIN_HAVE_OPENGLES_COMPOSITING 1 ) set( KWIN_HAVE_OPENGLES_COMPOSITING 1 )
message("Compiling KWin for mobile.") message("Compiling KWin for mobile.")
endif( KWIN_HAVE_COMPOSITING AND OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES ) endif( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES )
# safety
if( KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING )
# ok
else( KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING )
set( KWIN_HAVE_COMPOSITING ) # unset
endif( KWIN_HAVE_OPENGL_COMPOSITING OR KWIN_HAVE_XRENDER_COMPOSITING )
macro_log_feature(KWIN_HAVE_COMPOSITING "Compositing support" "X11 Compositing support" "http://www.x.org/" FALSE "" "XComposite and XDamage extensions and OpenGL or XRender with XFixes are required for KWin compositing support")
macro_bool_to_01( OPENGL_FOUND KWIN_HAVE_OPENGL ) macro_bool_to_01( OPENGL_FOUND KWIN_HAVE_OPENGL )
macro_bool_to_01( KWIN_HAVE_OPENGLES_COMPOSITING KWIN_HAVE_OPENGLES ) macro_bool_to_01( KWIN_HAVE_OPENGLES_COMPOSITING KWIN_HAVE_OPENGLES )
@ -101,9 +84,7 @@ if( KWIN_BUILD_DECORATIONS )
endif( KWIN_BUILD_DECORATIONS ) endif( KWIN_BUILD_DECORATIONS )
add_subdirectory( data ) add_subdirectory( data )
if( KWIN_HAVE_COMPOSITING )
add_subdirectory( effects ) add_subdirectory( effects )
endif( KWIN_HAVE_COMPOSITING )
########### next target ############### ########### next target ###############

View file

@ -85,7 +85,6 @@ extern int currentRefreshRate();
void Workspace::setupCompositing() void Workspace::setupCompositing()
{ {
#ifdef KWIN_HAVE_COMPOSITING
if (scene != NULL) if (scene != NULL)
return; return;
if (compositingSuspended) { if (compositingSuspended) {
@ -154,11 +153,7 @@ void Workspace::setupCompositing()
break; break;
#endif #endif
default: default:
#ifndef KWIN_HAVE_COMPOSITING
kDebug(1212) << "Compositing was not available at compile time";
#else
kDebug(1212) << "No compositing enabled"; kDebug(1212) << "No compositing enabled";
#endif
delete cm_selection; delete cm_selection;
return; return;
} }
@ -191,14 +186,10 @@ void Workspace::setupCompositing()
foreach (Unmanaged * c, unmanaged) foreach (Unmanaged * c, unmanaged)
c->setupCompositing(); c->setupCompositing();
discardPopup(); // force re-creation of the Alt+F3 popup (opacity option) discardPopup(); // force re-creation of the Alt+F3 popup (opacity option)
#else
kDebug(1212) << "Compositing was not available at compile time";
#endif
} }
void Workspace::finishCompositing() void Workspace::finishCompositing()
{ {
#ifdef KWIN_HAVE_COMPOSITING
if (scene == NULL) if (scene == NULL)
return; return;
m_finishingCompositing = true; m_finishingCompositing = true;
@ -241,7 +232,6 @@ void Workspace::finishCompositing()
while (!deleted.isEmpty()) while (!deleted.isEmpty())
deleted.first()->discard(Allowed); deleted.first()->discard(Allowed);
m_finishingCompositing = false; m_finishingCompositing = false;
#endif
} }
// OpenGL self-check failed, fallback to XRender // OpenGL self-check failed, fallback to XRender
@ -377,7 +367,6 @@ void Workspace::timerEvent(QTimerEvent *te)
void Workspace::performCompositing() void Workspace::performCompositing()
{ {
#ifdef KWIN_HAVE_COMPOSITING
if (((repaints_region.isEmpty() && !windowRepaintsPending()) // no damage if (((repaints_region.isEmpty() && !windowRepaintsPending()) // no damage
|| !scene->overlayWindow()->isVisible())) { // nothing is visible anyway || !scene->overlayWindow()->isVisible())) { // nothing is visible anyway
vBlankPadding += 3; vBlankPadding += 3;
@ -427,7 +416,6 @@ void Workspace::performCompositing()
// checkCompositeTime() would restart it again somewhen later, called from functions that // checkCompositeTime() would restart it again somewhen later, called from functions that
// would again add something pending. // would again add something pending.
checkCompositeTimer(); checkCompositeTimer();
#endif
} }
void Workspace::performMousePoll() void Workspace::performMousePoll()
@ -532,7 +520,6 @@ void Workspace::delayedCheckUnredirect()
void Toplevel::setupCompositing() void Toplevel::setupCompositing()
{ {
#ifdef KWIN_HAVE_COMPOSITING
if (!compositing()) if (!compositing())
return; return;
damageRatio = 0.0; damageRatio = 0.0;
@ -545,12 +532,10 @@ void Toplevel::setupCompositing()
unredirect = false; unredirect = false;
workspace()->checkUnredirect(true); workspace()->checkUnredirect(true);
scene->windowAdded(this); scene->windowAdded(this);
#endif
} }
void Toplevel::finishCompositing() void Toplevel::finishCompositing()
{ {
#ifdef KWIN_HAVE_COMPOSITING
damageRatio = 0.0; damageRatio = 0.0;
if (damage_handle == None) if (damage_handle == None)
return; return;
@ -564,7 +549,6 @@ 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()
@ -581,7 +565,6 @@ void Toplevel::discardWindowPixmap()
Pixmap Toplevel::createWindowPixmap() Pixmap Toplevel::createWindowPixmap()
{ {
#ifdef KWIN_HAVE_COMPOSITING
assert(compositing()); assert(compositing());
if (unredirected()) if (unredirected())
return None; return None;
@ -600,9 +583,6 @@ Pixmap Toplevel::createWindowPixmap()
} }
ungrabXServer(); ungrabXServer();
return pix; return pix;
#else
return None;
#endif
} }
#ifdef HAVE_XDAMAGE #ifdef HAVE_XDAMAGE

View file

@ -69,7 +69,6 @@ bool CompositingPrefs::compositingPossible()
gl_workaround_group.readEntry("OpenGLIsUnsafe", false)) gl_workaround_group.readEntry("OpenGLIsUnsafe", false))
return false; return false;
#ifdef KWIN_HAVE_COMPOSITING
Extensions::init(); Extensions::init();
if (!Extensions::compositeAvailable()) { if (!Extensions::compositeAvailable()) {
kDebug(1212) << "No composite extension available"; kDebug(1212) << "No composite extension available";
@ -92,14 +91,10 @@ bool CompositingPrefs::compositingPossible()
#endif #endif
kDebug(1212) << "No OpenGL or XRender/XFixes support"; kDebug(1212) << "No OpenGL or XRender/XFixes support";
return false; return false;
#else
return false;
#endif
} }
QString CompositingPrefs::compositingNotPossibleReason() QString CompositingPrefs::compositingNotPossibleReason()
{ {
#ifdef KWIN_HAVE_COMPOSITING
// first off, check whether we figured that we'll crash on detection because of a buggy driver // first off, check whether we figured that we'll crash on detection because of a buggy driver
KSharedConfigPtr config = KSharedConfig::openConfig("kwinrc"); KSharedConfigPtr config = KSharedConfig::openConfig("kwinrc");
KConfigGroup gl_workaround_group(config, "Compositing"); KConfigGroup gl_workaround_group(config, "Compositing");
@ -129,10 +124,6 @@ QString CompositingPrefs::compositingNotPossibleReason()
} }
#endif #endif
return QString(); return QString();
#else
return i18n("Compositing was disabled at compile time.\n"
"It is likely Xorg development headers were not installed.");
#endif
} }
static bool s_glxDetected = false; static bool s_glxDetected = false;

View file

@ -16,9 +16,6 @@
*/ */
/* KWIN_HAVE_COMPOSITING - whether any compositing support is available */
#cmakedefine KWIN_HAVE_COMPOSITING
/* KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available */ /* KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available */
#cmakedefine KWIN_HAVE_OPENGL_COMPOSITING #cmakedefine KWIN_HAVE_OPENGL_COMPOSITING