Add virtual AbstractClient::showContextHelp and ::providesContextHelp

Required in the context of decorations. Default implementation does
nothing respectively returns false.
This commit is contained in:
Martin Gräßlin 2015-12-03 17:11:14 +01:00
parent 5de55b61e7
commit ae28c2499d
3 changed files with 36 additions and 7 deletions

View file

@ -1461,4 +1461,13 @@ void AbstractClient::startDecorationDoubleClickTimer()
m_decorationDoubleClickTimer.start();
}
bool AbstractClient::providesContextHelp() const
{
return false;
}
void AbstractClient::showContextHelp()
{
}
}

View file

@ -213,6 +213,11 @@ class KWIN_EXPORT AbstractClient : public Toplevel
* If this property gets abused by application developers, it will be removed again.
**/
Q_PROPERTY(bool noBorder READ noBorder WRITE setNoBorder)
/**
* Whether the Client provides context help. Mostly needed by decorations to decide whether to
* show the help button or not.
**/
Q_PROPERTY(bool providesContextHelp READ providesContextHelp CONSTANT)
public:
virtual ~AbstractClient();
@ -511,6 +516,26 @@ public:
bool processDecorationButtonPress(QMouseEvent *event, bool ignoreMenu = false);
void processDecorationButtonRelease(QMouseEvent *event);
/**
* Returns whether the window provides context help or not. If it does,
* you should show a help menu item or a help button like '?' and call
* contextHelp() if this is invoked.
*
* Default implementation returns @c false.
* @see showContextHelp;
*/
virtual bool providesContextHelp() const;
/**
* Invokes context help on the window. Only works if the window
* actually provides context help.
*
* Default implementation does nothing.
*
* @see providesContextHelp()
*/
virtual void showContextHelp();
// TODO: remove boolean trap
static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, bool active_hack = false);

View file

@ -89,11 +89,6 @@ class Client
* @see moveable
**/
Q_PROPERTY(bool moveableAcrossScreens READ isMovableAcrossScreens)
/**
* Whether the Client provides context help. Mostly needed by decorations to decide whether to
* show the help button or not.
**/
Q_PROPERTY(bool providesContextHelp READ providesContextHelp CONSTANT)
/**
* Whether the Client can be resized. The property is evaluated each time it is invoked.
* Because of that there is no notify signal.
@ -236,7 +231,7 @@ public:
void resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet);
QSize sizeForClientSize(const QSize&, Sizemode mode = SizemodeAny, bool noframe = false) const override;
bool providesContextHelp() const;
bool providesContextHelp() const override;
const QKeySequence &shortcut() const override;
void setShortcut(const QString& cut) override;
@ -286,7 +281,7 @@ public:
void killWindow();
void toggleShade();
void showContextHelp();
void showContextHelp() override;
void cancelShadeHoverTimer();
void checkActiveModal();
StrutRect strutRect(StrutArea area) const;