Remove define KWIN_HAVE_OPENGL_COMPOSITING

Due to changes in build system we have always either OpenGL or OpenGL ES.
This allows to remove the KWIN_HAVE_OPENGL_COMPOSITING define. In the
effects the define is kept as KWIN_HAVE_OPENGL which can be used in
future to build also an XRender only effect system.
icc-effect-5.14.5
Martin Gräßlin 2011-08-13 15:21:51 +02:00
parent b7d2b16b8d
commit 987bc837d9
26 changed files with 55 additions and 167 deletions

View File

@ -28,30 +28,21 @@ if(KWIN_PLASMA_ACTIVE)
set(KWIN_BUILD_WITH_OPENGLES ON)
endif(KWIN_PLASMA_ACTIVE)
# KWIN_HAVE_OPENGL_COMPOSITING - always have either OpenGL or OpenGL ES
set( KWIN_HAVE_OPENGL_COMPOSITING 1 )
# 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_BUILD_XRENDER_COMPOSITING )
# KWIN_HAVE_OPENGLES_COMPOSITING - whether OpenGL ES-based compositing support is available
if( OPENGLES_FOUND AND KWIN_BUILD_WITH_OPENGLES)
set( KWIN_HAVE_OPENGLES_COMPOSITING 1 )
message("Compiling KWin for mobile.")
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 )
macro_bool_to_01( OPENGLES_FOUND KWIN_HAVE_OPENGLES )
if(OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
endif(OPENGL_FOUND)
if(OPENGLES_FOUND AND KWIN_HAVE_OPENGLES_COMPOSITING)
if(OPENGLES_FOUND)
include_directories(${OPENGLES_INCLUDE_DIR})
endif(OPENGLES_FOUND AND KWIN_HAVE_OPENGLES_COMPOSITING)
endif(OPENGLES_FOUND)
# for things that are also used by kwin libraries
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )

View File

@ -109,7 +109,6 @@ void Workspace::setupCompositing()
kDebug( 1212 ) << "X compositing";
scene = new SceneBasic( this );
break; // don't fall through (this is a testing one) */
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
case OpenGLCompositing: {
kDebug(1212) << "Initializing OpenGL compositing";
@ -145,7 +144,6 @@ void Workspace::setupCompositing()
// Do not Fall back to XRender - it causes problems when selfcheck fails during startup, but works later on
break;
}
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
case XRenderCompositing:
kDebug(1212) << "Initializing XRender compositing";
@ -672,7 +670,6 @@ void Toplevel::addDamage(int x, int y, int w, int h)
damageRatio = float(damageArea) / float(rect().width()*rect().height());
repaints_region += r;
emit damaged(this, r);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
// discard lanczos texture
if (effect_window) {
QVariant cachedTextureVariant = effect_window->data(LanczosCacheRole);
@ -683,7 +680,6 @@ void Toplevel::addDamage(int x, int y, int w, int h)
effect_window->setData(LanczosCacheRole, QVariant());
}
}
#endif
workspace()->checkCompositeTimer();
}
@ -695,7 +691,6 @@ void Toplevel::addDamageFull()
repaints_region = rect();
damageRatio = 1.0;
emit damaged(this, rect());
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
// discard lanczos texture
if (effect_window) {
QVariant cachedTextureVariant = effect_window->data(LanczosCacheRole);
@ -706,7 +701,6 @@ void Toplevel::addDamageFull()
effect_window->setData(LanczosCacheRole, QVariant());
}
}
#endif
workspace()->checkCompositeTimer();
}

View File

