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
(cherry picked from commit d35ec6d18377fd872207b88dd39f560a483bcc14)
This commit is contained in:
Matthias Fuchs 2011-07-28 23:49:08 +02:00
parent 4f50a8df3c
commit 7d67380205
2 changed files with 22 additions and 3 deletions

View file

@ -643,6 +643,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();

View file

@ -2354,8 +2354,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;
@ -2372,10 +2374,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));
}