2014-07-22 11:11:19 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2020-08-02 22:10:35 +00:00
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2014-07-22 11:11:19 +00:00
|
|
|
|
2020-08-02 22:10:35 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
2014-07-22 11:11:19 +00:00
|
|
|
*********************************************************************/
|
|
|
|
#ifndef KWIN_DECORATED_CLIENT_H
|
|
|
|
#define KWIN_DECORATED_CLIENT_H
|
2016-05-11 11:33:03 +00:00
|
|
|
#include "options.h"
|
2014-07-22 11:11:19 +00:00
|
|
|
|
|
|
|
#include <KDecoration2/Private/DecoratedClientPrivate>
|
|
|
|
|
Improve tooltips behavior
Summary:
Window buttons tooltips used to appear on hover immediately. As
the result, they mostly appeared when not needed e.g. when user
was closing a window, or when the mouse pointer slightly touched
a button while being moved elsewhere.
This commit changes the tooltips behavior to WakeUp-FallAsleep
approach used by Widgets.
BUG: 392765
FIXED-IN: 5.13
Reviewers: #kwin, graesslin, broulik, #plasma
Reviewed By: #kwin, graesslin, #plasma
Subscribers: zzag, broulik, kwin, hein
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12404
2018-04-22 17:40:54 +00:00
|
|
|
#include <QDeadlineTimer>
|
2014-07-22 11:11:19 +00:00
|
|
|
#include <QObject>
|
Improve tooltips behavior
Summary:
Window buttons tooltips used to appear on hover immediately. As
the result, they mostly appeared when not needed e.g. when user
was closing a window, or when the mouse pointer slightly touched
a button while being moved elsewhere.
This commit changes the tooltips behavior to WakeUp-FallAsleep
approach used by Widgets.
BUG: 392765
FIXED-IN: 5.13
Reviewers: #kwin, graesslin, broulik, #plasma
Reviewed By: #kwin, graesslin, #plasma
Subscribers: zzag, broulik, kwin, hein
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12404
2018-04-22 17:40:54 +00:00
|
|
|
#include <QTimer>
|
2014-07-22 11:11:19 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-12-03 16:12:25 +00:00
|
|
|
class AbstractClient;
|
2014-07-22 11:11:19 +00:00
|
|
|
|
|
|
|
namespace Decoration
|
|
|
|
{
|
|
|
|
|
|
|
|
class Renderer;
|
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
class DecoratedClientImpl : public QObject, public KDecoration2::ApplicationMenuEnabledDecoratedClientPrivate
|
2014-07-22 11:11:19 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-12-03 16:29:06 +00:00
|
|
|
explicit DecoratedClientImpl(AbstractClient *client, KDecoration2::DecoratedClient *decoratedClient, KDecoration2::Decoration *decoration);
|
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
|
|
|
~DecoratedClientImpl() override;
|
2014-07-22 11:11:19 +00:00
|
|
|
QString caption() const override;
|
|
|
|
WId decorationId() const override;
|
|
|
|
int desktop() const override;
|
|
|
|
int height() const override;
|
|
|
|
QIcon icon() const override;
|
|
|
|
bool isActive() const override;
|
|
|
|
bool isCloseable() const override;
|
|
|
|
bool isKeepAbove() const override;
|
|
|
|
bool isKeepBelow() const override;
|
2014-10-23 08:56:43 +00:00
|
|
|
bool isMaximizeable() const override;
|
2014-07-22 11:11:19 +00:00
|
|
|
bool isMaximized() const override;
|
|
|
|
bool isMaximizedHorizontally() const override;
|
|
|
|
bool isMaximizedVertically() const override;
|
2014-10-23 08:56:43 +00:00
|
|
|
bool isMinimizeable() const override;
|
2014-07-22 11:11:19 +00:00
|
|
|
bool isModal() const override;
|
2014-10-23 08:56:43 +00:00
|
|
|
bool isMoveable() const override;
|
2014-07-22 11:11:19 +00:00
|
|
|
bool isOnAllDesktops() const override;
|
2014-10-23 08:56:43 +00:00
|
|
|
bool isResizeable() const override;
|
2014-07-22 11:11:19 +00:00
|
|
|
bool isShadeable() const override;
|
|
|
|
bool isShaded() const override;
|
|
|
|
QPalette palette() const override;
|
2015-03-31 13:26:42 +00:00
|
|
|
QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override;
|
2014-07-22 11:11:19 +00:00
|
|
|
bool providesContextHelp() const override;
|
2020-01-27 13:16:02 +00:00
|
|
|
QSize size() const override;
|
2014-07-22 11:11:19 +00:00
|
|
|
int width() const override;
|
|
|
|
WId windowId() const override;
|
|
|
|
|
2014-11-11 13:33:31 +00:00
|
|
|
Qt::Edges adjacentScreenEdges() const override;
|
2014-07-25 09:20:34 +00:00
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
bool hasApplicationMenu() const override;
|
|
|
|
bool isApplicationMenuActive() const override;
|
|
|
|
|
2018-01-18 18:59:17 +00:00
|
|
|
void requestShowToolTip(const QString &text) override;
|
|
|
|
void requestHideToolTip() override;
|
2014-07-22 11:11:19 +00:00
|
|
|
void requestClose() override;
|
|
|
|
void requestContextHelp() override;
|
2014-11-11 08:53:54 +00:00
|
|
|
void requestToggleMaximization(Qt::MouseButtons buttons) override;
|
2014-07-22 11:11:19 +00:00
|
|
|
void requestMinimize() override;
|
|
|
|
void requestShowWindowMenu() override;
|
2017-01-11 09:21:03 +00:00
|
|
|
void requestShowApplicationMenu(const QRect &rect, int actionId) override;
|
2014-07-22 11:11:19 +00:00
|
|
|
void requestToggleKeepAbove() override;
|
|
|
|
void requestToggleKeepBelow() override;
|
|
|
|
void requestToggleOnAllDesktops() override;
|
|
|
|
void requestToggleShade() 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 showApplicationMenu(int actionId) override;
|
2017-01-11 09:21:03 +00:00
|
|
|
|
2015-12-03 16:12:25 +00:00
|
|
|
AbstractClient *client() {
|
2014-07-22 11:11:19 +00:00
|
|
|
return m_client;
|
|
|
|
}
|
|
|
|
Renderer *renderer() {
|
|
|
|
return m_renderer;
|
|
|
|
}
|
|
|
|
KDecoration2::DecoratedClient *decoratedClient() {
|
|
|
|
return KDecoration2::DecoratedClientPrivate::client();
|
|
|
|
}
|
|
|
|
|
2016-01-07 22:12:40 +00:00
|
|
|
void signalShadeChange();
|
|
|
|
|
2016-05-11 11:33:03 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void delayedRequestToggleMaximization(Options::WindowOperation operation);
|
|
|
|
|
2014-07-22 11:11:19 +00:00
|
|
|
private:
|
|
|
|
void createRenderer();
|
2019-02-20 13:09:37 +00:00
|
|
|
void destroyRenderer();
|
2015-12-03 16:12:25 +00:00
|
|
|
AbstractClient *m_client;
|
2016-08-10 08:48:55 +00:00
|
|
|
QSize m_clientSize;
|
2014-07-22 11:11:19 +00:00
|
|
|
Renderer *m_renderer;
|
2016-05-23 07:28:27 +00:00
|
|
|
QMetaObject::Connection m_compositorToggledConnection;
|
Improve tooltips behavior
Summary:
Window buttons tooltips used to appear on hover immediately. As
the result, they mostly appeared when not needed e.g. when user
was closing a window, or when the mouse pointer slightly touched
a button while being moved elsewhere.
This commit changes the tooltips behavior to WakeUp-FallAsleep
approach used by Widgets.
BUG: 392765
FIXED-IN: 5.13
Reviewers: #kwin, graesslin, broulik, #plasma
Reviewed By: #kwin, graesslin, #plasma
Subscribers: zzag, broulik, kwin, hein
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12404
2018-04-22 17:40:54 +00:00
|
|
|
|
|
|
|
QString m_toolTipText;
|
|
|
|
QTimer m_toolTipWakeUp;
|
|
|
|
QDeadlineTimer m_toolTipFallAsleep;
|
2018-06-03 11:29:36 +00:00
|
|
|
bool m_toolTipShowing = false;
|
2014-07-22 11:11:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|