Git commit 3139dcd3b9b1fe022bb4c82ec7667b07021a5eb3 by Martin Gr=C3=A4=C3= =9Flin. Committed on 12/08/2015 at 09:39. Pushed by graesslin into branch 'master'. Drop cmakedefine HAVE_WAYLAND Now a required build dependency. M +0 -1 CMakeLists.txt M +0 -6 abstract_client.cpp M +0 -16 abstract_egl_backend.cpp M +0 -2 abstract_egl_backend.h M +6 -18 composite.cpp M +0 -1 config-kwin.h.cmake M +0 -12 effects.cpp M +0 -4 events.cpp M +0 -4 geometry.cpp M +0 -61 input.cpp M +0 -4 layers.cpp M +0 -10 scene.cpp M +0 -10 scene.h M +1 -8 scene_opengl.cpp M +0 -8 scene_qpainter.cpp M +0 -4 screens.cpp M +0 -6 scripting/scripting_model.cpp M +0 -16 shadow.cpp M +0 -4 thumbnailitem.cpp M +4 -9 toplevel.cpp M +0 -8 toplevel.h M +0 -16 workspace.cpp http://commits.kde.org/kwin/3139dcd3b9b1fe022bb4c82ec7667b07021a5eb3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a30827..23c00eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,7 +261,6 @@ include_directories(${epoxy_INCLUDE_DIR}) # for things that are also used by kwin libraries configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DI= R}/libkwineffects/kwinconfig.h ) # for kwin internal things -set(HAVE_WAYLAND TRUE) set(HAVE_WAYLAND_EGL ${Wayland_Egl_FOUND}) set(HAVE_X11_XCB ${X11_XCB_FOUND}) = diff --git a/abstract_client.cpp b/abstract_client.cpp index 4597622..c6b0bec 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -27,10 +27,8 @@ along with this program. If not, see . #include "tabgroup.h" #include "workspace.h" = -#if HAVE_WAYLAND #include "wayland_server.h" #include -#endif = namespace KWin { @@ -518,7 +516,6 @@ bool AbstractClient::hasStrut() const = void AbstractClient::setupWindowManagementInterface() { -#if HAVE_WAYLAND if (m_windowManagementInterface) { // already setup return; @@ -629,15 +626,12 @@ void AbstractClient::setupWindowManagementInterface() } ); m_windowManagementInterface =3D w; -#endif } = void AbstractClient::destroyWindowManagementInterface() { -#if HAVE_WAYLAND delete m_windowManagementInterface; m_windowManagementInterface =3D nullptr; -#endif } = Options::MouseCommand AbstractClient::getMouseCommand(Qt::MouseButton butt= on, bool *handled) const diff --git a/abstract_egl_backend.cpp b/abstract_egl_backend.cpp index 5ef3ada..28c557d 100644 --- a/abstract_egl_backend.cpp +++ b/abstract_egl_backend.cpp @@ -19,11 +19,9 @@ along with this program. If not, see . *********************************************************************/ #include "abstract_egl_backend.h" #include "options.h" -#if HAVE_WAYLAND #include "wayland_server.h" #include #include -#endif // kwin libs #include // Qt @@ -32,7 +30,6 @@ along with this program. If not, see . namespace KWin { = -#if HAVE_WAYLAND typedef GLboolean(*eglBindWaylandDisplayWL_func)(EGLDisplay dpy, wl_displa= y *display); typedef GLboolean(*eglUnbindWaylandDisplayWL_func)(EGLDisplay dpy, wl_disp= lay *display); typedef GLboolean(*eglQueryWaylandBufferWL_func)(EGLDisplay dpy, struct wl= _resource *buffer, EGLint attribute, EGLint *value); @@ -49,7 +46,6 @@ eglQueryWaylandBufferWL_func eglQueryWaylandBufferWL =3D = nullptr; #ifndef EGL_WAYLAND_Y_INVERTED_WL #define EGL_WAYLAND_Y_INVERTED_WL 0x31DB #endif -#endif = AbstractEglBackend::AbstractEglBackend() : OpenGLBackend() @@ -60,11 +56,9 @@ AbstractEglBackend::~AbstractEglBackend() =3D default; = void AbstractEglBackend::cleanup() { -#if HAVE_WAYLAND if (eglUnbindWaylandDisplayWL && eglDisplay() !=3D EGL_NO_DISPLAY) { eglUnbindWaylandDisplayWL(eglDisplay(), *(WaylandServer::self()->d= isplay())); } -#endif cleanupGL(); doneCurrent(); eglDestroyContext(m_display, m_context); @@ -133,7 +127,6 @@ void AbstractEglBackend::initBufferAge() = void AbstractEglBackend::initWayland() { -#if HAVE_WAYLAND if (!WaylandServer::self()) { return; } @@ -148,7 +141,6 @@ void AbstractEglBackend::initWayland() waylandServer()->display()->setEglDisplay(eglDisplay()); } } -#endif } = void AbstractEglBackend::initClientExtensions() @@ -207,7 +199,6 @@ OpenGLBackend *AbstractEglTexture::backend() = bool AbstractEglTexture::loadTexture(WindowPixmap *pixmap) { -#if HAVE_WAYLAND const auto &buffer =3D pixmap->buffer(); if (buffer.isNull()) { // try X11 loading @@ -219,9 +210,6 @@ bool AbstractEglTexture::loadTexture(WindowPixmap *pixm= ap) } else { return loadEglTexture(buffer); } -#else - return loadTexture(pixmap->pixmap(), pixmap->toplevel()->size()); -#endif } = bool AbstractEglTexture::loadTexture(xcb_pixmap_t pix, const QSize &size) @@ -256,7 +244,6 @@ bool AbstractEglTexture::loadTexture(xcb_pixmap_t pix, = const QSize &size) = void AbstractEglTexture::updateTexture(WindowPixmap *pixmap) { -#if HAVE_WAYLAND const auto &buffer =3D pixmap->buffer(); if (buffer.isNull()) { return; @@ -303,10 +290,8 @@ void AbstractEglTexture::updateTexture(WindowPixmap *p= ixmap) } } q->unbind(); -#endif } = -#if HAVE_WAYLAND bool AbstractEglTexture::loadShmTexture(const QPointer< KWayland::Server::= BufferInterface > &buffer) { const QImage &image =3D buffer->data(); @@ -407,7 +392,6 @@ EGLImageKHR AbstractEglTexture::attach(const QPointer< = KWayland::Server::BufferI } return image; } -#endif = } = diff --git a/abstract_egl_backend.h b/abstract_egl_backend.h index c266521..8589869 100644 --- a/abstract_egl_backend.h +++ b/abstract_egl_backend.h @@ -91,11 +91,9 @@ protected: = private: bool loadTexture(xcb_pixmap_t pix, const QSize &size); -#if HAVE_WAYLAND bool loadShmTexture(const QPointer = &buffer); bool loadEglTexture(const QPointer = &buffer); EGLImageKHR attach(const QPointer &= buffer); -#endif SceneOpenGL::Texture *q; AbstractEglBackend *m_backend; EGLImageKHR m_image; diff --git a/composite.cpp b/composite.cpp index 1db4790..4b81c97 100644 --- a/composite.cpp +++ b/composite.cpp @@ -37,16 +37,12 @@ along with this program. If not, see . #include "useractions.h" #include "compositingprefs.h" #include "xcbutils.h" -#if HAVE_WAYLAND #include "abstract_backend.h" #include "shell_client.h" #include "wayland_server.h" -#endif #include "decorations/decoratedclient.h" = -#if HAVE_WAYLAND #include -#endif = #include = @@ -118,7 +114,6 @@ Compositor::Compositor(QObject* workspace) m_unusedSupportPropertyTimer.setInterval(compositorLostMessageDelay); m_unusedSupportPropertyTimer.setSingleShot(true); connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteU= nusedSupportProperties())); -#if HAVE_WAYLAND if (kwinApp()->operationMode() !=3D Application::OperationModeX11) { if (waylandServer()->backend()->isReady()) { QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection); @@ -132,15 +127,12 @@ Compositor::Compositor(QObject* workspace) } }, Qt::QueuedConnection ); - } else -#endif - - { - // delay the call to setup by one event cycle - // The ctor of this class is invoked from the Workspace ctor, that mea= ns before - // Workspace is completely constructed, so calling Workspace::self() w= ould result - // in undefined behavior. This is fixed by using a delayed invocation. - QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection); + } else { + // delay the call to setup by one event cycle + // The ctor of this class is invoked from the Workspace ctor, that= means before + // Workspace is completely constructed, so calling Workspace::self= () would result + // in undefined behavior. This is fixed by using a delayed invocat= ion. + QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection); } = // register DBus @@ -712,7 +704,6 @@ void Compositor::performCompositing() m_timeSinceLastVBlank =3D m_scene->paint(repaints, windows); m_timeSinceStart +=3D m_timeSinceLastVBlank; = -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { for (Toplevel *win : damaged) { if (auto surface =3D win->surface()) { @@ -720,7 +711,6 @@ void Compositor::performCompositing() } } } -#endif = compositeTimer.stop(); // stop here to ensure *we* cause the next repa= int schedule - not some effect through m_scene->paint() = @@ -749,7 +739,6 @@ bool Compositor::windowRepaintsPending() const foreach (Toplevel * c, Workspace::self()->deletedList()) if (!c->repaints().isEmpty()) return true; -#if HAVE_WAYLAND if (auto w =3D waylandServer()) { const auto &clients =3D w->clients(); for (auto c : clients) { @@ -764,7 +753,6 @@ bool Compositor::windowRepaintsPending() const } } } -#endif return false; } = diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake index 392c806..0633131 100644 --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -8,7 +8,6 @@ #define XCB_VERSION_STRING "${XCB_VERSION}" #define KWIN_KILLER_BIN "${CMAKE_INSTALL_PREFIX}/${LIBEXEC_INSTALL_DIR}/kw= in_killer_helper" #define KWIN_RULES_DIALOG_BIN "${CMAKE_INSTALL_PREFIX}/${LIBEXEC_INSTALL_D= IR}/kwin_rules_dialog" -#cmakedefine01 HAVE_WAYLAND #cmakedefine01 HAVE_WAYLAND_EGL #cmakedefine01 HAVE_INPUT #cmakedefine01 HAVE_X11_XCB diff --git a/effects.cpp b/effects.cpp index 81c6ede..d7c6462 100644 --- a/effects.cpp +++ b/effects.cpp @@ -55,11 +55,9 @@ along with this program. If not, see . #include #include "composite.h" #include "xcbutils.h" -#if HAVE_WAYLAND #include "abstract_backend.h" #include "shell_client.h" #include "wayland_server.h" -#endif = #include "decorations/decorationbridge.h" #include @@ -303,7 +301,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *comp= ositor, Scene *scene) for (Unmanaged *u : ws->unmanagedList()) { setupUnmanagedConnections(u); } -#if HAVE_WAYLAND if (auto w =3D waylandServer()) { connect(w, &WaylandServer::shellClientAdded, this, [this](ShellClient *c) { @@ -314,7 +311,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *comp= ositor, Scene *scene) } ); } -#endif reconfigure(); } = @@ -585,14 +581,12 @@ void EffectsHandlerImpl::slotClientShown(KWin::Toplev= el *t) = void EffectsHandlerImpl::slotShellClientShown(Toplevel *t) { -#if HAVE_WAYLAND ShellClient *c =3D static_cast(t); connect(c, &ShellClient::windowClosed, this, &EffectsHandlerImpl::slot= WindowClosed); connect(c, &ShellClient::geometryShapeChanged, this, &EffectsHandlerIm= pl::slotGeometryShapeChanged); connect(c, static_cast(&Client::clientMaximizedStateChanged), this, &EffectsHandlerImpl::slotClientMaximized); emit windowAdded(t->effectWindow()); -#endif } = void EffectsHandlerImpl::slotUnmanagedShown(KWin::Toplevel *t) @@ -705,11 +699,9 @@ void EffectsHandlerImpl::startMouseInterception(Effect= *effect, Qt::CursorShape return; } if (kwinApp()->operationMode() !=3D Application::OperationModeX11) { -#if HAVE_WAYLAND if (AbstractBackend *w =3D waylandServer()->backend()) { w->installCursorImage(shape); } -#endif return; } // NOTE: it is intended to not perform an XPointerGrab on X11. See doc= umentation in kwineffects.h @@ -1038,13 +1030,11 @@ EffectWindow* EffectsHandlerImpl::findWindow(WId id= ) const return w->effectWindow(); if (Unmanaged* w =3D Workspace::self()->findUnmanaged(id)) return w->effectWindow(); -#if HAVE_WAYLAND if (waylandServer()) { if (ShellClient *w =3D waylandServer()->findClient(id)) { return w->effectWindow(); } } -#endif return NULL; } = @@ -1212,13 +1202,11 @@ QSize EffectsHandlerImpl::virtualScreenSize() const void EffectsHandlerImpl::defineCursor(Qt::CursorShape shape) { if (!m_mouseInterceptionWindow.isValid()) { -#if HAVE_WAYLAND if (waylandServer()) { if (AbstractBackend *w =3D waylandServer()->backend()) { w->installCursorImage(shape); } } -#endif return; } const xcb_cursor_t c =3D Cursor::x11Cursor(shape); diff --git a/events.cpp b/events.cpp index 3ce3f91..ba5aa4f 100644 --- a/events.cpp +++ b/events.cpp @@ -66,10 +66,8 @@ along with this program. If not, see . #include "killwindow.h" #include "x11eventfilter.h" = -#if HAVE_WAYLAND #include "wayland_server.h" #include -#endif = #ifndef XCB_GE_GENERIC #define XCB_GE_GENERIC 35 @@ -1659,11 +1657,9 @@ void Toplevel::clientMessageEvent(xcb_client_message= _event_t *e) { if (e->type =3D=3D atoms->wl_surface_id) { m_surfaceId =3D e->data.data32[0]; -#if HAVE_WAYLAND if (auto w =3D waylandServer()) { m_surface =3D KWayland::Server::SurfaceInterface::get(m_surfac= eId, w->xWaylandConnection()); } -#endif emit surfaceIdChanged(m_surfaceId); } } diff --git a/geometry.cpp b/geometry.cpp index f63e851..c460da2 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -44,10 +44,8 @@ along with this program. If not, see . #include = #include "outline.h" -#if HAVE_WAYLAND #include "shell_client.h" #include "wayland_server.h" -#endif = #include #include @@ -184,7 +182,6 @@ void Workspace::updateClientArea(bool force) } } } -#if HAVE_WAYLAND if (waylandServer()) { auto updateStrutsForWaylandClient =3D [&] (ShellClient *c) { // assuming that only docks have "struts" and that all docks h= ave a strut @@ -216,7 +213,6 @@ void Workspace::updateClientArea(bool force) updateStrutsForWaylandClient(c); } } -#endif #if 0 for (int i =3D 1; i <=3D numberOfDesktops(); diff --git a/input.cpp b/input.cpp index c511e25..213b6d9 100644 --- a/input.cpp +++ b/input.cpp @@ -32,7 +32,6 @@ along with this program. If not, see . #if HAVE_INPUT #include "libinput/connection.h" #endif -#if HAVE_WAYLAND #include "abstract_backend.h" #include "shell_client.h" #include "wayland_server.h" @@ -40,7 +39,6 @@ along with this program. If not, see . #include #include #include -#endif #include #include // Qt @@ -134,7 +132,6 @@ void Xkb::updateKeymap(xkb_keymap *keymap) = void Xkb::createKeymapFile() { -#if HAVE_WAYLAND if (!waylandServer()) { return; } @@ -168,7 +165,6 @@ void Xkb::createKeymapFile() return; } waylandServer()->seat()->setKeymap(tmp->handle(), size); -#endif } = void Xkb::updateModifiers(uint32_t modsDepressed, uint32_t modsLatched, ui= nt32_t modsLocked, uint32_t group) @@ -283,7 +279,6 @@ void InputRedirection::init() = void InputRedirection::setupWorkspace() { -#if HAVE_WAYLAND if (waylandServer()) { connect(workspace(), &Workspace::clientActivated, this, &InputRedi= rection::updateKeyboardWindow); using namespace KWayland::Server; @@ -348,10 +343,8 @@ void InputRedirection::setupWorkspace() } ); } -#endif } = -#if HAVE_WAYLAND static KWayland::Server::SeatInterface *findSeat() { auto server =3D waylandServer(); @@ -360,7 +353,6 @@ static KWayland::Server::SeatInterface *findSeat() } return server->seat(); } -#endif = void InputRedirection::setupLibInput() { @@ -400,7 +392,6 @@ void InputRedirection::setupLibInput() } else { connect(kwinApp(), &Application::screensCreated, this, &InputR= edirection::setupLibInputWithScreens); } -#if HAVE_WAYLAND if (auto s =3D findSeat()) { s->setHasKeyboard(conn->hasKeyboard()); s->setHasPointer(conn->hasPointer()); @@ -437,7 +428,6 @@ void InputRedirection::setupLibInput() } } ); -#endif } #endif } @@ -480,7 +470,6 @@ void InputRedirection::updatePointerWindow() if (!oldWindow.isNull() && t =3D=3D m_pointerWindow.data()) { return; } -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { // disconnect old surface if (oldWindow) { @@ -509,7 +498,6 @@ void InputRedirection::updatePointerWindow() t =3D nullptr; } } -#endif if (!t) { m_pointerWindow.clear(); return; @@ -540,11 +528,9 @@ void InputRedirection::updatePointerDecoration(Topleve= l *t) // send leave QHoverEvent event(QEvent::HoverLeave, QPointF(), QPointF()); QCoreApplication::instance()->sendEvent(oldDeco->decoration(), &ev= ent); -#if HAVE_WAYLAND if (!m_pointerDecoration && waylandServer()) { waylandServer()->backend()->installCursorImage(Qt::ArrowCursor= ); } -#endif } if (m_pointerDecoration) { const QPointF p =3D m_globalPointer - t->pos(); @@ -558,7 +544,6 @@ void InputRedirection::updatePointerDecoration(Toplevel= *t) void InputRedirection::updatePointerInternalWindow() { const auto oldInternalWindow =3D m_pointerInternalWindow; -#if HAVE_WAYLAND if (waylandServer()) { bool found =3D false; const auto &internalClients =3D waylandServer()->internalClients(); @@ -582,7 +567,6 @@ void InputRedirection::updatePointerInternalWindow() } } } -#endif if (oldInternalWindow !=3D m_pointerInternalWindow) { // changed if (oldInternalWindow) { @@ -618,16 +602,13 @@ void InputRedirection::pointerInternalWindowVisibilit= yChanged(bool visible) = void InputRedirection::installCursorFromDecoration() { -#if HAVE_WAYLAND if (waylandServer() && m_pointerDecoration) { waylandServer()->backend()->installCursorImage(m_pointerDecoration= ->client()->cursor()); } -#endif } = void InputRedirection::updateFocusedPointerPosition() { -#if HAVE_WAYLAND if (m_pointerWindow.isNull()) { return; } @@ -641,12 +622,10 @@ void InputRedirection::updateFocusedPointerPosition() } seat->setFocusedPointerSurfacePosition(m_pointerWindow.data()->pos= ()); } -#endif } = void InputRedirection::updateFocusedTouchPosition() { -#if HAVE_WAYLAND if (m_touchWindow.isNull()) { return; } @@ -656,7 +635,6 @@ void InputRedirection::updateFocusedTouchPosition() } seat->setFocusedTouchSurfacePosition(m_touchWindow.data()->pos()); } -#endif } = void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t t= ime) @@ -690,12 +668,10 @@ void InputRedirection::processPointerMotion(const QPo= intF &pos, uint32_t time) m_pointerDecoration->client()->processDecorationMove(); } } -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->setTimestamp(time); seat->setPointerPos(m_globalPointer); } -#endif } = void InputRedirection::processPointerButton(uint32_t button, InputRedirect= ion::PointerButtonState state, uint32_t time) @@ -743,7 +719,6 @@ void InputRedirection::processPointerButton(uint32_t bu= tton, InputRedirection::P installCursorFromDecoration(); } // TODO: check which part of KWin would like to intercept the event -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->setTimestamp(time); bool passThrough =3D true; @@ -760,7 +735,6 @@ void InputRedirection::processPointerButton(uint32_t bu= tton, InputRedirection::P state =3D=3D PointerButtonPressed ? seat->pointerButtonPressed= (button) : seat->pointerButtonReleased(button); } } -#endif if (state =3D=3D PointerButtonReleased && !areButtonsPressed()) { updatePointerWindow(); } @@ -820,17 +794,14 @@ void InputRedirection::processPointerAxis(InputRedire= ction::PointerAxis axis, qr = // TODO: check which part of KWin would like to intercept the event // TODO: Axis support for effect redirection -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->setTimestamp(time); seat->pointerAxis(axis =3D=3D InputRedirection::PointerAxisHorizon= tal ? Qt::Horizontal : Qt::Vertical, delta); } -#endif } = void InputRedirection::updateKeyboardWindow() { -#if HAVE_WAYLAND if (!workspace()) { return; } @@ -851,7 +822,6 @@ void InputRedirection::updateKeyboardWindow() } } } -#endif } = void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::= KeyboardKeyState state, uint32_t time) @@ -861,7 +831,6 @@ void InputRedirection::processKeyboardKey(uint32_t key,= InputRedirection::Keyboa if (oldMods !=3D keyboardModifiers()) { emit keyboardModifiersChanged(keyboardModifiers(), oldMods); } -#if HAVE_WAYLAND // check for vt-switch if (VirtualTerminal::self()) { const xkb_keysym_t keysym =3D m_xkb->toKeysym(key); @@ -871,7 +840,6 @@ void InputRedirection::processKeyboardKey(uint32_t key,= InputRedirection::Keyboa return; } } -#endif // TODO: pass to internal parts of KWin #ifdef KWIN_BUILD_TABBOX if (TabBox::TabBox::self() && TabBox::TabBox::self()->isGrabbed()) { @@ -903,12 +871,10 @@ void InputRedirection::processKeyboardKey(uint32_t ke= y, InputRedirection::Keyboa return; } } -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->setTimestamp(time); state =3D=3D InputRedirection::KeyboardKeyPressed ? seat->keyPress= ed(key) : seat->keyReleased(key); } -#endif } = void InputRedirection::processKeyboardModifiers(uint32_t modsDepressed, ui= nt32_t modsLatched, uint32_t modsLocked, uint32_t group) @@ -930,7 +896,6 @@ void InputRedirection::processKeymapChange(int fd, uint= 32_t size) void InputRedirection::processTouchDown(qint32 id, const QPointF &pos, qui= nt32 time) { // TODO: internal handling? -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->setTimestamp(time); if (!seat->isTouchSequence()) { @@ -949,11 +914,6 @@ void InputRedirection::processTouchDown(qint32 id, con= st QPointF &pos, quint32 t } m_touchIdMapper.insert(id, seat->touchDown(pos)); } -#else - Q_UNUSED(id) - Q_UNUSED(pos) - Q_UNUSED(time) -#endif } = void InputRedirection::updateTouchWindow(const QPointF &pos) @@ -964,7 +924,6 @@ void InputRedirection::updateTouchWindow(const QPointF = &pos) if (!oldWindow.isNull() && t =3D=3D oldWindow.data()) { return; } -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { // disconnect old surface if (oldWindow) { @@ -978,7 +937,6 @@ void InputRedirection::updateTouchWindow(const QPointF = &pos) t =3D nullptr; } } -#endif if (!t) { m_touchWindow.clear(); return; @@ -990,7 +948,6 @@ void InputRedirection::updateTouchWindow(const QPointF = &pos) void InputRedirection::processTouchUp(qint32 id, quint32 time) { // TODO: internal handling? -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { auto it =3D m_touchIdMapper.constFind(id); if (it !=3D m_touchIdMapper.constEnd()) { @@ -998,16 +955,11 @@ void InputRedirection::processTouchUp(qint32 id, quin= t32 time) seat->touchUp(it.value()); } } -#else - Q_UNUSED(id) - Q_UNUSED(time) -#endif } = void InputRedirection::processTouchMotion(qint32 id, const QPointF &pos, q= uint32 time) { // TODO: internal handling? -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->setTimestamp(time); auto it =3D m_touchIdMapper.constFind(id); @@ -1016,29 +968,20 @@ void InputRedirection::processTouchMotion(qint32 id,= const QPointF &pos, quint32 seat->touchMove(it.value(), pos); } } -#else - Q_UNUSED(id) - Q_UNUSED(pos) - Q_UNUSED(time) -#endif } = void InputRedirection::cancelTouch() { -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->cancelTouchSequence(); } -#endif } = void InputRedirection::touchFrame() { -#if HAVE_WAYLAND if (auto seat =3D findSeat()) { seat->touchFrame(); } -#endif } = QEvent::Type InputRedirection::buttonStateToEvent(InputRedirection::Pointe= rButtonState state) @@ -1257,22 +1200,18 @@ void InputRedirection::updatePointerAfterScreenChan= ge() void InputRedirection::warpPointer(const QPointF &pos) { if (supportsPointerWarping()) { -#if HAVE_WAYLAND if (waylandServer()) { waylandServer()->backend()->warpPointer(pos); } -#endif updatePointerPosition(pos); } } = bool InputRedirection::supportsPointerWarping() const { -#if HAVE_WAYLAND if (waylandServer() && waylandServer()->backend()->supportsPointerWarp= ing()) { return true; } -#endif return m_pointerWarping; } = diff --git a/layers.cpp b/layers.cpp index d8328cc..a780cac 100644 --- a/layers.cpp +++ b/layers.cpp @@ -92,10 +92,8 @@ along with this program. If not, see . #include "effects.h" #include "composite.h" #include "screenedge.h" -#if HAVE_WAYLAND #include "shell_client.h" #include "wayland_server.h" -#endif = #include = @@ -692,14 +690,12 @@ ToplevelList Workspace::xStackingOrder() const } } } -#if HAVE_WAYLAND if (waylandServer()) { const auto clients =3D waylandServer()->internalClients(); for (auto c: clients) { x_stacking << c; } } -#endif if (m_compositor) { const_cast< Workspace* >(this)->m_compositor->checkUnredirect(); } diff --git a/scene.cpp b/scene.cpp index 09b7ec4..2cce31a 100644 --- a/scene.cpp +++ b/scene.cpp @@ -80,10 +80,8 @@ along with this program. If not, see . = #include "thumbnailitem.h" = -#if HAVE_WAYLAND #include #include -#endif = namespace KWin { @@ -937,13 +935,11 @@ WindowPixmap::~WindowPixmap() if (isValid() && !kwinApp()->shouldUseWaylandForCompositing()) { xcb_free_pixmap(connection(), m_pixmap); } -#if HAVE_WAYLAND if (m_buffer) { using namespace KWayland::Server; QObject::disconnect(m_buffer.data(), &BufferInterface::aboutToBeDe= stroyed, m_buffer.data(), &BufferInterface::unref); m_buffer->unref(); } -#endif } = void WindowPixmap::create() @@ -951,7 +947,6 @@ void WindowPixmap::create() if (isValid() || toplevel()->isDeleted()) { return; } -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { // use Buffer updateBuffer(); @@ -960,7 +955,6 @@ void WindowPixmap::create() } return; } -#endif XServerGrabber grabber; xcb_pixmap_t pix =3D xcb_generate_id(connection()); xcb_void_cookie_t namePixmapCookie =3D xcb_composite_name_window_pixma= p_checked(connection(), toplevel()->frameId(), pix); @@ -992,15 +986,12 @@ void WindowPixmap::create() = bool WindowPixmap::isValid() const { -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { return !m_buffer.isNull(); } -#endif return m_pixmap !=3D XCB_PIXMAP_NONE; } = -#if HAVE_WAYLAND void WindowPixmap::updateBuffer() { if (auto s =3D toplevel()->surface()) { @@ -1016,7 +1007,6 @@ void WindowPixmap::updateBuffer() } } } -#endif = //**************************************** // Scene::EffectFrame diff --git a/scene.h b/scene.h index 9e41ccc..640e861 100644 --- a/scene.h +++ b/scene.h @@ -27,7 +27,6 @@ along with this program. If not, see . = #include = -#if HAVE_WAYLAND namespace KWayland { namespace Server @@ -35,7 +34,6 @@ namespace Server class BufferInterface; } } -#endif = namespace KWin { @@ -353,12 +351,10 @@ public: * @return The native X11 pixmap handle */ xcb_pixmap_t pixmap() const; -#if HAVE_WAYLAND /** * @return The Wayland BufferInterface for this WindowPixmap. **/ QPointer buffer() const; -#endif /** * @brief Whether this WindowPixmap is considered as discarded. This m= eans the window has changed in a way that a new * WindowPixmap should have been created already. @@ -397,22 +393,18 @@ protected: */ Scene::Window *window(); = -#if HAVE_WAYLAND /** * Should be called by the implementing subclasses when the Wayland Bu= ffer changed and needs * updating. **/ void updateBuffer(); -#endif private: Scene::Window *m_window; xcb_pixmap_t m_pixmap; QSize m_pixmapSize; bool m_discarded; QRect m_contentsRect; -#if HAVE_WAYLAND QPointer m_buffer; -#endif }; = class Scene::EffectFrame @@ -516,13 +508,11 @@ Shadow* Scene::Window::shadow() return m_shadow; } = -#if HAVE_WAYLAND inline QPointer WindowPixmap::buffer() const { return m_buffer; } -#endif = template inline diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 3e9b849..b1ace1c 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -32,10 +32,8 @@ along with this program. If not, see . #include "glxbackend.h" #endif // KWIN_HAVE_OPENGLES = -#if HAVE_WAYLAND #include "abstract_backend.h" #include "wayland_server.h" -#endif // HAVE_WAYLAND = #include #include @@ -546,12 +544,9 @@ SceneOpenGL *SceneOpenGL::createScene(QObject *parent) #endif break; case EglPlatformInterface: -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { backend =3D waylandServer()->backend()->createOpenGLBackend(); - } else -#endif // HAVE_WAYLAND - { + } else { backend =3D new EglOnXBackend(); } break; @@ -1676,10 +1671,8 @@ bool OpenGLWindowPixmap::bind() { if (!m_texture->isNull()) { if (!toplevel()->damage().isEmpty()) { -#if HAVE_WAYLAND updateBuffer(); m_texture->updateFromPixmap(this); -#endif // mipmaps need to be updated m_texture->setDirty(); toplevel()->resetDamage(); diff --git a/scene_qpainter.cpp b/scene_qpainter.cpp index e682913..0517662 100644 --- a/scene_qpainter.cpp +++ b/scene_qpainter.cpp @@ -27,12 +27,10 @@ along with this program. If not, see . #include "main.h" #include "screens.h" #include "toplevel.h" -#if HAVE_WAYLAND #include "abstract_backend.h" #include "wayland_server.h" #include #include -#endif #include "xcbutils.h" #include "decorations/decoratedclient.h" // Qt @@ -97,7 +95,6 @@ QImage *QPainterBackend::bufferForScreen(int screenId) SceneQPainter *SceneQPainter::createScene(QObject *parent) { QScopedPointer backend; -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { backend.reset(waylandServer()->backend()->createQPainterBackend()); if (backend.isNull()) { @@ -108,7 +105,6 @@ SceneQPainter *SceneQPainter::createScene(QObject *pare= nt) } return new SceneQPainter(backend.take(), parent); } -#endif return NULL; } = @@ -428,19 +424,16 @@ void QPainterWindowPixmap::create() if (!isValid()) { return; } -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { // performing deep copy, this could probably be improved m_image =3D buffer()->data().copy(); return; } -#endif m_image =3D QImage((uchar*)m_shm->buffer(), size().width(), size().hei= ght(), QImage::Format_ARGB32_Premultiplied); } = bool QPainterWindowPixmap::update(const QRegion &damage) { -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { const auto oldBuffer =3D buffer(); updateBuffer(); @@ -456,7 +449,6 @@ bool QPainterWindowPixmap::update(const QRegion &damage) } return true; } -#endif = if (!m_shm->isValid()) { return false; diff --git a/screens.cpp b/screens.cpp index 226a2ec..5a2aeb5 100644 --- a/screens.cpp +++ b/screens.cpp @@ -26,10 +26,8 @@ along with this program. If not, see . #include #include #include "screens_xrandr.h" -#if HAVE_WAYLAND #include "abstract_backend.h" #include "wayland_server.h" -#endif #ifdef KWIN_UNIT_TEST #include #endif @@ -44,11 +42,9 @@ Screens *Screens::create(QObject *parent) #ifdef KWIN_UNIT_TEST s_self =3D new MockScreens(parent); #else -#if HAVE_WAYLAND if (kwinApp()->shouldUseWaylandForCompositing()) { s_self =3D waylandServer()->backend()->createScreens(parent); } -#endif if (kwinApp()->operationMode() =3D=3D Application::OperationModeX11) { s_self =3D new XRandRScreens(parent); } diff --git a/scripting/scripting_model.cpp b/scripting/scripting_model.cpp index 8b595f7..42fce08 100644 --- a/scripting/scripting_model.cpp +++ b/scripting/scripting_model.cpp @@ -25,10 +25,8 @@ along with this program. If not, see . #include "client.h" #include "screens.h" #include "workspace.h" -#if HAVE_WAYLAND #include "shell_client.h" #include "wayland_server.h" -#endif = namespace KWin { namespace ScriptingClientModel { @@ -44,11 +42,9 @@ ClientLevel::ClientLevel(ClientModel *model, AbstractLev= el *parent) connect(Workspace::self(), &Workspace::clientAdded, this, &ClientLevel= ::clientAdded); connect(Workspace::self(), &Workspace::clientRemoved, this, &ClientLev= el::clientRemoved); connect(model, SIGNAL(exclusionsChanged()), SLOT(reInit())); -#if HAVE_WAYLAND if (waylandServer()) { connect(waylandServer(), &WaylandServer::shellClientAdded, this, &= ClientLevel::clientAdded); } -#endif } = ClientLevel::~ClientLevel() @@ -227,14 +223,12 @@ void ClientLevel::reInit() for (ClientList::const_iterator it =3D clients.begin(); it !=3D client= s.end(); ++it) { checkClient((*it)); } -#if HAVE_WAYLAND if (waylandServer()) { const auto &clients =3D waylandServer()->clients(); for (auto *c : clients) { checkClient(c); } } -#endif } = quint32 ClientLevel::idForRow(int row) const diff --git a/shadow.cpp b/shadow.cpp index 56bc97f..99f89bf 100644 --- a/shadow.cpp +++ b/shadow.cpp @@ -24,18 +24,14 @@ along with this program. If not, see . #include "composite.h" #include "effects.h" #include "toplevel.h" -#if HAVE_WAYLAND #include "wayland_server.h" -#endif = #include #include = -#if HAVE_WAYLAND #include #include #include -#endif = namespace KWin { @@ -58,11 +54,9 @@ Shadow *Shadow::createShadow(Toplevel *toplevel) return NULL; } Shadow *shadow =3D crateShadowFromDecoration(toplevel); -#if HAVE_WAYLAND if (!shadow && waylandServer()) { shadow =3D createShadowFromWayland(toplevel); } -#endif if (!shadow) { shadow =3D createShadowFromX11(toplevel); } @@ -114,7 +108,6 @@ Shadow *Shadow::crateShadowFromDecoration(Toplevel *top= level) = Shadow *Shadow::createShadowFromWayland(Toplevel *toplevel) { -#if HAVE_WAYLAND auto surface =3D toplevel->surface(); if (!surface) { return nullptr; @@ -129,9 +122,6 @@ Shadow *Shadow::createShadowFromWayland(Toplevel *tople= vel) return nullptr; } return shadow; -#else - return nullptr; -#endif } = QVector< uint32_t > Shadow::readX11ShadowProperty(xcb_window_t id) @@ -225,7 +215,6 @@ bool Shadow::init(KDecoration2::Decoration *decoration) = bool Shadow::init(const QPointer< KWayland::Server::ShadowInterface > &sha= dow) { -#if HAVE_WAYLAND if (!shadow) { return false; } @@ -250,9 +239,6 @@ bool Shadow::init(const QPointer< KWayland::Server::Sha= dowInterface > &shadow) } buildQuads(); return true; -#else - return false; -#endif } = void Shadow::updateShadowRegion() @@ -367,7 +353,6 @@ bool Shadow::updateShadow() clear(); return false; } -#if HAVE_WAYLAND if (waylandServer()) { if (m_topLevel && m_topLevel->surface()) { if (const auto &s =3D m_topLevel->surface()->shadow()) { @@ -380,7 +365,6 @@ bool Shadow::updateShadow() } } } -#endif auto data =3D Shadow::readX11ShadowProperty(m_topLevel->window()); if (data.isEmpty()) { clear(); diff --git a/thumbnailitem.cpp b/thumbnailitem.cpp index 8b98455..9932b82 100644 --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -25,10 +25,8 @@ along with this program. If not, see . #include "effects.h" #include "workspace.h" #include "composite.h" -#if HAVE_WAYLAND #include "shell_client.h" #include "wayland_server.h" -#endif // Qt #include #include @@ -143,11 +141,9 @@ void WindowThumbnailItem::setWId(qulonglong wId) m_wId =3D wId; if (m_wId !=3D 0) { AbstractClient *c =3D Workspace::self()->findClient(Predicate::Win= dowMatch, m_wId); -#if HAVE_WAYLAND if (!c && waylandServer()) { c =3D waylandServer()->findClient(m_wId); } -#endif setClient(c); } else if (m_client) { m_client =3D NULL; diff --git a/toplevel.cpp b/toplevel.cpp index 4740c8f..7201b78 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -31,9 +31,7 @@ along with this program. If not, see . #include "shadow.h" #include "xcbutils.h" = -#if HAVE_WAYLAND #include -#endif = #include = @@ -454,7 +452,6 @@ void Toplevel::setSkipCloseAnimation(bool set) emit skipCloseAnimationChanged(); } = -#if HAVE_WAYLAND void Toplevel::setSurface(KWayland::Server::SurfaceInterface *surface) { if (m_surface =3D=3D surface) { @@ -472,7 +469,6 @@ void Toplevel::setSurface(KWayland::Server::SurfaceInte= rface *surface) } ); } -#endif = void Toplevel::addDamage(const QRegion &damage) { @@ -503,13 +499,12 @@ void Toplevel::setDepth(int depth) = QRegion Toplevel::inputShape() const { -#if HAVE_WAYLAND if (m_surface) { return m_surface->input(); - } else -#endif - // TODO: maybe also for X11? - return QRegion(); + } else { + // TODO: maybe also for X11? + return QRegion(); + } } = } // namespace diff --git a/toplevel.h b/toplevel.h index eb46eb4..dfb246f 100644 --- a/toplevel.h +++ b/toplevel.h @@ -41,7 +41,6 @@ along with this program. If not, see . // c++ #include = -#if HAVE_WAYLAND namespace KWayland { namespace Server @@ -49,7 +48,6 @@ namespace Server class SurfaceInterface; } } -#endif = namespace KWin { @@ -355,10 +353,8 @@ public: void setSkipCloseAnimation(bool set); = quint32 surfaceId() const; -#if HAVE_WAYLAND KWayland::Server::SurfaceInterface *surface() const; void setSurface(KWayland::Server::SurfaceInterface *surface); -#endif = /** * @brief Finds the Toplevel matching the condition expressed in @p fu= nc in @p list. @@ -498,9 +494,7 @@ private: int m_screen; bool m_skipCloseAnimation; quint32 m_surfaceId =3D 0; -#if HAVE_WAYLAND KWayland::Server::SurfaceInterface *m_surface =3D nullptr; -#endif // when adding new data members, check also copyToDeleted() }; = @@ -732,12 +726,10 @@ inline quint32 Toplevel::surfaceId() const return m_surfaceId; } = -#if HAVE_WAYLAND inline KWayland::Server::SurfaceInterface *Toplevel::surface() const { return m_surface; } -#endif = template inline T *Toplevel::findInList(const QList &list, std::function func) diff --git a/workspace.cpp b/workspace.cpp index a190fa8..f9100ab 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -52,10 +52,8 @@ along with this program. If not, see . #include "unmanaged.h" #include "useractions.h" #include "virtualdesktops.h" -#if HAVE_WAYLAND #include "shell_client.h" #include "wayland_server.h" -#endif #include "xcbutils.h" #include "main.h" #include "decorations/decorationbridge.h" @@ -136,22 +134,16 @@ Workspace::Workspace(const QString &sessionKey) Xcb::Extensions::self(); = // start the Wayland Backend - will only be created if WAYLAND_DISPLAY= is present -#if HAVE_WAYLAND if (kwinApp()->operationMode() !=3D Application::OperationModeX11) { connect(this, SIGNAL(stackingOrderChanged()), input(), SLOT(update= PointerWindow())); } -#endif = #ifdef KWIN_BUILD_ACTIVITIES Activities *activities =3D nullptr; // HACK: do not use Activities on Wayland as it blocks the startup -#if HAVE_WAYLAND if (kwinApp()->operationMode() =3D=3D Application::OperationModeX11) { activities =3D Activities::create(this); } -#else - activities =3D Activities::create(this); -#endif if (activities) { connect(activities, SIGNAL(currentChanged(QString)), SLOT(updateCu= rrentActivity(QString))); } @@ -378,7 +370,6 @@ void Workspace::init() = Scripting::create(this); = -#if HAVE_WAYLAND if (auto w =3D waylandServer()) { connect(w, &WaylandServer::shellClientAdded, this, [this] (ShellClient *c) { @@ -410,7 +401,6 @@ void Workspace::init() } ); } -#endif = // SELI TODO: This won't work with unreasonable focus policies, // and maybe in rare cases also if the selected client doesn't @@ -1357,12 +1347,6 @@ QString Workspace::supportInformation() const #else support.append(no); #endif - support.append(QStringLiteral("HAVE_WAYLAND: ")); -#if HAVE_WAYLAND - support.append(yes); -#else - support.append(no); -#endif support.append(QStringLiteral("HAVE_WAYLAND_EGL: ")); #if HAVE_WAYLAND_EGL support.append(yes);