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>
|
|
|
|
SPDX-FileCopyrightText: 2009 Lucas Murray <lmurray@undefinedfire.com>
|
|
|
|
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@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_WORKSPACE_H
|
|
|
|
#define KWIN_WORKSPACE_H
|
|
|
|
|
2013-04-25 13:47:40 +00:00
|
|
|
// kwin
|
2014-12-02 09:39:38 +00:00
|
|
|
#include "options.h"
|
2019-07-29 19:24:43 +00:00
|
|
|
#include "sm.h"
|
2013-04-25 13:47:40 +00:00
|
|
|
#include "utils.h"
|
|
|
|
// Qt
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QTimer>
|
|
|
|
#include <QVector>
|
2013-08-05 07:42:10 +00:00
|
|
|
// std
|
|
|
|
#include <functional>
|
2017-06-21 19:10:12 +00:00
|
|
|
#include <memory>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
class KConfig;
|
2013-08-06 08:27:49 +00:00
|
|
|
class KConfigGroup;
|
2007-04-29 17:35:43 +00:00
|
|
|
class KStartupInfo;
|
|
|
|
class KStartupInfoData;
|
2019-07-29 19:24:43 +00:00
|
|
|
class KStartupInfoId;
|
|
|
|
class QStringList;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2013-04-30 11:06:46 +00:00
|
|
|
namespace Xcb
|
|
|
|
{
|
2017-06-21 19:10:12 +00:00
|
|
|
class Tree;
|
2013-04-30 11:06:46 +00:00
|
|
|
class Window;
|
|
|
|
}
|
|
|
|
|
2015-03-05 11:10:30 +00:00
|
|
|
class AbstractClient;
|
2021-02-19 13:59:01 +00:00
|
|
|
class AbstractOutput;
|
2020-07-20 08:07:08 +00:00
|
|
|
class ColorMapper;
|
2019-07-29 19:24:43 +00:00
|
|
|
class Compositor;
|
2019-10-31 13:20:42 +00:00
|
|
|
class Deleted;
|
|
|
|
class Group;
|
2019-08-26 07:44:04 +00:00
|
|
|
class InternalClient;
|
2013-04-08 12:30:55 +00:00
|
|
|
class KillWindow;
|
2013-04-25 15:21:54 +00:00
|
|
|
class ShortcutDialog;
|
2019-10-31 13:20:42 +00:00
|
|
|
class Toplevel;
|
|
|
|
class Unmanaged;
|
2012-08-19 10:00:53 +00:00
|
|
|
class UserActionsMenu;
|
2021-08-13 08:41:57 +00:00
|
|
|
class VirtualDesktop;
|
2019-09-24 08:48:08 +00:00
|
|
|
class X11Client;
|
2014-09-02 16:46:07 +00:00
|
|
|
class X11EventFilter;
|
2014-03-20 08:19:53 +00:00
|
|
|
enum class Predicate;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-02-20 08:33:36 +00:00
|
|
|
class KWIN_EXPORT Workspace : public QObject
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2020-04-02 11:44:27 +00:00
|
|
|
explicit Workspace();
|
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
|
|
|
~Workspace() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
static Workspace* self() {
|
|
|
|
return _self;
|
|
|
|
}
|
|
|
|
|
2013-07-26 05:52:56 +00:00
|
|
|
bool workspaceEvent(xcb_generic_event_t*);
|
2011-01-30 14:34:42 +00:00
|
|
|
bool workspaceEvent(QEvent*);
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
bool hasClient(const X11Client *);
|
2015-03-05 11:41:15 +00:00
|
|
|
bool hasClient(const AbstractClient*);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2014-03-20 08:19:53 +00:00
|
|
|
/**
|
|
|
|
* @brief Finds the first Client matching the condition expressed by passed in @p func.
|
|
|
|
*
|
|
|
|
* Internally findClient uses the std::find_if algorithm and that determines how the function
|
|
|
|
* needs to be implemented. An example usage for finding a Client with a matching windowId
|
|
|
|
* @code
|
|
|
|
* xcb_window_t w; // our test window
|
2019-09-24 08:48:08 +00:00
|
|
|
* X11Client *client = findClient([w](const X11Client *c) -> bool {
|
2014-03-20 08:19:53 +00:00
|
|
|
* return c->window() == w;
|
|
|
|
* });
|
|
|
|
* @endcode
|
|
|
|
*
|
|
|
|
* For the standard cases of matching the window id with one of the Client's windows use
|
|
|
|
* the simplified overload method findClient(Predicate, xcb_window_t). Above example
|
|
|
|
* can be simplified to:
|
|
|
|
* @code
|
|
|
|
* xcb_window_t w; // our test window
|
2019-09-24 08:48:08 +00:00
|
|
|
* X11Client *client = findClient(Predicate::WindowMatch, w);
|
2014-03-20 08:19:53 +00:00
|
|
|
* @endcode
|
|
|
|
*
|
2019-09-24 08:48:08 +00:00
|
|
|
* @param func Unary function that accepts a X11Client *as argument and
|
2014-03-20 08:19:53 +00:00
|
|
|
* returns a value convertible to bool. The value returned indicates whether the
|
2019-09-24 08:48:08 +00:00
|
|
|
* X11Client *is considered a match in the context of this function.
|
2014-03-20 08:19:53 +00:00
|
|
|
* The function shall not modify its argument.
|
|
|
|
* This can either be a function pointer or a function object.
|
2019-09-24 08:48:08 +00:00
|
|
|
* @return KWin::X11Client *The found Client or @c null
|
2014-03-20 08:19:53 +00:00
|
|
|
* @see findClient(Predicate, xcb_window_t)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *findClient(std::function<bool (const X11Client *)> func) const;
|
2015-12-04 08:53:18 +00:00
|
|
|
AbstractClient *findAbstractClient(std::function<bool (const AbstractClient*)> func) const;
|
2020-07-21 13:33:03 +00:00
|
|
|
AbstractClient *findAbstractClient(const QUuid &internalId) const;
|
2014-03-20 08:19:53 +00:00
|
|
|
/**
|
|
|
|
* @brief Finds the Client matching the given match @p predicate for the given window.
|
|
|
|
*
|
|
|
|
* @param predicate Which window should be compared
|
|
|
|
* @param w The window id to test against
|
2019-09-24 08:48:08 +00:00
|
|
|
* @return KWin::X11Client *The found Client or @c null
|
|
|
|
* @see findClient(std::function<bool (const X11Client *)>)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *findClient(Predicate predicate, xcb_window_t w) const;
|
|
|
|
void forEachClient(std::function<void (X11Client *)> func);
|
2015-12-17 14:49:32 +00:00
|
|
|
void forEachAbstractClient(std::function<void (AbstractClient*)> func);
|
2014-03-20 06:52:18 +00:00
|
|
|
Unmanaged *findUnmanaged(std::function<bool (const Unmanaged*)> func) const;
|
|
|
|
/**
|
|
|
|
* @brief Finds the Unmanaged with the given window id.
|
|
|
|
*
|
|
|
|
* @param w The window id to search for
|
|
|
|
* @return KWin::Unmanaged* Found Unmanaged or @c null if there is no Unmanaged with given Id.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-03-20 06:52:18 +00:00
|
|
|
Unmanaged *findUnmanaged(xcb_window_t w) const;
|
2013-08-05 07:42:10 +00:00
|
|
|
void forEachUnmanaged(std::function<void (Unmanaged*)> func);
|
2015-02-09 15:07:30 +00:00
|
|
|
Toplevel *findToplevel(std::function<bool (const Toplevel*)> func) const;
|
2019-11-29 19:12:11 +00:00
|
|
|
void forEachToplevel(std::function<void (Toplevel *)> func);
|
2020-07-23 11:13:22 +00:00
|
|
|
|
|
|
|
Toplevel *findToplevel(const QUuid &internalId) const;
|
|
|
|
|
2016-03-04 08:42:33 +00:00
|
|
|
/**
|
|
|
|
* @brief Finds a Toplevel for the internal window @p w.
|
|
|
|
*
|
|
|
|
* Internal window means a window created by KWin itself. On X11 this is an Unmanaged
|
2019-08-30 21:36:58 +00:00
|
|
|
* and mapped by the window id, on Wayland a XdgShellClient mapped on the internal window id.
|
2016-03-04 08:42:33 +00:00
|
|
|
*
|
|
|
|
* @returns Toplevel
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-03-04 08:42:33 +00:00
|
|
|
Toplevel *findInternal(QWindow *w) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const;
|
2015-03-06 07:58:59 +00:00
|
|
|
QRect clientArea(clientAreaOption, const AbstractClient* c) const;
|
2021-08-17 11:55:34 +00:00
|
|
|
QRect clientArea(clientAreaOption, const AbstractClient *client, const AbstractOutput *output) const;
|
|
|
|
QRect clientArea(clientAreaOption, const AbstractClient *client, int screen) const;
|
|
|
|
QRect clientArea(clientAreaOption, const AbstractClient *client, const QPoint &pos) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect clientArea(clientAreaOption, int screen, int desktop) const;
|
2021-02-19 13:59:01 +00:00
|
|
|
QRect clientArea(clientAreaOption, const AbstractOutput *output, int desktop) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
QRegion restrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const;
|
|
|
|
|
|
|
|
bool initializing() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the active client, i.e. the client that has the focus (or None
|
|
|
|
* if no client has the focus)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-06 12:37:56 +00:00
|
|
|
AbstractClient* activeClient() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
|
|
|
* Client that was activated, but it's not yet really activeClient(), because
|
|
|
|
* we didn't process yet the matching FocusIn event. Used mostly in focus
|
|
|
|
* stealing prevention code.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-12 10:56:55 +00:00
|
|
|
AbstractClient* mostRecentlyActivatedClient() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2016-02-18 09:28:00 +00:00
|
|
|
AbstractClient* clientUnderMouse(int screen) const;
|
2012-02-13 22:50:49 +00:00
|
|
|
|
2015-03-06 13:45:58 +00:00
|
|
|
void activateClient(AbstractClient*, bool force = false);
|
2020-07-22 11:00:11 +00:00
|
|
|
bool requestFocus(AbstractClient* c, bool force = false);
|
2014-03-20 12:39:00 +00:00
|
|
|
enum ActivityFlag {
|
|
|
|
ActivityFocus = 1 << 0, // focus the window
|
|
|
|
ActivityFocusForce = 1 << 1 | ActivityFocus, // focus even if Dock etc.
|
|
|
|
ActivityRaise = 1 << 2 // raise the window
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(ActivityFlags, ActivityFlag)
|
2020-07-22 11:00:11 +00:00
|
|
|
bool takeActivity(AbstractClient* c, ActivityFlags flags);
|
2015-03-12 10:35:31 +00:00
|
|
|
bool allowClientActivation(const AbstractClient* c, xcb_timestamp_t time = -1U, bool focus_in = false,
|
2011-01-30 14:34:42 +00:00
|
|
|
bool ignore_desktop = false);
|
2020-07-22 11:00:11 +00:00
|
|
|
bool restoreFocus();
|
2015-07-09 11:16:19 +00:00
|
|
|
void gotFocusIn(const AbstractClient*);
|
|
|
|
void setShouldGetFocus(AbstractClient*);
|
2015-04-30 11:47:44 +00:00
|
|
|
bool activateNextClient(AbstractClient* c);
|
2011-01-30 14:34:42 +00:00
|
|
|
bool focusChangeEnabled() {
|
|
|
|
return block_focus == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-04-18 12:28:11 +00:00
|
|
|
* Indicates that the client c is being moved or resized by the user.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-04-18 12:28:11 +00:00
|
|
|
void setMoveResizeClient(AbstractClient* c);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2020-08-17 13:14:20 +00:00
|
|
|
QRect adjustClientArea(AbstractClient *client, const QRect &area) const;
|
2015-09-18 11:46:42 +00:00
|
|
|
QPoint adjustClientPosition(AbstractClient* c, QPoint pos, bool unrestricted, double snapAdjust = 1.0);
|
2015-09-18 12:05:19 +00:00
|
|
|
QRect adjustClientSize(AbstractClient* c, QRect moveResizeGeom, int mode);
|
2015-03-05 12:35:54 +00:00
|
|
|
void raiseClient(AbstractClient* c, bool nogroup = false);
|
|
|
|
void lowerClient(AbstractClient* c, bool nogroup = false);
|
2015-09-16 14:36:26 +00:00
|
|
|
void raiseClientRequest(AbstractClient* c, NET::RequestSource src = NET::FromApplication, xcb_timestamp_t timestamp = 0);
|
2019-09-24 08:48:08 +00:00
|
|
|
void lowerClientRequest(X11Client *c, NET::RequestSource src, xcb_timestamp_t timestamp);
|
2015-09-16 14:36:26 +00:00
|
|
|
void lowerClientRequest(AbstractClient* c);
|
2015-03-06 14:32:35 +00:00
|
|
|
void restackClientUnderActive(AbstractClient*);
|
2015-03-05 11:10:30 +00:00
|
|
|
void restack(AbstractClient *c, AbstractClient *under, bool force = false);
|
2015-03-05 12:35:54 +00:00
|
|
|
void raiseOrLowerClient(AbstractClient*);
|
2011-01-30 14:34:42 +00:00
|
|
|
void resetUpdateToolWindowsTimer();
|
2019-09-24 08:48:08 +00:00
|
|
|
void restoreSessionStackingOrder(X11Client *c);
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateStackingOrder(bool propagate_new_clients = false);
|
|
|
|
void forceRestacking();
|
|
|
|
|
2021-05-09 15:07:36 +00:00
|
|
|
void constrain(AbstractClient *below, AbstractClient *above);
|
|
|
|
void unconstrain(AbstractClient *below, AbstractClient *above);
|
|
|
|
|
2015-04-30 11:47:44 +00:00
|
|
|
void clientHidden(AbstractClient*);
|
2015-03-13 10:13:29 +00:00
|
|
|
void clientAttentionChanged(AbstractClient* c, bool set);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2011-02-27 08:25:45 +00:00
|
|
|
/**
|
|
|
|
* @return List of clients currently managed by Workspace
|
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
|
|
|
const QList<X11Client *> &clientList() const {
|
2021-05-24 16:01:49 +00:00
|
|
|
return m_x11Clients;
|
2011-02-27 08:25:45 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return List of unmanaged "clients" currently registered in Workspace
|
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
|
|
|
const QList<Unmanaged *> &unmanagedList() const {
|
2020-10-09 15:49:32 +00:00
|
|
|
return m_unmanaged;
|
2011-02-27 08:25:45 +00:00
|
|
|
}
|
2011-08-21 19:50:23 +00:00
|
|
|
/**
|
|
|
|
* @return List of deleted "clients" currently managed by Workspace
|
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
|
|
|
const QList<Deleted *> &deletedList() const {
|
2011-08-21 19:50:23 +00:00
|
|
|
return deleted;
|
|
|
|
}
|
2015-09-18 11:44:54 +00:00
|
|
|
/**
|
|
|
|
* @returns List of all clients (either X11 or Wayland) currently managed by Workspace
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-18 11:44:54 +00:00
|
|
|
const QList<AbstractClient*> allClientList() const {
|
|
|
|
return m_allClients;
|
|
|
|
}
|
2011-02-27 08:25:45 +00:00
|
|
|
|
2019-08-26 07:44:04 +00:00
|
|
|
/**
|
|
|
|
* @returns List of all internal clients currently managed by Workspace
|
|
|
|
*/
|
|
|
|
const QList<InternalClient *> &internalClients() const {
|
|
|
|
return m_internalClients;
|
|
|
|
}
|
|
|
|
|
2013-02-08 19:59:35 +00:00
|
|
|
void stackScreenEdgesUnderOverrideRedirect();
|
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
SessionManager *sessionManager() const;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2015-03-06 08:31:14 +00:00
|
|
|
QPoint cascadeOffset(const AbstractClient *c) const;
|
2012-08-25 16:20:34 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2011-08-21 19:50:23 +00:00
|
|
|
Compositor *m_compositor;
|
2020-06-12 13:50:24 +00:00
|
|
|
QTimer *m_quickTileCombineTimer;
|
|
|
|
QuickTileMode m_lastTilingMode;
|
2011-04-28 09:16:27 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
//-------------------------------------------------
|
|
|
|
// Unsorted
|
|
|
|
|
|
|
|
public:
|
2013-02-12 23:40:11 +00:00
|
|
|
bool isOnCurrentHead();
|
2011-09-30 11:22:39 +00:00
|
|
|
// True when performing Workspace::updateClientArea().
|
|
|
|
// The calls below are valid only in that case.
|
|
|
|
bool inUpdateClientArea() const;
|
|
|
|
QRegion previousRestrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const;
|
|
|
|
QVector< QRect > previousScreenSizes() const;
|
2011-09-30 12:50:18 +00:00
|
|
|
int oldDisplayWidth() const;
|
|
|
|
int oldDisplayHeight() const;
|
2011-09-30 11:22:39 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
|
|
|
* Returns the list of clients sorted in stacking order, with topmost client
|
|
|
|
* at the last position
|
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
|
|
|
const QList<Toplevel *> &stackingOrder() const;
|
|
|
|
QList<Toplevel *> xStackingOrder() const;
|
|
|
|
QList<X11Client *> ensureStackingOrder(const QList<X11Client *> &clients) const;
|
2015-09-14 07:20:05 +00:00
|
|
|
QList<AbstractClient*> ensureStackingOrder(const QList<AbstractClient*> &clients) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2021-08-13 08:41:57 +00:00
|
|
|
AbstractClient *topClientOnDesktop(VirtualDesktop *desktop, int screen, bool unconstrained = false,
|
|
|
|
bool only_normal = true) const;
|
2021-08-13 08:49:11 +00:00
|
|
|
AbstractClient *findDesktop(bool topmost, VirtualDesktop *desktop) const;
|
2015-03-06 16:31:47 +00:00
|
|
|
void sendClientToDesktop(AbstractClient* c, int desktop, bool dont_activate);
|
2015-03-06 14:17:13 +00:00
|
|
|
void windowToPreviousDesktop(AbstractClient* c);
|
|
|
|
void windowToNextDesktop(AbstractClient* c);
|
2015-03-06 07:36:29 +00:00
|
|
|
void sendClientToScreen(AbstractClient* c, int screen);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2018-08-24 21:10:48 +00:00
|
|
|
void addManualOverlay(xcb_window_t id) {
|
|
|
|
manual_overlays << id;
|
|
|
|
}
|
|
|
|
void removeManualOverlay(xcb_window_t id) {
|
|
|
|
manual_overlays.removeOne(id);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
|
|
|
* Shows the menu operations menu for the client and makes it active if
|
|
|
|
* it's not already.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-06 14:33:13 +00:00
|
|
|
void showWindowMenu(const QRect& pos, AbstractClient* cl);
|
2012-08-19 10:00:53 +00:00
|
|
|
const UserActionsMenu *userActionsMenu() const {
|
|
|
|
return m_userActionsMenu;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
void showApplicationMenu(const QRect &pos, AbstractClient *c, int actionId);
|
|
|
|
|
2015-09-14 08:55:27 +00:00
|
|
|
void updateMinimizedOfTransients(AbstractClient*);
|
2015-09-14 09:37:19 +00:00
|
|
|
void updateOnAllDesktopsOfTransients(AbstractClient*);
|
2013-04-30 13:41:59 +00:00
|
|
|
void checkTransients(xcb_window_t w);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2020-04-02 11:44:27 +00:00
|
|
|
void storeSession(const QString &sessionName, SMSavePhase phase);
|
2019-09-24 08:48:08 +00:00
|
|
|
void storeClient(KConfigGroup &cg, int num, X11Client *c);
|
2011-01-30 14:34:42 +00:00
|
|
|
void storeSubSession(const QString &name, QSet<QByteArray> sessionIds);
|
2013-04-04 14:14:12 +00:00
|
|
|
void loadSubSessionInfo(const QString &name);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
SessionInfo* takeSessionInfo(X11Client *);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// D-Bus interface
|
2012-03-04 14:13:22 +00:00
|
|
|
QString supportInformation() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void setCurrentScreen(int new_screen);
|
|
|
|
|
|
|
|
void setShowingDesktop(bool showing);
|
|
|
|
bool showingDesktop() const;
|
|
|
|
|
2021-05-24 16:01:49 +00:00
|
|
|
void removeX11Client(X11Client *); // Only called from X11Client::destroyClient() or X11Client::releaseWindow()
|
2015-03-12 11:08:54 +00:00
|
|
|
void setActiveClient(AbstractClient*);
|
2013-04-30 13:41:59 +00:00
|
|
|
Group* findGroup(xcb_window_t leader) const;
|
2013-04-26 07:47:45 +00:00
|
|
|
void addGroup(Group* group);
|
|
|
|
void removeGroup(Group* group);
|
2019-09-24 08:48:08 +00:00
|
|
|
Group* findClientLeaderGroup(const X11Client *c) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
void removeUnmanaged(Unmanaged*); // Only called from Unmanaged::release()
|
|
|
|
void removeDeleted(Deleted*);
|
|
|
|
void addDeleted(Deleted*, Toplevel*);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-04-30 13:41:59 +00:00
|
|
|
bool checkStartupNotification(xcb_window_t w, KStartupInfoId& id, KStartupInfoData& data);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void focusToNull(); // SELI TODO: Public?
|
|
|
|
|
2017-07-21 18:22:56 +00:00
|
|
|
void clientShortcutUpdated(AbstractClient* c);
|
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
|
|
|
bool shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore = nullptr) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool globalShortcutsDisabled() const;
|
|
|
|
void disableGlobalShortcutsForClient(bool disable);
|
|
|
|
|
|
|
|
void setWasUserInteraction();
|
|
|
|
bool wasUserInteraction() const;
|
|
|
|
|
2019-09-28 15:36:15 +00:00
|
|
|
int packPositionLeft(const AbstractClient *client, int oldX, bool leftEdge) const;
|
|
|
|
int packPositionRight(const AbstractClient *client, int oldX, bool rightEdge) const;
|
|
|
|
int packPositionUp(const AbstractClient *client, int oldY, bool topEdge) const;
|
|
|
|
int packPositionDown(const AbstractClient *client, int oldY, bool bottomEdge) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void cancelDelayFocus();
|
2016-02-18 10:18:50 +00:00
|
|
|
void requestDelayFocus(AbstractClient*);
|
2015-01-28 23:14:47 +00:00
|
|
|
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* updates the mouse position to track whether a focus follow mouse focus change was caused by
|
|
|
|
* an actual mouse move
|
|
|
|
* is esp. called on enter/motion events of inactive windows
|
|
|
|
* since an active window doesn't receive mouse events, it must also be invoked if a (potentially)
|
|
|
|
* active window might be moved/resize away from the cursor (causing a leave event)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateFocusMousePosition(const QPoint& pos);
|
|
|
|
QPoint focusMousePosition() const;
|
|
|
|
|
2019-04-18 12:28:11 +00:00
|
|
|
/**
|
|
|
|
* Returns a client that is currently being moved or resized by the user.
|
|
|
|
*
|
|
|
|
* If none of clients is being moved or resized, @c null will be returned.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-04-18 12:28:11 +00:00
|
|
|
AbstractClient* moveResizeClient() {
|
2011-06-23 10:09:17 +00:00
|
|
|
return movingClient;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2017-06-21 19:10:12 +00:00
|
|
|
void markXStackingOrderAsDirty();
|
|
|
|
|
2017-07-18 19:12:37 +00:00
|
|
|
void quickTileWindow(QuickTileMode mode);
|
|
|
|
|
2017-07-20 04:58:35 +00:00
|
|
|
enum Direction {
|
|
|
|
DirectionNorth,
|
|
|
|
DirectionEast,
|
|
|
|
DirectionSouth,
|
|
|
|
DirectionWest
|
|
|
|
};
|
|
|
|
void switchWindow(Direction direction);
|
|
|
|
|
2017-07-22 10:49:57 +00:00
|
|
|
ShortcutDialog *shortcutDialog() const {
|
|
|
|
return client_keys_dialog;
|
|
|
|
}
|
|
|
|
|
2019-08-26 07:44:04 +00:00
|
|
|
/**
|
|
|
|
* Adds the internal client to Workspace.
|
|
|
|
*
|
|
|
|
* This method will be called by InternalClient when it's mapped.
|
|
|
|
*
|
|
|
|
* @see internalClientAdded
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
void addInternalClient(InternalClient *client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the internal client from Workspace.
|
|
|
|
*
|
|
|
|
* This method is meant to be called only by InternalClient.
|
|
|
|
*
|
|
|
|
* @see internalClientRemoved
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
void removeInternalClient(InternalClient *client);
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
public Q_SLOTS:
|
2015-03-06 09:05:40 +00:00
|
|
|
void performWindowOperation(KWin::AbstractClient* c, Options::WindowOperation op);
|
2011-01-30 14:34:42 +00:00
|
|
|
// Keybindings
|
|
|
|
//void slotSwitchToWindow( int );
|
2021-08-17 07:19:46 +00:00
|
|
|
void slotWindowToDesktop(VirtualDesktop *desktop);
|
2011-02-16 18:23:54 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
//void slotWindowToListPosition( int );
|
2011-02-16 18:23:54 +00:00
|
|
|
void slotSwitchToScreen();
|
|
|
|
void slotWindowToScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotSwitchToNextScreen();
|
|
|
|
void slotWindowToNextScreen();
|
2013-05-19 12:23:49 +00:00
|
|
|
void slotSwitchToPrevScreen();
|
|
|
|
void slotWindowToPrevScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotToggleShowDesktop();
|
|
|
|
|
|
|
|
void slotWindowMaximize();
|
|
|
|
void slotWindowMaximizeVertical();
|
|
|
|
void slotWindowMaximizeHorizontal();
|
|
|
|
void slotWindowMinimize();
|
|
|
|
void slotWindowShade();
|
|
|
|
void slotWindowRaise();
|
|
|
|
void slotWindowLower();
|
|
|
|
void slotWindowRaiseOrLower();
|
|
|
|
void slotActivateAttentionWindow();
|
|
|
|
void slotWindowPackLeft();
|
|
|
|
void slotWindowPackRight();
|
|
|
|
void slotWindowPackUp();
|
|
|
|
void slotWindowPackDown();
|
|
|
|
void slotWindowGrowHorizontal();
|
|
|
|
void slotWindowGrowVertical();
|
|
|
|
void slotWindowShrinkHorizontal();
|
|
|
|
void slotWindowShrinkVertical();
|
|
|
|
|
2011-08-19 19:53:30 +00:00
|
|
|
void slotIncreaseWindowOpacity();
|
|
|
|
void slotLowerWindowOpacity();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotWindowOperations();
|
|
|
|
void slotWindowClose();
|
|
|
|
void slotWindowMove();
|
|
|
|
void slotWindowResize();
|
|
|
|
void slotWindowAbove();
|
|
|
|
void slotWindowBelow();
|
|
|
|
void slotWindowOnAllDesktops();
|
|
|
|
void slotWindowFullScreen();
|
|
|
|
void slotWindowNoBorder();
|
|
|
|
|
|
|
|
void slotWindowToNextDesktop();
|
|
|
|
void slotWindowToPreviousDesktop();
|
|
|
|
void slotWindowToDesktopRight();
|
|
|
|
void slotWindowToDesktopLeft();
|
|
|
|
void slotWindowToDesktopUp();
|
|
|
|
void slotWindowToDesktopDown();
|
|
|
|
|
|
|
|
void reconfigure();
|
|
|
|
void slotReconfigure();
|
|
|
|
|
|
|
|
void slotKillWindow();
|
|
|
|
|
|
|
|
void slotSetupWindowShortcut();
|
|
|
|
void setupWindowShortcutDone(bool);
|
|
|
|
|
|
|
|
void updateClientArea();
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
private Q_SLOTS:
|
2011-01-30 14:34:42 +00:00
|
|
|
void desktopResized();
|
2014-06-15 12:07:44 +00:00
|
|
|
void selectWmInputEventMask();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotUpdateToolWindows();
|
|
|
|
void delayFocus();
|
|
|
|
void slotReloadConfig();
|
|
|
|
void updateCurrentActivity(const QString &new_activity);
|
2012-11-16 07:23:47 +00:00
|
|
|
// virtual desktop handling
|
|
|
|
void slotDesktopCountChanged(uint previousCount, uint newCount);
|
|
|
|
void slotCurrentDesktopChanged(uint oldDesktop, uint newDesktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
2012-04-13 09:27:50 +00:00
|
|
|
/**
|
|
|
|
* Emitted after the Workspace has setup the complete initialization process.
|
|
|
|
* This can be used to connect to for performing post-workspace initialization.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-04-13 09:27:50 +00:00
|
|
|
void workspaceInitialized();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2010-09-21 14:31:40 +00:00
|
|
|
//Signals required for the scripting interface
|
2015-03-13 10:48:08 +00:00
|
|
|
void desktopPresenceChanged(KWin::AbstractClient*, int);
|
2015-03-06 11:38:07 +00:00
|
|
|
void currentDesktopChanged(int, KWin::AbstractClient*);
|
2020-05-11 17:34:36 +00:00
|
|
|
void clientAdded(KWin::AbstractClient *);
|
2015-04-30 08:51:58 +00:00
|
|
|
void clientRemoved(KWin::AbstractClient*);
|
2015-03-06 12:58:24 +00:00
|
|
|
void clientActivated(KWin::AbstractClient*);
|
2015-03-13 10:13:29 +00:00
|
|
|
void clientDemandsAttentionChanged(KWin::AbstractClient*, bool);
|
2017-10-04 19:02:16 +00:00
|
|
|
void clientMinimizedChanged(KWin::AbstractClient*);
|
2011-01-30 14:34:42 +00:00
|
|
|
void groupAdded(KWin::Group*);
|
2011-02-25 21:06:02 +00:00
|
|
|
void unmanagedAdded(KWin::Unmanaged*);
|
2013-07-01 06:37:59 +00:00
|
|
|
void unmanagedRemoved(KWin::Unmanaged*);
|
2011-02-27 09:47:42 +00:00
|
|
|
void deletedRemoved(KWin::Deleted*);
|
2011-07-13 09:36:49 +00:00
|
|
|
void configChanged();
|
2015-03-28 23:08:32 +00:00
|
|
|
void showingDesktopChanged(bool showing);
|
2013-01-01 00:47:16 +00:00
|
|
|
/**
|
2020-11-05 14:52:46 +00:00
|
|
|
* This signal is emitted when the stacking order changed, i.e. a window is risen
|
2013-01-01 00:47:16 +00:00
|
|
|
* or lowered
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-01-01 00:47:16 +00:00
|
|
|
void stackingOrderChanged();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2019-08-26 07:44:04 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted whenever an internal client is created.
|
|
|
|
*/
|
|
|
|
void internalClientAdded(KWin::InternalClient *client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This signal is emitted whenever an internal client gets removed.
|
|
|
|
*/
|
|
|
|
void internalClientRemoved(KWin::InternalClient *client);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
|
|
|
void init();
|
2020-07-20 08:07:08 +00:00
|
|
|
void initializeX11();
|
|
|
|
void cleanupX11();
|
2011-01-30 14:34:42 +00:00
|
|
|
void initShortcuts();
|
2013-09-09 07:41:37 +00:00
|
|
|
template <typename Slot>
|
|
|
|
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut,
|
|
|
|
Slot slot, const QVariant &data = QVariant());
|
2017-09-24 08:10:52 +00:00
|
|
|
template <typename T, typename Slot>
|
|
|
|
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, T *receiver, Slot slot, const QVariant &data = QVariant());
|
2015-03-06 08:03:08 +00:00
|
|
|
void setupWindowShortcut(AbstractClient* c);
|
2021-08-17 06:44:30 +00:00
|
|
|
bool switchWindow(AbstractClient *c, Direction direction, QPoint curPos, VirtualDesktop *desktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void propagateClients(bool propagate_new_clients); // Called only from updateStackingOrder
|
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 *> constrainedStackingOrder();
|
2015-09-14 12:49:18 +00:00
|
|
|
void raiseClientWithinApplication(AbstractClient* c);
|
2015-09-14 12:47:45 +00:00
|
|
|
void lowerClientWithinApplication(AbstractClient* c);
|
2015-03-12 10:46:08 +00:00
|
|
|
bool allowFullClientRaising(const AbstractClient* c, xcb_timestamp_t timestamp);
|
2011-01-30 14:34:42 +00:00
|
|
|
void blockStackingUpdates(bool block);
|
|
|
|
void updateToolWindows(bool also_hide);
|
2012-03-26 15:30:34 +00:00
|
|
|
void fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geom);
|
2011-09-30 11:22:39 +00:00
|
|
|
void saveOldScreenSizes();
|
2021-05-09 15:07:36 +00:00
|
|
|
void addToStack(Toplevel *toplevel);
|
|
|
|
void replaceInStack(Toplevel *original, Deleted *deleted);
|
|
|
|
void removeFromStack(Toplevel *toplevel);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/// This is the right way to create a new client
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *createClient(xcb_window_t w, bool is_mapped);
|
2016-07-01 14:03:13 +00:00
|
|
|
void setupClientConnections(AbstractClient *client);
|
2019-09-24 08:48:08 +00:00
|
|
|
void addClient(X11Client *c);
|
2013-04-30 13:41:59 +00:00
|
|
|
Unmanaged* createUnmanaged(xcb_window_t w);
|
2013-04-26 07:47:45 +00:00
|
|
|
void addUnmanaged(Unmanaged* c);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2020-03-04 07:55:26 +00:00
|
|
|
void addShellClient(AbstractClient *client);
|
|
|
|
void removeShellClient(AbstractClient *client);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
|
|
|
void closeActivePopup();
|
|
|
|
void updateClientArea(bool force);
|
2012-11-16 07:23:47 +00:00
|
|
|
void resetClientAreas(uint desktopCount);
|
2021-08-16 12:07:43 +00:00
|
|
|
void updateClientVisibilityOnDesktopChange(VirtualDesktop *newDesktop);
|
|
|
|
void activateClientOnNewDesktop(VirtualDesktop *desktop);
|
|
|
|
AbstractClient *findClientToActivateOnDesktop(VirtualDesktop *desktop);
|
2021-05-24 16:01:49 +00:00
|
|
|
void removeAbstractClient(AbstractClient *client);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2021-05-09 15:07:36 +00:00
|
|
|
struct Constraint
|
|
|
|
{
|
|
|
|
Toplevel *below;
|
|
|
|
Toplevel *above;
|
|
|
|
// All constraints above our "below" window
|
|
|
|
QList<Constraint *> parents;
|
|
|
|
// All constraints below our "above" window
|
|
|
|
QList<Constraint *> children;
|
|
|
|
// Used to prevent cycles.
|
|
|
|
bool enqueued = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
QList<Constraint *> m_constraints;
|
2011-01-30 14:34:42 +00:00
|
|
|
QWidget* active_popup;
|
2015-03-06 08:03:08 +00:00
|
|
|
AbstractClient* active_popup_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-05-01 14:55:15 +00:00
|
|
|
int m_initialDesktop;
|
2020-04-02 11:44:27 +00:00
|
|
|
void loadSessionInfo(const QString &sessionName);
|
2011-01-30 14:34:42 +00:00
|
|
|
void addSessionInfo(KConfigGroup &cg);
|
|
|
|
|
|
|
|
QList<SessionInfo*> session;
|
|
|
|
|
2017-06-21 19:10:12 +00:00
|
|
|
void updateXStackingOrder();
|
2019-07-29 18:24:09 +00:00
|
|
|
void updateTabbox();
|
2017-06-21 04:56:53 +00:00
|
|
|
|
2015-03-12 11:08:54 +00:00
|
|
|
AbstractClient* active_client;
|
2015-03-12 10:39:22 +00:00
|
|
|
AbstractClient* last_active_client;
|
2015-03-06 11:38:07 +00:00
|
|
|
AbstractClient* movingClient;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Delay(ed) window focus timer and client
|
|
|
|
QTimer* delayFocusTimer;
|
2016-02-18 10:18:50 +00:00
|
|
|
AbstractClient* delayfocus_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
QPoint focusMousePos;
|
|
|
|
|
2021-05-24 16:01:49 +00:00
|
|
|
QList<X11Client *> m_x11Clients;
|
2015-09-18 11:44:54 +00:00
|
|
|
QList<AbstractClient*> m_allClients;
|
2020-10-09 15:49:32 +00:00
|
|
|
QList<Unmanaged *> m_unmanaged;
|
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<Deleted *> deleted;
|
2019-08-26 07:44:04 +00:00
|
|
|
QList<InternalClient *> m_internalClients;
|
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 *> unconstrained_stacking_order; // Topmost last
|
|
|
|
QList<Toplevel *> stacking_order; // Topmost last
|
2018-08-24 21:10:48 +00:00
|
|
|
QVector<xcb_window_t> manual_overlays; //Topmost last
|
2011-01-30 14:34:42 +00:00
|
|
|
bool force_restacking;
|
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 *> x_stacking; // From XQueryTree()
|
2017-06-21 19:10:12 +00:00
|
|
|
std::unique_ptr<Xcb::Tree> m_xStackingQueryTree;
|
2017-09-17 07:26:24 +00:00
|
|
|
bool m_xStackingDirty = false;
|
2015-03-12 10:59:41 +00:00
|
|
|
QList<AbstractClient*> should_get_focus; // Last is most recent
|
2015-03-13 10:13:29 +00:00
|
|
|
QList<AbstractClient*> attention_chain;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
bool showing_desktop;
|
|
|
|
|
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<Group *> groups;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
bool was_user_interaction;
|
2017-08-17 17:10:45 +00:00
|
|
|
QScopedPointer<X11EventFilter> m_wasUserInteractionFilter;
|
2019-10-31 16:16:53 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int session_active_client;
|
|
|
|
int session_desktop;
|
|
|
|
|
|
|
|
int block_focus;
|
|
|
|
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* Holds the menu containing the user actions which is shown
|
|
|
|
* on e.g. right click the window decoration.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-19 10:00:53 +00:00
|
|
|
UserActionsMenu *m_userActionsMenu;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void modalActionsSwitch(bool enabled);
|
|
|
|
|
|
|
|
ShortcutDialog* client_keys_dialog;
|
2015-03-06 08:03:08 +00:00
|
|
|
AbstractClient* client_keys_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool global_shortcuts_disabled_for_client;
|
|
|
|
|
|
|
|
// Timer to collect requests for 'reconfigure'
|
|
|
|
QTimer reconfigureTimer;
|
|
|
|
|
|
|
|
QTimer updateToolWindowsTimer;
|
|
|
|
|
|
|
|
static Workspace* _self;
|
|
|
|
|
|
|
|
bool workspaceInit;
|
|
|
|
|
2020-07-20 08:07:08 +00:00
|
|
|
QScopedPointer<KStartupInfo> m_startup;
|
|
|
|
QScopedPointer<ColorMapper> m_colorMapper;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
QVector<QRect> workarea; // Array of workareas for virtual desktops
|
|
|
|
// Array of restricted areas that window cannot be moved into
|
|
|
|
QVector<StrutRects> restrictedmovearea;
|
|
|
|
// Array of the previous restricted areas that window cannot be moved into
|
|
|
|
QVector<StrutRects> oldrestrictedmovearea;
|
|
|
|
QVector< QVector<QRect> > screenarea; // Array of workareas per xinerama screen for all virtual desktops
|
2011-09-30 11:22:39 +00:00
|
|
|
QVector< QRect > oldscreensizes; // array of previous sizes of xinerama screens
|
2011-09-30 12:50:18 +00:00
|
|
|
QSize olddisplaysize; // previous sizes od displayWidth()/displayHeight()
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
int set_active_client_recursion;
|
|
|
|
int block_stacking_updates; // When > 0, stacking updates are temporarily disabled
|
|
|
|
bool blocked_propagating_new_clients; // Propagate also new clients after enabling stacking updates?
|
2013-04-30 11:06:46 +00:00
|
|
|
QScopedPointer<Xcb::Window> m_nullFocus;
|
2011-01-30 14:34:42 +00:00
|
|
|
friend class StackingUpdatesBlocker;
|
|
|
|
|
2012-12-27 13:26:46 +00:00
|
|
|
QScopedPointer<KillWindow> m_windowKiller;
|
2017-08-17 19:12:28 +00:00
|
|
|
QScopedPointer<X11EventFilter> m_movingClientFilter;
|
2020-04-27 11:01:17 +00:00
|
|
|
QScopedPointer<X11EventFilter> m_syncAlarmFilter;
|
2014-09-02 16:46:07 +00:00
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
SessionManager *m_sessionManager;
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
|
|
|
friend bool performTransiencyCheck();
|
2013-05-08 11:39:06 +00:00
|
|
|
friend Workspace *workspace();
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
/**
|
|
|
|
* Helper for Workspace::blockStackingUpdates() being called in pairs (True/false)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
class StackingUpdatesBlocker
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-12-29 06:34:38 +00:00
|
|
|
explicit StackingUpdatesBlocker(Workspace* w)
|
2011-01-30 14:34:42 +00:00
|
|
|
: ws(w) {
|
|
|
|
ws->blockStackingUpdates(true);
|
|
|
|
}
|
|
|
|
~StackingUpdatesBlocker() {
|
|
|
|
ws->blockStackingUpdates(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Workspace* ws;
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-30 12:55:06 +00:00
|
|
|
class ColorMapper : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ColorMapper(QObject *parent);
|
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
|
|
|
~ColorMapper() override;
|
2013-04-30 12:55:06 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
void update();
|
|
|
|
private:
|
|
|
|
xcb_colormap_t m_default;
|
|
|
|
xcb_colormap_t m_installed;
|
|
|
|
};
|
|
|
|
|
2009-02-14 15:40:52 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// Unsorted
|
|
|
|
|
|
|
|
inline bool Workspace::initializing() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-02-14 15:40:52 +00:00
|
|
|
return workspaceInit;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-02-14 09:46:12 +00:00
|
|
|
|
2015-03-12 11:11:42 +00:00
|
|
|
inline AbstractClient *Workspace::activeClient() const
|
|
|
|
{
|
|
|
|
return active_client;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline AbstractClient *Workspace::mostRecentlyActivatedClient() const
|
|
|
|
{
|
|
|
|
return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
|
|
|
|
}
|
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
inline void Workspace::addGroup(Group* group)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT groupAdded(group);
|
2011-01-30 14:34:42 +00:00
|
|
|
groups.append(group);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
inline void Workspace::removeGroup(Group* group)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
groups.removeAll(group);
|
|
|
|
}
|
2007-04-29 17:35:43 +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
|
|
|
inline const QList<Toplevel *> &Workspace::stackingOrder() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-12-18 13:50:57 +00:00
|
|
|
// TODO: Q_ASSERT( block_stacking_updates == 0 );
|
2007-04-29 17:35:43 +00:00
|
|
|
return stacking_order;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
inline bool Workspace::wasUserInteraction() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return was_user_interaction;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
inline SessionManager *Workspace::sessionManager() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-10-31 16:16:53 +00:00
|
|
|
return m_sessionManager;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Workspace::showingDesktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return showing_desktop;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Workspace::globalShortcutsDisabled() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-08 15:28:55 +00:00
|
|
|
return global_shortcuts_disabled_for_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
inline void Workspace::forceRestacking()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-07-04 09:51:10 +00:00
|
|
|
force_restacking = true;
|
2011-01-30 14:34:42 +00:00
|
|
|
StackingUpdatesBlocker blocker(this); // Do restacking if not blocked
|
|
|
|
}
|
2007-07-04 09:51:10 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
inline void Workspace::updateFocusMousePosition(const QPoint& pos)
|
|
|
|
{
|
2007-08-24 09:46:56 +00:00
|
|
|
focusMousePos = pos;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-08-24 09:46:56 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
inline QPoint Workspace::focusMousePosition() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-08-24 09:46:56 +00:00
|
|
|
return focusMousePos;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-08-24 09:46:56 +00:00
|
|
|
|
2013-08-05 07:42:10 +00:00
|
|
|
inline
|
2019-09-24 08:48:08 +00:00
|
|
|
void Workspace::forEachClient(std::function< void (X11Client *) > func)
|
2013-08-05 07:42:10 +00:00
|
|
|
{
|
2021-05-24 16:01:49 +00:00
|
|
|
std::for_each(m_x11Clients.constBegin(), m_x11Clients.constEnd(), func);
|
2013-08-05 07:42:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void Workspace::forEachUnmanaged(std::function< void (Unmanaged*) > func)
|
|
|
|
{
|
2020-10-09 15:49:32 +00:00
|
|
|
std::for_each(m_unmanaged.constBegin(), m_unmanaged.constEnd(), func);
|
2013-08-05 07:42:10 +00:00
|
|
|
}
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
inline bool Workspace::hasClient(const X11Client *c)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-09-24 08:48:08 +00:00
|
|
|
return findClient([c](const X11Client *test) {
|
2014-03-20 08:19:53 +00:00
|
|
|
return test == c;
|
|
|
|
});
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-05-08 11:39:06 +00:00
|
|
|
inline Workspace *workspace()
|
|
|
|
{
|
|
|
|
return Workspace::_self;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|
2014-03-20 12:39:00 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Workspace::ActivityFlags)
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#endif
|