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>
|
2022-11-24 00:48:25 +00:00
|
|
|
SPDX-FileCopyrightText: 2022 Natalie Clarius <natalie_clarius@yahoo.de>
|
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
|
|
|
|
2022-12-16 20:08:44 +00:00
|
|
|
#pragma once
|
2007-04-29 17:35:43 +00:00
|
|
|
|
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"
|
2022-01-18 08:35:52 +00:00
|
|
|
#include "utils/common.h"
|
2013-04-25 13:47:40 +00:00
|
|
|
// Qt
|
2022-03-09 16:41:07 +00:00
|
|
|
#include <QStringList>
|
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;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2022-07-20 11:46:41 +00:00
|
|
|
namespace Decoration
|
|
|
|
{
|
|
|
|
class DecorationBridge;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-07-31 00:12:25 +00:00
|
|
|
namespace TabBox
|
|
|
|
{
|
|
|
|
class TabBox;
|
|
|
|
}
|
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
class Window;
|
2022-04-14 12:33:28 +00:00
|
|
|
class Output;
|
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 Group;
|
2022-04-22 17:45:19 +00:00
|
|
|
class InternalWindow;
|
2013-04-08 12:30:55 +00:00
|
|
|
class KillWindow;
|
2013-04-25 15:21:54 +00:00
|
|
|
class ShortcutDialog;
|
2012-08-19 10:00:53 +00:00
|
|
|
class UserActionsMenu;
|
2021-08-13 08:41:57 +00:00
|
|
|
class VirtualDesktop;
|
2022-04-22 17:54:31 +00:00
|
|
|
class X11Window;
|
2014-09-02 16:46:07 +00:00
|
|
|
class X11EventFilter;
|
2022-07-20 09:14:51 +00:00
|
|
|
class FocusChain;
|
2022-07-20 11:46:27 +00:00
|
|
|
class ApplicationMenu;
|
2022-06-22 23:02:35 +00:00
|
|
|
class PlacementTracker;
|
2014-03-20 08:19:53 +00:00
|
|
|
enum class Predicate;
|
2022-07-30 21:56:03 +00:00
|
|
|
class Outline;
|
2022-07-30 22:40:49 +00:00
|
|
|
class RuleBook;
|
2022-07-30 22:55:56 +00:00
|
|
|
class ScreenEdges;
|
2022-07-20 10:53:54 +00:00
|
|
|
#if KWIN_BUILD_ACTIVITIES
|
|
|
|
class Activities;
|
|
|
|
#endif
|
2022-08-27 18:30:27 +00:00
|
|
|
class PlaceholderInputEventFilter;
|
2022-09-06 10:10:28 +00:00
|
|
|
class PlaceholderOutput;
|
2022-08-31 20:29:15 +00:00
|
|
|
class Placement;
|
2022-09-05 07:31:57 +00:00
|
|
|
class OutputConfiguration;
|
2022-12-01 14:39:22 +00:00
|
|
|
class TileManager;
|
2023-03-05 13:59:49 +00:00
|
|
|
class OutputConfigurationStore;
|
2023-05-08 08:48:30 +00:00
|
|
|
class LidSwitchTracker;
|
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
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
static Workspace *self()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return _self;
|
|
|
|
}
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
bool workspaceEvent(xcb_generic_event_t *);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
bool hasWindow(const Window *);
|
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
|
2022-04-22 17:54:31 +00:00
|
|
|
* X11Window *client = findClient([w](const X11Window *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
|
2022-04-22 17:54:31 +00:00
|
|
|
* X11Window *client = findClient(Predicate::WindowMatch, w);
|
2014-03-20 08:19:53 +00:00
|
|
|
* @endcode
|
|
|
|
*
|
2022-04-22 17:54:31 +00:00
|
|
|
* @param func Unary function that accepts a X11Window *as argument and
|
2014-03-20 08:19:53 +00:00
|
|
|
* returns a value convertible to bool. The value returned indicates whether the
|
2022-04-22 17:54:31 +00:00
|
|
|
* X11Window *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.
|
2022-04-22 17:54:31 +00:00
|
|
|
* @return KWin::X11Window *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
|
|
|
*/
|
2022-04-22 17:54:31 +00:00
|
|
|
X11Window *findClient(std::function<bool(const X11Window *)> func) 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
|
2022-04-22 17:54:31 +00:00
|
|
|
* @return KWin::X11Window *The found Client or @c null
|
|
|
|
* @see findClient(std::function<bool (const X11Window *)>)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-22 17:54:31 +00:00
|
|
|
X11Window *findClient(Predicate predicate, xcb_window_t w) const;
|
|
|
|
void forEachClient(std::function<void(X11Window *)> func);
|
2023-03-28 11:38:19 +00:00
|
|
|
X11Window *findUnmanaged(std::function<bool(const X11Window *)> func) const;
|
2014-03-20 06:52:18 +00:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
*/
|
2023-03-28 11:38:19 +00:00
|
|
|
X11Window *findUnmanaged(xcb_window_t w) const;
|
2020-07-23 11:13:22 +00:00
|
|
|
|
2023-03-07 20:39:01 +00:00
|
|
|
Window *findWindow(const QUuid &internalId) const;
|
|
|
|
Window *findWindow(std::function<bool(const Window *)> func) const;
|
|
|
|
void forEachWindow(std::function<void(Window *)> func);
|
2020-07-23 11:13:22 +00:00
|
|
|
|
2016-03-04 08:42:33 +00:00
|
|
|
/**
|
2022-04-22 17:39:12 +00:00
|
|
|
* @brief Finds a Window for the internal window @p w.
|
2016-03-04 08:42:33 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
*
|
2022-04-22 17:39:12 +00:00
|
|
|
* @returns Window
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-22 17:39:12 +00:00
|
|
|
Window *findInternal(QWindow *w) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QRectF clientArea(clientAreaOption, const Output *output, const VirtualDesktop *desktop) const;
|
|
|
|
QRectF clientArea(clientAreaOption, const Window *window) const;
|
|
|
|
QRectF clientArea(clientAreaOption, const Window *window, const Output *output) const;
|
|
|
|
QRectF clientArea(clientAreaOption, const Window *window, const QPointF &pos) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2021-08-30 07:52:20 +00:00
|
|
|
/**
|
|
|
|
* Returns the geometry of this Workspace, i.e. the bounding rectangle of all outputs.
|
|
|
|
*/
|
|
|
|
QRect geometry() const;
|
2022-11-02 16:20:37 +00:00
|
|
|
StrutRects restrictedMoveArea(const VirtualDesktop *desktop, StrutAreas areas = StrutAreaAll) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
bool initializing() const;
|
|
|
|
|
2022-07-13 16:41:25 +00:00
|
|
|
Output *xineramaIndexToOutput(int index) const;
|
|
|
|
|
2022-12-15 10:08:36 +00:00
|
|
|
void setOutputOrder(const QVector<Output *> &order);
|
|
|
|
QVector<Output *> outputOrder() const;
|
2022-07-30 12:13:35 +00:00
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *activeOutput() const;
|
|
|
|
void setActiveOutput(Output *output);
|
2022-05-16 20:13:39 +00:00
|
|
|
void setActiveOutput(const QPointF &pos);
|
2022-09-26 00:14:13 +00:00
|
|
|
void setActiveCursorOutput(Output *output);
|
|
|
|
void setActiveCursorOutput(const QPointF &pos);
|
2021-08-28 18:58:29 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2022-04-23 08:33:23 +00:00
|
|
|
* Returns the active window, i.e. the window that has the focus (or None
|
|
|
|
* if no window has the focus)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *activeWindow() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2022-04-23 08:33:23 +00:00
|
|
|
* Window that was activated, but it's not yet really activeWindow(), because
|
2011-01-30 14:34:42 +00:00
|
|
|
* we didn't process yet the matching FocusIn event. Used mostly in focus
|
|
|
|
* stealing prevention code.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *mostRecentlyActivatedWindow() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *windowUnderMouse(Output *output) const;
|
2012-02-13 22:50:49 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void activateWindow(Window *window, bool force = false);
|
|
|
|
bool requestFocus(Window *window, 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)
|
2022-04-23 08:33:23 +00:00
|
|
|
bool takeActivity(Window *window, ActivityFlags flags);
|
2020-07-22 11:00:11 +00:00
|
|
|
bool restoreFocus();
|
2022-04-23 08:33:23 +00:00
|
|
|
void gotFocusIn(const Window *window);
|
|
|
|
void setShouldGetFocus(Window *window);
|
|
|
|
bool activateNextWindow(Window *window);
|
2022-03-23 10:13:38 +00:00
|
|
|
bool focusChangeEnabled()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
return block_focus == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-04-23 08:33:23 +00:00
|
|
|
* Indicates that the given @a window is being moved or resized by the user.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-23 08:33:23 +00:00
|
|
|
void setMoveResizeWindow(Window *window);
|
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QRectF adjustClientArea(Window *window, const QRectF &area) const;
|
|
|
|
QPointF adjustWindowPosition(Window *window, QPointF pos, bool unrestricted, double snapAdjust = 1.0);
|
|
|
|
QRectF adjustWindowSize(Window *window, QRectF moveResizeGeom, Gravity gravity);
|
2022-04-23 08:33:23 +00:00
|
|
|
void raiseWindow(Window *window, bool nogroup = false);
|
|
|
|
void lowerWindow(Window *window, bool nogroup = false);
|
|
|
|
void raiseWindowRequest(Window *window, NET::RequestSource src = NET::FromApplication, xcb_timestamp_t timestamp = 0);
|
|
|
|
void lowerWindowRequest(X11Window *window, NET::RequestSource src, xcb_timestamp_t timestamp);
|
|
|
|
void lowerWindowRequest(Window *window);
|
|
|
|
void restackWindowUnderActive(Window *window);
|
|
|
|
void restack(Window *window, Window *under, bool force = false);
|
|
|
|
void raiseOrLowerWindow(Window *window);
|
2011-01-30 14:34:42 +00:00
|
|
|
void resetUpdateToolWindowsTimer();
|
2022-04-23 08:33:23 +00:00
|
|
|
void restoreSessionStackingOrder(X11Window *window);
|
|
|
|
void updateStackingOrder(bool propagate_new_windows = false);
|
2011-01-30 14:34:42 +00:00
|
|
|
void forceRestacking();
|
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
void constrain(Window *below, Window *above);
|
|
|
|
void unconstrain(Window *below, Window *above);
|
2021-05-09 15:07:36 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void windowHidden(Window *);
|
|
|
|
void windowAttentionChanged(Window *, bool set);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-09-18 11:44:54 +00:00
|
|
|
/**
|
2022-04-23 08:33:23 +00:00
|
|
|
* @returns List of all windows (either X11 or Wayland) currently managed by Workspace
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2023-03-13 11:54:38 +00:00
|
|
|
const QList<Window *> windows() const
|
2022-03-23 10:13:38 +00:00
|
|
|
{
|
2023-03-13 11:54:38 +00:00
|
|
|
return m_windows;
|
2015-09-18 11:44:54 +00:00
|
|
|
}
|
2011-02-27 08:25:45 +00:00
|
|
|
|
2013-02-08 19:59:35 +00:00
|
|
|
void stackScreenEdgesUnderOverrideRedirect();
|
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
SessionManager *sessionManager() const;
|
|
|
|
|
2022-12-01 14:39:22 +00:00
|
|
|
/**
|
|
|
|
* @returns the TileManager associated to a given output
|
|
|
|
*/
|
|
|
|
TileManager *tileManager(Output *output);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2022-04-22 17:39:12 +00:00
|
|
|
QPoint cascadeOffset(const Window *c) const;
|
2012-08-25 16:20:34 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
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:
|
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;
|
2022-11-02 16:20:37 +00:00
|
|
|
StrutRects previousRestrictedMoveArea(const VirtualDesktop *desktop, StrutAreas areas = StrutAreaAll) const;
|
2022-04-14 12:33:28 +00:00
|
|
|
QHash<const Output *, QRect> previousScreenSizes() const;
|
2011-09-30 11:22:39 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2022-04-23 08:33:23 +00:00
|
|
|
* Returns the list of windows sorted in stacking order, with topmost window
|
2011-01-30 14:34:42 +00:00
|
|
|
* at the last position
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-22 17:39:12 +00:00
|
|
|
const QList<Window *> &stackingOrder() const;
|
|
|
|
QList<Window *> unconstrainedStackingOrder() const;
|
2022-04-23 08:33:23 +00:00
|
|
|
QList<X11Window *> ensureStackingOrder(const QList<X11Window *> &windows) const;
|
|
|
|
QList<Window *> ensureStackingOrder(const QList<Window *> &windows) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *topWindowOnDesktop(VirtualDesktop *desktop, Output *output = nullptr, bool unconstrained = false,
|
|
|
|
bool only_normal = true) const;
|
2022-04-22 17:39:12 +00:00
|
|
|
Window *findDesktop(bool topmost, VirtualDesktop *desktop) const;
|
2023-02-23 17:10:08 +00:00
|
|
|
void sendWindowToDesktops(Window *window, const QVector<VirtualDesktop *> &desktops, bool dont_activate);
|
2022-04-23 08:33:23 +00:00
|
|
|
void windowToPreviousDesktop(Window *window);
|
|
|
|
void windowToNextDesktop(Window *window);
|
|
|
|
void sendWindowToOutput(Window *window, Output *output);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
void addManualOverlay(xcb_window_t id)
|
|
|
|
{
|
2018-08-24 21:10:48 +00:00
|
|
|
manual_overlays << id;
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
void removeManualOverlay(xcb_window_t id)
|
|
|
|
{
|
2018-08-24 21:10:48 +00:00
|
|
|
manual_overlays.removeOne(id);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
2022-04-23 08:33:23 +00:00
|
|
|
* Shows the menu operations menu for the window and makes it active if
|
2011-01-30 14:34:42 +00:00
|
|
|
* it's not already.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-22 17:39:12 +00:00
|
|
|
void showWindowMenu(const QRect &pos, Window *cl);
|
2023-06-14 14:05:57 +00:00
|
|
|
UserActionsMenu *userActionsMenu() const
|
2022-03-23 10:13:38 +00:00
|
|
|
{
|
2012-08-19 10:00:53 +00:00
|
|
|
return m_userActionsMenu;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void showApplicationMenu(const QRect &pos, Window *window, int actionId);
|
2017-01-11 09:21:03 +00:00
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
void updateMinimizedOfTransients(Window *);
|
|
|
|
void updateOnAllDesktopsOfTransients(Window *);
|
2013-04-30 13:41:59 +00:00
|
|
|
void checkTransients(xcb_window_t w);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-22 17:54:31 +00:00
|
|
|
SessionInfo *takeSessionInfo(X11Window *);
|
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
|
|
|
|
2022-11-24 00:48:25 +00:00
|
|
|
enum Direction {
|
|
|
|
DirectionNorth,
|
|
|
|
DirectionEast,
|
|
|
|
DirectionSouth,
|
|
|
|
DirectionWest,
|
|
|
|
DirectionPrev,
|
|
|
|
DirectionNext
|
|
|
|
};
|
2022-11-24 01:09:50 +00:00
|
|
|
Output *findOutput(Output *reference, Direction direction, bool wrapAround = false) const;
|
2022-04-14 12:33:28 +00:00
|
|
|
void switchToOutput(Output *output);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-07-11 10:41:15 +00:00
|
|
|
QList<Output *> outputs() const;
|
|
|
|
Output *outputAt(const QPointF &pos) const;
|
|
|
|
|
2022-02-04 14:11:42 +00:00
|
|
|
/**
|
|
|
|
* Set "Show Desktop" status
|
|
|
|
*
|
|
|
|
* @param showing @c true to show the desktop, @c false to restore the window positions
|
|
|
|
* @param animated @c true if the "Show Desktop Animation" should be played, otherwise @c false
|
|
|
|
*/
|
|
|
|
void setShowingDesktop(bool showing, bool animated = true);
|
2011-01-30 14:34:42 +00:00
|
|
|
bool showingDesktop() const;
|
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void removeX11Window(X11Window *); // Only called from X11Window::destroyWindow() or X11Window::releaseWindow()
|
|
|
|
void setActiveWindow(Window *window);
|
2022-03-23 10:13:38 +00:00
|
|
|
Group *findGroup(xcb_window_t leader) const;
|
|
|
|
void addGroup(Group *group);
|
|
|
|
void removeGroup(Group *group);
|
2022-04-22 17:54:31 +00:00
|
|
|
Group *findClientLeaderGroup(const X11Window *c) const;
|
|
|
|
int unconstainedStackingOrderIndex(const X11Window *c) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2023-03-28 11:38:19 +00:00
|
|
|
void removeUnmanaged(X11Window *);
|
2023-03-02 21:08:15 +00:00
|
|
|
void removeDeleted(Window *);
|
Drop Deleted
Currently, the normal window lifecycle looks as follows: create Window,
wait until it's shown, add it to Workspace, wait until it's closed,
create a Deleted, copy properties from the original window to the
deleted one, destroy the original window, wait until the last deleted
window reference is dropped.
There are a couple of issues with this design: we can't nicely
encapsulate X11 or Wayland specific implementation details if they need
to be accessed for closed windows; manual copying of properties is
cumbersome and error prone and we've had a dozen of cases where effects
worked incorrectly because some properties had not been copied.
The goal of this patch is to drop Deleted and extend the lifetime of the
original window, but with a special state set: Window::isDeleted().
The main danger is that somebody can try to do something with deleted
windows that they should not do, but on the other hand, such code needs
to be guarded with relevant checks too.
2023-03-14 09:45:18 +00:00
|
|
|
void addDeleted(Window *);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-03-23 10:13:38 +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?
|
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void windowShortcutUpdated(Window *window);
|
2022-04-22 17:39:12 +00:00
|
|
|
bool shortcutAvailable(const QKeySequence &cut, Window *ignore = nullptr) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool globalShortcutsDisabled() const;
|
|
|
|
void disableGlobalShortcutsForClient(bool disable);
|
|
|
|
|
|
|
|
void setWasUserInteraction();
|
|
|
|
bool wasUserInteraction() const;
|
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
qreal packPositionLeft(const Window *window, qreal oldX, bool leftEdge) const;
|
|
|
|
qreal packPositionRight(const Window *window, qreal oldX, bool rightEdge) const;
|
|
|
|
qreal packPositionUp(const Window *window, qreal oldY, bool topEdge) const;
|
|
|
|
qreal packPositionDown(const Window *window, qreal oldY, bool bottomEdge) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void cancelDelayFocus();
|
2022-04-22 17:39:12 +00:00
|
|
|
void requestDelayFocus(Window *);
|
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
|
|
|
*/
|
2022-05-16 20:13:39 +00:00
|
|
|
void updateFocusMousePosition(const QPointF &pos);
|
|
|
|
QPointF focusMousePosition() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2019-04-18 12:28:11 +00:00
|
|
|
/**
|
2022-04-23 08:33:23 +00:00
|
|
|
* Returns a window that is currently being moved or resized by the user.
|
2019-04-18 12:28:11 +00:00
|
|
|
*
|
2022-04-23 08:33:23 +00:00
|
|
|
* If none of windows is being moved or resized, @c null will be returned.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *moveResizeWindow()
|
2022-03-23 10:13:38 +00:00
|
|
|
{
|
2022-04-23 08:33:23 +00:00
|
|
|
return m_moveResizeWindow;
|
2011-06-23 10:09:17 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2017-07-18 19:12:37 +00:00
|
|
|
void quickTileWindow(QuickTileMode mode);
|
2017-07-20 04:58:35 +00:00
|
|
|
void switchWindow(Direction direction);
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
ShortcutDialog *shortcutDialog() const
|
|
|
|
{
|
2022-04-23 08:33:23 +00:00
|
|
|
return m_windowKeysDialog;
|
2017-07-22 10:49:57 +00:00
|
|
|
}
|
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void addInternalWindow(InternalWindow *window);
|
|
|
|
void removeInternalWindow(InternalWindow *window);
|
2019-08-26 07:44:04 +00:00
|
|
|
|
2022-04-04 22:53:48 +00:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
* Used by session management
|
|
|
|
*/
|
|
|
|
void setInitialDesktop(int desktop);
|
|
|
|
|
2022-05-04 23:49:53 +00:00
|
|
|
bool inShouldGetFocus(Window *w) const
|
|
|
|
{
|
|
|
|
return should_get_focus.contains(w);
|
|
|
|
}
|
|
|
|
Window *lastActiveWindow() const
|
|
|
|
{
|
|
|
|
return m_lastActiveWindow;
|
|
|
|
}
|
2022-07-20 09:14:51 +00:00
|
|
|
FocusChain *focusChain() const;
|
2022-07-20 11:46:27 +00:00
|
|
|
ApplicationMenu *applicationMenu() const;
|
2022-07-20 11:46:41 +00:00
|
|
|
Decoration::DecorationBridge *decorationBridge() const;
|
2022-07-30 21:56:03 +00:00
|
|
|
Outline *outline() const;
|
2022-07-30 22:22:38 +00:00
|
|
|
Placement *placement() const;
|
2022-07-30 22:40:49 +00:00
|
|
|
RuleBook *rulebook() const;
|
2022-07-30 22:55:56 +00:00
|
|
|
ScreenEdges *screenEdges() const;
|
2022-07-31 00:12:25 +00:00
|
|
|
#if KWIN_BUILD_TABBOX
|
|
|
|
TabBox::TabBox *tabbox() const;
|
|
|
|
#endif
|
2022-07-20 10:53:54 +00:00
|
|
|
#if KWIN_BUILD_ACTIVITIES
|
|
|
|
Activities *activities() const;
|
|
|
|
#endif
|
2022-05-04 23:49:53 +00:00
|
|
|
|
2022-09-05 07:31:57 +00:00
|
|
|
/**
|
|
|
|
* Apply the requested output configuration. Note that you must use this function
|
|
|
|
* instead of Platform::applyOutputChanges().
|
|
|
|
*/
|
2022-12-15 10:08:36 +00:00
|
|
|
bool applyOutputConfiguration(const OutputConfiguration &config, const QVector<Output *> &outputOrder = {});
|
2022-09-05 07:31:57 +00:00
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
public Q_SLOTS:
|
2022-04-23 08:33:23 +00:00
|
|
|
void performWindowOperation(KWin::Window *window, Options::WindowOperation op);
|
2011-01-30 14:34:42 +00:00
|
|
|
// Keybindings
|
2022-03-23 10:13:38 +00:00
|
|
|
// void slotSwitchToWindow( int );
|
2021-08-17 07:19:46 +00:00
|
|
|
void slotWindowToDesktop(VirtualDesktop *desktop);
|
2011-02-16 18:23:54 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// void slotWindowToListPosition( int );
|
2022-10-13 07:46:30 +00:00
|
|
|
void slotSwitchToScreen(Output *output);
|
|
|
|
void slotWindowToScreen(Output *output);
|
2022-11-11 00:52:33 +00:00
|
|
|
void slotSwitchToLeftScreen();
|
|
|
|
void slotSwitchToRightScreen();
|
|
|
|
void slotSwitchToAboveScreen();
|
|
|
|
void slotSwitchToBelowScreen();
|
|
|
|
void slotSwitchToPrevScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotSwitchToNextScreen();
|
2022-11-11 00:52:33 +00:00
|
|
|
void slotWindowToLeftScreen();
|
|
|
|
void slotWindowToRightScreen();
|
|
|
|
void slotWindowToAboveScreen();
|
|
|
|
void slotWindowToBelowScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotWindowToNextScreen();
|
2013-05-19 12:23:49 +00:00
|
|
|
void slotWindowToPrevScreen();
|
2022-11-11 00:52:33 +00:00
|
|
|
|
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();
|
2021-09-20 13:14:24 +00:00
|
|
|
|
|
|
|
void slotWindowCenter();
|
|
|
|
|
2021-10-04 16:20:10 +00:00
|
|
|
void slotWindowMoveLeft();
|
|
|
|
void slotWindowMoveRight();
|
|
|
|
void slotWindowMoveUp();
|
|
|
|
void slotWindowMoveDown();
|
|
|
|
void slotWindowExpandHorizontal();
|
|
|
|
void slotWindowExpandVertical();
|
2011-01-30 14:34:42 +00:00
|
|
|
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
|
2023-02-23 17:37:46 +00:00
|
|
|
void slotCurrentDesktopChanged(VirtualDesktop *previousDesktop, VirtualDesktop *newDesktop);
|
|
|
|
void slotCurrentDesktopChanging(VirtualDesktop *currentDesktop, QPointF delta);
|
2022-03-22 22:34:52 +00:00
|
|
|
void slotCurrentDesktopChangingCancelled();
|
2021-08-21 17:46:51 +00:00
|
|
|
void slotDesktopAdded(VirtualDesktop *desktop);
|
|
|
|
void slotDesktopRemoved(VirtualDesktop *desktop);
|
2022-11-05 10:43:41 +00:00
|
|
|
void slotOutputBackendOutputsQueried();
|
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();
|
2021-11-09 10:38:17 +00:00
|
|
|
void geometryChanged();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// Signals required for the scripting interface
|
2021-11-09 10:51:30 +00:00
|
|
|
void currentActivityChanged();
|
2023-02-23 17:37:46 +00:00
|
|
|
void currentDesktopChanged(KWin::VirtualDesktop *previousDesktop, KWin::Window *);
|
|
|
|
void currentDesktopChanging(KWin::VirtualDesktop *currentDesktop, QPointF delta, KWin::Window *); // for realtime animations
|
2022-03-22 22:34:52 +00:00
|
|
|
void currentDesktopChangingCancelled();
|
2022-04-23 08:33:23 +00:00
|
|
|
void windowAdded(KWin::Window *);
|
|
|
|
void windowRemoved(KWin::Window *);
|
|
|
|
void windowActivated(KWin::Window *);
|
|
|
|
void windowMinimizedChanged(KWin::Window *);
|
2022-03-23 10:13:38 +00:00
|
|
|
void groupAdded(KWin::Group *);
|
2023-03-02 21:08:15 +00:00
|
|
|
void deletedRemoved(KWin::Window *);
|
2011-07-13 09:36:49 +00:00
|
|
|
void configChanged();
|
2022-02-04 14:11:42 +00:00
|
|
|
void showingDesktopChanged(bool showing, bool animated);
|
2022-12-15 10:08:36 +00:00
|
|
|
void outputOrderChanged();
|
2022-07-11 10:41:15 +00:00
|
|
|
void outputAdded(KWin::Output *);
|
|
|
|
void outputRemoved(KWin::Output *);
|
2022-09-05 07:31:57 +00:00
|
|
|
void outputsChanged();
|
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
|
|
|
|
|
|
|
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();
|
2022-03-23 10:13:38 +00:00
|
|
|
template<typename Slot>
|
2022-10-13 07:46:30 +00:00
|
|
|
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, Slot slot);
|
2022-03-23 10:13:38 +00:00
|
|
|
template<typename T, typename Slot>
|
2022-10-13 07:46:30 +00:00
|
|
|
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, T *receiver, Slot slot);
|
2022-04-23 08:33:23 +00:00
|
|
|
void setupWindowShortcut(Window *window);
|
|
|
|
bool switchWindow(Window *window, Direction direction, QPoint curPos, VirtualDesktop *desktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void propagateWindows(bool propagate_new_windows); // Called only from updateStackingOrder
|
2022-04-22 17:39:12 +00:00
|
|
|
QList<Window *> constrainedStackingOrder();
|
2022-04-23 08:33:23 +00:00
|
|
|
void raiseWindowWithinApplication(Window *window);
|
|
|
|
void lowerWindowWithinApplication(Window *window);
|
|
|
|
bool allowFullClientRaising(const Window *window, 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();
|
2022-04-23 08:33:23 +00:00
|
|
|
void addToStack(Window *window);
|
|
|
|
void removeFromStack(Window *window);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
/// This is the right way to create a new X11 window
|
|
|
|
X11Window *createX11Window(xcb_window_t windowId, bool is_mapped);
|
|
|
|
void addX11Window(X11Window *c);
|
|
|
|
void setupWindowConnections(Window *window);
|
2023-03-28 11:38:19 +00:00
|
|
|
X11Window *createUnmanaged(xcb_window_t windowId);
|
|
|
|
void addUnmanaged(X11Window *c);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
void addWaylandWindow(Window *window);
|
|
|
|
void removeWaylandWindow(Window *window);
|
2020-03-04 07:55:26 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
|
|
|
void closeActivePopup();
|
2022-04-23 08:33:23 +00:00
|
|
|
void updateWindowVisibilityOnDesktopChange(VirtualDesktop *newDesktop);
|
|
|
|
void activateWindowOnNewDesktop(VirtualDesktop *desktop);
|
|
|
|
Window *findWindowToActivateOnDesktop(VirtualDesktop *desktop);
|
2022-05-18 09:49:31 +00:00
|
|
|
void removeWindow(Window *window);
|
2022-06-22 23:02:35 +00:00
|
|
|
QString getPlacementTrackerHash();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-08-17 12:39:49 +00:00
|
|
|
void updateOutputConfiguration();
|
2022-12-15 10:08:36 +00:00
|
|
|
void updateOutputs(const QVector<Output *> &outputOrder = {});
|
2022-08-17 12:39:49 +00:00
|
|
|
|
2021-05-09 15:07:36 +00:00
|
|
|
struct Constraint
|
|
|
|
{
|
2022-04-22 17:39:12 +00:00
|
|
|
Window *below;
|
|
|
|
Window *above;
|
2021-05-09 15:07:36 +00:00
|
|
|
// 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;
|
2022-03-23 10:13:38 +00:00
|
|
|
QWidget *active_popup;
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *m_activePopupWindow;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-05-01 14:55:15 +00:00
|
|
|
int m_initialDesktop;
|
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
|
|
|
|
2022-07-11 10:41:15 +00:00
|
|
|
QList<Output *> m_outputs;
|
2022-04-14 12:33:28 +00:00
|
|
|
Output *m_activeOutput = nullptr;
|
2022-09-26 00:14:13 +00:00
|
|
|
Output *m_activeCursorOutput = nullptr;
|
2022-12-15 10:08:36 +00:00
|
|
|
QVector<Output *> m_outputOrder;
|
2022-08-17 12:39:49 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *m_activeWindow;
|
|
|
|
Window *m_lastActiveWindow;
|
|
|
|
Window *m_moveResizeWindow;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
// Delay(ed) window focus timer and window
|
2022-03-23 10:13:38 +00:00
|
|
|
QTimer *delayFocusTimer;
|
2022-04-23 08:33:23 +00:00
|
|
|
Window *m_delayFocusWindow;
|
2022-05-16 20:13:39 +00:00
|
|
|
QPointF focusMousePos;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2023-03-13 11:54:38 +00:00
|
|
|
QList<Window *> m_windows;
|
2023-03-02 21:08:15 +00:00
|
|
|
QList<Window *> deleted;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
QList<Window *> unconstrained_stacking_order; // Topmost last
|
|
|
|
QList<Window *> stacking_order; // Topmost last
|
2022-03-23 10:13:38 +00:00
|
|
|
QVector<xcb_window_t> manual_overlays; // Topmost last
|
2011-01-30 14:34:42 +00:00
|
|
|
bool force_restacking;
|
2022-04-22 17:39:12 +00:00
|
|
|
QList<Window *> should_get_focus; // Last is most recent
|
|
|
|
QList<Window *> 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;
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<X11EventFilter> m_wasUserInteractionFilter;
|
2019-10-31 16:16:53 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
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);
|
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
ShortcutDialog *m_windowKeysDialog = nullptr;
|
|
|
|
Window *m_windowKeysWindow = nullptr;
|
|
|
|
bool m_globalShortcutsDisabledForWindow = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Timer to collect requests for 'reconfigure'
|
|
|
|
QTimer reconfigureTimer;
|
|
|
|
|
|
|
|
QTimer updateToolWindowsTimer;
|
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
static Workspace *_self;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KStartupInfo> m_startup;
|
|
|
|
std::unique_ptr<ColorMapper> m_colorMapper;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
QHash<const VirtualDesktop *, QRectF> m_workAreas;
|
2021-08-21 17:46:51 +00:00
|
|
|
QHash<const VirtualDesktop *, StrutRects> m_restrictedAreas;
|
2022-05-16 20:13:39 +00:00
|
|
|
QHash<const VirtualDesktop *, QHash<const Output *, QRectF>> m_screenAreas;
|
2021-08-30 07:52:20 +00:00
|
|
|
QRect m_geometry;
|
2021-08-21 17:46:51 +00:00
|
|
|
|
2022-04-14 12:33:28 +00:00
|
|
|
QHash<const Output *, QRect> m_oldScreenGeometries;
|
2021-08-21 17:46:51 +00:00
|
|
|
QHash<const VirtualDesktop *, StrutRects> m_oldRestrictedAreas;
|
2021-10-30 10:43:08 +00:00
|
|
|
bool m_inUpdateClientArea = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
int m_setActiveWindowRecursion = 0;
|
|
|
|
int m_blockStackingUpdates = 0; // When > 0, stacking updates are temporarily disabled
|
|
|
|
bool m_blockedPropagatingNewWindows; // Propagate also new windows after enabling stacking updates?
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<Xcb::Window> m_nullFocus;
|
2011-01-30 14:34:42 +00:00
|
|
|
friend class StackingUpdatesBlocker;
|
|
|
|
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KillWindow> m_windowKiller;
|
|
|
|
std::unique_ptr<X11EventFilter> m_movingClientFilter;
|
|
|
|
std::unique_ptr<X11EventFilter> m_syncAlarmFilter;
|
2014-09-02 16:46:07 +00:00
|
|
|
|
2019-10-31 16:16:53 +00:00
|
|
|
SessionManager *m_sessionManager;
|
2022-07-20 09:14:51 +00:00
|
|
|
std::unique_ptr<FocusChain> m_focusChain;
|
2022-07-20 11:46:27 +00:00
|
|
|
std::unique_ptr<ApplicationMenu> m_applicationMenu;
|
2022-07-20 11:46:41 +00:00
|
|
|
std::unique_ptr<Decoration::DecorationBridge> m_decorationBridge;
|
2022-07-30 21:56:03 +00:00
|
|
|
std::unique_ptr<Outline> m_outline;
|
2022-07-30 22:22:38 +00:00
|
|
|
std::unique_ptr<Placement> m_placement;
|
2022-07-30 22:40:49 +00:00
|
|
|
std::unique_ptr<RuleBook> m_rulebook;
|
2022-07-30 22:55:56 +00:00
|
|
|
std::unique_ptr<ScreenEdges> m_screenEdges;
|
2022-07-31 00:12:25 +00:00
|
|
|
#if KWIN_BUILD_TABBOX
|
|
|
|
std::unique_ptr<TabBox::TabBox> m_tabbox;
|
|
|
|
#endif
|
2022-07-20 10:53:54 +00:00
|
|
|
#if KWIN_BUILD_ACTIVITIES
|
|
|
|
std::unique_ptr<Activities> m_activities;
|
|
|
|
#endif
|
2022-06-22 23:02:35 +00:00
|
|
|
std::unique_ptr<PlacementTracker> m_placementTracker;
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2022-09-05 07:31:57 +00:00
|
|
|
PlaceholderOutput *m_placeholderOutput = nullptr;
|
2022-08-27 18:30:27 +00:00
|
|
|
std::unique_ptr<PlaceholderInputEventFilter> m_placeholderFilter;
|
2022-12-01 14:39:22 +00:00
|
|
|
std::map<Output *, std::unique_ptr<TileManager>> m_tileManagers;
|
2023-03-05 13:59:49 +00:00
|
|
|
std::unique_ptr<OutputConfigurationStore> m_outputConfigStore;
|
2023-05-08 08:48:30 +00:00
|
|
|
std::unique_ptr<LidSwitchTracker> m_lidSwitchTracker;
|
2022-08-27 18:30:27 +00:00
|
|
|
|
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:
|
2022-03-23 10:13:38 +00:00
|
|
|
explicit StackingUpdatesBlocker(Workspace *w)
|
|
|
|
: ws(w)
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
ws->blockStackingUpdates(true);
|
|
|
|
}
|
2022-03-23 10:13:38 +00:00
|
|
|
~StackingUpdatesBlocker()
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
ws->blockStackingUpdates(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2022-03-23 10:13:38 +00:00
|
|
|
Workspace *ws;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
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();
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2013-04-30 12:55:06 +00:00
|
|
|
private:
|
|
|
|
xcb_colormap_t m_default;
|
|
|
|
xcb_colormap_t m_installed;
|
|
|
|
};
|
|
|
|
|
2009-02-14 15:40:52 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// Unsorted
|
|
|
|
|
2022-07-11 10:41:15 +00:00
|
|
|
inline QList<Output *> Workspace::outputs() const
|
|
|
|
{
|
|
|
|
return m_outputs;
|
|
|
|
}
|
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
inline Window *Workspace::activeWindow() const
|
2015-03-12 11:11:42 +00:00
|
|
|
{
|
2022-04-23 08:33:23 +00:00
|
|
|
return m_activeWindow;
|
2015-03-12 11:11:42 +00:00
|
|
|
}
|
|
|
|
|
2022-04-23 08:33:23 +00:00
|
|
|
inline Window *Workspace::mostRecentlyActivatedWindow() const
|
2015-03-12 11:11:42 +00:00
|
|
|
{
|
2022-04-23 08:33:23 +00:00
|
|
|
return should_get_focus.count() > 0 ? should_get_focus.last() : m_activeWindow;
|
2015-03-12 11:11:42 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 10:13:38 +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
|
|
|
|
2022-03-23 10:13:38 +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
|
|
|
|
2022-04-22 17:39:12 +00:00
|
|
|
inline const QList<Window *> &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
|
|
|
{
|
2022-04-23 08:33:23 +00:00
|
|
|
return m_globalShortcutsDisabledForWindow;
|
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;
|
2022-03-23 10:13:38 +00:00
|
|
|
StackingUpdatesBlocker blocker(this); // Do restacking if not blocked
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-07-04 09:51:10 +00:00
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
inline void Workspace::updateFocusMousePosition(const QPointF &pos)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
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
|
|
|
|
2022-05-16 20:13:39 +00:00
|
|
|
inline QPointF 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-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)
|