kwin/internal_client.h
Martin Flöser 9b922f8833 Split out a dedicated InternalClient class
Summary:
Most of the functionality which is special to internal clients is moved
from ShellClient to InternalClient. As KWin's qpa is still bound to the
Wayland protocol InternalClient inherits from ShellClient. Due to that
some aspects in ShellClient are "weird". ShellClient still detects
whether it's an internal client and uses the variable m_internal to
capture the state. This is required as we cannot use the isInternal
method. Most of m_internal usage is in init which is called from
constructor of ShellClient. Thus it's not possible to call into virtual
methods of InternalClient.

Also some of the code is duplicated and some methods are temporarily
marked as virtual.

The next step will be to remove ShmBuffer for internal windows which
should decouple the two implementations further with the long term goal
of having InternalClient inherit AbstractClient directly.

Test Plan:
Run nested KWin, triggered outline (OpenGL case) and debug console (shm case).
InternalWindow unit test still passes.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18569
2019-02-21 18:51:25 +01:00

81 lines
3 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;
quint32 windowId() const override;
using AbstractClient::resizeWithChecks;
void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
QWindow *internalWindow() 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();
};
}