Drop cmakedefine HAVE_WAYLAND

Now a required build dependency.
This commit is contained in:
Martin Gräßlin 2015-08-10 16:31:45 +02:00
parent a6c6408f54
commit 3139dcd3b9
22 changed files with 11 additions and 228 deletions

View file

@ -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_DIR}/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})

View file

@ -27,10 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "tabgroup.h"
#include "workspace.h"
#if HAVE_WAYLAND
#include "wayland_server.h"
#include <KWayland/Server/plasmawindowmanagement_interface.h>
#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 = w;
#endif
}
void AbstractClient::destroyWindowManagementInterface()
{
#if HAVE_WAYLAND
delete m_windowManagementInterface;
m_windowManagementInterface = nullptr;
#endif
}
Options::MouseCommand AbstractClient::getMouseCommand(Qt::MouseButton button, bool *handled) const

View file

@ -19,11 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "abstract_egl_backend.h"
#include "options.h"
#if HAVE_WAYLAND
#include "wayland_server.h"
#include <KWayland/Server/buffer_interface.h>
#include <KWayland/Server/display.h>
#endif
// kwin libs
#include <kwinglplatform.h>
// Qt
@ -32,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
#if HAVE_WAYLAND
typedef GLboolean(*eglBindWaylandDisplayWL_func)(EGLDisplay dpy, wl_display *display);
typedef GLboolean(*eglUnbindWaylandDisplayWL_func)(EGLDisplay dpy, wl_display *display);
typedef GLboolean(*eglQueryWaylandBufferWL_func)(EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value);
@ -49,7 +46,6 @@ eglQueryWaylandBufferWL_func eglQueryWaylandBufferWL = 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() = default;
void AbstractEglBackend::cleanup()
{
#if HAVE_WAYLAND
if (eglUnbindWaylandDisplayWL && eglDisplay() != EGL_NO_DISPLAY) {
eglUnbindWaylandDisplayWL(eglDisplay(), *(WaylandServer::self()->display()));
}
#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 = pixmap->buffer();
if (buffer.isNull()) {
// try X11 loading
@ -219,9 +210,6 @@ bool AbstractEglTexture::loadTexture(WindowPixmap *pixmap)
} 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 = pixmap->buffer();
if (buffer.isNull()) {
return;
@ -303,10 +290,8 @@ void AbstractEglTexture::updateTexture(WindowPixmap *pixmap)
}
}
q->unbind();
#endif
}
#if HAVE_WAYLAND
bool AbstractEglTexture::loadShmTexture(const QPointer< KWayland::Server::BufferInterface > &buffer)
{
const QImage &image = buffer->data();
@ -407,7 +392,6 @@ EGLImageKHR AbstractEglTexture::attach(const QPointer< KWayland::Server::BufferI
}
return image;
}
#endif
}

View file

@ -91,11 +91,9 @@ protected:
private:
bool loadTexture(xcb_pixmap_t pix, const QSize &size);
#if HAVE_WAYLAND
bool loadShmTexture(const QPointer<KWayland::Server::BufferInterface> &buffer);
bool loadEglTexture(const QPointer<KWayland::Server::BufferInterface> &buffer);
EGLImageKHR attach(const QPointer<KWayland::Server::BufferInterface> &buffer);
#endif
SceneOpenGL::Texture *q;
AbstractEglBackend *m_backend;
EGLImageKHR m_image;

View file

@ -37,16 +37,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 <KWayland/Server/surface_interface.h>
#endif
#include <stdio.h>
@ -118,7 +114,6 @@ Compositor::Compositor(QObject* workspace)
m_unusedSupportPropertyTimer.setInterval(compositorLostMessageDelay);
m_unusedSupportPropertyTimer.setSingleShot(true);
connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteUnusedSupportProperties()));
#if HAVE_WAYLAND
if (kwinApp()->operationMode() != 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 means before
// Workspace is completely constructed, so calling Workspace::self() would 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 invocation.
QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection);
}
// register DBus
@ -712,7 +704,6 @@ void Compositor::performCompositing()
m_timeSinceLastVBlank = m_scene->paint(repaints, windows);
m_timeSinceStart += m_timeSinceLastVBlank;
#if HAVE_WAYLAND
if (kwinApp()->shouldUseWaylandForCompositing()) {
for (Toplevel *win : damaged) {
if (auto surface = win->surface()) {
@ -720,7 +711,6 @@ void Compositor::performCompositing()
}
}
}
#endif
compositeTimer.stop(); // stop here to ensure *we* cause the next repaint 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 = waylandServer()) {
const auto &clients = w->clients();
for (auto c : clients) {
@ -764,7 +753,6 @@ bool Compositor::windowRepaintsPending() const
}
}
}
#endif
return false;
}