@ -78,10 +78,8 @@ bool CompositingPrefs::compositingPossible()
kDebug(1212) << "No damage extension available";
return false;
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (hasGlx())
return true;
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (Extensions::renderAvailable() && Extensions::fixesAvailable())
return true;
@ -110,13 +108,9 @@ QString CompositingPrefs::compositingNotPossibleReason()
if (!Extensions::compositeAvailable() || !Extensions::damageAvailable()) {
return i18n("Required X extensions (XComposite and XDamage) are not available.");
}
#if defined( KWIN_HAVE_OPENGL_COMPOSITING ) && !defined( KWIN_HAVE_XRENDER_COMPOSITING )
#if !defined( KWIN_HAVE_XRENDER_COMPOSITING )
if (!hasGlx())
return i18n("GLX/OpenGL are not available and only OpenGL support is compiled.");
#elif !defined( KWIN_HAVE_OPENGL_COMPOSITING ) && defined( KWIN_HAVE_XRENDER_COMPOSITING )
if (!(Extensions::renderAvailable() && Extensions::fixesAvailable()))
return i18n("XRender/XFixes extensions are not available and only XRender support"
" is compiled.");
#else
if (!(hasGlx()
|| (Extensions::renderAvailable() && Extensions::fixesAvailable()))) {
@ -134,11 +128,9 @@ bool CompositingPrefs::hasGlx()
if (s_glxDetected) {
return s_hasGlx;
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
int event_base, error_base;
s_hasGlx = glXQueryExtension(display(), &event_base, &error_base);
#endif
#endif
s_glxDetected = true;
return s_hasGlx;
@ -159,7 +151,6 @@ void CompositingPrefs::detect()
gl_workaround_config.writeEntry("OpenGLIsUnsafe", true);
gl_workaround_config.sync();
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGLES
bool haveContext = false;
bool canDetect = false;
@ -232,12 +223,10 @@ void CompositingPrefs::detect()
#endif
gl_workaround_config.writeEntry("OpenGLIsUnsafe", false);
gl_workaround_config.sync();
#endif
}
bool CompositingPrefs::initGLXContext()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
mGLContext = NULL;
KXErrorHandler handler;
@ -282,21 +271,16 @@ bool CompositingPrefs::initGLXContext()
#else
return false;
#endif
#else
return false;
#endif
}
void CompositingPrefs::deleteGLXContext()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
if (mGLContext == NULL)
return;
glXDestroyContext(display(), mGLContext);
XDestroyWindow(display(), mGLWindow);
#endif
#endif
}
bool CompositingPrefs::initEGLContext()
@ -387,17 +371,14 @@ void CompositingPrefs::deleteEGLContext()
void CompositingPrefs::detectDriverAndVersion()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
GLPlatform *gl = GLPlatform::instance();
gl->detect();
gl->printResults();
#endif
}
// See http://techbase.kde.org/Projects/KWin/HW for a list of some cards that are known to work.
void CompositingPrefs::applyDriverSpecificOptions()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
// Always recommend
mRecommendCompositing = true;
@ -405,7 +386,6 @@ void CompositingPrefs::applyDriverSpecificOptions()
mStrictBinding = !gl->supports(LooseBinding);
if (gl->driver() == Driver_Intel)
mEnableVSync = false;
#endif
}
} // namespace

View File

@ -80,7 +80,6 @@ private:
bool mEnableDirectRendering;
bool mStrictBinding;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGLES
EGLDisplay mEGLDisplay;
EGLContext mEGLContext;
@ -89,7 +88,6 @@ private:
GLXContext mGLContext;
#endif
Window mGLWindow;
#endif
};
}

View File

@ -1288,13 +1288,11 @@ EffectWindowImpl::EffectWindowImpl() : EffectWindow()
EffectWindowImpl::~EffectWindowImpl()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
QVariant cachedTextureVariant = data(LanczosCacheRole);
if (cachedTextureVariant.isValid()) {
GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>());
delete cachedTexture;
}
#endif
}
bool EffectWindowImpl::isPaintingEnabled()
@ -1773,9 +1771,7 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint
m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders);
if (effects->compositingType() == OpenGLCompositing) {
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
m_sceneFrame = new SceneOpenGL::EffectFrame(this);
#endif
} else if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
m_sceneFrame = new SceneXrender::EffectFrame(this);

View File

@ -114,28 +114,26 @@ if( NOT KWIN_MOBILE_EFFECTS )
endif( NOT KWIN_MOBILE_EFFECTS )
# OpenGL-specific effects
if( KWIN_HAVE_OPENGL_COMPOSITING )
include( blur/CMakeLists.txt )
include( screenshot/CMakeLists.txt )
# OpenGL-specific effects for desktop
if( NOT KWIN_MOBILE_EFFECTS )
include( coverswitch/CMakeLists.txt )
include( cube/CMakeLists.txt )
include( explosion/CMakeLists.txt )
include( flipswitch/CMakeLists.txt )
include( glide/CMakeLists.txt )
include( invert/CMakeLists.txt )
include( lookingglass/CMakeLists.txt )
include( blur/CMakeLists.txt )
include( screenshot/CMakeLists.txt )
# OpenGL-specific effects for desktop
if( NOT KWIN_MOBILE_EFFECTS )
include( coverswitch/CMakeLists.txt )
include( cube/CMakeLists.txt )
include( explosion/CMakeLists.txt )
include( flipswitch/CMakeLists.txt )
include( glide/CMakeLists.txt )
include( invert/CMakeLists.txt )
include( lookingglass/CMakeLists.txt )
# Magnifier currently broken due to removed PaintClipper
# include( magnifier/CMakeLists.txt )
include( mousemark/CMakeLists.txt )
include( sheet/CMakeLists.txt )
include( snaphelper/CMakeLists.txt )
include( startupfeedback/CMakeLists.txt )
include( trackmouse/CMakeLists.txt )
include( wobblywindows/CMakeLists.txt )
endif( NOT KWIN_MOBILE_EFFECTS )
endif( KWIN_HAVE_OPENGL_COMPOSITING )
include( mousemark/CMakeLists.txt )
include( sheet/CMakeLists.txt )
include( snaphelper/CMakeLists.txt )
include( startupfeedback/CMakeLists.txt )
include( trackmouse/CMakeLists.txt )
include( wobblywindows/CMakeLists.txt )
endif( NOT KWIN_MOBILE_EFFECTS )
###############################################################################

