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: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2003 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
|
|
|
|
|
|
|
// SELI zmenit doc
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
This file contains things relevant to stacking order and layers.
|
|
|
|
|
|
|
|
Design:
|
|
|
|
|
|
|
|
Normal unconstrained stacking order, as requested by the user (by clicking
|
|
|
|
on windows to raise them, etc.), is in Workspace::unconstrained_stacking_order.
|
|
|
|
That list shouldn't be used at all, except for building
|
|
|
|
Workspace::stacking_order. The building is done
|
|
|
|
in Workspace::constrainedStackingOrder(). Only Workspace::stackingOrder() should
|
|
|
|
be used to get the stacking order, because it also checks the stacking order
|
|
|
|
is up to date.
|
|
|
|
All clients are also stored in Workspace::clients (except for isDesktop() clients,
|
|
|
|
as those are very special, and are stored in Workspace::desktops), in the order
|
|
|
|
the clients were created.
|
|
|
|
|
2014-01-20 10:02:07 +00:00
|
|
|
Every window has one layer assigned in which it is. There are 7 layers,
|
2015-01-02 11:11:54 +00:00
|
|
|
from bottom : DesktopLayer, BelowLayer, NormalLayer, DockLayer, AboveLayer, NotificationLayer,
|
2019-05-02 08:29:38 +00:00
|
|
|
ActiveLayer, CriticalNotificationLayer, and OnScreenDisplayLayer (see also NETWM sect.7.10.).
|
|
|
|
The layer a window is in depends on the window type, and on other things like whether the window
|
|
|
|
is active. We extend the layers provided in NETWM by the NotificationLayer, OnScreenDisplayLayer,
|
|
|
|
and CriticalNotificationLayer.
|
2015-01-02 11:11:54 +00:00
|
|
|
The NoficationLayer contains notification windows which are kept above all windows except the active
|
2019-05-02 08:29:38 +00:00
|
|
|
fullscreen window. The CriticalNotificationLayer contains notification windows which are important
|
|
|
|
enough to keep them even above fullscreen windows. The OnScreenDisplayLayer is used for eg. volume
|
|
|
|
and brightness change feedback and is kept above all windows since it provides immediate response
|
|
|
|
to a user action.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
NET::Splash clients belong to the Normal layer. NET::TopMenu clients
|
|
|
|
belong to Dock layer. Clients that are both NET::Dock and NET::KeepBelow
|
|
|
|
are in the Normal layer in order to keep the 'allow window to cover
|
|
|
|
the panel' Kicker setting to work as intended (this may look like a slight
|
|
|
|
spec violation, but a) I have no better idea, b) the spec allows adjusting
|
|
|
|
the stacking order if the WM thinks it's a good idea . We put all
|
|
|
|
NET::KeepAbove above all Docks too, even though the spec suggests putting
|
|
|
|
them in the same layer.
|
|
|
|
|
|
|
|
Most transients are in the same layer as their mainwindow,
|
|
|
|
see Workspace::constrainedStackingOrder(), they may also be in higher layers, but
|
|
|
|
they should never be below their mainwindow.
|
|
|
|
|
|
|
|
Currently the things that affect client in which layer a client
|
|
|
|
belongs: KeepAbove/Keep Below flags, window type, fullscreen
|
|
|
|
state and whether the client is active, mainclient (transiency).
|
|
|
|
|
|
|
|
Make sure updateStackingOrder() is called in order to make
|
|
|
|
Workspace::stackingOrder() up to date and propagated to the world.
|
|
|
|
Using Workspace::blockStackingUpdates() (or the StackingUpdatesBlocker
|
|
|
|
helper class) it's possible to temporarily disable updates
|
|
|
|
and the stacking order will be updated once after it's allowed again.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2022-01-18 08:35:52 +00:00
|
|
|
#include "utils/common.h"
|
2019-09-24 08:48:08 +00:00
|
|
|
#include "x11client.h"
|
2012-11-20 16:26:50 +00:00
|
|
|
#include "focuschain.h"
|
2013-04-26 08:41:24 +00:00
|
|
|
#include "netinfo.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "workspace.h"
|
|
|
|
#include "tabbox.h"
|
|
|
|
#include "group.h"
|
|
|
|
#include "rules.h"
|
2013-04-03 10:19:27 +00:00
|
|
|
#include "screens.h"
|
2007-05-23 16:22:59 +00:00
|
|
|
#include "unmanaged.h"
|
2008-04-24 12:53:03 +00:00
|
|
|
#include "deleted.h"
|
2010-09-25 18:51:18 +00:00
|
|
|
#include "effects.h"
|
2011-08-21 19:50:23 +00:00
|
|
|
#include "composite.h"
|
2013-01-21 08:04:06 +00:00
|
|
|
#include "screenedge.h"
|
2015-05-21 08:35:03 +00:00
|
|
|
#include "wayland_server.h"
|
2019-08-26 07:44:04 +00:00
|
|
|
#include "internal_client.h"
|
2021-08-12 14:16:08 +00:00
|
|
|
#include "virtualdesktops.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2021-11-03 06:29:57 +00:00
|
|
|
#include <array>
|
|
|
|
|
2013-09-02 11:14:39 +00:00
|
|
|
#include <QDebug>
|
2021-05-09 15:07:36 +00:00
|
|
|
#include <QQueue>
|
2013-09-02 11:14:39 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
//*******************************
|
|
|
|
// Workspace
|
|
|
|
//*******************************
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void Workspace::updateStackingOrder(bool propagate_new_clients)
|
|
|
|
{
|
|
|
|
if (block_stacking_updates > 0) {
|
|
|
|
if (propagate_new_clients)
|
2007-04-29 17:35:43 +00:00
|
|
|
blocked_propagating_new_clients = true;
|
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<Toplevel *> new_stacking_order = constrainedStackingOrder();
|
2012-09-25 20:46:03 +00:00
|
|
|
bool changed = (force_restacking || new_stacking_order != stacking_order);
|
2007-07-04 09:51:10 +00:00
|
|
|
force_restacking = false;
|
2007-04-29 17:35:43 +00:00
|
|
|
stacking_order = new_stacking_order;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (changed || propagate_new_clients) {
|
|
|
|
propagateClients(propagate_new_clients);
|
2020-09-24 07:40:57 +00:00
|
|
|
markXStackingOrderAsDirty();
|
2021-07-14 09:55:37 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < stacking_order.size(); ++i) {
|
|
|
|
stacking_order[i]->setStackingOrder(i);
|
|
|
|
}
|
|
|
|
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT stackingOrderChanged();
|
2011-08-21 19:50:23 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (active_client)
|
2007-04-29 22:37:19 +00:00
|
|
|
active_client->updateMouseGrab();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
2013-02-08 19:59:35 +00:00
|
|
|
* Some fullscreen effects have to raise the screenedge on top of an input window, thus all windows
|
|
|
|
* this function puts them back where they belong for regular use and is some cheap variant of
|
|
|
|
* the regular propagateClients function in that it completely ignores managed clients and everything
|
|
|
|
* else and also does not update the NETWM property.
|
|
|
|
* Called from Effects::destroyInputWindow so far.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-02-08 19:59:35 +00:00
|
|
|
void Workspace::stackScreenEdgesUnderOverrideRedirect()
|
|
|
|
{
|
2017-08-07 04:57:37 +00:00
|
|
|
if (!rootInfo()) {
|
|
|
|
return;
|
|
|
|
}
|
2013-04-29 10:17:42 +00:00
|
|
|
Xcb::restackWindows(QVector<xcb_window_t>() << rootInfo()->supportWindow() << ScreenEdges::self()->windows());
|
2013-02-08 19:59:35 +00:00
|
|
|
}
|
|
|
|
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Propagates the managed clients to the world.
|
|
|
|
* Called ONLY from updateStackingOrder().
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void Workspace::propagateClients(bool propagate_new_clients)
|
|
|
|
{
|
2017-08-07 04:57:37 +00:00
|
|
|
if (!rootInfo()) {
|
|
|
|
return;
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
// restack the windows according to the stacking order
|
2013-02-07 21:18:05 +00:00
|
|
|
// supportWindow > electric borders > clients > hidden clients
|
|
|
|
QVector<xcb_window_t> newWindowStack;
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// Stack all windows under the support window. The support window is
|
|
|
|
// not used for anything (besides the NETWM property), and it's not shown,
|
|
|
|
// but it was lowered after kwin startup. Stacking all clients below
|
|
|
|
// it ensures that no client will be ever shown above override-redirect
|
|
|
|
// windows (e.g. popups).
|
2013-04-29 10:17:42 +00:00
|
|
|
newWindowStack << rootInfo()->supportWindow();
|
2013-02-07 21:18:05 +00:00
|
|
|
|
|
|
|
newWindowStack << ScreenEdges::self()->windows();
|
|
|
|
|
2018-08-24 21:10:48 +00:00
|
|
|
newWindowStack << manual_overlays;
|
|
|
|
|
2013-02-07 21:18:05 +00:00
|
|
|
newWindowStack.reserve(newWindowStack.size() + 2*stacking_order.size()); // *2 for inputWindow
|
|
|
|
|
|
|
|
for (int i = stacking_order.size() - 1; i >= 0; --i) {
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *client = qobject_cast<X11Client *>(stacking_order.at(i));
|
2012-04-08 08:07:35 +00:00
|
|
|
if (!client || client->hiddenPreview()) {
|
2007-07-04 09:51:10 +00:00
|
|
|
continue;
|
2011-06-25 17:50:16 +00:00
|
|
|
}
|
2011-11-09 19:39:13 +00:00
|
|
|
|
|
|
|
if (client->inputId())
|
|
|
|
// Stack the input window above the frame
|
2013-02-07 21:18:05 +00:00
|
|
|
newWindowStack << client->inputId();
|
2011-11-09 19:39:13 +00:00
|
|
|
|
2013-02-07 21:18:05 +00:00
|
|
|
newWindowStack << client->frameId();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2012-01-13 02:08:40 +00:00
|
|
|
|
|
|
|
// when having hidden previews, stack hidden windows below everything else
|
|
|
|
// (as far as pure X stacking order is concerned), in order to avoid having
|
|
|
|
// these windows that should be unmapped to interfere with other windows
|
2013-02-07 21:18:05 +00:00
|
|
|
for (int i = stacking_order.size() - 1; i >= 0; --i) {
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *client = qobject_cast<X11Client *>(stacking_order.at(i));
|
2012-04-08 08:07:35 +00:00
|
|
|
if (!client || !client->hiddenPreview())
|
2012-01-13 02:08:40 +00:00
|
|
|
continue;
|
2013-02-07 21:18:05 +00:00
|
|
|
newWindowStack << client->frameId();
|
2012-01-13 02:08:40 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
// TODO isn't it too inefficient to restack always all clients?
|
|
|
|
// TODO don't restack not visible windows?
|
2019-08-31 14:28:37 +00:00
|
|
|
Q_ASSERT(newWindowStack.at(0) == rootInfo()->supportWindow());
|
2013-02-07 21:18:05 +00:00
|
|
|
Xcb::restackWindows(newWindowStack);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 17:50:16 +00:00
|
|
|
int pos = 0;
|
2013-11-18 12:57:46 +00:00
|
|
|
xcb_window_t *cl(nullptr);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (propagate_new_clients) {
|
2021-05-24 16:01:49 +00:00
|
|
|
cl = new xcb_window_t[ manual_overlays.count() + m_x11Clients.count()];
|
2021-05-13 16:41:39 +00:00
|
|
|
for (const auto win : qAsConst(manual_overlays)) {
|
2018-08-24 21:10:48 +00:00
|
|
|
cl[pos++] = win;
|
|
|
|
}
|
2021-05-24 16:01:49 +00:00
|
|
|
for (auto it = m_x11Clients.constBegin(); it != m_x11Clients.constEnd(); ++it)
|
2011-01-30 14:34:42 +00:00
|
|
|
cl[pos++] = (*it)->window();
|
2013-04-29 10:17:42 +00:00
|
|
|
rootInfo()->setClientList(cl, pos);
|
2007-04-29 17:35:43 +00:00
|
|
|
delete [] cl;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2018-08-24 21:10:48 +00:00
|
|
|
cl = new xcb_window_t[ manual_overlays.count() + stacking_order.count()];
|
2007-04-29 17:35:43 +00:00
|
|
|
pos = 0;
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
for (auto it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it) {
|
2020-01-09 12:19:34 +00:00
|
|
|
X11Client *client = qobject_cast<X11Client *>(*it);
|
|
|
|
if (client) {
|
|
|
|
cl[pos++] = client->window();
|
|
|
|
}
|
2012-09-25 20:46:03 +00:00
|
|
|
}
|
2021-05-13 16:41:39 +00:00
|
|
|
for (const auto win : qAsConst(manual_overlays)) {
|
2018-08-24 21:10:48 +00:00
|
|
|
cl[pos++] = win;
|
|
|
|
}
|
2013-04-29 10:17:42 +00:00
|
|
|
rootInfo()->setClientListStacking(cl, pos);
|
2007-04-29 17:35:43 +00:00
|
|
|
delete [] cl;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-02-06 14:21:20 +00:00
|
|
|
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Returns topmost visible client. Windows on the dock, the desktop
|
|
|
|
* or of any other special kind are excluded. Also if the window
|
|
|
|
* doesn't accept focus it's excluded.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2008-08-23 09:20:42 +00:00
|
|
|
// TODO misleading name for this method, too many slightly different ways to use it
|
2021-08-28 14:28:54 +00:00
|
|
|
AbstractClient *Workspace::topClientOnDesktop(VirtualDesktop *desktop, AbstractOutput *output, bool unconstrained, bool only_normal) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
// TODO Q_ASSERT( block_stacking_updates == 0 );
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<Toplevel *> list;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!unconstrained)
|
2007-04-29 22:39:07 +00:00
|
|
|
list = stacking_order;
|
2007-04-29 17:35:43 +00:00
|
|
|
else
|
2007-04-29 22:39:07 +00:00
|
|
|
list = unconstrained_stacking_order;
|
2011-01-30 14:34:42 +00:00
|
|
|
for (int i = list.size() - 1;
|
|
|
|
i >= 0;
|
|
|
|
--i) {
|
2015-09-14 11:37:11 +00:00
|
|
|
AbstractClient *c = qobject_cast<AbstractClient*>(list.at(i));
|
2012-04-08 08:07:35 +00:00
|
|
|
if (!c) {
|
|
|
|
continue;
|
|
|
|
}
|
2021-11-23 12:13:56 +00:00
|
|
|
if (c->isOnDesktop(desktop) && c->isShown() && c->isOnCurrentActivity() && !c->isShade()) {
|
2021-08-28 14:28:54 +00:00
|
|
|
if (output && c->output() != output)
|
2008-08-23 09:20:42 +00:00
|
|
|
continue;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!only_normal)
|
2012-04-08 08:07:35 +00:00
|
|
|
return c;
|
|
|
|
if (c->wantsTabFocus() && !c->isSpecialWindow())
|
|
|
|
return c;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
return nullptr;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2021-08-13 08:49:11 +00:00
|
|
|
AbstractClient *Workspace::findDesktop(bool topmost, VirtualDesktop *desktop) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
// TODO Q_ASSERT( block_stacking_updates == 0 );
|
2011-01-30 14:34:42 +00:00
|
|
|
if (topmost) {
|
|
|
|
for (int i = stacking_order.size() - 1; i >= 0; i--) {
|
2015-09-14 11:31:41 +00:00
|
|
|
AbstractClient *c = qobject_cast<AbstractClient*>(stacking_order.at(i));
|
2021-11-23 12:13:56 +00:00
|
|
|
if (c && c->isOnDesktop(desktop) && c->isDesktop() && c->isShown()) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return c;
|
2021-11-03 11:55:31 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2012-04-08 08:07:35 +00:00
|
|
|
} else { // bottom-most
|
2021-11-03 11:55:31 +00:00
|
|
|
for (Toplevel *c : qAsConst(stacking_order)) {
|
2015-09-14 11:31:41 +00:00
|
|
|
AbstractClient *client = qobject_cast<AbstractClient*>(c);
|
2021-11-23 12:13:56 +00:00
|
|
|
if (client && c->isOnDesktop(desktop) && c->isDesktop() && client->isShown()) {
|
2012-04-08 08:07:35 +00:00
|
|
|
return client;
|
2021-11-03 11:55:31 +00:00
|
|
|
}
|
2012-04-08 08:07:35 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
return nullptr;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-03-05 12:35:54 +00:00
|
|
|
void Workspace::raiseOrLowerClient(AbstractClient *c)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2021-08-13 08:41:57 +00:00
|
|
|
if (!c || !c->isOnCurrentDesktop()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-05-10 08:02:43 +00:00
|
|
|
const AbstractClient *topmost =
|
2021-08-13 08:41:57 +00:00
|
|
|
topClientOnDesktop(VirtualDesktopManager::self()->currentDesktop(),
|
2021-08-28 14:28:54 +00:00
|
|
|
options->isSeparateScreenFocus() ? c->output() : nullptr);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (c == topmost)
|
2007-04-29 17:35:43 +00:00
|
|
|
lowerClient(c);
|
|
|
|
else
|
|
|
|
raiseClient(c);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
|
2015-03-05 12:35:54 +00:00
|
|
|
void Workspace::lowerClient(AbstractClient* c, bool nogroup)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (!c)
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
c->cancelAutoRaise();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
StackingUpdatesBlocker blocker(this);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
unconstrained_stacking_order.removeAll(c);
|
|
|
|
unconstrained_stacking_order.prepend(c);
|
|
|
|
if (!nogroup && c->isTransient()) {
|
2008-03-21 17:12:21 +00:00
|
|
|
// lower also all windows in the group, in their reversed stacking order
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<X11Client *> wins;
|
2018-12-31 17:57:13 +00:00
|
|
|
if (auto group = c->group()) {
|
|
|
|
wins = ensureStackingOrder(group->members());
|
2015-09-14 11:53:46 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
for (int i = wins.size() - 1;
|
|
|
|
i >= 0;
|
|
|
|
--i) {
|
|
|
|
if (wins[ i ] != c)
|
|
|
|
lowerClient(wins[ i ], true);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-09-14 12:47:45 +00:00
|
|
|
void Workspace::lowerClientWithinApplication(AbstractClient* c)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (!c)
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
c->cancelAutoRaise();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
StackingUpdatesBlocker blocker(this);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
unconstrained_stacking_order.removeAll(c);
|
2007-04-29 17:35:43 +00:00
|
|
|
bool lowered = false;
|
|
|
|
// first try to put it below the bottom-most window of the application
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
for (auto it = unconstrained_stacking_order.begin();
|
2011-01-30 14:34:42 +00:00
|
|
|
it != unconstrained_stacking_order.end();
|
2012-05-26 14:57:37 +00:00
|
|
|
++it) {
|
2015-09-14 12:47:45 +00:00
|
|
|
AbstractClient *client = qobject_cast<AbstractClient*>(*it);
|
2012-05-26 14:57:37 +00:00
|
|
|
if (!client) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-09-14 12:47:45 +00:00
|
|
|
if (AbstractClient::belongToSameApplication(client, c)) {
|
2011-01-30 14:34:42 +00:00
|
|
|
unconstrained_stacking_order.insert(it, c);
|
2007-04-29 17:35:43 +00:00
|
|
|
lowered = true;
|
|
|
|
break;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2012-05-26 14:57:37 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!lowered)
|
|
|
|
unconstrained_stacking_order.prepend(c);
|
2007-04-29 17:35:43 +00:00
|
|
|
// ignore mainwindows
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-03-05 12:35:54 +00:00
|
|
|
void Workspace::raiseClient(AbstractClient* c, bool nogroup)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (!c)
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
c->cancelAutoRaise();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
StackingUpdatesBlocker blocker(this);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!nogroup && c->isTransient()) {
|
2015-09-11 09:37:40 +00:00
|
|
|
QList<AbstractClient*> transients;
|
|
|
|
AbstractClient *transient_parent = c;
|
2009-10-03 15:40:58 +00:00
|
|
|
while ((transient_parent = transient_parent->transientFor()))
|
|
|
|
transients << transient_parent;
|
2021-11-03 11:55:31 +00:00
|
|
|
for (const auto &transient_parent : qAsConst(transients)) {
|
2011-12-11 18:00:43 +00:00
|
|
|
raiseClient(transient_parent, true);
|
2021-11-03 11:55:31 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
unconstrained_stacking_order.removeAll(c);
|
|
|
|
unconstrained_stacking_order.append(c);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-09-14 12:49:18 +00:00
|
|
|
void Workspace::raiseClientWithinApplication(AbstractClient* c)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (!c)
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
c->cancelAutoRaise();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
StackingUpdatesBlocker blocker(this);
|
2007-04-29 17:35:43 +00:00
|
|
|
// ignore mainwindows
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// first try to put it above the top-most window of the application
|
2011-12-11 18:00:43 +00:00
|
|
|
for (int i = unconstrained_stacking_order.size() - 1; i > -1 ; --i) {
|
2015-09-14 12:49:18 +00:00
|
|
|
AbstractClient *other = qobject_cast<AbstractClient*>(unconstrained_stacking_order.at(i));
|
2012-04-08 08:07:35 +00:00
|
|
|
if (!other) {
|
|
|
|
continue;
|
|
|
|
}
|
2011-12-11 18:00:43 +00:00
|
|
|
if (other == c) // don't lower it just because it asked to be raised
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
2015-09-14 12:49:18 +00:00
|
|
|
if (AbstractClient::belongToSameApplication(other, c)) {
|
2011-01-30 14:34:42 +00:00
|
|
|
unconstrained_stacking_order.removeAll(c);
|
2011-12-11 18:00:43 +00:00
|
|
|
unconstrained_stacking_order.insert(unconstrained_stacking_order.indexOf(other) + 1, c); // insert after the found one
|
|
|
|
break;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-09-16 14:36:26 +00:00
|
|
|
void Workspace::raiseClientRequest(KWin::AbstractClient *c, NET::RequestSource src, xcb_timestamp_t timestamp)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (src == NET::FromTool || allowFullClientRaising(c, timestamp))
|
|
|
|
raiseClient(c);
|
|
|
|
else {
|
|
|
|
raiseClientWithinApplication(c);
|
2007-04-29 17:35:43 +00:00
|
|
|
c->demandAttention();
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
void Workspace::lowerClientRequest(KWin::X11Client *c, NET::RequestSource src, xcb_timestamp_t /*timestamp*/)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
// If the client has support for all this focus stealing prevention stuff,
|
|
|
|
// do only lowering within the application, as that's the more logical
|
|
|
|
// variant of lowering when application requests it.
|
|
|
|
// No demanding of attention here of course.
|
2011-01-30 14:34:42 +00:00
|
|
|
if (src == NET::FromTool || !c->hasUserTimeSupport())
|
|
|
|
lowerClient(c);
|
2007-04-29 17:35:43 +00:00
|
|
|
else
|
2011-01-30 14:34:42 +00:00
|
|
|
lowerClientWithinApplication(c);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-09-16 14:36:26 +00:00
|
|
|
void Workspace::lowerClientRequest(KWin::AbstractClient *c)
|
|
|
|
{
|
|
|
|
lowerClientWithinApplication(c);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-03-05 11:10:30 +00:00
|
|
|
void Workspace::restack(AbstractClient* c, AbstractClient* under, bool force)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-08-31 14:28:37 +00:00
|
|
|
Q_ASSERT(unconstrained_stacking_order.contains(under));
|
2015-03-05 11:10:30 +00:00
|
|
|
if (!force && !AbstractClient::belongToSameApplication(under, c)) {
|
2011-12-11 18:00:43 +00:00
|
|
|
// put in the stacking order below _all_ windows belonging to the active application
|
2012-04-24 19:10:16 +00:00
|
|
|
for (int i = 0; i < unconstrained_stacking_order.size(); ++i) {
|
2015-03-05 11:10:30 +00:00
|
|
|
AbstractClient *other = qobject_cast<AbstractClient*>(unconstrained_stacking_order.at(i));
|
|
|
|
if (other && other->layer() == c->layer() && AbstractClient::belongToSameApplication(under, other)) {
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
under = (c == other) ? nullptr : other;
|
2011-01-30 14:34:42 +00:00
|
|
|
break;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2011-12-11 18:00:43 +00:00
|
|
|
if (under) {
|
|
|
|
unconstrained_stacking_order.removeAll(c);
|
|
|
|
unconstrained_stacking_order.insert(unconstrained_stacking_order.indexOf(under), c);
|
|
|
|
}
|
|
|
|
|
2019-08-31 14:28:37 +00:00
|
|
|
Q_ASSERT(unconstrained_stacking_order.contains(c));
|
2012-11-20 16:26:50 +00:00
|
|
|
FocusChain::self()->moveAfterClient(c, under);
|
2011-01-30 14:34:42 +00:00
|
|
|
updateStackingOrder();
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-03-06 14:32:35 +00:00
|
|
|
void Workspace::restackClientUnderActive(AbstractClient* c)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-09-09 20:38:23 +00:00
|
|
|
if (!active_client || active_client == c || active_client->layer() != c->layer()) {
|
2011-01-30 14:34:42 +00:00
|
|
|
raiseClient(c);
|
2010-10-17 19:49:07 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
restack(c, active_client);
|
|
|
|
}
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
void Workspace::restoreSessionStackingOrder(X11Client *c)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (c->sessionStackingOrder() < 0)
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
StackingUpdatesBlocker blocker(this);
|
|
|
|
unconstrained_stacking_order.removeAll(c);
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
for (auto it = unconstrained_stacking_order.begin(); // from bottom
|
2011-01-30 14:34:42 +00:00
|
|
|
it != unconstrained_stacking_order.end();
|
|
|
|
++it) {
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *current = qobject_cast<X11Client *>(*it);
|
2012-04-08 08:07:35 +00:00
|
|
|
if (!current) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (current->sessionStackingOrder() > c->sessionStackingOrder()) {
|
2011-01-30 14:34:42 +00:00
|
|
|
unconstrained_stacking_order.insert(it, c);
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
unconstrained_stacking_order.append(c);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2021-05-09 15:15:37 +00:00
|
|
|
static Layer layerForClient(const X11Client *client)
|
|
|
|
{
|
|
|
|
Layer layer = client->layer();
|
|
|
|
|
|
|
|
// Desktop windows cannot be promoted to upper layers.
|
|
|
|
if (layer == DesktopLayer) {
|
|
|
|
return layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (const Group *group = client->group()) {
|
|
|
|
const auto members = group->members();
|
|
|
|
for (const X11Client *member : members) {
|
|
|
|
if (member == client) {
|
|
|
|
continue;
|
2021-08-28 13:43:03 +00:00
|
|
|
} else if (member->output() != client->output()) {
|
2021-05-09 15:15:37 +00:00
|
|
|
continue;
|
|
|
|
}
|
2021-05-12 16:39:12 +00:00
|
|
|
if (member->layer() == ActiveLayer) {
|
|
|
|
return ActiveLayer;
|
2021-05-09 15:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Layer computeLayer(const Toplevel *toplevel)
|
|
|
|
{
|
|
|
|
if (auto client = qobject_cast<const X11Client *>(toplevel)) {
|
|
|
|
return layerForClient(client);
|
|
|
|
} else {
|
|
|
|
return toplevel->layer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Returns a stacking order based upon \a list that fulfills certain contained.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<Toplevel *> Workspace::constrainedStackingOrder()
|
2021-08-12 14:16:08 +00:00
|
|
|
{
|
2021-05-09 15:15:37 +00:00
|
|
|
// Sort the windows based on their layers while preserving their relative order in the
|
|
|
|
// unconstrained stacking order.
|
|
|
|
std::array<QList<Toplevel *>, NumLayers> windows;
|
|
|
|
for (Toplevel *window : qAsConst(unconstrained_stacking_order)) {
|
|
|
|
const Layer layer = computeLayer(window);
|
|
|
|
windows[layer] << window;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2021-05-09 15:15:37 +00:00
|
|
|
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<Toplevel *> stacking;
|
2021-05-09 15:15:37 +00:00
|
|
|
stacking.reserve(unconstrained_stacking_order.count());
|
|
|
|
for (uint layer = FirstLayer; layer < NumLayers; ++layer) {
|
|
|
|
stacking += windows[layer];
|
2019-08-11 14:23:03 +00:00
|
|
|
}
|
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
|
|
|
|
2021-05-09 15:07:36 +00:00
|
|
|
// Apply the stacking order constraints. First, we enqueue the root constraints, i.e.
|
|
|
|
// the ones that are not affected by other constraints.
|
|
|
|
QQueue<Constraint *> constraints;
|
|
|
|
constraints.reserve(m_constraints.count());
|
|
|
|
for (Constraint *constraint : qAsConst(m_constraints)) {
|
|
|
|
if (constraint->parents.isEmpty()) {
|
|
|
|
constraint->enqueued = true;
|
|
|
|
constraints.enqueue(constraint);
|
|
|
|
} else {
|
|
|
|
constraint->enqueued = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2021-05-09 15:07:36 +00:00
|
|
|
}
|
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
|
|
|
|
2021-05-09 15:07:36 +00:00
|
|
|
// Once we've enqueued all the root constraints, we traverse the constraints tree in
|
|
|
|
// the breadth-first search fashion. A constraint is applied only if its condition is
|
|
|
|
// not met.
|
|
|
|
while (!constraints.isEmpty()) {
|
|
|
|
Constraint *constraint = constraints.dequeue();
|
|
|
|
|
|
|
|
const int belowIndex = stacking.indexOf(constraint->below);
|
|
|
|
const int aboveIndex = stacking.indexOf(constraint->above);
|
|
|
|
if (belowIndex == -1 || aboveIndex == -1) {
|
2007-04-29 17:35:43 +00:00
|
|
|
continue;
|
2021-05-09 15:07:36 +00:00
|
|
|
} else if (aboveIndex < belowIndex) {
|
|
|
|
stacking.removeAt(aboveIndex);
|
|
|
|
stacking.insert(belowIndex, constraint->above);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
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
|
|
|
|
2021-05-09 15:07:36 +00:00
|
|
|
for (Constraint *child : qAsConst(constraint->children)) {
|
|
|
|
if (!child->enqueued) {
|
|
|
|
child->enqueued = true;
|
|
|
|
constraints.enqueue(child);
|
|
|
|
}
|
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
|
|
|
}
|
2021-05-09 15:07:36 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
return stacking;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void Workspace::blockStackingUpdates(bool block)
|
|
|
|
{
|
|
|
|
if (block) {
|
|
|
|
if (block_stacking_updates == 0)
|
2007-04-29 17:35:43 +00:00
|
|
|
blocked_propagating_new_clients = false;
|
|
|
|
++block_stacking_updates;
|
2011-01-30 14:34:42 +00:00
|
|
|
} else // !block
|
|
|
|
if (--block_stacking_updates == 0) {
|
|
|
|
updateStackingOrder(blocked_propagating_new_clients);
|
|
|
|
if (effects)
|
|
|
|
static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowStacking();
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-09-14 07:20:05 +00:00
|
|
|
namespace {
|
|
|
|
template <class T>
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<T*> ensureStackingOrderInList(const QList<Toplevel *> &stackingOrder, const QList<T*> &list)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2015-09-14 07:20:05 +00:00
|
|
|
static_assert(std::is_base_of<Toplevel, T>::value,
|
|
|
|
"U must be derived from T");
|
2007-04-29 17:35:43 +00:00
|
|
|
// TODO Q_ASSERT( block_stacking_updates == 0 );
|
2011-01-30 14:34:42 +00:00
|
|
|
if (list.count() < 2)
|
2007-04-29 17:35:43 +00:00
|
|
|
return list;
|
|
|
|
// TODO is this worth optimizing?
|
2015-09-14 07:20:05 +00:00
|
|
|
QList<T*> result = list;
|
|
|
|
for (auto it = stackingOrder.begin();
|
|
|
|
it != stackingOrder.end();
|
2012-04-08 08:07:35 +00:00
|
|
|
++it) {
|
2015-09-14 07:20:05 +00:00
|
|
|
T *c = qobject_cast<T*>(*it);
|
2012-04-08 08:07:35 +00:00
|
|
|
if (!c) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (result.removeAll(c) != 0)
|
|
|
|
result.append(c);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
return result;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2015-09-14 07:20:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure list is in stacking order
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<X11Client *> Workspace::ensureStackingOrder(const QList<X11Client *> &list) const
|
2015-09-14 07:20:05 +00:00
|
|
|
{
|
|
|
|
return ensureStackingOrderInList(stacking_order, list);
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<AbstractClient*> Workspace::ensureStackingOrder(const QList<AbstractClient*> &list) const
|
|
|
|
{
|
|
|
|
return ensureStackingOrderInList(stacking_order, list);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-08-24 10:35:45 +00:00
|
|
|
// Returns all windows in their stacking order on the root window.
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
QList<Toplevel *> Workspace::xStackingOrder() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2017-09-17 07:26:24 +00:00
|
|
|
if (m_xStackingDirty) {
|
2017-06-21 19:10:12 +00:00
|
|
|
const_cast<Workspace*>(this)->updateXStackingOrder();
|
|
|
|
}
|
|
|
|
return x_stacking;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Workspace::updateXStackingOrder()
|
|
|
|
{
|
2008-07-04 14:06:23 +00:00
|
|
|
// use our own stacking order, not the X one, as they may differ
|
2020-09-23 00:00:18 +00:00
|
|
|
x_stacking = stacking_order;
|
2013-08-02 06:42:33 +00:00
|
|
|
|
2020-09-23 00:00:18 +00:00
|
|
|
if (m_xStackingQueryTree && !m_xStackingQueryTree->isNull()) {
|
|
|
|
std::unique_ptr<Xcb::Tree> tree{std::move(m_xStackingQueryTree)};
|
2017-06-21 19:10:12 +00:00
|
|
|
xcb_window_t *windows = tree->children();
|
|
|
|
const auto count = tree->data()->children_len;
|
2020-10-09 15:49:32 +00:00
|
|
|
int foundUnmanagedCount = m_unmanaged.count();
|
2015-03-20 11:39:33 +00:00
|
|
|
for (unsigned int i = 0;
|
|
|
|
i < count;
|
|
|
|
++i) {
|
2020-10-09 15:49:32 +00:00
|
|
|
for (auto it = m_unmanaged.constBegin(); it != m_unmanaged.constEnd(); ++it) {
|
2015-03-20 11:39:33 +00:00
|
|
|
Unmanaged *u = *it;
|
|
|
|
if (u->window() == windows[i]) {
|
|
|
|
x_stacking.append(u);
|
|
|
|
foundUnmanagedCount--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (foundUnmanagedCount == 0) {
|
2015-01-15 07:32:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-05-23 16:22:59 +00:00
|
|
|
}
|
2019-08-26 07:44:04 +00:00
|
|
|
|
2017-09-17 07:26:24 +00:00
|
|
|
m_xStackingDirty = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-05-23 16:22:59 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
//*******************************
|
|
|
|
// Client
|
|
|
|
//*******************************
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
void X11Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource src, xcb_timestamp_t timestamp, bool send_event)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *other = nullptr;
|
2013-05-03 08:27:04 +00:00
|
|
|
if (detail == XCB_STACK_MODE_OPPOSITE) {
|
2014-03-20 08:19:53 +00:00
|
|
|
other = workspace()->findClient(Predicate::WindowMatch, above);
|
2011-12-11 18:00:43 +00:00
|
|
|
if (!other) {
|
|
|
|
workspace()->raiseOrLowerClient(this);
|
|
|
|
return;
|
|
|
|
}
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
auto it = workspace()->stackingOrder().constBegin(),
|
2011-12-11 18:00:43 +00:00
|
|
|
end = workspace()->stackingOrder().constEnd();
|
|
|
|
while (it != end) {
|
|
|
|
if (*it == this) {
|
2013-05-03 08:27:04 +00:00
|
|
|
detail = XCB_STACK_MODE_ABOVE;
|
2011-12-11 18:00:43 +00:00
|
|
|
break;
|
|
|
|
} else if (*it == other) {
|
2013-05-03 08:27:04 +00:00
|
|
|
detail = XCB_STACK_MODE_BELOW;
|
2011-12-11 18:00:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
++it;
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2013-05-03 08:27:04 +00:00
|
|
|
else if (detail == XCB_STACK_MODE_TOP_IF) {
|
2014-03-20 08:19:53 +00:00
|
|
|
other = workspace()->findClient(Predicate::WindowMatch, above);
|
2019-09-27 10:01:10 +00:00
|
|
|
if (other && other->frameGeometry().intersects(frameGeometry()))
|
2011-12-11 18:00:43 +00:00
|
|
|
workspace()->raiseClientRequest(this, src, timestamp);
|
|
|
|
return;
|
|
|
|
}
|
2013-05-03 08:27:04 +00:00
|
|
|
else if (detail == XCB_STACK_MODE_BOTTOM_IF) {
|
2014-03-20 08:19:53 +00:00
|
|
|
other = workspace()->findClient(Predicate::WindowMatch, above);
|
2019-09-27 10:01:10 +00:00
|
|
|
if (other && other->frameGeometry().intersects(frameGeometry()))
|
2011-12-11 18:00:43 +00:00
|
|
|
workspace()->lowerClientRequest(this, src, timestamp);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!other)
|
2014-03-20 08:19:53 +00:00
|
|
|
other = workspace()->findClient(Predicate::WindowMatch, above);
|
2011-12-11 18:00:43 +00:00
|
|
|
|
2013-05-03 08:27:04 +00:00
|
|
|
if (other && detail == XCB_STACK_MODE_ABOVE) {
|
Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example
QList<QWeakPointer<TabBoxClient>> TabBoxClientList
in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?
Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.
So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.
Test Plan: Compiles.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24950
2019-10-16 09:11:04 +00:00
|
|
|
auto it = workspace()->stackingOrder().constEnd(),
|
2011-12-11 18:00:43 +00:00
|
|
|
begin = workspace()->stackingOrder().constBegin();
|
|
|
|
while (--it != begin) {
|
|
|
|
|
|
|
|
if (*it == other) { // the other one is top on stack
|
|
|
|
it = begin; // invalidate
|
|
|
|
src = NET::FromTool; // force
|
|
|
|
break;
|
|
|
|
}
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *c = qobject_cast<X11Client *>(*it);
|
2011-12-11 18:00:43 +00:00
|
|
|
|
2021-11-23 12:13:56 +00:00
|
|
|
if (!c || !( (*it)->isNormalWindow() && c->isShown() &&
|
2021-08-28 13:43:03 +00:00
|
|
|
(*it)->isOnCurrentDesktop() && (*it)->isOnCurrentActivity() && (*it)->isOnOutput(output()) ))
|
2011-12-11 18:00:43 +00:00
|
|
|
continue; // irrelevant clients
|
|
|
|
|
|
|
|
if (*(it - 1) == other)
|
|
|
|
break; // "it" is the one above the target one, stack below "it"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (it != begin && (*(it - 1) == other))
|
2019-09-24 08:48:08 +00:00
|
|
|
other = qobject_cast<X11Client *>(*it);
|
2011-12-11 18:00:43 +00:00
|
|
|
else
|
Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.
This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson, romangg
Reviewed By: #kwin, davidedmundson, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 14:46:54 +00:00
|
|
|
other = nullptr;
|
2011-12-11 18:00:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (other)
|
|
|
|
workspace()->restack(this, other);
|
2013-05-03 08:27:04 +00:00
|
|
|
else if (detail == XCB_STACK_MODE_BELOW)
|
2011-12-11 18:00:43 +00:00
|
|
|
workspace()->lowerClientRequest(this, src, timestamp);
|
2013-05-03 08:27:04 +00:00
|
|
|
else if (detail == XCB_STACK_MODE_ABOVE)
|
2011-12-11 18:00:43 +00:00
|
|
|
workspace()->raiseClientRequest(this, src, timestamp);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (send_event)
|
|
|
|
sendSyntheticConfigureNotify();
|
|
|
|
}
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
bool X11Client::belongsToDesktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2021-11-03 11:55:31 +00:00
|
|
|
const auto members = group()->members();
|
|
|
|
for (const X11Client *c : members) {
|
2015-09-17 09:06:59 +00:00
|
|
|
if (c->isDesktop())
|
|
|
|
return true;
|
2015-05-13 21:10:19 +00:00
|
|
|
}
|
2015-09-17 09:06:59 +00:00
|
|
|
return false;
|
2013-11-17 16:37:46 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|