View file

@ -8,7 +8,6 @@
#define XCB_VERSION_STRING "${XCB_VERSION}"
#define KWIN_KILLER_BIN "${CMAKE_INSTALL_PREFIX}/${LIBEXEC_INSTALL_DIR}/kwin_killer_helper"
#define KWIN_RULES_DIALOG_BIN "${CMAKE_INSTALL_PREFIX}/${LIBEXEC_INSTALL_DIR}/kwin_rules_dialog"
#cmakedefine01 HAVE_WAYLAND
#cmakedefine01 HAVE_WAYLAND_EGL
#cmakedefine01 HAVE_INPUT
#cmakedefine01 HAVE_X11_XCB

View file

@ -55,11 +55,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <assert.h>
#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 <KDecoration2/DecorationSettings>
@ -303,7 +301,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
for (Unmanaged *u : ws->unmanagedList()) {
setupUnmanagedConnections(u);
}
#if HAVE_WAYLAND
if (auto w = waylandServer()) {
connect(w, &WaylandServer::shellClientAdded, this,
[this](ShellClient *c) {
@ -314,7 +311,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
}
);
}
#endif
reconfigure();
}
@ -585,14 +581,12 @@ void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t)
void EffectsHandlerImpl::slotShellClientShown(Toplevel *t)
{
#if HAVE_WAYLAND
ShellClient *c = static_cast<ShellClient*>(t);
connect(c, &ShellClient::windowClosed, this, &EffectsHandlerImpl::slotWindowClosed);
connect(c, &ShellClient::geometryShapeChanged, this, &EffectsHandlerImpl::slotGeometryShapeChanged);
connect(c, static_cast<void (ShellClient::*)(KWin::AbstractClient*, MaximizeMode)>(&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() != Application::OperationModeX11) {
#if HAVE_WAYLAND
if (AbstractBackend *w = waylandServer()->backend()) {
w->installCursorImage(shape);
}
#endif
return;
}
// NOTE: it is intended to not perform an XPointerGrab on X11. See documentation in kwineffects.h
@ -1038,13 +1030,11 @@ EffectWindow* EffectsHandlerImpl::findWindow(WId id) const
return w->effectWindow();
if (Unmanaged* w = Workspace::self()->findUnmanaged(id))
return w->effectWindow();
#if HAVE_WAYLAND
if (waylandServer()) {
if (ShellClient *w = 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 = waylandServer()->backend()) {
w->installCursorImage(shape);
}
}
#endif
return;
}
const xcb_cursor_t c = Cursor::x11Cursor(shape);

View file

@ -66,10 +66,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "killwindow.h"
#include "x11eventfilter.h"
#if HAVE_WAYLAND
#include "wayland_server.h"
#include <KWayland/Server/surface_interface.h>
#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 == atoms->wl_surface_id) {
m_surfaceId = e->data.data32[0];
#if HAVE_WAYLAND
if (auto w = waylandServer()) {
m_surface = KWayland::Server::SurfaceInterface::get(m_surfaceId, w->xWaylandConnection());
}
#endif
emit surfaceIdChanged(m_surfaceId);
}
}

View file

