2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_DELETED_H
|
|
|
|
#define KWIN_DELETED_H
|
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
#include "window.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
class KWIN_EXPORT Deleted : public Window
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
2019-02-06 17:06:08 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2022-04-22 17:39:12 +00:00
|
|
|
static Deleted *create(Window *c);
|
2011-01-30 14:34:42 +00:00
|
|
|
// used by effects to keep the window around for e.g. fadeout effects when it's destroyed
|
|
|
|
void refWindow();
|
2013-05-31 17:15:51 +00:00
|
|
|
void unrefWindow();
|
2013-04-26 07:47:45 +00:00
|
|
|
void discard();
|
2019-09-27 10:33:42 +00:00
|
|
|
QMargins frameMargins() const override;
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
int desktop() const override;
|
|
|
|
QStringList activities() const override;
|
|
|
|
QVector<VirtualDesktop *> desktops() const override;
|
|
|
|
QPoint clientPos() const override;
|
|
|
|
bool isDeleted() const override;
|
|
|
|
xcb_window_t frameId() const override;
|
2022-04-18 08:39:44 +00:00
|
|
|
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const override;
|
2022-03-23 10:13:38 +00:00
|
|
|
Layer layer() const override
|
|
|
|
{
|
2012-04-07 14:43:27 +00:00
|
|
|
return m_layer;
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
bool isShade() const override
|
|
|
|
{
|
2021-05-26 09:34:35 +00:00
|
|
|
return m_shade;
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
bool isMinimized() const
|
|
|
|
{
|
2012-07-21 16:09:58 +00:00
|
|
|
return m_minimized;
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
bool isModal() const
|
|
|
|
{
|
2013-06-03 13:08:05 +00:00
|
|
|
return m_modal;
|
|
|
|
}
|
2022-04-23 08:33:23 +00:00
|
|
|
QList<Window *> mainWindows() const override
|
2022-03-23 10:13:38 +00:00
|
|
|
{
|
2022-04-23 08:33:23 +00:00
|
|
|
return m_mainWindows;
|
2013-06-03 13:08:05 +00:00
|
|
|
}
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
|
2022-03-23 10:13:38 +00:00
|
|
|
bool wasClient() const
|
|
|
|
{
|
2013-06-23 22:13:08 +00:00
|
|
|
return m_wasClient;
|
|
|
|
}
|
2015-03-04 07:53:51 +00:00
|
|
|
QByteArray windowRole() const override;
|
2014-07-23 07:20:28 +00:00
|
|
|
|
2022-04-15 07:15:59 +00:00
|
|
|
bool isFullScreen() const override
|
2022-03-23 10:13:38 +00:00
|
|
|
{
|
2016-01-27 13:14:37 +00:00
|
|
|
return m_fullscreen;
|
|
|
|
}
|
2016-06-01 17:46:35 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
bool keepAbove() const
|
|
|
|
{
|
2018-06-21 07:42:16 +00:00
|
|
|
return m_keepAbove;
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
bool keepBelow() const
|
|
|
|
{
|
2018-06-21 07:42:16 +00:00
|
|
|
return m_keepBelow;
|
|
|
|
}
|
2022-04-15 07:15:59 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
QString caption() const
|
|
|
|
{
|
2018-06-21 07:42:16 +00:00
|
|
|
return m_caption;
|
|
|
|
}
|
Keep Deleted transients above old parents
Summary:
If a modal window is closed, usually, it will go behind its parent. The
reason for this is that Workspace::constrainedStackingOrder() puts only
AbstractClient transients above parents, not Deleted transients.
So, if fade/glide/scale effect animates the disappearing of a transient,
unfortunately, one can't see that animation.
BUG: 397448
FIXED-IN: 5.15.0
Test Plan:
=== Closing of a transient and parent window
Before:
https://www.youtube.com/watch?v=XiLq7EAVCp0
After:
https://www.youtube.com/watch?v=cH_Ki-sqY8M
=== Scale effect
Before:
https://www.youtube.com/watch?v=Eb2a3U7R10I
After:
https://www.youtube.com/watch?v=4AKu3fdrnYQ
=== Sheet effect
Before:
https://www.youtube.com/watch?v=xPPSnR5FUU0
After:
https://www.youtube.com/watch?v=o_hxTNT-5Hg
=== Popup menus on Wayland
Before:
https://www.youtube.com/watch?v=5DnrY8p3F5A
After:
https://www.youtube.com/watch?v=7XEo8n_CrCc
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: abetts, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D14868
2018-10-15 13:04:05 +00:00
|
|
|
|
2022-04-15 07:15:59 +00:00
|
|
|
QString captionNormal() const override { return m_caption; }
|
|
|
|
QString captionSuffix() const override { return {}; }
|
|
|
|
bool isCloseable() const override { return false; }
|
|
|
|
bool isShown() const override { return false; }
|
|
|
|
bool isHiddenInternal() const override { return false; }
|
|
|
|
void hideClient() override { /* nothing to do */ }
|
|
|
|
void showClient() override { /* nothing to do */ }
|
2022-04-22 17:39:12 +00:00
|
|
|
Window *findModal(bool /*allow_itself*/) override { return nullptr; }
|
2022-04-15 07:15:59 +00:00
|
|
|
bool isResizable() const override { return false; }
|
|
|
|
bool isMovable() const override { return false; }
|
|
|
|
bool isMovableAcrossScreens() const override { return false; }
|
|
|
|
bool takeFocus() override { return false; }
|
|
|
|
bool wantsInput() const override { return false; }
|
|
|
|
void killWindow() override { /* nothing to do */ }
|
2022-04-23 08:33:23 +00:00
|
|
|
void destroyWindow() override { /* nothing to do */ }
|
2022-04-15 07:15:59 +00:00
|
|
|
void closeWindow() override { /* nothing to do */ }
|
|
|
|
bool acceptsFocus() const override { return false; }
|
2022-04-22 17:39:12 +00:00
|
|
|
bool belongsToSameApplication(const Window *other, SameApplicationChecks /*checks*/) const override { return other == this; }
|
|
|
|
void moveResizeInternal(const QRect & /*rect*/, KWin::Window::MoveResizeMode /*mode*/) override { /* nothing to do */ }
|
2022-04-15 07:15:59 +00:00
|
|
|
void updateCaption() override { /* nothing to do */ }
|
|
|
|
void resizeWithChecks(const QSize&) override { /* nothing to do */ }
|
2022-05-09 15:47:12 +00:00
|
|
|
WindowItem *createItem() override;
|
2022-04-15 07:15:59 +00:00
|
|
|
|
2018-11-12 10:47:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the client was a popup.
|
|
|
|
*
|
|
|
|
* @returns @c true if the client was a popup, @c false otherwise.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-03-23 10:13:38 +00:00
|
|
|
bool isPopupWindow() const override
|
|
|
|
{
|
2018-11-12 10:47:36 +00:00
|
|
|
return m_wasPopupWindow;
|
|
|
|
}
|
|
|
|
|
2018-11-30 09:58:45 +00:00
|
|
|
QVector<uint> x11DesktopIds() const;
|
|
|
|
|
2019-03-19 14:01:29 +00:00
|
|
|
/**
|
|
|
|
* Whether this Deleted represents the outline.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-03-23 10:13:38 +00:00
|
|
|
bool isOutline() const override
|
|
|
|
{
|
2019-03-19 14:01:29 +00:00
|
|
|
return m_wasOutline;
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
bool isLockScreen() const override
|
|
|
|
{
|
2021-05-12 18:56:16 +00:00
|
|
|
return m_wasLockScreen;
|
|
|
|
}
|
2019-03-19 14:01:29 +00:00
|
|
|
|
2013-06-03 13:08:05 +00:00
|
|
|
private Q_SLOTS:
|
2022-04-23 08:33:23 +00:00
|
|
|
void mainWindowClosed(KWin::Window *window);
|
Keep Deleted transients above old parents
Summary:
If a modal window is closed, usually, it will go behind its parent. The
reason for this is that Workspace::constrainedStackingOrder() puts only
AbstractClient transients above parents, not Deleted transients.
So, if fade/glide/scale effect animates the disappearing of a transient,
unfortunately, one can't see that animation.
BUG: 397448
FIXED-IN: 5.15.0
Test Plan:
=== Closing of a transient and parent window
Before:
https://www.youtube.com/watch?v=XiLq7EAVCp0
After:
https://www.youtube.com/watch?v=cH_Ki-sqY8M
=== Scale effect
Before:
https://www.youtube.com/watch?v=Eb2a3U7R10I
After:
https://www.youtube.com/watch?v=4AKu3fdrnYQ
=== Sheet effect
Before:
https://www.youtube.com/watch?v=xPPSnR5FUU0
After:
https://www.youtube.com/watch?v=o_hxTNT-5Hg
=== Popup menus on Wayland
Before:
https://www.youtube.com/watch?v=5DnrY8p3F5A
After:
https://www.youtube.com/watch?v=7XEo8n_CrCc
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: abetts, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D14868
2018-10-15 13:04:05 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2022-03-23 10:13:38 +00:00
|
|
|
Deleted(); // use create()
|
2022-04-22 17:39:12 +00:00
|
|
|
void copyToDeleted(Window *c);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~Deleted() override; // deleted only using unrefWindow()
|
Keep Deleted transients above old parents
Summary:
If a modal window is closed, usually, it will go behind its parent. The
reason for this is that Workspace::constrainedStackingOrder() puts only
AbstractClient transients above parents, not Deleted transients.
So, if fade/glide/scale effect animates the disappearing of a transient,
unfortunately, one can't see that animation.
BUG: 397448
FIXED-IN: 5.15.0
Test Plan:
=== Closing of a transient and parent window
Before:
https://www.youtube.com/watch?v=XiLq7EAVCp0
After:
https://www.youtube.com/watch?v=cH_Ki-sqY8M
=== Scale effect
Before:
https://www.youtube.com/watch?v=Eb2a3U7R10I
After:
https://www.youtube.com/watch?v=4AKu3fdrnYQ
=== Sheet effect
Before:
https://www.youtube.com/watch?v=xPPSnR5FUU0
After:
https://www.youtube.com/watch?v=o_hxTNT-5Hg
=== Popup menus on Wayland
Before:
https://www.youtube.com/watch?v=5DnrY8p3F5A
After:
https://www.youtube.com/watch?v=7XEo8n_CrCc
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: abetts, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D14868
2018-10-15 13:04:05 +00:00
|
|
|
|
2019-09-27 10:33:42 +00:00
|
|
|
QMargins m_frameMargins;
|
2019-10-03 19:43:28 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int delete_refcount;
|
|
|
|
int desk;
|
|
|
|
QStringList activityList;
|
|
|
|
QRect contentsRect; // for clientPos()/clientSize()
|
2013-09-10 06:13:33 +00:00
|
|
|
xcb_window_t m_frame;
|
2022-03-23 10:13:38 +00:00
|
|
|
QVector<VirtualDesktop *> m_desktops;
|
2009-07-29 11:07:28 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect decoration_left;
|
|
|
|
QRect decoration_right;
|
|
|
|
QRect decoration_top;
|
|
|
|
QRect decoration_bottom;
|
2012-04-07 14:43:27 +00:00
|
|
|
Layer m_layer;
|
2021-05-26 09:34:35 +00:00
|
|
|
bool m_shade;
|
2012-07-21 16:09:58 +00:00
|
|
|
bool m_minimized;
|
2013-06-03 13:08:05 +00:00
|
|
|
bool m_modal;
|
2022-04-23 08:33:23 +00:00
|
|
|
QList<Window *> m_mainWindows;
|
2013-06-23 22:13:08 +00:00
|
|
|
bool m_wasClient;
|
2015-03-04 07:26:57 +00:00
|
|
|
NET::WindowType m_type = NET::Unknown;
|
2015-03-04 07:53:51 +00:00
|
|
|
QByteArray m_windowRole;
|
2016-01-27 13:14:37 +00:00
|
|
|
bool m_fullscreen;
|
2018-06-21 07:42:16 +00:00
|
|
|
bool m_keepAbove;
|
|
|
|
bool m_keepBelow;
|
|
|
|
QString m_caption;
|
2018-11-12 10:47:36 +00:00
|
|
|
bool m_wasPopupWindow;
|
2019-03-19 14:01:29 +00:00
|
|
|
bool m_wasOutline;
|
2021-05-12 18:56:16 +00:00
|
|
|
bool m_wasLockScreen;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline void Deleted::refWindow()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
++delete_refcount;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
Q_DECLARE_METATYPE(KWin::Deleted *)
|
2015-10-22 08:06:01 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|