Move implementation of demanding attention to AbstractClient

icc-effect-5.14.5
Martin Gräßlin 2015-03-13 11:19:46 +01:00
parent 16568804be
commit e672a53721
5 changed files with 33 additions and 32 deletions

View File

@ -225,4 +225,18 @@ bool AbstractClient::isSpecialWindow() const
return isDesktop() || isDock() || isSplash() || isToolbar() || isNotification() || isOnScreenDisplay();
}
void AbstractClient::demandAttention(bool set)
{
if (isActive())
set = false;
if (m_demandsAttention == set)
return;
m_demandsAttention = set;
if (info) {
info->setState(set ? NET::DemandsAttention : NET::States(0), NET::DemandsAttention);
}
workspace()->clientAttentionChanged(this, set);
emit demandsAttentionChanged();
}
}

View File

@ -73,6 +73,15 @@ class AbstractClient : public Toplevel
* Because of that no changed signal is provided.
**/
Q_PROPERTY(bool specialWindow READ isSpecialWindow)
/**
* Whether window state _NET_WM_STATE_DEMANDS_ATTENTION is set. This state indicates that some
* action in or with the window happened. For example, it may be set by the Window Manager if
* the window requested activation but the Window Manager refused it, or the application may set
* it if it finished some work. This state may be set by both the Client and the Window Manager.
* It should be unset by the Window Manager when it decides the window got the required attention
* (usually, that it got activated).
**/
Q_PROPERTY(bool demandsAttention READ isDemandingAttention WRITE demandAttention NOTIFY demandsAttentionChanged)
public:
virtual ~AbstractClient();
@ -115,6 +124,11 @@ public:
}
void setKeepBelow(bool);
void demandAttention(bool set = true);
bool isDemandingAttention() const {
return m_demandsAttention;
}
void cancelAutoRaise();
bool wantsTabFocus() const;
@ -172,7 +186,6 @@ public:
virtual bool wantsInput() const = 0;
virtual void checkWorkspacePosition(QRect oldGeometry = QRect(), int oldDesktop = -2) = 0;
virtual xcb_timestamp_t userTime() const;
virtual void demandAttention(bool set = true) = 0;
virtual void updateWindowRules(Rules::Types selection) = 0;
virtual void growHorizontal();
@ -230,6 +243,10 @@ Q_SIGNALS:
void activeChanged();
void keepAboveChanged(bool);
void keepBelowChanged(bool);
/**
* Emitted whenever the demands attention state changes.
**/
void demandsAttentionChanged();
protected:
AbstractClient();
@ -271,6 +288,7 @@ private:
bool m_active = false;
bool m_keepAbove = false;
bool m_keepBelow = false;
bool m_demandsAttention = false;
QTimer *m_autoRaiseTimer = nullptr;
};

View File

@ -684,18 +684,6 @@ xcb_timestamp_t Client::readUserCreationTime() const
return prop.value<xcb_timestamp_t>(-1);
}
void Client::demandAttention(bool set)
{
if (isActive())
set = false;
if (demands_attention == set)
return;
demands_attention = set;
info->setState(set ? NET::DemandsAttention : NET::States(0), NET::DemandsAttention);
workspace()->clientAttentionChanged(this, set);
emit demandsAttentionChanged();
}
xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, const KStartupInfoData *asn_data,
bool session) const
{

View File

@ -166,7 +166,6 @@ Client::Client()
noborder = false;
app_noborder = false;
ignore_focus_stealing = false;
demands_attention = false;
check_active_modal = false;
skip_pager = false;

View File

@ -222,15 +222,6 @@ class Client
* If this property gets abused by application developers, it will be removed again.
**/
Q_PROPERTY(bool noBorder READ noBorder WRITE setNoBorder)
/**
* Whether window state _NET_WM_STATE_DEMANDS_ATTENTION is set. This state indicates that some
* action in or with the window happened. For example, it may be set by the Window Manager if
* the window requested activation but the Window Manager refused it, or the application may set
* it if it finished some work. This state may be set by both the Client and the Window Manager.
* It should be unset by the Window Manager when it decides the window got the required attention
* (usually, that it got activated).
**/
Q_PROPERTY(bool demandsAttention READ isDemandingAttention WRITE demandAttention NOTIFY demandsAttentionChanged)
/**
* A client can block compositing. That is while the Client is alive and the state is set,
* Compositing is suspended and is resumed when there are no Clients blocking compositing any
@ -380,10 +371,6 @@ public:
bool isCloseable() const override; ///< May be closed by the user (May have a close button)
void takeFocus() override;
bool isDemandingAttention() const {
return demands_attention;
}
void demandAttention(bool set = true) override;
void updateDecoration(bool check_workspace_pos, bool force = false);
void triggerDecorationRepaint();
@ -683,10 +670,6 @@ Q_SIGNALS:
*/
void appMenuUnavailable();
/**
* Emitted whenever the demands attention state changes.
**/
void demandsAttentionChanged();
/**
* Emitted whenever the Client's block compositing state changes.
**/
@ -852,7 +835,6 @@ private:
uint noborder : 1;
uint app_noborder : 1; ///< App requested no border via window type, shape extension, etc.
uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client
uint demands_attention : 1;
bool blocks_compositing;
WindowRules client_rules;
Qt::CursorShape m_cursor;