2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
2008-09-22 13:03:00 +00:00
|
|
|
Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_PRESENTWINDOWS_H
|
|
|
|
#define KWIN_PRESENTWINDOWS_H
|
|
|
|
|
2009-02-06 10:15:06 +00:00
|
|
|
#include "presentwindows_proxy.h"
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <kwineffects.h>
|
2019-10-21 13:36:39 +00:00
|
|
|
#include <kwineffectquickview.h>
|
2010-09-30 20:25:22 +00:00
|
|
|
|
2019-10-21 15:45:00 +00:00
|
|
|
#include <QElapsedTimer>
|
|
|
|
|
2017-11-08 10:23:00 +00:00
|
|
|
class QMouseEvent;
|
2013-10-25 10:57:34 +00:00
|
|
|
class QQuickView;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2019-10-21 13:36:39 +00:00
|
|
|
class CloseWindowView : public EffectQuickScene
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2010-09-30 20:25:22 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
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
|
|
|
explicit CloseWindowView(QObject *parent = nullptr);
|
2011-04-25 15:04:04 +00:00
|
|
|
void disarm();
|
2011-01-30 14:34:42 +00:00
|
|
|
Q_SIGNALS:
|
2013-08-05 12:08:23 +00:00
|
|
|
void requestClose();
|
2019-10-21 13:36:39 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void clicked();
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2019-10-21 15:45:00 +00:00
|
|
|
QElapsedTimer m_armTimer;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2010-09-30 20:25:22 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
/**
|
|
|
|
* Expose-like effect which shows all windows on current desktop side-by-side,
|
|
|
|
* letting the user select active window.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
class PresentWindowsEffect
|
2011-02-25 19:25:21 +00:00
|
|
|
: public Effect
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
2012-08-11 09:24:37 +00:00
|
|
|
Q_PROPERTY(int layoutMode READ layoutMode)
|
|
|
|
Q_PROPERTY(bool showCaptions READ isShowCaptions)
|
|
|
|
Q_PROPERTY(bool showIcons READ isShowIcons)
|
|
|
|
Q_PROPERTY(bool doNotCloseWindows READ isDoNotCloseWindows)
|
|
|
|
Q_PROPERTY(bool ignoreMinimized READ isIgnoreMinimized)
|
|
|
|
Q_PROPERTY(int accuracy READ accuracy)
|
|
|
|
Q_PROPERTY(bool fillGaps READ isFillGaps)
|
|
|
|
Q_PROPERTY(int fadeDuration READ fadeDuration)
|
|
|
|
Q_PROPERTY(bool showPanel READ isShowPanel)
|
|
|
|
Q_PROPERTY(int leftButtonWindow READ leftButtonWindow)
|
|
|
|
Q_PROPERTY(int rightButtonWindow READ rightButtonWindow)
|
|
|
|
Q_PROPERTY(int middleButtonWindow READ middleButtonWindow)
|
|
|
|
Q_PROPERTY(int leftButtonDesktop READ leftButtonDesktop)
|
|
|
|
Q_PROPERTY(int middleButtonDesktop READ middleButtonDesktop)
|
|
|
|
Q_PROPERTY(int rightButtonDesktop READ rightButtonDesktop)
|
|
|
|
// TODO: electric borders
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
|
|
|
// Structures
|
|
|
|
struct WindowData {
|
|
|
|
bool visible;
|
|
|
|
bool deleted;
|
|
|
|
bool referenced;
|
|
|
|
double opacity;
|
|
|
|
double highlight;
|
|
|
|
EffectFrame* textFrame;
|
|
|
|
EffectFrame* iconFrame;
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
2011-01-30 14:34:42 +00:00
|
|
|
typedef QHash<EffectWindow*, WindowData> DataHash;
|
|
|
|
struct GridSize {
|
|
|
|
int columns;
|
|
|
|
int rows;
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
PresentWindowsEffect();
|
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
|
|
|
~PresentWindowsEffect() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
void reconfigure(ReconfigureFlags) override;
|
|
|
|
void* proxy() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Screen painting
|
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
|
|
|
void prePaintScreen(ScreenPrePaintData &data, int time) override;
|
2019-10-29 22:04:15 +00:00
|
|
|
void paintScreen(int mask, const QRegion ®ion, ScreenPaintData &data) override;
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
void postPaintScreen() override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Window painting
|
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
|
|
|
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time) override;
|
|
|
|
void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// User interaction
|
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
|
|
|
bool borderActivated(ElectricBorder border) override;
|
|
|
|
void windowInputMouseEvent(QEvent *e) override;
|
|
|
|
void grabbedKeyboardEvent(QKeyEvent *e) override;
|
|
|
|
bool isActive() const override;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2019-08-11 19:57:45 +00:00
|
|
|
bool touchDown(qint32 id, const QPointF &pos, quint32 time) override;
|
|
|
|
bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override;
|
|
|
|
bool touchUp(qint32 id, quint32 time) override;
|
2016-08-15 13:44:10 +00:00
|
|
|
|
2014-03-24 10:50:09 +00:00
|
|
|
int requestedEffectChainPosition() const override {
|
|
|
|
return 70;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
enum { LayoutNatural, LayoutRegularGrid, LayoutFlexibleGrid }; // Layout modes
|
|
|
|
enum PresentWindowsMode {
|
|
|
|
ModeAllDesktops, // Shows windows of all desktops
|
|
|
|
ModeCurrentDesktop, // Shows windows on current desktop
|
|
|
|
ModeSelectedDesktop, // Shows windows of selected desktop via property (m_desktop)
|
|
|
|
ModeWindowGroup, // Shows windows selected via property
|
|
|
|
ModeWindowClass // Shows all windows of same class as selected class
|
|
|
|
};
|
|
|
|
enum WindowMouseAction {
|
|
|
|
WindowNoAction = 0, // Nothing
|
|
|
|
WindowActivateAction = 1, // Activates the window and deactivates the effect
|
|
|
|
WindowExitAction = 2, // Deactivates the effect without activating new window
|
|
|
|
WindowToCurrentDesktopAction = 3, // Brings window to current desktop
|
|
|
|
WindowToAllDesktopsAction = 4, // Brings window to all desktops
|
[effects/presentwindows] Allow closing windows on middle-click
Summary:
Plasma's Task manager exposes an optional feature whereby the user
can middle-click on a window to close it, but the Present Windows effect
does not do the same.
The presence of a close button you can left-click does not replace the desirable
feature to be able to middle-click on a window to close it, because then the
whole window becomes a click target, so it can be much much faster than
having to aim for the little close button. Also it's off by default, so a user
who goes out of their way to turn it on is signaling that they want to accept the
risk of accidentally closing a window by accident.
Finally, the feature is not allowed for left-click, so people can never accidentally
wreck Present Windows for themselves by assigning it to left-click by accident
and then mistakenly closing their windows.
This reverts commit 55585514f926d1251148e876bfe9ce3504432997.
FEATURE: 321190
FIXED-IN: 5.17.0
Test Plan:
Set "Close window" in the Present windows effect, trigger effect, and middle-click on window
{F6815303}
Reviewers: #kwin, davidedmundson, broulik, zzag, #plasma, hein, mart
Reviewed By: #kwin, #plasma, mart
Subscribers: mart, abetts, apol, zzag, luebking, kossebau, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21083
2019-05-08 14:57:08 +00:00
|
|
|
WindowMinimizeAction = 5, // Minimizes the window
|
|
|
|
WindowCloseAction = 6 // Closes the window
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
|
|
|
enum DesktopMouseAction {
|
|
|
|
DesktopNoAction = 0, // nothing
|
|
|
|
DesktopActivateAction = 1, // Activates the window and deactivates the effect
|
|
|
|
DesktopExitAction = 2, // Deactivates the effect without activating new window
|
|
|
|
DesktopShowDesktopAction = 3 // Minimizes all windows
|
|
|
|
};
|
|
|
|
|
2012-08-11 09:24:37 +00:00
|
|
|
// for properties
|
|
|
|
int layoutMode() const {
|
|
|
|
return m_layoutMode;
|
|
|
|
}
|
|
|
|
bool isShowCaptions() const {
|
|
|
|
return m_showCaptions;
|
|
|
|
}
|
|
|
|
bool isShowIcons() const {
|
|
|
|
return m_showIcons;
|
|
|
|
}
|
|
|
|
bool isDoNotCloseWindows() const {
|
|
|
|
return m_doNotCloseWindows;
|
|
|
|
}
|
|
|
|
bool isIgnoreMinimized() const {
|
|
|
|
return m_ignoreMinimized;
|
|
|
|
}
|
|
|
|
int accuracy() const {
|
|
|
|
return m_accuracy;
|
|
|
|
}
|
|
|
|
bool isFillGaps() const {
|
|
|
|
return m_fillGaps;
|
|
|
|
}
|
|
|
|
int fadeDuration() const {
|
|
|
|
return m_fadeDuration;
|
|
|
|
}
|
|
|
|
bool isShowPanel() const {
|
|
|
|
return m_showPanel;
|
|
|
|
}
|
|
|
|
int leftButtonWindow() const {
|
|
|
|
return m_leftButtonWindow;
|
|
|
|
}
|
|
|
|
int rightButtonWindow() const {
|
|
|
|
return m_rightButtonWindow;
|
|
|
|
}
|
|
|
|
int middleButtonWindow() const {
|
|
|
|
return m_middleButtonWindow;
|
|
|
|
}
|
|
|
|
int leftButtonDesktop() const {
|
|
|
|
return m_leftButtonDesktop;
|
|
|
|
}
|
|
|
|
int middleButtonDesktop() const {
|
|
|
|
return m_middleButtonDesktop;
|
|
|
|
}
|
|
|
|
int rightButtonDesktop() const {
|
|
|
|
return m_rightButtonDesktop;
|
|
|
|
}
|
2013-07-22 14:07:39 +00:00
|
|
|
public Q_SLOTS:
|
2012-05-24 09:15:24 +00:00
|
|
|
void setActive(bool active);
|
2011-01-30 14:34:42 +00:00
|
|
|
void toggleActive() {
|
|
|
|
m_mode = ModeCurrentDesktop;
|
|
|
|
setActive(!m_activated);
|
|
|
|
}
|
|
|
|
void toggleActiveAllDesktops() {
|
|
|
|
m_mode = ModeAllDesktops;
|
|
|
|
setActive(!m_activated);
|
|
|
|
}
|
|
|
|
void toggleActiveClass();
|
|
|
|
|
|
|
|
// slots for global shortcut changed
|
|
|
|
// needed to toggle the effect
|
2013-08-14 19:13:12 +00:00
|
|
|
void globalShortcutChanged(QAction *action, const QKeySequence &seq);
|
2011-02-25 21:06:02 +00:00
|
|
|
// EffectsHandler
|
2012-01-29 11:29:24 +00:00
|
|
|
void slotWindowAdded(KWin::EffectWindow *w);
|
|
|
|
void slotWindowClosed(KWin::EffectWindow *w);
|
|
|
|
void slotWindowDeleted(KWin::EffectWindow *w);
|
|
|
|
void slotWindowGeometryShapeChanged(KWin::EffectWindow *w, const QRect &old);
|
2011-03-12 18:18:19 +00:00
|
|
|
// atoms
|
2012-01-29 11:29:24 +00:00
|
|
|
void slotPropertyNotify(KWin::EffectWindow* w, long atom);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
private Q_SLOTS:
|
2011-01-30 14:34:42 +00:00
|
|
|
void closeWindow();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Window rearranging
|
|
|
|
void rearrangeWindows();
|
2015-08-28 05:50:20 +00:00
|
|
|
void reCreateGrids();
|
2011-01-30 14:34:42 +00:00
|
|
|
void calculateWindowTransformations(EffectWindowList windowlist, int screen,
|
|
|
|
WindowMotionManager& motionManager, bool external = false);
|
|
|
|
void calculateWindowTransformationsClosest(EffectWindowList windowlist, int screen,
|
|
|
|
WindowMotionManager& motionManager);
|
|
|
|
void calculateWindowTransformationsKompose(EffectWindowList windowlist, int screen,
|
|
|
|
WindowMotionManager& motionManager);
|
|
|
|
void calculateWindowTransformationsNatural(EffectWindowList windowlist, int screen,
|
|
|
|
WindowMotionManager& motionManager);
|
|
|
|
|
|
|
|
// Helper functions for window rearranging
|
|
|
|
inline double aspectRatio(EffectWindow *w) {
|
|
|
|
return w->width() / double(w->height());
|
|
|
|
}
|
|
|
|
inline int widthForHeight(EffectWindow *w, int height) {
|
|
|
|
return int((height / double(w->height())) * w->width());
|
|
|
|
}
|
|
|
|
inline int heightForWidth(EffectWindow *w, int width) {
|
|
|
|
return int((width / double(w->width())) * w->height());
|
|
|
|
}
|
|
|
|
bool isOverlappingAny(EffectWindow *w, const QHash<EffectWindow*, QRect> &targets, const QRegion &border);
|
|
|
|
|
|
|
|
// Filter box
|
|
|
|
void updateFilterFrame();
|
|
|
|
|
|
|
|
// Helper functions
|
|
|
|
bool isSelectableWindow(EffectWindow *w);
|
|
|
|
bool isVisibleWindow(EffectWindow *w);
|
|
|
|
void setHighlightedWindow(EffectWindow *w);
|
|
|
|
EffectWindow* relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const;
|
|
|
|
EffectWindow* findFirstWindow() const;
|
|
|
|
void updateCloseWindow();
|
|
|
|
|
|
|
|
// Helper functions for mouse actions
|
|
|
|
void mouseActionWindow(WindowMouseAction& action);
|
|
|
|
void mouseActionDesktop(DesktopMouseAction& action);
|
2016-08-15 13:44:10 +00:00
|
|
|
void inputEventUpdate(const QPoint &pos, QEvent::Type type = QEvent::None, Qt::MouseButton button = Qt::NoButton);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
PresentWindowsEffectProxy m_proxy;
|
|
|
|
friend class PresentWindowsEffectProxy;
|
|
|
|
|
|
|
|
// User configuration settings
|
|
|
|
QList<ElectricBorder> m_borderActivate;
|
|
|
|
QList<ElectricBorder> m_borderActivateAll;
|
2011-12-24 19:26:01 +00:00
|
|
|
QList<ElectricBorder> m_borderActivateClass;
|
2011-01-30 14:34:42 +00:00
|
|
|
int m_layoutMode;
|
|
|
|
bool m_showCaptions;
|
|
|
|
bool m_showIcons;
|
|
|
|
bool m_doNotCloseWindows;
|
|
|
|
int m_accuracy;
|
|
|
|
bool m_fillGaps;
|
|
|
|
double m_fadeDuration;
|
|
|
|
bool m_showPanel;
|
|
|
|
|
|
|
|
// Activation
|
|
|
|
bool m_activated;
|
|
|
|
bool m_ignoreMinimized;
|
|
|
|
double m_decalOpacity;
|
|
|
|
bool m_hasKeyboardGrab;
|
|
|
|
PresentWindowsMode m_mode;
|
|
|
|
int m_desktop;
|
|
|
|
EffectWindowList m_selectedWindows;
|
|
|
|
EffectWindow *m_managerWindow;
|
|
|
|
QString m_class;
|
2013-06-27 19:54:50 +00:00
|
|
|
bool m_needInitialSelection;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Window data
|
|
|
|
WindowMotionManager m_motionManager;
|
|
|
|
DataHash m_windowData;
|
|
|
|
EffectWindow *m_highlightedWindow;
|
|
|
|
|
|
|
|
// Grid layout info
|
|
|
|
QList<GridSize> m_gridSizes;
|
|
|
|
|
|
|
|
// Filter box
|
|
|
|
EffectFrame* m_filterFrame;
|
|
|
|
QString m_windowFilter;
|
|
|
|
|
|
|
|
// Shortcut - needed to toggle the effect
|
2013-08-14 19:13:12 +00:00
|
|
|
QList<QKeySequence> shortcut;
|
|
|
|
QList<QKeySequence> shortcutAll;
|
|
|
|
QList<QKeySequence> shortcutClass;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Atoms
|
|
|
|
// Present windows for all windows of given desktop
|
|
|
|
// -1 for all desktops
|
|
|
|
long m_atomDesktop;
|
|
|
|
// Present windows for group of window ids
|
|
|
|
long m_atomWindows;
|
|
|
|
|
|
|
|
// Mouse Actions
|
|
|
|
WindowMouseAction m_leftButtonWindow;
|
|
|
|
WindowMouseAction m_middleButtonWindow;
|
|
|
|
WindowMouseAction m_rightButtonWindow;
|
|
|
|
DesktopMouseAction m_leftButtonDesktop;
|
|
|
|
DesktopMouseAction m_middleButtonDesktop;
|
|
|
|
DesktopMouseAction m_rightButtonDesktop;
|
|
|
|
|
|
|
|
CloseWindowView* m_closeView;
|
2011-04-25 15:04:04 +00:00
|
|
|
Qt::Corner m_closeButtonCorner;
|
2016-08-15 13:44:10 +00:00
|
|
|
struct {
|
2019-08-11 19:57:45 +00:00
|
|
|
qint32 id = 0;
|
2016-08-15 13:44:10 +00:00
|
|
|
bool active = false;
|
|
|
|
} m_touch;
|
2017-04-01 17:30:44 +00:00
|
|
|
|
|
|
|
QAction *m_exposeAction;
|
|
|
|
QAction *m_exposeAllAction;
|
|
|
|
QAction *m_exposeClassAction;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|