Commit 305699be authored by Martin Flöser's avatar Martin Flöser

Move modal from Client to AbstractClient

parent 1d242d9d
......@@ -845,4 +845,20 @@ QList<AbstractClient*> AbstractClient::allMainClients() const
return result;
}
void AbstractClient::setModal(bool m)
{
// Qt-3.2 can have even modal normal windows :(
if (m_modal == m)
return;
m_modal = m;
emit modalChanged();
// Changing modality for a mapped window is weird (?)
// _NET_WM_STATE_MODAL should possibly rather be _NET_WM_WINDOW_TYPE_MODAL_DIALOG
}
bool AbstractClient::isModal() const
{
return m_modal;
}
}
......@@ -170,6 +170,10 @@ class AbstractClient : public Toplevel
* The Client to which this Client is a transient if any.
**/
Q_PROPERTY(KWin::AbstractClient *transientFor READ transientFor NOTIFY transientChanged)
/**
* Whether the Client represents a modal window.
**/
Q_PROPERTY(bool modal READ isModal NOTIFY modalChanged)
public:
virtual ~AbstractClient();
......@@ -391,6 +395,9 @@ public:
virtual bool hasStrut() const;
void setModal(bool modal);
bool isModal() const;
/**
* Determines the mouse command for the given @p button in the current state.
*
......@@ -431,6 +438,7 @@ Q_SIGNALS:
void clientMaximizedStateChanged(KWin::AbstractClient*, MaximizeMode);
void clientMaximizedStateChanged(KWin::AbstractClient* c, bool h, bool v);
void transientChanged();
void modalChanged();
protected:
AbstractClient();
......@@ -518,6 +526,7 @@ private:
KWayland::Server::PlasmaWindowInterface *m_windowManagementInterface = nullptr;
AbstractClient *m_transientFor = nullptr;
bool m_modal = false;
};
inline void AbstractClient::move(const QPoint& p, ForceGeometry_t force)
......
......@@ -155,7 +155,6 @@ Client::Client()
deleting = false;
fullscreen_mode = FullScreenNone;
hidden = false;
modal = false;
noborder = false;
app_noborder = false;
ignore_focus_stealing = false;
......@@ -1210,17 +1209,6 @@ void Client::doSetSkipPager()
info->setState(skipPager() ? NET::SkipPager : NET::States(0), NET::SkipPager);
}
void Client::setModal(bool m)
{
// Qt-3.2 can have even modal normal windows :(
if (modal == m)
return;
modal = m;
emit modalChanged();
// Changing modality for a mapped window is weird (?)
// _NET_WM_STATE_MODAL should possibly rather be _NET_WM_WINDOW_TYPE_MODAL_DIALOG
}
void Client::doSetDesktop(int desktop, int was_desk)
{
info->setDesktop(desktop);
......
......@@ -86,10 +86,6 @@ class Client
* Because of that there is no notify signal.
**/
Q_PROPERTY(bool maximizable READ isMaximizable)
/**
* Whether the Client represents a modal window.
**/
Q_PROPERTY(bool modal READ isModal NOTIFY modalChanged)
/**
* Whether the Client is moveable. Even if it is not moveable, it might be possible to move
* it to another screen. The property is evaluated each time it is invoked.
......@@ -276,9 +272,6 @@ public:
void updateLayer() override;
int sessionStackingOrder() const;
void setModal(bool modal);
bool isModal() const;
// Auxiliary functions, depend on the windowType
bool wantsInput() const override;
......@@ -544,7 +537,6 @@ Q_SIGNALS:
void clientStartUserMovedResized(KWin::Client*);
void clientStepUserMovedResized(KWin::Client *, const QRect&);
void clientFinishUserMovedResized(KWin::Client*);
void modalChanged();
void moveResizedChanged();
/**
......@@ -722,7 +714,6 @@ private:
uint deleting : 1; ///< True when doing cleanup and destroying the client
Xcb::MotifHints m_motif;
uint hidden : 1; ///< Forcibly hidden by calling hide()
uint modal : 1; ///< NET::Modal
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
......@@ -900,11 +891,6 @@ inline bool Client::isFullScreen() const
return fullscreen_mode != FullScreenNone;
}
inline bool Client::isModal() const
{
return modal;
}
inline bool Client::hasNETSupport() const
{
return info->hasNETSupport();
......
......@@ -138,7 +138,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
updateUrgency();
updateAllowedActions(); // Group affects isMinimizable()
modal = (info->state() & NET::Modal) != 0; // Needs to be valid before handling groups
setModal((info->state() & NET::Modal) != 0); // Needs to be valid before handling groups
readTransientProperty(transientCookie);
getIcons();
m_geometryHints.read();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment