2015-03-04 08:21:10 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
|
[wayland] Asyncronously update maximise flags
Summary:
A window maximising is an async operation. We work out what size we want
the client to be, then request the client to update. The window isn't
really maximised until we get that new buffer with the new size.
This patch splits the requested, pending and current state, updating as
appropriate.
Things are a bit complex with things like borders. Technically we
shouldn't update them till we get a response, but we also need to have
the correct geometry of the full size window in our request. For now
they behave as before, updating when we request the change.
X code is untouched.
This hopefully fixes maximise animations on wayland as now we update the
geometry before emitting maximisedChanged.
Test Plan:
Maximised a window with the button and double clicking title bar.
I get only the following events on maximise/restore:
19:51:39.156 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(47,24 640x509) QRect(0,0 716x573)
19:51:39.157 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised true true
19:51:40.522 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(0,0 716x573) QRect(47,24 640x509)
19:51:40.522 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised false false
BUG: 382698
Reviewers: #kwin, romangg
Reviewed By: #kwin, romangg
Subscribers: romangg, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15150
2018-10-05 14:36:02 +00:00
|
|
|
Copyright (C) 2018 David Edmundson <davidedmundson@kde.org>
|
2019-09-29 14:03:25 +00:00
|
|
|
Copyright (C) 2019 Vlad Zahorodnii <vladzzag@gmail.com>
|
2015-03-04 08:21:10 +00: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/>.
|
|
|
|
*********************************************************************/
|
2019-09-15 09:44:33 +00:00
|
|
|
|
|
|
|
#pragma once
|
2015-03-04 08:21:10 +00:00
|
|
|
|
2015-03-16 08:14:04 +00:00
|
|
|
#include "abstract_client.h"
|
2019-09-15 09:41:21 +00:00
|
|
|
|
2016-04-22 12:13:37 +00:00
|
|
|
#include <KWayland/Server/xdgshell_interface.h>
|
2015-03-04 08:21:10 +00:00
|
|
|
|
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace Server
|
|
|
|
{
|
2015-12-17 10:14:54 +00:00
|
|
|
class ServerSideDecorationInterface;
|
2018-01-04 18:32:18 +00:00
|
|
|
class ServerSideDecorationPaletteInterface;
|
2017-12-22 14:22:24 +00:00
|
|
|
class AppMenuInterface;
|
2015-06-09 17:10:56 +00:00
|
|
|
class PlasmaShellSurfaceInterface;
|
2019-01-01 17:37:18 +00:00
|
|
|
class XdgDecorationInterface;
|
2015-03-04 08:21:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
XdgV6 - Kwin side
Summary:
Adds XDGV6 support for the kwin side.
Popup placement support is limited to the stuff v5 had,
a simple offset, rather than the awesome new positioner.
But Qt doesn't make use of it yet either.
Also ideally we should do all the positioning before sending the first
configure, but again Qt doesn't actually do anything with that anyway.
Also integrate pinging clients
Test Plan: gtk3-demo works nicely.
Reviewers: #plasma, graesslin, mart
Reviewed By: #plasma, graesslin
Subscribers: mart, graesslin, kwin, plasma-devel, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D6591
2017-09-25 15:37:59 +00:00
|
|
|
/**
|
|
|
|
* @brief The reason for which the server pinged a client surface
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
XdgV6 - Kwin side
Summary:
Adds XDGV6 support for the kwin side.
Popup placement support is limited to the stuff v5 had,
a simple offset, rather than the awesome new positioner.
But Qt doesn't make use of it yet either.
Also ideally we should do all the positioning before sending the first
configure, but again Qt doesn't actually do anything with that anyway.
Also integrate pinging clients
Test Plan: gtk3-demo works nicely.
Reviewers: #plasma, graesslin, mart
Reviewed By: #plasma, graesslin
Subscribers: mart, graesslin, kwin, plasma-devel, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D6591
2017-09-25 15:37:59 +00:00
|
|
|
enum class PingReason {
|
|
|
|
CloseWindow = 0,
|
|
|
|
FocusWindow
|
|
|
|
};
|
2019-01-28 00:28:48 +00:00
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
class KWIN_EXPORT XdgShellClient : public AbstractClient
|
2015-03-04 08:21:10 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-09-15 09:41:21 +00:00
|
|
|
|
2015-03-04 08:21:10 +00:00
|
|
|
public:
|
2019-08-30 21:36:58 +00:00
|
|
|
XdgShellClient(KWayland::Server::XdgShellSurfaceInterface *surface);
|
|
|
|
XdgShellClient(KWayland::Server::XdgShellPopupInterface *surface);
|
|
|
|
~XdgShellClient() override;
|
2015-03-04 08:21:10 +00:00
|
|
|
|
|
|
|
QStringList activities() const override;
|
2015-12-08 09:11:26 +00:00
|
|
|
QPoint clientContentPos() const override;
|
2015-03-04 08:21:10 +00:00
|
|
|
QSize clientSize() const override;
|
|
|
|
QRect transparentRect() const override;
|
|
|
|
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
|
|
|
|
void debug(QDebug &stream) const override;
|
|
|
|
double opacity() const override;
|
2015-03-16 08:13:19 +00:00
|
|
|
void setOpacity(double opacity) override;
|
2015-03-04 08:21:10 +00:00
|
|
|
QByteArray windowRole() const override;
|
2015-03-16 08:14:04 +00:00
|
|
|
void blockActivityUpdates(bool b = true) override;
|
2019-09-15 09:41:21 +00:00
|
|
|
QString captionNormal() const override;
|
|
|
|
QString captionSuffix() const override;
|
2015-03-16 08:14:04 +00:00
|
|
|
void closeWindow() override;
|
|
|
|
AbstractClient *findModal(bool allow_itself = false) override;
|
|
|
|
bool isCloseable() const override;
|
2019-01-09 14:20:19 +00:00
|
|
|
bool isFullScreenable() const override;
|
2015-03-16 08:14:04 +00:00
|
|
|
bool isFullScreen() const override;
|
|
|
|
bool isMaximizable() const override;
|
|
|
|
bool isMinimizable() const override;
|
|
|
|
bool isMovable() const override;
|
|
|
|
bool isMovableAcrossScreens() const override;
|
|
|
|
bool isResizable() const override;
|
|
|
|
bool isShown(bool shaded_is_shown) const override;
|
2019-09-15 09:41:21 +00:00
|
|
|
bool isHiddenInternal() const override;
|
2015-05-23 07:02:11 +00:00
|
|
|
void hideClient(bool hide) override;
|
2015-03-16 08:14:04 +00:00
|
|
|
MaximizeMode maximizeMode() const override;
|
2018-10-07 16:51:42 +00:00
|
|
|
MaximizeMode requestedMaximizeMode() const override;
|
2019-09-15 09:41:21 +00:00
|
|
|
QRect geometryRestore() const override;
|
2015-03-16 08:14:04 +00:00
|
|
|
bool noBorder() const override;
|
|
|
|
void setFullScreen(bool set, bool user = true) override;
|
|
|
|
void setNoBorder(bool set) override;
|
2015-12-17 14:47:36 +00:00
|
|
|
void updateDecoration(bool check_workspace_pos, bool force = false) override;
|
2015-03-16 08:14:04 +00:00
|
|
|
void setOnAllActivities(bool set) override;
|
|
|
|
void takeFocus() override;
|
|
|
|
bool userCanSetFullScreen() const override;
|
|
|
|
bool userCanSetNoBorder() const override;
|
|
|
|
bool wantsInput() const override;
|
2016-10-12 13:09:52 +00:00
|
|
|
bool dockWantsInput() const override;
|
2015-05-27 09:48:33 +00:00
|
|
|
using AbstractClient::resizeWithChecks;
|
|
|
|
void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
|
2015-10-13 08:52:01 +00:00
|
|
|
using AbstractClient::setGeometry;
|
|
|
|
void setGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
|
2015-06-19 22:14:49 +00:00
|
|
|
bool hasStrut() const override;
|
2019-09-15 09:41:21 +00:00
|
|
|
quint32 windowId() const override;
|
2017-05-13 15:02:30 +00:00
|
|
|
pid_t pid() const override;
|
2015-11-16 10:19:38 +00:00
|
|
|
bool isLockScreen() const override;
|
|
|
|
bool isInputMethod() const override;
|
2017-10-12 18:33:30 +00:00
|
|
|
bool isInitialPositionSet() const override;
|
2015-09-11 10:11:01 +00:00
|
|
|
bool isTransient() const override;
|
2015-09-11 11:31:41 +00:00
|
|
|
bool hasTransientPlacementHint() const override;
|
2018-10-19 22:21:54 +00:00
|
|
|
QRect transientPlacement(const QRect &bounds) const override;
|
2015-12-07 13:27:06 +00:00
|
|
|
QMatrix4x4 inputTransformation() const override;
|
2016-09-15 19:03:40 +00:00
|
|
|
void showOnScreenEdge() override;
|
2017-03-25 17:41:28 +00:00
|
|
|
bool hasPopupGrab() const override;
|
|
|
|
void popupDone() override;
|
2017-10-01 14:38:57 +00:00
|
|
|
void updateColorScheme() override;
|
[effects] Make Scale and Glide effects Wayland-friendly
Summary:
The Scale effect and the Glide effect have to animate only ordinary
windows(i.e. the ones that are considered to be apps).
On X11, in order to distinguish ordinary windows from combo box popups,
popup menus, and other popups, those effects check whether given window
is managed.
On Wayland, there is no concept of managed/unmanaged windows.
XDG Shell protocol defines 2 surface roles:
* xdg_toplevel;
* and, xdg_popup.
The former can be used to implement typical windows, the ones that can
be minimized, maximized, etc.
The latter can be used to implement tooltips, popup menus, etc. Thus,
that's a good criteria to filter popup windows.
CCBUG: 398100
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, graesslin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15117
2018-10-08 18:08:13 +00:00
|
|
|
bool isPopupWindow() const override;
|
2019-09-15 09:41:21 +00:00
|
|
|
void killWindow() override;
|
|
|
|
bool isLocalhost() const override;
|
|
|
|
bool supportsWindowRules() const override;
|
[effects] Make Scale and Glide effects Wayland-friendly
Summary:
The Scale effect and the Glide effect have to animate only ordinary
windows(i.e. the ones that are considered to be apps).
On X11, in order to distinguish ordinary windows from combo box popups,
popup menus, and other popups, those effects check whether given window
is managed.
On Wayland, there is no concept of managed/unmanaged windows.
XDG Shell protocol defines 2 surface roles:
* xdg_toplevel;
* and, xdg_popup.
The former can be used to implement typical windows, the ones that can
be minimized, maximized, etc.
The latter can be used to implement tooltips, popup menus, etc. Thus,
that's a good criteria to filter popup windows.
CCBUG: 398100
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, graesslin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15117
2018-10-08 18:08:13 +00:00
|
|
|
|
2019-09-15 09:41:21 +00:00
|
|
|
void installPlasmaShellSurface(KWayland::Server::PlasmaShellSurfaceInterface *surface);
|
|
|
|
void installServerSideDecoration(KWayland::Server::ServerSideDecorationInterface *decoration);
|
|
|
|
void installAppMenu(KWayland::Server::AppMenuInterface *appmenu);
|
|
|
|
void installPalette(KWayland::Server::ServerSideDecorationPaletteInterface *palette);
|
|
|
|
void installXdgDecoration(KWayland::Server::XdgDecorationInterface *decoration);
|
2018-12-23 07:56:15 +00:00
|
|
|
|
2019-09-15 09:41:21 +00:00
|
|
|
void placeIn(const QRect &area);
|
[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 11:58:57 +00:00
|
|
|
|
2015-03-04 08:21:10 +00:00
|
|
|
protected:
|
|
|
|
void addDamage(const QRegion &damage) override;
|
2017-11-05 09:10:17 +00:00
|
|
|
bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override;
|
2015-07-07 14:15:58 +00:00
|
|
|
void doSetActive() override;
|
2019-02-27 10:52:44 +00:00
|
|
|
bool belongsToDesktop() const override;
|
2015-09-17 09:06:59 +00:00
|
|
|
Layer layerForDock() const override;
|
2015-10-13 08:22:18 +00:00
|
|
|
void changeMaximize(bool horizontal, bool vertical, bool adjust) override;
|
2019-09-15 09:41:21 +00:00
|
|
|
void setGeometryRestore(const QRect &geo) override;
|
2015-10-28 10:16:48 +00:00
|
|
|
void doResizeSync() override;
|
2015-12-07 15:18:30 +00:00
|
|
|
bool acceptsFocus() const override;
|
2016-08-11 15:32:39 +00:00
|
|
|
void doMinimize() override;
|
2017-08-03 05:11:40 +00:00
|
|
|
void updateCaption() override;
|
2015-03-04 08:21:10 +00:00
|
|
|
|
2015-05-19 10:03:53 +00:00
|
|
|
private Q_SLOTS:
|
2019-09-15 10:54:53 +00:00
|
|
|
void handleConfigureAcknowledged(quint32 serial);
|
|
|
|
void handleSurfaceSizeChanged();
|
|
|
|
void handleTransientForChanged();
|
|
|
|
void handleWindowClassChanged(const QByteArray &windowClass);
|
|
|
|
void handleWindowTitleChanged(const QString &title);
|
|
|
|
void handleMoveRequested(KWayland::Server::SeatInterface *seat, quint32 serial);
|
|
|
|
void handleResizeRequested(KWayland::Server::SeatInterface *seat, quint32 serial, Qt::Edges edges);
|
|
|
|
void handleMinimizeRequested();
|
|
|
|
void handleMaximizeRequested(bool maximized);
|
|
|
|
void handleFullScreenRequested(bool fullScreen, KWayland::Server::OutputInterface *output);
|
|
|
|
void handleWindowMenuRequested(KWayland::Server::SeatInterface *seat, quint32 serial, const QPoint &surfacePos);
|
|
|
|
void handleGrabRequested(KWayland::Server::SeatInterface *seat, quint32 serial);
|
|
|
|
void handlePingDelayed(quint32 serial);
|
|
|
|
void handlePingTimeout(quint32 serial);
|
|
|
|
void handlePongReceived(quint32 serial);
|
2015-05-19 10:03:53 +00:00
|
|
|
|
2015-03-04 08:21:10 +00:00
|
|
|
private:
|
2019-02-26 13:41:07 +00:00
|
|
|
/**
|
|
|
|
* Called when the shell is created.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-04-18 09:55:40 +00:00
|
|
|
void init();
|
2019-02-26 13:41:07 +00:00
|
|
|
/**
|
|
|
|
* Called for the XDG case when the shell surface is committed to the surface.
|
|
|
|
* At this point all initial properties should have been set by the client.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-26 13:41:07 +00:00
|
|
|
void finishInit();
|
2015-12-17 14:47:36 +00:00
|
|
|
void createDecoration(const QRect &oldgeom);
|
2015-03-04 08:21:10 +00:00
|
|
|
void destroyClient();
|
2015-05-18 12:51:40 +00:00
|
|
|
void createWindowId();
|
2015-06-19 23:11:42 +00:00
|
|
|
void updateIcon();
|
2016-06-03 11:37:24 +00:00
|
|
|
bool shouldExposeToWindowManagement();
|
2017-08-24 16:57:30 +00:00
|
|
|
void updateClientOutputs();
|
2019-05-17 14:13:54 +00:00
|
|
|
void updateWindowMargins();
|
2016-04-22 12:13:37 +00:00
|
|
|
KWayland::Server::XdgShellSurfaceInterface::States xdgSurfaceStates() const;
|
2016-09-15 19:03:40 +00:00
|
|
|
void updateShowOnScreenEdge();
|
[wayland] Asyncronously update maximise flags
Summary:
A window maximising is an async operation. We work out what size we want
the client to be, then request the client to update. The window isn't
really maximised until we get that new buffer with the new size.
This patch splits the requested, pending and current state, updating as
appropriate.
Things are a bit complex with things like borders. Technically we
shouldn't update them till we get a response, but we also need to have
the correct geometry of the full size window in our request. For now
they behave as before, updating when we request the change.
X code is untouched.
This hopefully fixes maximise animations on wayland as now we update the
geometry before emitting maximisedChanged.
Test Plan:
Maximised a window with the button and double clicking title bar.
I get only the following events on maximise/restore:
19:51:39.156 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(47,24 640x509) QRect(0,0 716x573)
19:51:39.157 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised true true
19:51:40.522 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(0,0 716x573) QRect(47,24 640x509)
19:51:40.522 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised false false
BUG: 382698
Reviewers: #kwin, romangg
Reviewed By: #kwin, romangg
Subscribers: romangg, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15150
2018-10-05 14:36:02 +00:00
|
|
|
void updateMaximizeMode(MaximizeMode maximizeMode);
|
2018-10-05 14:27:05 +00:00
|
|
|
// called on surface commit and processes all m_pendingConfigureRequests up to m_lastAckedConfigureReqest
|
|
|
|
void updatePendingGeometry();
|
2019-02-22 14:08:47 +00:00
|
|
|
QPoint popupOffset(const QRect &anchorRect, const Qt::Edges anchorEdge, const Qt::Edges gravity, const QSize popupSize) const;
|
2019-08-26 07:44:04 +00:00
|
|
|
void requestGeometry(const QRect &rect);
|
|
|
|
void doSetGeometry(const QRect &rect);
|
|
|
|
void unmap();
|
|
|
|
void markAsMapped();
|
2019-08-30 21:36:58 +00:00
|
|
|
static void deleteClient(XdgShellClient *c);
|
2015-03-04 08:21:10 +00:00
|
|
|
|
2019-05-17 14:13:54 +00:00
|
|
|
QSize toWindowGeometry(const QSize &geometry) const;
|
|
|
|
|
2016-04-22 12:13:37 +00:00
|
|
|
KWayland::Server::XdgShellSurfaceInterface *m_xdgShellSurface;
|
|
|
|
KWayland::Server::XdgShellPopupInterface *m_xdgShellPopup;
|
2018-10-10 11:03:22 +00:00
|
|
|
|
|
|
|
// size of the last buffer
|
2015-03-04 08:21:10 +00:00
|
|
|
QSize m_clientSize;
|
2018-10-10 11:03:22 +00:00
|
|
|
// last size we requested or empty if we haven't sent an explicit request to the client
|
|
|
|
// if empty the client should choose their own default size
|
2018-10-11 21:58:16 +00:00
|
|
|
QSize m_requestedClientSize = QSize(0, 0);
|
2015-05-19 10:03:53 +00:00
|
|
|
|
2018-10-05 14:27:05 +00:00
|
|
|
struct PendingConfigureRequest {
|
|
|
|
//note for wl_shell we have no serial, so serialId and m_lastAckedConfigureRequest will always be 0
|
|
|
|
//meaning we treat a surface commit as having processed all requests
|
|
|
|
quint32 serialId = 0;
|
|
|
|
// position to apply after a resize operation has been completed
|
|
|
|
QPoint positionAfterResize;
|
[wayland] Asyncronously update maximise flags
Summary:
A window maximising is an async operation. We work out what size we want
the client to be, then request the client to update. The window isn't
really maximised until we get that new buffer with the new size.
This patch splits the requested, pending and current state, updating as
appropriate.
Things are a bit complex with things like borders. Technically we
shouldn't update them till we get a response, but we also need to have
the correct geometry of the full size window in our request. For now
they behave as before, updating when we request the change.
X code is untouched.
This hopefully fixes maximise animations on wayland as now we update the
geometry before emitting maximisedChanged.
Test Plan:
Maximised a window with the button and double clicking title bar.
I get only the following events on maximise/restore:
19:51:39.156 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(47,24 640x509) QRect(0,0 716x573)
19:51:39.157 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised true true
19:51:40.522 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(0,0 716x573) QRect(47,24 640x509)
19:51:40.522 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised false false
BUG: 382698
Reviewers: #kwin, romangg
Reviewed By: #kwin, romangg
Subscribers: romangg, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15150
2018-10-05 14:36:02 +00:00
|
|
|
MaximizeMode maximizeMode;
|
2018-10-05 14:27:05 +00:00
|
|
|
};
|
|
|
|
QVector<PendingConfigureRequest> m_pendingConfigureRequests;
|
|
|
|
quint32 m_lastAckedConfigureRequest = 0;
|
|
|
|
|
[wayland] Asyncronously update maximise flags
Summary:
A window maximising is an async operation. We work out what size we want
the client to be, then request the client to update. The window isn't
really maximised until we get that new buffer with the new size.
This patch splits the requested, pending and current state, updating as
appropriate.
Things are a bit complex with things like borders. Technically we
shouldn't update them till we get a response, but we also need to have
the correct geometry of the full size window in our request. For now
they behave as before, updating when we request the change.
X code is untouched.
This hopefully fixes maximise animations on wayland as now we update the
geometry before emitting maximisedChanged.
Test Plan:
Maximised a window with the button and double clicking title bar.
I get only the following events on maximise/restore:
19:51:39.156 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(47,24 640x509) QRect(0,0 716x573)
19:51:39.157 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised true true
19:51:40.522 KWin::EffectsHandlerImpl::slotGeometryShapeChanged geometry
shape changed QRect(0,0 716x573) QRect(47,24 640x509)
19:51:40.522 KWin::EffectsHandlerImpl::slotClientMaximized slot client
maximised false false
BUG: 382698
Reviewers: #kwin, romangg
Reviewed By: #kwin, romangg
Subscribers: romangg, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15150
2018-10-05 14:36:02 +00:00
|
|
|
//mode in use by the current buffer
|
|
|
|
MaximizeMode m_maximizeMode = MaximizeRestore;
|
|
|
|
//mode we currently want to be, could be pending on client updating, could be not sent yet
|
|
|
|
MaximizeMode m_requestedMaximizeMode = MaximizeRestore;
|
|
|
|
|
2015-05-19 10:03:53 +00:00
|
|
|
QRect m_geomFsRestore; //size and position of the window before it was set to fullscreen
|
2015-04-30 11:48:59 +00:00
|
|
|
bool m_closing = false;
|
2015-05-18 12:51:40 +00:00
|
|
|
quint32 m_windowId = 0;
|
2015-06-03 19:19:00 +00:00
|
|
|
bool m_unmapped = true;
|
2015-06-07 01:28:38 +00:00
|
|
|
QRect m_geomMaximizeRestore; // size and position of the window before it was set to maximize
|
2015-06-08 19:27:55 +00:00
|
|
|
NET::WindowType m_windowType = NET::Normal;
|
2015-06-09 17:10:56 +00:00
|
|
|
QPointer<KWayland::Server::PlasmaShellSurfaceInterface> m_plasmaShellSurface;
|
2017-12-22 14:22:24 +00:00
|
|
|
QPointer<KWayland::Server::AppMenuInterface> m_appMenuInterface;
|
2018-01-04 18:32:18 +00:00
|
|
|
QPointer<KWayland::Server::ServerSideDecorationPaletteInterface> m_paletteInterface;
|
2015-12-17 10:14:54 +00:00
|
|
|
KWayland::Server::ServerSideDecorationInterface *m_serverDecoration = nullptr;
|
2019-01-01 17:37:18 +00:00
|
|
|
KWayland::Server::XdgDecorationInterface *m_xdgDecoration = nullptr;
|
2015-12-17 14:47:36 +00:00
|
|
|
bool m_userNoBorder = false;
|
2015-10-08 08:05:40 +00:00
|
|
|
bool m_fullScreen = false;
|
2015-10-08 09:04:06 +00:00
|
|
|
bool m_transient = false;
|
2016-10-11 14:24:10 +00:00
|
|
|
bool m_hidden = false;
|
XdgV6 - Kwin side
Summary:
Adds XDGV6 support for the kwin side.
Popup placement support is limited to the stuff v5 had,
a simple offset, rather than the awesome new positioner.
But Qt doesn't make use of it yet either.
Also ideally we should do all the positioning before sending the first
configure, but again Qt doesn't actually do anything with that anyway.
Also integrate pinging clients
Test Plan: gtk3-demo works nicely.
Reviewers: #plasma, graesslin, mart
Reviewed By: #plasma, graesslin
Subscribers: mart, graesslin, kwin, plasma-devel, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D6591
2017-09-25 15:37:59 +00:00
|
|
|
bool m_hasPopupGrab = false;
|
2016-02-18 07:27:02 +00:00
|
|
|
qreal m_opacity = 1.0;
|
2016-06-09 14:54:06 +00:00
|
|
|
|
2019-02-26 13:41:07 +00:00
|
|
|
class RequestGeometryBlocker { //TODO rename ConfigureBlocker when this class is Xdg only
|
2016-06-09 14:54:06 +00:00
|
|
|
public:
|
2019-08-30 21:36:58 +00:00
|
|
|
RequestGeometryBlocker(XdgShellClient *client)
|
2016-06-09 14:54:06 +00:00
|
|
|
: m_client(client)
|
|
|
|
{
|
|
|
|
m_client->m_requestGeometryBlockCounter++;
|
|
|
|
}
|
|
|
|
~RequestGeometryBlocker()
|
|
|
|
{
|
|
|
|
m_client->m_requestGeometryBlockCounter--;
|
|
|
|
if (m_client->m_requestGeometryBlockCounter == 0) {
|
2019-02-26 13:40:54 +00:00
|
|
|
m_client->requestGeometry(m_client->m_blockedRequestGeometry);
|
2016-06-09 14:54:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
private:
|
2019-08-30 21:36:58 +00:00
|
|
|
XdgShellClient *m_client;
|
2016-06-09 14:54:06 +00:00
|
|
|
};
|
|
|
|
friend class RequestGeometryBlocker;
|
|
|
|
int m_requestGeometryBlockCounter = 0;
|
|
|
|
QRect m_blockedRequestGeometry;
|
2016-06-16 11:30:32 +00:00
|
|
|
QString m_caption;
|
2017-08-03 05:11:40 +00:00
|
|
|
QString m_captionSuffix;
|
XdgV6 - Kwin side
Summary:
Adds XDGV6 support for the kwin side.
Popup placement support is limited to the stuff v5 had,
a simple offset, rather than the awesome new positioner.
But Qt doesn't make use of it yet either.
Also ideally we should do all the positioning before sending the first
configure, but again Qt doesn't actually do anything with that anyway.
Also integrate pinging clients
Test Plan: gtk3-demo works nicely.
Reviewers: #plasma, graesslin, mart
Reviewed By: #plasma, graesslin
Subscribers: mart, graesslin, kwin, plasma-devel, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D6591
2017-09-25 15:37:59 +00:00
|
|
|
QHash<qint32, PingReason> m_pingSerials;
|
2016-08-19 10:33:59 +00:00
|
|
|
|
2019-05-17 14:13:54 +00:00
|
|
|
QMargins m_windowMargins;
|
|
|
|
|
[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 11:58:57 +00:00
|
|
|
bool m_isInitialized = false;
|
2019-09-10 07:40:36 +00:00
|
|
|
|
|
|
|
friend class Workspace;
|
2015-03-04 08:21:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
Q_DECLARE_METATYPE(KWin::XdgShellClient *)
|