@ -44,10 +44,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QVarLengthArray>
#include "outline.h"
#if HAVE_WAYLAND
#include "shell_client.h"
#include "wayland_server.h"
#endif
#include <KDecoration2/Decoration>
#include <KDecoration2/DecoratedClient>
@ -184,7 +182,6 @@ void Workspace::updateClientArea(bool force)
}
}
}
#if HAVE_WAYLAND
if (waylandServer()) {
auto updateStrutsForWaylandClient = [&] (ShellClient *c) {
// assuming that only docks have "struts" and that all docks have a strut
@ -216,7 +213,6 @@ void Workspace::updateClientArea(bool force)
updateStrutsForWaylandClient(c);
}
}
#endif
#if 0
for (int i = 1;
i <= numberOfDesktops();

View file

@ -32,7 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 <http://www.gnu.org/licenses/>.
#include <KWayland/Server/display.h>
#include <KWayland/Server/fakeinput_interface.h>
#include <KWayland/Server/seat_interface.h>
#endif
#include <decorations/decoratedclient.h>
#include <KDecoration2/Decoration>
// 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, uint32_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, &InputRedirection::updateKeyboardWindow);
using namespace KWayland::Server;
@ -348,10 +343,8 @@ void InputRedirection::setupWorkspace()
}
);
}
#endif
}
#if HAVE_WAYLAND
static KWayland::Server::SeatInterface *findSeat()
{
auto server = 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, &InputRedirection::setupLibInputWithScreens);
}
#if HAVE_WAYLAND
if (auto s = 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 == m_pointerWindow.data()) {
return;
}
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
// disconnect old surface
if (oldWindow) {
@ -509,7 +498,6 @@ void InputRedirection::updatePointerWindow()
t = nullptr;
}
}
#endif
if (!t) {
m_pointerWindow.clear();
return;
@ -540,11 +528,9 @@ void InputRedirection::updatePointerDecoration(Toplevel *t)
// send leave
QHoverEvent event(QEvent::HoverLeave, QPointF(), QPointF());
QCoreApplication::instance()->sendEvent(oldDeco->decoration(), &event);
#if HAVE_WAYLAND
if (!m_pointerDecoration && waylandServer()) {
waylandServer()->backend()->installCursorImage(Qt::ArrowCursor);
}
#endif
}
if (m_pointerDecoration) {
const QPointF p = m_globalPointer - t->pos();
@ -558,7 +544,6 @@ void InputRedirection::updatePointerDecoration(Toplevel *t)
void InputRedirection::updatePointerInternalWindow()
{
const auto oldInternalWindow = m_pointerInternalWindow;
#if HAVE_WAYLAND
if (waylandServer()) {
bool found = false;
const auto &internalClients = waylandServer()->internalClients();
@ -582,7 +567,6 @@ void InputRedirection::updatePointerInternalWindow()
}
}
}
#endif
if (oldInternalWindow != m_pointerInternalWindow) {
// changed
if (oldInternalWindow) {
@ -618,16 +602,13 @@ void InputRedirection::pointerInternalWindowVisibilityChanged(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 time)
@ -690,12 +668,10 @@ void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time)
m_pointerDecoration->client()->processDecorationMove();
}
}
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
seat->setTimestamp(time);
seat->setPointerPos(m_globalPointer);
}
#endif
}
void InputRedirection::processPointerButton(uint32_t button, InputRedirection::PointerButtonState state, uint32_t time)
@ -743,7 +719,6 @@ void InputRedirection::processPointerButton(uint32_t button, InputRedirection::P
installCursorFromDecoration();
}
// TODO: check which part of KWin would like to intercept the event
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
seat->setTimestamp(time);
bool passThrough = true;
@ -760,7 +735,6 @@ void InputRedirection::processPointerButton(uint32_t button, InputRedirection::P
state == PointerButtonPressed ? seat->pointerButtonPressed(button) : seat->pointerButtonReleased(button);
}
}
#endif
if (state == PointerButtonReleased && !areButtonsPressed()) {
updatePointerWindow();
}
@ -820,17 +794,14 @@ void InputRedirection::processPointerAxis(InputRedirection::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 = findSeat()) {
seat->setTimestamp(time);
seat->pointerAxis(axis == InputRedirection::PointerAxisHorizontal ? 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 != keyboardModifiers()) {
emit keyboardModifiersChanged(keyboardModifiers(), oldMods);
}
#if HAVE_WAYLAND
// check for vt-switch
if (VirtualTerminal::self()) {
const xkb_keysym_t keysym = 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 key, InputRedirection::Keyboa
return;
}
}
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
seat->setTimestamp(time);
state == InputRedirection::KeyboardKeyPressed ? seat->keyPressed(key) : seat->keyReleased(key);
}
#endif
}
void InputRedirection::processKeyboardModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group)
@ -930,7 +896,6 @@ void InputRedirection::processKeymapChange(int fd, uint32_t size)
void InputRedirection::processTouchDown(qint32 id, const QPointF &pos, quint32 time)
{
// TODO: internal handling?
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
seat->setTimestamp(time);
if (!seat->isTouchSequence()) {
@ -949,11 +914,6 @@ void InputRedirection::processTouchDown(qint32 id, const 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 == oldWindow.data()) {
return;
}
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
// disconnect old surface
if (oldWindow) {
@ -978,7 +937,6 @@ void InputRedirection::updateTouchWindow(const QPointF &pos)
t = 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 = findSeat()) {
auto it = m_touchIdMapper.constFind(id);
if (it != m_touchIdMapper.constEnd()) {
@ -998,16 +955,11 @@ void InputRedirection::processTouchUp(qint32 id, quint32 time)
seat->touchUp(it.value());
}
}
#else
Q_UNUSED(id)
Q_UNUSED(time)
#endif
}
void InputRedirection::processTouchMotion(qint32 id, const QPointF &pos, quint32 time)
{
// TODO: internal handling?
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
seat->setTimestamp(time);
auto it = 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 = findSeat()) {
seat->cancelTouchSequence();
}
#endif
}
void InputRedirection::touchFrame()
{
#if HAVE_WAYLAND
if (auto seat = findSeat()) {
seat->touchFrame();
}
#endif
}
QEvent::Type InputRedirection::buttonStateToEvent(InputRedirection::PointerButtonState state)
@ -1257,22 +1200,18 @@ void InputRedirection::updatePointerAfterScreenChange()
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()->supportsPointerWarping()) {
return true;
}
#endif
return m_pointerWarping;
}