View File

@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "windowgeometry/windowgeometry_config.h"
#include "zoom/zoom_config.h"
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#include "blur/blur_config.h"
#include "coverswitch/coverswitch_config.h"
#include "cube/cube_config.h"
@ -76,7 +76,7 @@ KWIN_EFFECT_CONFIG_MULTIPLE(builtins,
KWIN_EFFECT_CONFIG_SINGLE(windowgeometry, WindowGeometryConfig)
KWIN_EFFECT_CONFIG_SINGLE(zoom, ZoomEffectConfig)
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
KWIN_EFFECT_CONFIG_SINGLE(blur, BlurEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(coverswitch, CoverSwitchEffectConfig)
KWIN_EFFECT_CONFIG_SINGLE(cube, CubeEffectConfig)

View File

@ -55,7 +55,7 @@ LogoutEffect::LogoutEffect()
XChangeProperty(display(), sel, hack, hack, 8, PropModeReplace, (unsigned char*)&hack, 1);
// the atom is not removed when effect is destroyed, this is temporary anyway
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
blurTexture = NULL;
blurTarget = NULL;
#endif
@ -68,7 +68,7 @@ LogoutEffect::LogoutEffect()
LogoutEffect::~LogoutEffect()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
delete blurTexture;
delete blurTarget;
#endif
@ -76,7 +76,7 @@ LogoutEffect::~LogoutEffect()
void LogoutEffect::reconfigure(ReconfigureFlags)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
frameDelay = 0;
KConfigGroup conf = effects->effectConfig("Logout");
useBlur = conf.readEntry("UseBlur", true);
@ -90,7 +90,7 @@ void LogoutEffect::reconfigure(ReconfigureFlags)
void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (!displayEffect && progress == 0.0) {
if (blurTexture) {
delete blurTexture;
@ -132,7 +132,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
progress = qMax(0.0, progress - time / animationTime(500.0));
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (blurSupported && progress > 0.0) {
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
}
@ -144,7 +144,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time)
void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
{
if (progress > 0.0) {
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == KWin::OpenGLCompositing) {
// In OpenGL mode we add vignetting and, if supported, a slight blur
if (blurSupported) {
@ -193,13 +193,13 @@ void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (blurSupported && progress > 0.0)
GLRenderTarget::pushRenderTarget(blurTarget);
#endif
effects->paintScreen(mask, region, data);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#ifndef KWIN_HAVE_OPENGLES
if (effects->compositingType() == KWin::OpenGLCompositing && progress > 0.0) {
if (!blurSupported) {
@ -295,7 +295,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
void LogoutEffect::postPaintScreen()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if ((progress != 0.0 && progress != 1.0) || frameDelay)
effects->addRepaintFull();
#else
@ -334,7 +334,7 @@ void LogoutEffect::slotWindowClosed(EffectWindow* w)
void LogoutEffect::slotWindowDeleted(EffectWindow* w)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
windows.removeAll(w);
#endif
ignoredWindows.removeAll(w);
@ -352,7 +352,7 @@ bool LogoutEffect::isLogoutDialog(EffectWindow* w)
return false;
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
void LogoutEffect::renderVignetting()
{
#ifndef KWIN_HAVE_OPENGLES

View File

@ -62,7 +62,7 @@ private:
bool canDoPersistent;
EffectWindowList ignoredWindows;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
void renderVignetting();
int frameDelay;
bool blurSupported, useBlur;

View File

@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kdebug.h>
#include <kglobalsettings.h>
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#include <kwinglutils.h>
#endif
@ -393,7 +393,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
QPoint point(rect.x() + rect.width() * 0.95,
rect.y() + rect.height() * 0.95);
winData->iconFrame->setPosition(point);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) {
const float a = 0.9 * data.opacity * m_decalOpacity * 0.75;
data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a));
@ -405,7 +405,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region
QPoint point(rect.x() + rect.width() / 2,
rect.y() + rect.height() / 2);
winData->textFrame->setPosition(point);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) {
const float a = 0.9 * data.opacity * m_decalOpacity * 0.75;
data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a));

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "resize.h"
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#include <kwinglutils.h>
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@ -84,7 +84,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
float alpha = 0.8f;
QColor color = KColorScheme(QPalette::Normal, KColorScheme::Selection).background().color();
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == OpenGLCompositing) {
#ifndef KWIN_HAVE_OPENGLES
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT);

View File

@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kglobal.h>
#include <ksharedconfig.h>
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#include <kwinglutils.h>
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@ -51,7 +51,7 @@ const int MAX_TIME = 100;
ShowFpsEffect::ShowFpsEffect()
: paints_pos(0)
, frames_pos(0)
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
, fpsText(0)
#endif
{
@ -162,7 +162,7 @@ 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 KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == OpenGLCompositing) {
paintGL(fps);
glFinish(); // make sure all rendering is done
@ -176,7 +176,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
#endif
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
void ShowFpsEffect::paintGL(int fps)
{
int x = this->x;
@ -343,7 +343,7 @@ void ShowFpsEffect::paintDrawSizeGraph(int x, int y)
void ShowFpsEffect::paintGraph(int x, int y, QList<int> values, QList<int> lines, bool colorize)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == OpenGLCompositing) {
QColor color(0, 0, 0);
color.setAlphaF(alpha);
@ -458,7 +458,7 @@ void ShowFpsEffect::paintFPSText(int fps)
{
if (!fpsTextRect.isValid())
return;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
QImage im(100, 100, QImage::Format_ARGB32);
im.fill(0);
QPainter painter(&im);

View File

@ -42,7 +42,7 @@ public:
virtual void postPaintScreen();
enum { INSIDE_GRAPH, NOWHERE, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT }; // fps text position
private:
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
void paintGL(int fps);
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@ -64,7 +64,7 @@ private:
int x;
int y;
QRect fps_rect;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
GLTexture *fpsText;
#endif
int textPosition;

View File

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinconfig.h>
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#include <kwinglutils.h>
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@ -57,10 +57,8 @@ void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
{
painted = QRegion();
effects->paintScreen(mask, region, data);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (effects->compositingType() == OpenGLCompositing)
paintGL();
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (effects->compositingType() == XRenderCompositing)
paintXrender();
@ -77,7 +75,7 @@ void ShowPaintEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
void ShowPaintEffect::paintGL()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#ifndef KWIN_HAVE_OPENGLES
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT);
#endif

View File

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kdebug.h>
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
#include <kwinglutils.h>
#endif
@ -88,7 +88,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi
thumbData.opacity *= data.opacity;
QRect r;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == KWin::OpenGLCompositing) {
if (data.shader) {
thumbData.shader = data.shader;

View File

@ -112,7 +112,6 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
effects->paintScreen(mask, region, data); // paint normal screen
if (!active)
return;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (texture) {
#ifndef KWIN_HAVE_OPENGLES
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT);
@ -140,7 +139,6 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
glPopAttrib();
#endif
}
#endif
}
void TrackMouseEffect::postPaintScreen()
@ -203,14 +201,12 @@ QRect TrackMouseEffect::starRect(int num) const
void TrackMouseEffect::loadTexture()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
QString file = KGlobal::dirs()->findResource("appdata", "trackmouse.png");
if (file.isEmpty())
return;
QImage im(file);
texture = new GLTexture(im);
textureSize = im.size();
#endif
}
} // namespace

View File

@ -133,7 +133,6 @@ ZoomEffect::~ZoomEffect()
void ZoomEffect::showCursor()
{
#if defined(KWIN_HAVE_OPENGL_COMPOSITING) || defined(KWIN_HAVE_XRENDER_COMPOSITING)
if (isMouseHidden) {
// show the previously hidden mouse-pointer again and free the loaded texture/picture.
Display* display = QX11Info::display();
@ -144,12 +143,10 @@ void ZoomEffect::showCursor()
xrenderPicture = 0;
isMouseHidden = false;
}
#endif
}
void ZoomEffect::hideCursor()
{
#if defined(KWIN_HAVE_OPENGL_COMPOSITING) || defined(KWIN_HAVE_XRENDER_COMPOSITING)
if (!isMouseHidden) {
// try to load the cursor-theme into a OpenGL texture and if successful then hide the mouse-pointer
recreateTexture();
@ -159,7 +156,6 @@ void ZoomEffect::hideCursor()
isMouseHidden = true;
}
}
#endif
}
void ZoomEffect::recreateTexture()
@ -185,7 +181,7 @@ void ZoomEffect::recreateTexture()
imageWidth = ximg->width;
imageHeight = ximg->height;
QImage img((uchar*)ximg->pixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (effects->compositingType() == OpenGLCompositing)
texture = new GLTexture(img);
#endif
@ -336,7 +332,7 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
QPoint p = QCursor::pos();
QRect rect(p.x() * zoom + data.xTranslate, p.y() * zoom + data.yTranslate, w, h);
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef KWIN_HAVE_OPENGL
if (texture) {
#ifndef KWIN_HAVE_OPENGLES
glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT);

View File

@ -89,12 +89,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
#define OPENGL_INDEX 0
#define XRENDER_INDEX 1
#ifndef KWIN_HAVE_OPENGL_COMPOSITING
ui.compositingType->removeItem(OPENGL_INDEX);
ui.glGroup->setEnabled(false);
#define OPENGL_INDEX -1
#define XRENDER_INDEX 0
#endif
#ifndef KWIN_HAVE_XRENDER_COMPOSITING
ui.compositingType->removeItem(XRENDER_INDEX);
ui.xrenderGroup->setEnabled(false);

View File

@ -22,10 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "lanczosfilter.h"
#include "effects.h"
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#include <kwinglutils.h>
#include <kwinglplatform.h>
#endif
#include <kwineffects.h>
#include <KDE/KGlobalSettings>
@ -38,21 +36,17 @@ namespace KWin
LanczosFilter::LanczosFilter(QObject* parent)
: QObject(parent)
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
, m_offscreenTex(0)
, m_offscreenTarget(0)
, m_shader(0)
#endif
, m_inited(false)
{
}
LanczosFilter::~LanczosFilter()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
delete m_offscreenTarget;
delete m_offscreenTex;
#endif
}
void LanczosFilter::init()
@ -60,7 +54,6 @@ void LanczosFilter::init()
if (m_inited)
return;
m_inited = true;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0);
if (force) {
kWarning(1212) << "Lanczos Filter forced on by environment variable";
@ -81,13 +74,11 @@ void LanczosFilter::init()
delete m_shader;
m_shader = 0;
}
#endif
}
void LanczosFilter::updateOffscreenSurfaces()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
int w = displayWidth();
int h = displayHeight();
if (!GLTexture::NPOTTextureSupported()) {
@ -104,7 +95,6 @@ void LanczosFilter::updateOffscreenSurfaces()
m_offscreenTex->setWrapMode(GL_CLAMP_TO_EDGE);
m_offscreenTarget = new GLRenderTarget(m_offscreenTex);
}
#endif
}
static float sinc(float x)
@ -123,7 +113,6 @@ static float lanczos(float x, float a)
return sinc(x) * sinc(x / a);
}
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
void LanczosShader::createKernel(float delta, int *size)
{
const float a = 2.0;
@ -163,11 +152,9 @@ void LanczosShader::createOffsets(int count, float width, Qt::Orientation direct
QVector2D(i / width, 0) : QVector2D(0, i / width);
}
}
#endif
void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (effects->compositingType() == KWin::OpenGLCompositing && (data.xScale < 0.9 || data.yScale < 0.9) &&
KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) {
if (!m_inited)
@ -371,13 +358,11 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region,
return;
}
} // if ( effects->compositingType() == KWin::OpenGLCompositing )
#endif
w->sceneWindow()->performPaint(mask, region, data);
} // End of function
void LanczosFilter::timerEvent(QTimerEvent *event)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (event->timerId() == m_timer.timerId()) {
m_timer.stop();
@ -395,12 +380,10 @@ void LanczosFilter::timerEvent(QTimerEvent *event)
}
}
}
#endif
}
void LanczosFilter::prepareRenderStates(GLTexture* tex, double opacity, double brightness, double saturation)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
const bool alpha = true;
// setup blending of transparent windows
@ -509,12 +492,10 @@ void LanczosFilter::prepareRenderStates(GLTexture* tex, double opacity, double b
}
}
#endif
#endif
}
void LanczosFilter::restoreRenderStates(GLTexture* tex, double opacity, double brightness, double saturation)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
if (opacity != 1.0 || saturation != 1.0 || brightness != 1.0f) {
if (saturation != 1.0 && tex->saturationSupported()) {
@ -532,13 +513,11 @@ void LanczosFilter::restoreRenderStates(GLTexture* tex, double opacity, double b
glPopAttrib(); // ENABLE_BIT
#endif
#endif
}
/************************************************
* LanczosShader
************************************************/
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
LanczosShader::LanczosShader(QObject* parent)
: QObject(parent)
, m_shader(0)
@ -690,7 +669,6 @@ bool LanczosShader::init()
return true;
#endif
}
#endif
} // namespace

