2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +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/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_DELETED_H
|
|
|
|
#define KWIN_DELETED_H
|
|
|
|
|
|
|
|
#include "toplevel.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-09-11 13:55:23 +00:00
|
|
|
class AbstractClient;
|
|
|
|
|
2014-07-23 07:20:28 +00:00
|
|
|
namespace Decoration
|
|
|
|
{
|
|
|
|
class Renderer;
|
|
|
|
}
|
|
|
|
|
2015-10-22 08:06:01 +00:00
|
|
|
class KWIN_EXPORT Deleted
|
2007-04-29 17:35:43 +00:00
|
|
|
: public Toplevel
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
2012-07-21 16:09:58 +00:00
|
|
|
Q_PROPERTY(bool minimized READ isMinimized)
|
2013-06-03 13:08:05 +00:00
|
|
|
Q_PROPERTY(bool modal READ isModal)
|
2016-01-27 13:14:37 +00:00
|
|
|
Q_PROPERTY(bool fullScreen READ isFullScreen CONSTANT)
|
2016-06-01 17:46:35 +00:00
|
|
|
Q_PROPERTY(bool isCurrentTab READ isCurrentTab)
|
2018-06-21 07:42:16 +00:00
|
|
|
Q_PROPERTY(bool keepAbove READ keepAbove CONSTANT)
|
|
|
|
Q_PROPERTY(bool keepBelow READ keepBelow CONSTANT)
|
|
|
|
Q_PROPERTY(QString caption READ caption CONSTANT)
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
static Deleted* create(Toplevel* c);
|
|
|
|
// 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();
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual int desktop() const;
|
|
|
|
virtual QStringList activities() const;
|
2018-11-07 16:22:41 +00:00
|
|
|
virtual QVector<VirtualDesktop *> desktops() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QPoint clientPos() const;
|
|
|
|
virtual QSize clientSize() const;
|
2015-12-08 09:11:26 +00:00
|
|
|
QPoint clientContentPos() const override {
|
|
|
|
return m_contentPos;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QRect transparentRect() const;
|
2012-01-15 09:51:09 +00:00
|
|
|
virtual bool isDeleted() const;
|
2013-09-10 06:13:33 +00:00
|
|
|
virtual xcb_window_t frameId() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool noBorder() const {
|
|
|
|
return no_border;
|
|
|
|
}
|
2014-07-25 10:55:28 +00:00
|
|
|
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect decorationRect() const;
|
2012-04-07 14:43:27 +00:00
|
|
|
virtual Layer layer() const {
|
|
|
|
return m_layer;
|
|
|
|
}
|
2012-07-21 16:09:58 +00:00
|
|
|
bool isMinimized() const {
|
|
|
|
return m_minimized;
|
|
|
|
}
|
2013-06-03 13:08:05 +00:00
|
|
|
bool isModal() const {
|
|
|
|
return m_modal;
|
|
|
|
}
|
2015-09-11 13:55:23 +00:00
|
|
|
QList<AbstractClient*> mainClients() const {
|
2013-06-03 13:08:05 +00:00
|
|
|
return m_mainClients;
|
|
|
|
}
|
2012-09-06 07:09:31 +00:00
|
|
|
NET::WindowType windowType(bool direct = false, int supported_types = 0) const;
|
2013-06-23 22:13:08 +00:00
|
|
|
bool wasClient() const {
|
|
|
|
return m_wasClient;
|
|
|
|
}
|
2015-03-04 06:56:51 +00:00
|
|
|
double opacity() const override;
|
2015-03-04 07:53:51 +00:00
|
|
|
QByteArray windowRole() const override;
|
2014-07-23 07:20:28 +00:00
|
|
|
|
|
|
|
const Decoration::Renderer *decorationRenderer() const {
|
|
|
|
return m_decorationRenderer;
|
|
|
|
}
|
2016-01-27 13:14:37 +00:00
|
|
|
|
|
|
|
bool isFullScreen() const {
|
|
|
|
return m_fullscreen;
|
|
|
|
}
|
2016-06-01 17:46:35 +00:00
|
|
|
|
|
|
|
bool isCurrentTab() const {
|
|
|
|
return m_wasCurrentTab;
|
|
|
|
}
|
2018-06-21 07:42:16 +00:00
|
|
|
bool keepAbove() const {
|
|
|
|
return m_keepAbove;
|
|
|
|
}
|
|
|
|
bool keepBelow() const {
|
|
|
|
return m_keepBelow;
|
|
|
|
}
|
|
|
|
QString caption() const {
|
|
|
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the client was active.
|
|
|
|
*
|
|
|
|
* @returns @c true if the client was active at the time when it was closed,
|
|
|
|
* @c false otherwise
|
|
|
|
**/
|
|
|
|
bool wasActive() const {
|
|
|
|
return m_wasActive;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether this was an X11 client.
|
|
|
|
*
|
|
|
|
* @returns @c true if it was an X11 client, @c false otherwise.
|
|
|
|
**/
|
|
|
|
bool wasX11Client() const {
|
|
|
|
return m_wasX11Client;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether this was a Wayland client.
|
|
|
|
*
|
|
|
|
* @returns @c true if it was a Wayland client, @c false otherwise.
|
|
|
|
**/
|
|
|
|
bool wasWaylandClient() const {
|
|
|
|
return m_wasWaylandClient;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the client was a transient.
|
|
|
|
*
|
|
|
|
* @returns @c true if it was a transient, @c false otherwise.
|
|
|
|
**/
|
|
|
|
bool wasTransient() const {
|
|
|
|
return !m_transientFor.isEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the client was a group transient.
|
|
|
|
*
|
|
|
|
* @returns @c true if it was a group transient, @c false otherwise.
|
|
|
|
* @note This is relevant only for X11 clients.
|
|
|
|
**/
|
|
|
|
bool wasGroupTransient() const {
|
|
|
|
return m_wasGroupTransient;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether this client was a transient for given toplevel.
|
|
|
|
*
|
|
|
|
* @param toplevel Toplevel against which we are testing.
|
|
|
|
* @returns @c true if it was a transient for given toplevel, @c false otherwise.
|
|
|
|
**/
|
|
|
|
bool wasTransientFor(const Toplevel *toplevel) const {
|
|
|
|
return m_transientFor.contains(const_cast<Toplevel *>(toplevel));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of transients.
|
|
|
|
*
|
|
|
|
* Because the window is Deleted, it can have only Deleted child transients.
|
|
|
|
**/
|
|
|
|
DeletedList transients() const {
|
|
|
|
return m_transients;
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
bool isPopupWindow() const override {
|
|
|
|
return m_wasPopupWindow;
|
|
|
|
}
|
|
|
|
|
2018-11-30 09:58:45 +00:00
|
|
|
QVector<uint> x11DesktopIds() const;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
protected:
|
|
|
|
virtual void debug(QDebug& stream) const;
|
2013-06-03 13:08:05 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void mainClientClosed(KWin::Toplevel *client);
|
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
|
|
|
void transientForClosed(Toplevel *toplevel, Deleted *deleted);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2013-05-08 11:39:06 +00:00
|
|
|
Deleted(); // use create()
|
2011-01-30 14:34:42 +00:00
|
|
|
void copyToDeleted(Toplevel* c);
|
|
|
|
virtual ~Deleted(); // 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
|
|
|
|
|
|
|
void addTransient(Deleted *transient);
|
|
|
|
void removeTransient(Deleted *transient);
|
|
|
|
void addTransientFor(AbstractClient *parent);
|
|
|
|
void removeTransientFor(Deleted *parent);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int delete_refcount;
|
|
|
|
double window_opacity;
|
|
|
|
int desk;
|
|
|
|
QStringList activityList;
|
|
|
|
QRect contentsRect; // for clientPos()/clientSize()
|
2015-12-08 09:11:26 +00:00
|
|
|
QPoint m_contentPos;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect transparent_rect;
|
2013-09-10 06:13:33 +00:00
|
|
|
xcb_window_t m_frame;
|
2018-11-07 16:22:41 +00:00
|
|
|
QVector <VirtualDesktop *> m_desktops;
|
2009-07-29 11:07:28 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
bool no_border;
|
|
|
|
QRect decoration_left;
|
|
|
|
QRect decoration_right;
|
|
|
|
QRect decoration_top;
|
|
|
|
QRect decoration_bottom;
|
2012-04-07 14:43:27 +00:00
|
|
|
Layer m_layer;
|
2012-07-21 16:09:58 +00:00
|
|
|
bool m_minimized;
|
2013-06-03 13:08:05 +00:00
|
|
|
bool m_modal;
|
2015-09-11 13:55:23 +00:00
|
|
|
QList<AbstractClient*> m_mainClients;
|
2013-06-23 22:13:08 +00:00
|
|
|
bool m_wasClient;
|
2016-06-01 17:46:35 +00:00
|
|
|
bool m_wasCurrentTab;
|
2014-07-23 07:20:28 +00:00
|
|
|
Decoration::Renderer *m_decorationRenderer;
|
2015-03-04 06:56:51 +00:00
|
|
|
double m_opacity;
|
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;
|
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
|
|
|
bool m_wasActive;
|
|
|
|
bool m_wasX11Client;
|
|
|
|
bool m_wasWaylandClient;
|
|
|
|
bool m_wasGroupTransient;
|
|
|
|
ToplevelList m_transientFor;
|
|
|
|
DeletedList m_transients;
|
2018-11-12 10:47:36 +00:00
|
|
|
bool m_wasPopupWindow;
|
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
|
|
|
|
|
2015-10-22 08:06:01 +00:00
|
|
|
Q_DECLARE_METATYPE(KWin::Deleted*)
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|