aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Fuchs <mat69@gmx.net>2011-07-28 21:49:08 (GMT)
committerMatthias Fuchs <mat69@gmx.net>2011-08-15 17:01:43 (GMT)
commitd35ec6d18377fd872207b88dd39f560a483bcc14 (patch)
tree87b4ffb2174c7ee9370845704f8106a7017d7a3e
parent50a702395842ce1bacb7a2a3f68ed4614fe26a2a (diff)
Fixes disabling fullscreen for windows using two displays.
Dragging a fullscreen window to another screen and then disabling fullscreen keeps the window at the new screen. BUG:261704 FIXED-IN:4.7.1 REVIEW:102103
-rw-r--r--kwin/client.h1
-rw-r--r--kwin/geometry.cpp24
2 files changed, 22 insertions, 3 deletions
diff --git a/kwin/client.h b/kwin/client.h
index 32ce6f7..c0a87db 100644
--- a/kwin/client.h
+++ b/kwin/client.h
@@ -644,6 +644,7 @@ private:
uint urgency : 1; ///< XWMHints, UrgencyHint
uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client
uint demands_attention : 1;
+ int m_screenNum;
bool blocks_compositing;
WindowRules client_rules;
void getWMHints();
diff --git a/kwin/geometry.cpp b/kwin/geometry.cpp
index c5e4fd9..4a05392 100644
--- a/kwin/geometry.cpp
+++ b/kwin/geometry.cpp
@@ -2387,8 +2387,10 @@ void Client::setFullScreen(bool set, bool user)
set = rules()->checkFullScreen(set);
setShade(ShadeNone);
bool was_fs = isFullScreen();
- if (!was_fs)
+ if (!was_fs) {
geom_fs_restore = geometry();
+ m_screenNum = workspace()->activeScreen();
+ }
fullscreen_mode = set ? FullScreenNormal : FullScreenNone;
if (was_fs == isFullScreen())
return;
@@ -2405,10 +2407,26 @@ void Client::setFullScreen(bool set, bool user)
else
setGeometry(workspace()->clientArea(FullScreenArea, this));
else {
- if (!geom_fs_restore.isNull())
+ if (!geom_fs_restore.isNull()) {
+ //adapt geom_fs_restore to the current screen geometry if needed
+ const int newScreen = workspace()->activeScreen();
+ if (options->xineramaFullscreenEnabled && (newScreen != m_screenNum)) {
+ const QRect oldGeom = workspace()->screenGeometry(m_screenNum);
+ const QRect newGeom = workspace()->screenGeometry(newScreen);
+ if (oldGeom.isValid()) {
+ const QPoint dist = geom_fs_restore.topLeft() - oldGeom.topLeft();
+ geom_fs_restore.moveTopLeft(newGeom.topLeft() + dist);
+
+ //make sure that the client is still visible
+ if (!newGeom.intersects(geom_fs_restore)) {
+ geom_fs_restore.moveTopLeft(newGeom.topLeft());
+ }
+ }
+ }
setGeometry(QRect(geom_fs_restore.topLeft(), adjustedSize(geom_fs_restore.size())));
+ checkWorkspacePosition();
// TODO isShaded() ?
- else {
+ } else {
// does this ever happen?
setGeometry(workspace()->clientArea(MaximizeArea, this));
}