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)
endif(KWIN_PLASMA_ACTIVE)
# KWIN_HAVE_COMPOSITING - whether any compositing support is available
if( X11_Xcomposite_FOUND AND X11_Xdamage_FOUND )
set( KWIN_HAVE_COMPOSITING 1 )
endif( X11_Xcomposite_FOUND AND X11_Xdamage_FOUND )
# KWIN_HAVE_OPENGL_COMPOSITING - always have either OpenGL or OpenGL ES
set( KWIN_HAVE_OPENGL_COMPOSITING 1 )
# KWIN_HAVE_OPENGL_COMPOSITING - whether OpenGL-based compositing support is available
if( KWIN_HAVE_COMPOSITING AND OPENGL_FOUND )
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 )
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
if( KWIN_BUILD_XRENDER_COMPOSITING )
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
if( KWIN_HAVE_COMPOSITING AND OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES)
set( KWIN_HAVE_OPENGL_COMPOSITING 1)
if( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES)
set( KWIN_HAVE_OPENGLES_COMPOSITING 1 )
message("Compiling KWin for mobile.")
endif( KWIN_HAVE_COMPOSITING AND 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")
endif( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES )
macro_bool_to_01( OPENGL_FOUND KWIN_HAVE_OPENGL )
macro_bool_to_01( KWIN_HAVE_OPENGLES_COMPOSITING KWIN_HAVE_OPENGLES )
@ -101,9 +84,7 @@ if( KWIN_BUILD_DECORATIONS )
endif( KWIN_BUILD_DECORATIONS )
add_subdirectory( data )
if( KWIN_HAVE_COMPOSITING )
add_subdirectory( effects )
endif( KWIN_HAVE_COMPOSITING )
########### next target ###############

View file

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

View file

@ -69,7 +69,6 @@ bool CompositingPrefs::compositingPossible()
gl_workaround_group.readEntry("OpenGLIsUnsafe", false))
return false;
#ifdef KWIN_HAVE_COMPOSITING
Extensions::init();
if (!Extensions::compositeAvailable()) {
kDebug(1212) << "No composite extension available";
@ -92,14 +91,10 @@ bool CompositingPrefs::compositingPossible()
#endif
kDebug(1212) << "No OpenGL or XRender/XFixes support";
return false;
#else
return false;
#endif
}
QString CompositingPrefs::compositingNotPossibleReason()
{
#ifdef KWIN_HAVE_COMPOSITING
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KSharedConfigPtr config = KSharedConfig::openConfig("kwinrc");
KConfigGroup gl_workaround_group(config, "Compositing");
@ -129,10 +124,6 @@ QString CompositingPrefs::compositingNotPossibleReason()
}
#endif
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;

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 */
#cmakedefine KWIN_HAVE_OPENGL_COMPOSITING