FullScreen Property

Setter and notify signal.
This commit is contained in:
Martin Gräßlin 2011-12-22 15:34:55 +01:00
parent 141acf7131
commit 7678667b5a
2 changed files with 13 additions and 3 deletions

View file

@ -90,8 +90,12 @@ class Client
* The desktop this Client is on. If the Client is on all desktops the property has value -1.
**/
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
// TODO: notify signal, proper setter with only one attribute
Q_PROPERTY(bool fullScreen READ isFullScreen)
/**
* Whether this Client is fullScreen. A Client might either be fullScreen due to the _NET_WM property
* or through a legacy support hack. The fullScreen state can only be changed if the Client does not
* use the legacy hack. To be sure whether the state changed, connect to the notify signal.
**/
Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
Q_PROPERTY(bool fullScreenable READ isFullScreenable)
// TODO: notify signal
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
@ -221,7 +225,7 @@ public:
void setMaximize(bool vertically, bool horizontally);
QRect iconGeometry() const;
void setFullScreen(bool set, bool user);
void setFullScreen(bool set, bool user = true);
bool isFullScreen() const;
bool isFullScreenable(bool fullscreen_hack = false) const;
bool isActiveFullScreen() const;
@ -533,6 +537,7 @@ signals:
void activeChanged();
void captionChanged();
void desktopChanged();
void fullScreenChanged();
private:
void exportMappingState(int s); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1

View file

@ -2428,6 +2428,9 @@ void Client::setFullScreen(bool set, bool user)
#endif
emit s_fullScreenSet(set, user);
if (was_fs != isFullScreen()) {
emit fullScreenChanged();
}
}
@ -2502,10 +2505,12 @@ void Client::updateFullScreenHack(const QRect& geom)
} else
geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop());
setGeometry(geom);
emit fullScreenChanged();
} else if (fullscreen_mode == FullScreenHack && type == 0) {
fullscreen_mode = FullScreenNone;
updateDecoration(false, false);
// whoever called this must setup correct geometry
emit fullScreenChanged();
}
StackingUpdatesBlocker blocker(workspace());
workspace()->updateClientLayer(this); // active fullscreens get different layer