From 92761e9e30d8ad3431e2003425f8de9b38cc0053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 13 Mar 2014 16:21:04 +0100 Subject: [PATCH] [kwin] Fix ifdefs for Wayland With the switch to FindWayland from ECM WAYLAND_FOUND was no longer set thus the ifdef didn't work. Now we use HAVE_WAYLAND and HAVE_WAYLAND_EGL. --- CMakeLists.txt | 2 ++ config-kwin.h.cmake | 2 ++ effects.cpp | 6 +++--- scene_opengl.cpp | 4 ++-- scene_qpainter.cpp | 6 +++--- scene_qpainter.h | 2 +- scene_xrender.cpp | 6 +++--- scene_xrender.h | 2 +- workspace.cpp | 4 ++-- 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd633bd0f7..1e3a147af9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,8 @@ endif() # for things that are also used by kwin libraries configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h ) # for kwin internal things +set(HAVE_WAYLAND ${Wayland_Client_FOUND}) +set(HAVE_WAYLAND_EGL ${Wayland_Egl_FOUND} AND ${Wayland_Client_FOUND}) configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h ) diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake index 333865479c..002a299fde 100644 --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -8,3 +8,5 @@ #define KWIN_NAME "${KWIN_NAME}" #define KWIN_CONFIG "${KWIN_NAME}rc" #define KWIN_VERSION_STRING "${KDE4WORKSPACE_VERSION}" +#cmakedefine01 HAVE_WAYLAND +#cmakedefine01 HAVE_WAYLAND_EGL diff --git a/effects.cpp b/effects.cpp index 5545696c4a..223b4851b2 100644 --- a/effects.cpp +++ b/effects.cpp @@ -66,7 +66,7 @@ along with this program. If not, see . #include #include "composite.h" #include "xcbutils.h" -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND #include "wayland_backend.h" #endif @@ -771,7 +771,7 @@ void EffectsHandlerImpl::startMouseInterception(Effect *effect, Qt::CursorShape return; } if (kwinApp()->operationMode() != Application::OperationModeX11) { -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND if (Wayland::WaylandBackend *w = Wayland::WaylandBackend::self()) { w->installCursorImage(shape); } @@ -1265,7 +1265,7 @@ QSize EffectsHandlerImpl::virtualScreenSize() const void EffectsHandlerImpl::defineCursor(Qt::CursorShape shape) { if (!m_mouseInterceptionWindow.isValid()) { -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND if (Wayland::WaylandBackend *w = Wayland::WaylandBackend::self()) { w->installCursorImage(shape); } diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 84bca4fa36..77452d7ad0 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -26,7 +26,7 @@ along with this program. If not, see . #include "eglonxbackend.h" // for Wayland #include "config-workspace.h" -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND_EGL #include "egl_wayland_backend.h" #endif #endif @@ -224,7 +224,7 @@ SceneOpenGL *SceneOpenGL::createScene() break; case EglPlatformInterface: #ifdef KWIN_HAVE_EGL -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND_EGL if (kwinApp()->shouldUseWaylandForCompositing()) { backend = new EglWaylandBackend(); } else { diff --git a/scene_qpainter.cpp b/scene_qpainter.cpp index e272474a92..85e674ac7c 100644 --- a/scene_qpainter.cpp +++ b/scene_qpainter.cpp @@ -26,7 +26,7 @@ along with this program. If not, see . #include "main.h" #include "paintredirector.h" #include "toplevel.h" -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND #include "wayland_backend.h" #endif #include "workspace.h" @@ -75,7 +75,7 @@ void QPainterBackend::setFailed(const QString &reason) m_failed = true; } -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND //**************************************** // WaylandQPainterBackend //**************************************** @@ -209,7 +209,7 @@ bool WaylandQPainterBackend::needsFullRepaint() const SceneQPainter *SceneQPainter::createScene() { QScopedPointer backend; -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { backend.reset(new WaylandQPainterBackend); if (backend->isFailed()) { diff --git a/scene_qpainter.h b/scene_qpainter.h index f062f85303..41b4183caa 100644 --- a/scene_qpainter.h +++ b/scene_qpainter.h @@ -100,7 +100,7 @@ private: bool m_failed; }; -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND namespace Wayland { class Buffer; } diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 13803117e5..72db3df3b7 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -35,7 +35,7 @@ along with this program. If not, see . #include "workspace.h" #include "xcbutils.h" #include "kwinxrenderutils.h" -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND #include "wayland_backend.h" #endif @@ -256,7 +256,7 @@ bool X11XRenderBackend::usesOverlayWindow() const //**************************************** // WaylandXRenderBackend //**************************************** -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND static void handleFrameCallback(void *data, wl_callback *callback, uint32_t time) { Q_UNUSED(data) @@ -367,7 +367,7 @@ bool WaylandXRenderBackend::usesOverlayWindow() const SceneXrender* SceneXrender::createScene() { QScopedPointer backend; -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { backend.reset(new WaylandXRenderBackend); if (backend->isFailed()) { diff --git a/scene_xrender.h b/scene_xrender.h index b3e3ec6dcc..366a4dbf40 100644 --- a/scene_xrender.h +++ b/scene_xrender.h @@ -152,7 +152,7 @@ private: xcb_render_pictformat_t m_format; }; -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND class WaylandXRenderBackend : public XRenderBackend { public: diff --git a/workspace.cpp b/workspace.cpp index 37edcfff81..8bac2f7e3b 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -58,7 +58,7 @@ along with this program. If not, see . #include "useractions.h" #include "virtualdesktops.h" #include -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND #include "wayland_backend.h" #endif #include "xcbutils.h" @@ -150,7 +150,7 @@ Workspace::Workspace(bool restore) InputRedirection::create(this); // start the Wayland Backend - will only be created if WAYLAND_DISPLAY is present -#ifdef WAYLAND_FOUND +#if HAVE_WAYLAND Wayland::WaylandBackend::create(this); #endif // start the cursor support