2014-07-22 11:11:19 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#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);
|
2014-07-22 11:11:19 +00:00
|
|
|
virtual ~DecoratedClientImpl();
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
void showApplicationMenu(int actionId);
|
|
|
|
|
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
|