Rename WaylandClient to WaylandWindow

The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
This commit is contained in:
Vlad Zahorodnii 2022-04-22 20:51:07 +03:00
parent 3cdee2f24a
commit f0f829bc5b
13 changed files with 62 additions and 62 deletions

View file

@ -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

View file

@ -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 <cerrno>
@ -938,7 +938,7 @@ void DebugConsoleModel::handleClientAdded(Window *client)
return;
}
WaylandClient *waylandClient = qobject_cast<WaylandClient *>(client);
WaylandWindow *waylandClient = qobject_cast<WaylandWindow *>(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<WaylandClient *>(client);
WaylandWindow *waylandClient = qobject_cast<WaylandWindow *>(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<WaylandClient>(index, role, m_waylandClients, generic);
return clientData<WaylandWindow>(index, role, m_waylandClients, generic);
case s_workspaceInternalId:
return clientData<InternalWindow>(index, role, m_internalClients, generic);
default:
@ -1269,7 +1269,7 @@ static T *clientForIndex(const QModelIndex &index, const QVector<T *> &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);
}

View file

@ -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<T *> &clients, T *client);
template<class T>
void remove(int parentRow, QVector<T *> &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<WaylandClient *> m_waylandClients;
QVector<WaylandWindow *> m_waylandClients;
QVector<InternalWindow *> m_internalClients;
QVector<X11Client *> m_x11Clients;
QVector<Unmanaged *> m_unmanageds;

View file

@ -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<KWin::WaylandClient *>(toplevel) != nullptr;
waylandClient = qobject_cast<KWin::WaylandWindow *>(toplevel) != nullptr;
x11Client = qobject_cast<KWin::X11Client *>(toplevel) != nullptr || qobject_cast<KWin::Unmanaged *>(toplevel) != nullptr;
}

View file

@ -26,7 +26,7 @@ namespace KWin
{
InputPanelV1Window::InputPanelV1Window(InputPanelSurfaceV1Interface *panelSurface)
: WaylandClient(panelSurface->surface())
: WaylandWindow(panelSurface->surface())
, m_panelSurface(panelSurface)
{
setSkipSwitcher(true);

View file

@ -10,14 +10,14 @@
#pragma once
#include "wayland/inputmethod_v1_interface.h"
#include "waylandclient.h"
#include "waylandwindow.h"
#include <QPointer>
namespace KWin
{
class Output;
class InputPanelV1Window : public WaylandClient
class InputPanelV1Window : public WaylandWindow
{
Q_OBJECT
public:

View file

@ -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:

View file

@ -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

View file

@ -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<WaylandClient *>(client)) {
if (qobject_cast<WaylandWindow *>(client)) {
m_windowItem.reset(new WindowItemWayland(toplevel));
} else if (qobject_cast<X11Client *>(client) || qobject_cast<Unmanaged *>(client)) {
m_windowItem.reset(new WindowItemX11(toplevel));

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -12,7 +12,7 @@
#pragma once
#include "wayland/xdgshell_interface.h"
#include "waylandclient.h"
#include "waylandwindow.h"
#include <QQueue>
#include <QTimer>
@ -50,7 +50,7 @@ public:
ConfigureFlags flags;
};
class XdgSurfaceClient : public WaylandClient
class XdgSurfaceClient : public WaylandWindow
{
Q_OBJECT