kwin/internal_client.h
Vlad Zagorodniy 18844f5925 [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 15:13:49 +03:00

83 lines
3.1 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2019 Martin Flöser <mgraesslin@kde.org>
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
#include "shell_client.h"
namespace KWin
{
class KWIN_EXPORT InternalClient : public ShellClient
{
Q_OBJECT
public:
InternalClient(KWayland::Server::ShellSurfaceInterface *surface);
// needed for template <class T> void WaylandServer::createSurface(T *surface)
InternalClient(KWayland::Server::XdgShellSurfaceInterface *surface);
// needed for template <class T> void WaylandServer::createSurface(T *surface)
InternalClient(KWayland::Server::XdgShellPopupInterface *surface);
~InternalClient() override;
bool eventFilter(QObject *watched, QEvent *event) override;
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
void killWindow() override;
bool isPopupWindow() const override;
void setInternalFramebufferObject(const QSharedPointer<QOpenGLFramebufferObject> &fbo) override;
void closeWindow() override;
bool isCloseable() const override;
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;
bool isOutline() const override;
quint32 windowId() const override;
using AbstractClient::resizeWithChecks;
void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
QWindow *internalWindow() const override;
bool supportsWindowRules() const override;
protected:
bool acceptsFocus() const override;
void doMove(int x, int y) override;
void doResizeSync() override;
bool requestGeometry(const QRect &rect) override;
void doSetGeometry(const QRect &rect) override;
private:
void findInternalWindow();
void updateInternalWindowGeometry();
void syncGeometryToInternalWindow();
NET::WindowType m_windowType = NET::Normal;
quint32 m_windowId = 0;
QWindow *m_internalWindow = nullptr;
Qt::WindowFlags m_internalWindowFlags = Qt::WindowFlags();
};
}