From f0f829bc5b1676c409230b620d7394b0d4663406 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 22 Apr 2022 20:51:07 +0300 Subject: [PATCH] Rename WaylandClient to WaylandWindow The word "client" means different things in wayland and kwin. Use a better word to refer to windows. --- src/CMakeLists.txt | 2 +- src/debug_console.cpp | 10 +-- src/debug_console.h | 6 +- src/effects.cpp | 4 +- src/inputpanelv1window.cpp | 2 +- src/inputpanelv1window.h | 4 +- src/layershellv1window.cpp | 4 +- src/layershellv1window.h | 4 +- src/scene.cpp | 4 +- src/{waylandclient.cpp => waylandwindow.cpp} | 72 ++++++++++---------- src/{waylandclient.h => waylandwindow.h} | 4 +- src/xdgshellclient.cpp | 4 +- src/xdgshellclient.h | 4 +- 13 files changed, 62 insertions(+), 62 deletions(-) rename src/{waylandclient.cpp => waylandwindow.cpp} (81%) rename src/{waylandclient.h => waylandwindow.h} (93%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 477c3fb933..5f533f9ca9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -142,10 +142,10 @@ target_sources(kwin PRIVATE virtualkeyboard_dbus.cpp was_user_interaction_x11_filter.cpp wayland_server.cpp - waylandclient.cpp waylandoutput.cpp waylandoutputdevicev2.cpp waylandshellintegration.cpp + waylandwindow.cpp window.cpp window_property_notify_x11_filter.cpp windowitem.cpp diff --git a/src/debug_console.cpp b/src/debug_console.cpp index 68dfb3700f..6151cc4bd8 100644 --- a/src/debug_console.cpp +++ b/src/debug_console.cpp @@ -27,7 +27,7 @@ #include "wayland/subcompositor_interface.h" #include "wayland/surface_interface.h" #include "wayland_server.h" -#include "waylandclient.h" +#include "waylandwindow.h" #include "workspace.h" #include "x11client.h" #include @@ -938,7 +938,7 @@ void DebugConsoleModel::handleClientAdded(Window *client) return; } - WaylandClient *waylandClient = qobject_cast(client); + WaylandWindow *waylandClient = qobject_cast(client); if (waylandClient) { add(s_waylandClientId - 1, m_waylandClients, waylandClient); return; @@ -953,7 +953,7 @@ void DebugConsoleModel::handleClientRemoved(Window *client) return; } - WaylandClient *waylandClient = qobject_cast(client); + WaylandWindow *waylandClient = qobject_cast(client); if (waylandClient) { remove(s_waylandClientId - 1, m_waylandClients, waylandClient); return; @@ -1248,7 +1248,7 @@ QVariant DebugConsoleModel::data(const QModelIndex &index, int role) const break; } case s_waylandClientId: - return clientData(index, role, m_waylandClients, generic); + return clientData(index, role, m_waylandClients, generic); case s_workspaceInternalId: return clientData(index, role, m_internalClients, generic); default: @@ -1269,7 +1269,7 @@ static T *clientForIndex(const QModelIndex &index, const QVector &clients, return clients.at(row); } -WaylandClient *DebugConsoleModel::waylandClient(const QModelIndex &index) const +WaylandWindow *DebugConsoleModel::waylandClient(const QModelIndex &index) const { return clientForIndex(index, m_waylandClients, s_waylandClientId); } diff --git a/src/debug_console.h b/src/debug_console.h index acece19f2c..ff05b1a40d 100644 --- a/src/debug_console.h +++ b/src/debug_console.h @@ -39,7 +39,7 @@ class X11Client; class InternalWindow; class Unmanaged; class DebugConsoleFilter; -class WaylandClient; +class WaylandWindow; class KWIN_EXPORT DebugConsoleModel : public QAbstractItemModel { @@ -72,13 +72,13 @@ private: void add(int parentRow, QVector &clients, T *client); template void remove(int parentRow, QVector &clients, T *client); - WaylandClient *waylandClient(const QModelIndex &index) const; + WaylandWindow *waylandClient(const QModelIndex &index) const; InternalWindow *internalClient(const QModelIndex &index) const; X11Client *x11Client(const QModelIndex &index) const; Unmanaged *unmanaged(const QModelIndex &index) const; int topLevelRowCount() const; - QVector m_waylandClients; + QVector m_waylandClients; QVector m_internalClients; QVector m_x11Clients; QVector m_unmanageds; diff --git a/src/effects.cpp b/src/effects.cpp index 6da83427e3..34be2f4bf7 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -47,7 +47,7 @@ #include "utils/xcbutils.h" #include "virtualdesktops.h" #include "wayland_server.h" -#include "waylandclient.h" +#include "waylandwindow.h" #include "window_property_notify_x11_filter.h" #include "workspace.h" @@ -1932,7 +1932,7 @@ EffectWindowImpl::EffectWindowImpl(Window *toplevel) // can still figure out whether it is/was a managed window. managed = toplevel->isClient(); - waylandClient = qobject_cast(toplevel) != nullptr; + waylandClient = qobject_cast(toplevel) != nullptr; x11Client = qobject_cast(toplevel) != nullptr || qobject_cast(toplevel) != nullptr; } diff --git a/src/inputpanelv1window.cpp b/src/inputpanelv1window.cpp index 95c1171493..c181ee8542 100644 --- a/src/inputpanelv1window.cpp +++ b/src/inputpanelv1window.cpp @@ -26,7 +26,7 @@ namespace KWin { InputPanelV1Window::InputPanelV1Window(InputPanelSurfaceV1Interface *panelSurface) - : WaylandClient(panelSurface->surface()) + : WaylandWindow(panelSurface->surface()) , m_panelSurface(panelSurface) { setSkipSwitcher(true); diff --git a/src/inputpanelv1window.h b/src/inputpanelv1window.h index 487c50bb49..2f1ad8207d 100644 --- a/src/inputpanelv1window.h +++ b/src/inputpanelv1window.h @@ -10,14 +10,14 @@ #pragma once #include "wayland/inputmethod_v1_interface.h" -#include "waylandclient.h" +#include "waylandwindow.h" #include namespace KWin { class Output; -class InputPanelV1Window : public WaylandClient +class InputPanelV1Window : public WaylandWindow { Q_OBJECT public: diff --git a/src/layershellv1window.cpp b/src/layershellv1window.cpp index e8d6b75e36..088c6f52bb 100644 --- a/src/layershellv1window.cpp +++ b/src/layershellv1window.cpp @@ -38,7 +38,7 @@ static NET::WindowType scopeToType(const QString &scope) LayerShellV1Window::LayerShellV1Window(LayerSurfaceV1Interface *shellSurface, Output *output, LayerShellV1Integration *integration) - : WaylandClient(shellSurface->surface()) + : WaylandWindow(shellSurface->surface()) , m_desiredOutput(output) , m_integration(integration) , m_shellSurface(shellSurface) @@ -194,7 +194,7 @@ void LayerShellV1Window::closeWindow() Layer LayerShellV1Window::belongsToLayer() const { if (!isNormalWindow()) { - return WaylandClient::belongsToLayer(); + return WaylandWindow::belongsToLayer(); } switch (m_shellSurface->layer()) { case LayerSurfaceV1Interface::BackgroundLayer: diff --git a/src/layershellv1window.h b/src/layershellv1window.h index d26ad174ea..07032744b4 100644 --- a/src/layershellv1window.h +++ b/src/layershellv1window.h @@ -6,7 +6,7 @@ #pragma once -#include "waylandclient.h" +#include "waylandwindow.h" namespace KWaylandServer { @@ -19,7 +19,7 @@ namespace KWin class Output; class LayerShellV1Integration; -class LayerShellV1Window : public WaylandClient +class LayerShellV1Window : public WaylandWindow { Q_OBJECT diff --git a/src/scene.cpp b/src/scene.cpp index 263a5393c0..e711b58b34 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -61,7 +61,7 @@ #include "surfaceitem.h" #include "unmanaged.h" #include "wayland/surface_interface.h" -#include "waylandclient.h" +#include "waylandwindow.h" #include "windowitem.h" #include "workspace.h" #include "x11client.h" @@ -712,7 +712,7 @@ SceneWindow::SceneWindow(Window *client, QObject *parent) , toplevel(client) , disable_painting(0) { - if (qobject_cast(client)) { + if (qobject_cast(client)) { m_windowItem.reset(new WindowItemWayland(toplevel)); } else if (qobject_cast(client) || qobject_cast(client)) { m_windowItem.reset(new WindowItemX11(toplevel)); diff --git a/src/waylandclient.cpp b/src/waylandwindow.cpp similarity index 81% rename from src/waylandclient.cpp rename to src/waylandwindow.cpp index fe863711b7..35a7ede401 100644 --- a/src/waylandclient.cpp +++ b/src/waylandwindow.cpp @@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ -#include "waylandclient.h" +#include "waylandwindow.h" #include "platform.h" #include "screens.h" #include "wayland/clientbuffer.h" @@ -35,62 +35,62 @@ enum WaylandGeometryType { }; Q_DECLARE_FLAGS(WaylandGeometryTypes, WaylandGeometryType) -WaylandClient::WaylandClient(SurfaceInterface *surface) +WaylandWindow::WaylandWindow(SurfaceInterface *surface) { setSurface(surface); setupCompositing(); connect(surface, &SurfaceInterface::shadowChanged, - this, &WaylandClient::updateShadow); - connect(this, &WaylandClient::frameGeometryChanged, - this, &WaylandClient::updateClientOutputs); - connect(this, &WaylandClient::desktopFileNameChanged, - this, &WaylandClient::updateIcon); - connect(screens(), &Screens::changed, this, &WaylandClient::updateClientOutputs); + this, &WaylandWindow::updateShadow); + connect(this, &WaylandWindow::frameGeometryChanged, + this, &WaylandWindow::updateClientOutputs); + connect(this, &WaylandWindow::desktopFileNameChanged, + this, &WaylandWindow::updateIcon); + connect(screens(), &Screens::changed, this, &WaylandWindow::updateClientOutputs); connect(surface->client(), &ClientConnection::aboutToBeDestroyed, - this, &WaylandClient::destroyClient); + this, &WaylandWindow::destroyClient); updateResourceName(); updateIcon(); } -QString WaylandClient::captionNormal() const +QString WaylandWindow::captionNormal() const { return m_captionNormal; } -QString WaylandClient::captionSuffix() const +QString WaylandWindow::captionSuffix() const { return m_captionSuffix; } -pid_t WaylandClient::pid() const +pid_t WaylandWindow::pid() const { return surface()->client()->processId(); } -bool WaylandClient::isClient() const +bool WaylandWindow::isClient() const { return true; } -bool WaylandClient::isLockScreen() const +bool WaylandWindow::isLockScreen() const { return surface()->client() == waylandServer()->screenLockerClientConnection(); } -bool WaylandClient::isLocalhost() const +bool WaylandWindow::isLocalhost() const { return true; } -Window *WaylandClient::findModal(bool allow_itself) +Window *WaylandWindow::findModal(bool allow_itself) { Q_UNUSED(allow_itself) return nullptr; } -void WaylandClient::resizeWithChecks(const QSize &size) +void WaylandWindow::resizeWithChecks(const QSize &size) { const QRect area = workspace()->clientArea(WorkArea, this); @@ -107,7 +107,7 @@ void WaylandClient::resizeWithChecks(const QSize &size) resize(QSize(width, height)); } -void WaylandClient::killWindow() +void WaylandWindow::killWindow() { if (!surface()) { return; @@ -122,12 +122,12 @@ void WaylandClient::killWindow() QTimer::singleShot(5000, c, &ClientConnection::destroy); } -QByteArray WaylandClient::windowRole() const +QByteArray WaylandWindow::windowRole() const { return QByteArray(); } -bool WaylandClient::belongsToSameApplication(const Window *other, SameApplicationChecks checks) const +bool WaylandWindow::belongsToSameApplication(const Window *other, SameApplicationChecks checks) const { if (checks.testFlag(SameApplicationCheck::AllowCrossProcesses)) { if (other->desktopFileName() == desktopFileName()) { @@ -140,7 +140,7 @@ bool WaylandClient::belongsToSameApplication(const Window *other, SameApplicatio return false; } -bool WaylandClient::belongsToDesktop() const +bool WaylandWindow::belongsToDesktop() const { const auto clients = waylandServer()->clients(); @@ -153,12 +153,12 @@ bool WaylandClient::belongsToDesktop() const }); } -void WaylandClient::updateClientOutputs() +void WaylandWindow::updateClientOutputs() { surface()->setOutputs(waylandServer()->display()->outputsIntersecting(frameGeometry())); } -void WaylandClient::updateIcon() +void WaylandWindow::updateIcon() { const QString waylandIconName = QStringLiteral("wayland"); const QString dfIconName = iconFromDesktopFile(); @@ -169,7 +169,7 @@ void WaylandClient::updateIcon() setIcon(QIcon::fromTheme(iconName)); } -void WaylandClient::updateResourceName() +void WaylandWindow::updateResourceName() { const QFileInfo fileInfo(surface()->client()->executablePath()); if (fileInfo.exists()) { @@ -178,7 +178,7 @@ void WaylandClient::updateResourceName() } } -void WaylandClient::updateCaption() +void WaylandWindow::updateCaption() { const QString oldSuffix = m_captionSuffix; const auto shortcut = shortcutCaptionSuffix(); @@ -195,7 +195,7 @@ void WaylandClient::updateCaption() } } -void WaylandClient::setCaption(const QString &caption) +void WaylandWindow::setCaption(const QString &caption) { const QString oldSuffix = m_captionSuffix; m_captionNormal = caption.simplified(); @@ -206,7 +206,7 @@ void WaylandClient::setCaption(const QString &caption) } } -void WaylandClient::doSetActive() +void WaylandWindow::doSetActive() { if (isActive()) { // TODO: Xwayland clients must be unfocused somewhere else. StackingUpdatesBlocker blocker(workspace()); @@ -214,7 +214,7 @@ void WaylandClient::doSetActive() } } -void WaylandClient::updateDepth() +void WaylandWindow::updateDepth() { if (surface()->buffer()->hasAlphaChannel()) { setDepth(32); @@ -223,7 +223,7 @@ void WaylandClient::updateDepth() } } -void WaylandClient::cleanGrouping() +void WaylandWindow::cleanGrouping() { if (transientFor()) { transientFor()->removeTransient(this); @@ -238,22 +238,22 @@ void WaylandClient::cleanGrouping() } } -bool WaylandClient::isShown() const +bool WaylandWindow::isShown() const { return !isZombie() && !isHidden() && !isMinimized(); } -bool WaylandClient::isHiddenInternal() const +bool WaylandWindow::isHiddenInternal() const { return isHidden(); } -bool WaylandClient::isHidden() const +bool WaylandWindow::isHidden() const { return m_isHidden; } -void WaylandClient::showClient() +void WaylandWindow::showClient() { if (!isHidden()) { return; @@ -263,7 +263,7 @@ void WaylandClient::showClient() Q_EMIT windowShown(this); } -void WaylandClient::hideClient() +void WaylandWindow::hideClient() { if (isHidden()) { return; @@ -277,12 +277,12 @@ void WaylandClient::hideClient() Q_EMIT windowHidden(this); } -QRect WaylandClient::frameRectToBufferRect(const QRect &rect) const +QRect WaylandWindow::frameRectToBufferRect(const QRect &rect) const { return QRect(rect.topLeft(), surface()->size()); } -void WaylandClient::updateGeometry(const QRect &rect) +void WaylandWindow::updateGeometry(const QRect &rect) { const QRect oldClientGeometry = m_clientGeometry; const QRect oldFrameGeometry = m_frameGeometry; diff --git a/src/waylandclient.h b/src/waylandwindow.h similarity index 93% rename from src/waylandclient.h rename to src/waylandwindow.h index 03ee1e42a9..0600c5bb47 100644 --- a/src/waylandclient.h +++ b/src/waylandwindow.h @@ -11,12 +11,12 @@ namespace KWin { -class WaylandClient : public Window +class WaylandWindow : public Window { Q_OBJECT public: - WaylandClient(KWaylandServer::SurfaceInterface *surface); + WaylandWindow(KWaylandServer::SurfaceInterface *surface); QString captionNormal() const override; QString captionSuffix() const override; diff --git a/src/xdgshellclient.cpp b/src/xdgshellclient.cpp index 01e0191ce3..65b6faf357 100644 --- a/src/xdgshellclient.cpp +++ b/src/xdgshellclient.cpp @@ -40,7 +40,7 @@ namespace KWin { XdgSurfaceClient::XdgSurfaceClient(XdgSurfaceInterface *shellSurface) - : WaylandClient(shellSurface->surface()) + : WaylandWindow(shellSurface->surface()) , m_shellSurface(shellSurface) , m_configureTimer(new QTimer(this)) { @@ -894,7 +894,7 @@ void XdgToplevelClient::doInteractiveResizeSync() void XdgToplevelClient::doSetActive() { - WaylandClient::doSetActive(); + WaylandWindow::doSetActive(); if (isActive()) { m_nextStates |= XdgToplevelInterface::State::Activated; diff --git a/src/xdgshellclient.h b/src/xdgshellclient.h index 62678c6b18..94f194baa9 100644 --- a/src/xdgshellclient.h +++ b/src/xdgshellclient.h @@ -12,7 +12,7 @@ #pragma once #include "wayland/xdgshell_interface.h" -#include "waylandclient.h" +#include "waylandwindow.h" #include #include @@ -50,7 +50,7 @@ public: ConfigureFlags flags; }; -class XdgSurfaceClient : public WaylandClient +class XdgSurfaceClient : public WaylandWindow { Q_OBJECT