View File

@ -38,9 +38,7 @@ class WindowPaintData;
class GLTexture;
class GLRenderTarget;
class GLShader;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
class LanczosShader;
#endif
class LanczosFilter
: public QObject
@ -61,14 +59,11 @@ private:
void restoreRenderStates(GLTexture* tex, double opacity, double brightness, double saturation);
GLTexture *m_offscreenTex;
GLRenderTarget *m_offscreenTarget;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
LanczosShader *m_shader;
#endif
QBasicTimer m_timer;
bool m_inited;
};
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
class LanczosShader
: public QObject
{
@ -94,7 +89,6 @@ private:
QVector4D m_kernel[16];
uint m_arbProgram; // TODO: GLuint
};
#endif
} // namespace

View File

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

View File

@ -686,21 +686,17 @@ QRegion PaintClipper::paintArea()
struct PaintClipper::Iterator::Data {
Data() : index(0) {}
int index;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
QVector< QRect > rects;
#endif
};
PaintClipper::Iterator::Iterator()
: data(new Data)
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (clip() && effects->compositingType() == OpenGLCompositing) {
data->rects = paintArea().rects();
data->index = -1;
next(); // move to the first one
}
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (clip() && effects->compositingType() == XRenderCompositing) {
XserverRegion region = toXserverRegion(paintArea());
@ -723,10 +719,8 @@ bool PaintClipper::Iterator::isDone()
{
if (!clip())
return data->index == 1; // run once
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (effects->compositingType() == OpenGLCompositing)
return data->index >= data->rects.count(); // run once per each area
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (effects->compositingType() == XRenderCompositing)
return data->index == 1; // run once
@ -743,10 +737,8 @@ QRect PaintClipper::Iterator::boundingRect() const
{
if (!clip())
return infiniteRegion();
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (effects->compositingType() == OpenGLCompositing)
return data->rects[ data->index ];
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (effects->compositingType() == XRenderCompositing)
return paintArea().boundingRect();

View File

@ -58,7 +58,6 @@ int currentRefreshRate()
int rate = -1;
if (options->refreshRate > 0) // use manually configured refresh rate
rate = options->refreshRate;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
else if (GLPlatform::instance()->driver() == Driver_NVidia) {
QProcess nvidia_settings;
@ -75,7 +74,6 @@ int currentRefreshRate()
}
}
#endif
#endif
#ifdef HAVE_XRANDR
else if (Extensions::randrAvailable()) {
XRRScreenConfiguration *config = XRRGetScreenInfo(display(), rootWindow());

View File

@ -84,8 +84,6 @@ Sources and other compositing managers:
// normally only few of them are enabled
//#define CHECK_GL_ERROR
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#include <X11/extensions/Xcomposite.h>
#include <qpainter.h>
@ -1734,5 +1732,3 @@ bool SceneOpenGLShadow::prepareBackend()
}
} // namespace
#endif

View File

@ -27,8 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwinglutils.h"
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifdef HAVE_XSHM
#include <X11/extensions/XShm.h>
#endif
@ -247,5 +245,3 @@ private:
} // namespace
#endif
#endif

View File

@ -22,9 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "atoms.h"
#include "effects.h"
#include "toplevel.h"
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
#include "scene_opengl.h"
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
#include "scene_xrender.h"
#endif
@ -52,9 +50,7 @@ Shadow *Shadow::createShadow(Toplevel *toplevel)
if (!data.isEmpty()) {
Shadow *shadow = NULL;
if (effects->compositingType() == OpenGLCompositing) {
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
shadow = new SceneOpenGLShadow(toplevel);
#endif
} else if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
shadow = new SceneXRenderShadow(toplevel);