View file

@ -92,10 +92,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "effects.h"
#include "composite.h"
#include "screenedge.h"
#if HAVE_WAYLAND
#include "shell_client.h"
#include "wayland_server.h"
#endif
#include <QDebug>
@ -692,14 +690,12 @@ ToplevelList Workspace::xStackingOrder() const
}
}
}
#if HAVE_WAYLAND
if (waylandServer()) {
const auto clients = waylandServer()->internalClients();
for (auto c: clients) {
x_stacking << c;
}
}
#endif
if (m_compositor) {
const_cast< Workspace* >(this)->m_compositor->checkUnredirect();
}

View file

@ -80,10 +80,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "thumbnailitem.h"
#if HAVE_WAYLAND
#include <KWayland/Server/buffer_interface.h>
#include <KWayland/Server/surface_interface.h>
#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::aboutToBeDestroyed, 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 = xcb_generate_id(connection());
xcb_void_cookie_t namePixmapCookie = xcb_composite_name_window_pixmap_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 != XCB_PIXMAP_NONE;
}
#if HAVE_WAYLAND
void WindowPixmap::updateBuffer()
{
if (auto s = toplevel()->surface()) {
@ -1016,7 +1007,6 @@ void WindowPixmap::updateBuffer()
}
}
}
#endif
//****************************************
// Scene::EffectFrame

10
scene.h
View file

@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QElapsedTimer>
#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<KWayland::Server::BufferInterface> buffer() const;
#endif
/**
* @brief Whether this WindowPixmap is considered as discarded. This means 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 Buffer 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<KWayland::Server::BufferInterface> m_buffer;
#endif
};
class Scene::EffectFrame
@ -516,13 +508,11 @@ Shadow* Scene::Window::shadow()
return m_shadow;
}
#if HAVE_WAYLAND
inline
QPointer<KWayland::Server::BufferInterface> WindowPixmap::buffer() const
{
return m_buffer;
}
#endif
template <typename T>
inline

View file

@ -32,10 +32,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "glxbackend.h"
#endif // KWIN_HAVE_OPENGLES
#if HAVE_WAYLAND
#include "abstract_backend.h"
#include "wayland_server.h"
#endif // HAVE_WAYLAND
#include <kwinglcolorcorrection.h>
#include <kwinglplatform.h>
@ -546,12 +544,9 @@ SceneOpenGL *SceneOpenGL::createScene(QObject *parent)
#endif
break;
case EglPlatformInterface:
#if HAVE_WAYLAND
if (kwinApp()->shouldUseWaylandForCompositing()) {
backend = waylandServer()->backend()->createOpenGLBackend();
} else
#endif // HAVE_WAYLAND
{
} else {
backend = 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();

View file

@ -27,12 +27,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "main.h"
#include "screens.h"
#include "toplevel.h"
#if HAVE_WAYLAND
#include "abstract_backend.h"
#include "wayland_server.h"
#include <KWayland/Server/buffer_interface.h>
#include <KWayland/Server/surface_interface.h>
#endif
#include "xcbutils.h"
#include "decorations/decoratedclient.h"
// Qt
@ -97,7 +95,6 @@ QImage *QPainterBackend::bufferForScreen(int screenId)
SceneQPainter *SceneQPainter::createScene(QObject *parent)
{
QScopedPointer<QPainterBackend> backend;
#if HAVE_WAYLAND
if (kwinApp()->shouldUseWaylandForCompositing()) {
backend.reset(waylandServer()->backend()->createQPainterBackend());
if (backend.isNull()) {
@ -108,7 +105,6 @@ SceneQPainter *SceneQPainter::createScene(QObject *parent)
}
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 = buffer()->data().copy();
return;
}
#endif
m_image = QImage((uchar*)m_shm->buffer(), size().width(), size().height(), QImage::Format_ARGB32_Premultiplied);
}
bool QPainterWindowPixmap::update(const QRegion &damage)
{
#if HAVE_WAYLAND
if (kwinApp()->shouldUseWaylandForCompositing()) {
const auto oldBuffer = buffer();
updateBuffer();
@ -456,7 +449,6 @@ bool QPainterWindowPixmap::update(const QRegion &damage)
}
return true;
}
#endif
if (!m_shm->isValid()) {
return false;

View file

@ -26,10 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <workspace.h>
#include <config-kwin.h>
#include "screens_xrandr.h"
#if HAVE_WAYLAND
#include "abstract_backend.h"
#include "wayland_server.h"
#endif
#ifdef KWIN_UNIT_TEST
#include <mock_screens.h>
#endif
@ -44,11 +42,9 @@ Screens *Screens::create(QObject *parent)
#ifdef KWIN_UNIT_TEST
s_self = new MockScreens(parent);
#else
#if HAVE_WAYLAND
if (kwinApp()->shouldUseWaylandForCompositing()) {
s_self = waylandServer()->backend()->createScreens(parent);
}
#endif
if (kwinApp()->operationMode() == Application::OperationModeX11) {
s_self = new XRandRScreens(parent);
}

View file

@ -25,10 +25,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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, AbstractLevel *parent)
connect(Workspace::self(), &Workspace::clientAdded, this, &ClientLevel::clientAdded);
connect(Workspace::self(), &Workspace::clientRemoved, this, &ClientLevel::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 = clients.begin(); it != clients.end(); ++it) {
checkClient((*it));
}
#if HAVE_WAYLAND
if (waylandServer()) {
const auto &clients = waylandServer()->clients();
for (auto *c : clients) {
checkClient(c);
}
}
#endif
}
quint32 ClientLevel::idForRow(int row) const

View file

@ -24,18 +24,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "composite.h"
#include "effects.h"
#include "toplevel.h"
#if HAVE_WAYLAND
#include "wayland_server.h"
#endif
#include <KDecoration2/Decoration>
#include <KDecoration2/DecorationShadow>
#if HAVE_WAYLAND
#include <KWayland/Server/buffer_interface.h>
#include <KWayland/Server/shadow_interface.h>
#include <KWayland/Server/surface_interface.h>
#endif
namespace KWin
{
@ -58,11 +54,9 @@ Shadow *Shadow::createShadow(Toplevel *toplevel)
return NULL;
}
Shadow *shadow = crateShadowFromDecoration(toplevel);
#if HAVE_WAYLAND
if (!shadow && waylandServer()) {
shadow = createShadowFromWayland(toplevel);
}
#endif
if (!shadow) {
shadow = createShadowFromX11(toplevel);
}
@ -114,7 +108,6 @@ Shadow *Shadow::crateShadowFromDecoration(Toplevel *toplevel)
Shadow *Shadow::createShadowFromWayland(Toplevel *toplevel)
{
#if HAVE_WAYLAND
auto surface = toplevel->surface();
if (!surface) {
return nullptr;
@ -129,9 +122,6 @@ Shadow *Shadow::createShadowFromWayland(Toplevel *toplevel)
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 > &shadow)
{
#if HAVE_WAYLAND
if (!shadow) {
return false;
}
@ -250,9 +239,6 @@ bool Shadow::init(const QPointer< KWayland::Server::ShadowInterface > &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 = m_topLevel->surface()->shadow()) {
@ -380,7 +365,6 @@ bool Shadow::updateShadow()
}
}
}
#endif
auto data = Shadow::readX11ShadowProperty(m_topLevel->window());
if (data.isEmpty()) {
clear();

View file

@ -25,10 +25,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "effects.h"
#include "workspace.h"
#include "composite.h"
#if HAVE_WAYLAND
#include "shell_client.h"
#include "wayland_server.h"
#endif
// Qt
#include <QDebug>
#include <QPainter>
@ -143,11 +141,9 @@ void WindowThumbnailItem::setWId(qulonglong wId)
m_wId = wId;
if (m_wId != 0) {
AbstractClient *c = Workspace::self()->findClient(Predicate::WindowMatch, m_wId);
#if HAVE_WAYLAND
if (!c && waylandServer()) {
c = waylandServer()->findClient(m_wId);
}
#endif
setClient(c);
} else if (m_client) {
m_client = NULL;

View file

@ -31,9 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "shadow.h"
#include "xcbutils.h"
#if HAVE_WAYLAND
#include <KWayland/Server/surface_interface.h>
#endif
#include <QDebug>
@ -454,7 +452,6 @@ void Toplevel::setSkipCloseAnimation(bool set)
emit skipCloseAnimationChanged();
}
#if HAVE_WAYLAND
void Toplevel::setSurface(KWayland::Server::SurfaceInterface *surface)
{
if (m_surface == surface) {
@ -472,7 +469,6 @@ void Toplevel::setSurface(KWayland::Server::SurfaceInterface *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

View file

@ -41,7 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// c++
#include <functional>
#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 func in @p list.
@ -498,9 +494,7 @@ private:
int m_screen;
bool m_skipCloseAnimation;
quint32 m_surfaceId = 0;
#if HAVE_WAYLAND
KWayland::Server::SurfaceInterface *m_surface = 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 <class T, class U>
inline T *Toplevel::findInList(const QList<T*> &list, std::function<bool (const U*)> func)

View file

@ -52,10 +52,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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() != Application::OperationModeX11) {
connect(this, SIGNAL(stackingOrderChanged()), input(), SLOT(updatePointerWindow()));
}
#endif
#ifdef KWIN_BUILD_ACTIVITIES
Activities *activities = nullptr;
// HACK: do not use Activities on Wayland as it blocks the startup
#if HAVE_WAYLAND
if (kwinApp()->operationMode() == Application::OperationModeX11) {
activities = Activities::create(this);
}
#else
activities = Activities::create(this);
#endif
if (activities) {
connect(activities, SIGNAL(currentChanged(QString)), SLOT(updateCurrentActivity(QString)));
}
@ -378,7 +370,6 @@ void Workspace::init()
Scripting::create(this);
#if HAVE_WAYLAND
if (auto w = 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
@ -1356,12 +1346,6 @@ QString Workspace::supportInformation() const
support.append(yes);
#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