2019-01-27 22:48:00 +03:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2019 Martin Flöser <mgraesslin@kde.org>
|
2019-08-26 10:44:04 +03:00
|
|
|
Copyright (C) 2019 Vlad Zagorodniy <vladzzag@gmail.com>
|
2019-01-27 22:48:00 +03:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#pragma once
|
|
|
|
|
2019-08-26 10:44:04 +03:00
|
|
|
#include "abstract_client.h"
|
2019-01-27 22:48:00 +03:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2019-08-26 10:44:04 +03:00
|
|
|
class KWIN_EXPORT InternalClient : public AbstractClient
|
2019-01-27 22:48:00 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-08-26 10:44:04 +03:00
|
|
|
|
2019-01-27 22:48:00 +03:00
|
|
|
public:
|
2019-08-26 10:44:04 +03:00
|
|
|
explicit InternalClient(QWindow *window);
|
2019-01-27 22:48:00 +03:00
|
|
|
~InternalClient() override;
|
|
|
|
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
|
|
2019-08-26 10:44:04 +03:00
|
|
|
QStringList activities() const override;
|
|
|
|
void blockActivityUpdates(bool b = true) override;
|
|
|
|
qreal bufferScale() const override;
|
|
|
|
QString captionNormal() const override;
|
|
|
|
QString captionSuffix() const override;
|
|
|
|
QPoint clientContentPos() const override;
|
|
|
|
QSize clientSize() const override;
|
|
|
|
void debug(QDebug &stream) const override;
|
|
|
|
QRect transparentRect() const override;
|
2019-01-27 22:48:00 +03:00
|
|
|
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
|
2019-08-26 10:44:04 +03:00
|
|
|
double opacity() const override;
|
|
|
|
void setOpacity(double opacity) override;
|
2019-01-27 22:48:00 +03:00
|
|
|
void killWindow() override;
|
|
|
|
bool isPopupWindow() const override;
|
2019-08-26 10:44:04 +03:00
|
|
|
QByteArray windowRole() const override;
|
2019-01-27 22:48:00 +03:00
|
|
|
void closeWindow() override;
|
|
|
|
bool isCloseable() const override;
|
2019-08-26 10:44:04 +03:00
|
|
|
bool isFullScreenable() const override;
|
|
|
|
bool isFullScreen() const override;
|
2019-01-27 22:48:00 +03:00
|
|
|
bool isMaximizable() const override;
|
|
|
|
bool isMinimizable() const override;
|
|
|
|
bool isMovable() const override;
|
|
|
|
bool isMovableAcrossScreens() const override;
|
|
|
|
bool isResizable() const override;
|
|
|
|
bool noBorder() const override;
|
|
|
|
bool userCanSetNoBorder() const override;
|
|
|
|
bool wantsInput() const override;
|
|
|
|
bool isInternal() const override;
|
|
|
|
bool isLockScreen() const override;
|
|
|
|
bool isInputMethod() const override;
|
2019-03-19 17:01:29 +03:00
|
|
|
bool isOutline() const override;
|
2019-01-27 22:48:00 +03:00
|
|
|
quint32 windowId() const override;
|
2019-08-26 10:44:04 +03:00
|
|
|
MaximizeMode maximizeMode() const override;
|
|
|
|
QRect geometryRestore() const override;
|
|
|
|
bool isShown(bool shaded_is_shown) const override;
|
|
|
|
bool isHiddenInternal() const override;
|
|
|
|
void hideClient(bool hide) override;
|
2019-01-27 22:48:00 +03:00
|
|
|
using AbstractClient::resizeWithChecks;
|
|
|
|
void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
|
2019-08-26 10:44:04 +03:00
|
|
|
using AbstractClient::setGeometry;
|
|
|
|
void setGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
|
|
|
|
void setGeometryRestore(const QRect &rect) override;
|
[wayland] Apply window rules only to xdg-shell clients
Summary:
There are rules that have to be applied only once, e.g. every Remember
and Apply Initially rule, as well rules that need to configure the client,
e.g. size, etc. In the best scenario the compositor would evaluate such
rules when the client is about to be mapped.
This change limits window rules only to xdg-shell clients because right
now only this protocol lets compositors to intervene in the client
initialization process. Also, it makes things a bit easier for us on the
compositor side.
xdg-shell protocol satisfies most of ours requirements to implement window
rules, but not all of them. If the client is about to be mapped for the
second time and its size is forced by a rule, then compositor may need
to configure it. Currently, xdg-shell protocol doesn't have any mechanism
that a client could use to notify the compositor about its intent to map.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: fmonteiro, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19411
2019-07-09 14:58:57 +03:00
|
|
|
bool supportsWindowRules() const override;
|
2019-08-26 10:44:04 +03:00
|
|
|
AbstractClient *findModal(bool allow_itself = false) override;
|
|
|
|
void setOnAllActivities(bool set) override;
|
|
|
|
void takeFocus() override;
|
|
|
|
bool userCanSetFullScreen() const override;
|
|
|
|
void setFullScreen(bool set, bool user = true) override;
|
|
|
|
void setNoBorder(bool set) override;
|
|
|
|
void updateDecoration(bool check_workspace_pos, bool force = false) override;
|
|
|
|
void updateColorScheme() override;
|
|
|
|
void showOnScreenEdge() override;
|
|
|
|
|
|
|
|
void destroyClient();
|
|
|
|
void present(const QSharedPointer<QOpenGLFramebufferObject> fbo);
|
|
|
|
void present(const QImage &image, const QRegion &damage);
|
|
|
|
QWindow *internalWindow() const;
|
2019-01-27 22:48:00 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool acceptsFocus() const override;
|
2019-08-26 10:44:04 +03:00
|
|
|
bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override;
|
|
|
|
void changeMaximize(bool horizontal, bool vertical, bool adjust) override;
|
|
|
|
void destroyDecoration() override;
|
2019-01-27 22:48:00 +03:00
|
|
|
void doMove(int x, int y) override;
|
|
|
|
void doResizeSync() override;
|
2019-08-26 10:44:04 +03:00
|
|
|
void updateCaption() override;
|
2019-01-27 22:48:00 +03:00
|
|
|
|
|
|
|
private:
|
2019-08-26 10:44:04 +03:00
|
|
|
QRect mapFromClient(const QRect &rect) const;
|
|
|
|
QRect mapToClient(const QRect &rect) const;
|
|
|
|
void createDecoration(const QRect &rect);
|
|
|
|
void requestGeometry(const QRect &rect);
|
|
|
|
void commitGeometry(const QRect &rect);
|
|
|
|
void setCaption(const QString &caption);
|
|
|
|
void markAsMapped();
|
2019-01-27 22:48:00 +03:00
|
|
|
void syncGeometryToInternalWindow();
|
2019-08-26 10:44:04 +03:00
|
|
|
void updateInternalWindowGeometry();
|
2019-01-27 22:48:00 +03:00
|
|
|
|
2019-08-26 10:44:04 +03:00
|
|
|
QWindow *m_internalWindow = nullptr;
|
|
|
|
QRect m_maximizeRestoreGeometry;
|
|
|
|
QSize m_clientSize = QSize(0, 0);
|
|
|
|
QString m_captionNormal;
|
|
|
|
QString m_captionSuffix;
|
|
|
|
double m_opacity = 1.0;
|
2019-01-27 22:48:00 +03:00
|
|
|
NET::WindowType m_windowType = NET::Normal;
|
|
|
|
quint32 m_windowId = 0;
|
|
|
|
Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
|
2019-08-26 10:44:04 +03:00
|
|
|
bool m_userNoBorder = false;
|
|
|
|
|
|
|
|
Q_DISABLE_COPY(InternalClient)
|
2019-01-27 22:48:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|