kwin/waylandclient.h
Vlad Zahorodnii 9acf04e2b7 Refactor Toplevel::opacity
The major difference between this version and the previous is that kwin
no longer forwards the opacity to the app window if it runs as a
window window manager and a compositing manager. As Keith Packard said [1]

> The window manager support is only needed to forward the property from the
> application window to the frame; with the Composite extension, a
> compositing manager can then take that value into account when
> constructing the desktop image.  Any X server can implement the Composite
> extension; the one in the X server project at freedesktop.org is just one
> such.  It would be trivial to implement this extension in a direct FB
> based X server, or any other X server which places windows in off-screen
> images.

There are a couple of reasons to do so: (a) simplifies code, (b) we don't
temper with opacities on override-redirect windows.

[1] https://listman.redhat.com/archives/xdg-list/2003-December/msg00153.html
2021-02-06 11:13:36 +02:00

90 lines
2.7 KiB
C++

/*
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "abstract_client.h"
namespace KWin
{
enum class SyncMode {
Sync,
Async,
};
class WaylandClient : public AbstractClient
{
Q_OBJECT
public:
WaylandClient(KWaylandServer::SurfaceInterface *surface);
QRect bufferGeometry() const override;
QString captionNormal() const override;
QString captionSuffix() const override;
QStringList activities() const override;
void setOnAllActivities(bool set) override;
void blockActivityUpdates(bool b = true) override;
QPoint clientContentPos() const override;
QRect transparentRect() const override;
pid_t pid() const override;
bool isLockScreen() const override;
bool isLocalhost() const override;
AbstractClient *findModal(bool allow_itself = false) override;
void resizeWithChecks(const QSize &size, ForceGeometry_t force = NormalGeometrySet) override;
void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet) override;
using AbstractClient::move;
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet) override;
void killWindow() override;
QByteArray windowRole() const override;
bool isShown(bool shaded_is_shown) const override;
bool isHiddenInternal() const override;
void hideClient(bool hide) override;
virtual QRect frameRectToBufferRect(const QRect &rect) const;
QRect requestedFrameGeometry() const;
QPoint requestedPos() const;
QSize requestedSize() const;
QRect requestedClientGeometry() const;
QSize requestedClientSize() const;
bool isHidden() const;
void updateDepth();
void setCaption(const QString &caption);
protected:
bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override;
bool belongsToDesktop() const override;
void doSetActive() override;
void updateCaption() override;
void setPositionSyncMode(SyncMode syncMode);
void setSizeSyncMode(SyncMode syncMode);
void cleanGrouping();
void cleanTabBox();
virtual void requestGeometry(const QRect &rect);
virtual void updateGeometry(const QRect &rect);
private:
void updateClientOutputs();
void updateIcon();
void updateResourceName();
void internalShow();
void internalHide();
QString m_captionNormal;
QString m_captionSuffix;
QRect m_requestedFrameGeometry;
QRect m_bufferGeometry;
QRect m_requestedClientGeometry;
SyncMode m_positionSyncMode = SyncMode::Sync;
SyncMode m_sizeSyncMode = SyncMode::Sync;
bool m_isHidden = false;
};
} // namespace KWin