Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
5d548179
Commit
5d548179
authored
Jan 20, 2021
by
Xaver Hugl
Browse files
Fix fullscreen moveresize and set geometry restore to the screen a fullscreen client gets moved to
parent
bd626d95
Changes
8
Hide whitespace changes
Inline
Side-by-side
abstract_client.cpp
View file @
5d548179
...
...
@@ -1000,14 +1000,15 @@ void AbstractClient::finishMoveResize(bool cancel)
checkScreen
();
// needs to be done because clientFinishUserMovedResized has not yet re-activated online alignment
if
(
screen
()
!=
moveResizeStartScreen
())
{
workspace
()
->
sendClientToScreen
(
this
,
screen
());
// checks rule validity
if
(
maximizeMode
()
!=
MaximizeRestore
)
if
(
maximizeMode
()
!=
MaximizeRestore
)
{
checkWorkspacePosition
();
}
}
if
(
isElectricBorderMaximizing
())
{
setQuickTileMode
(
electricBorderMode
());
setElectricBorderMaximizing
(
false
);
}
else
if
(
!
cancel
)
{
}
else
if
(
!
cancel
&&
!
isFullScreen
()
)
{
QRect
geom_restore
=
geometryRestore
();
if
(
!
(
maximizeMode
()
&
MaximizeHorizontal
))
{
geom_restore
.
setX
(
frameGeometry
().
x
());
...
...
@@ -3065,7 +3066,7 @@ void AbstractClient::sendToScreen(int newScreen)
}
}
}
if
(
screen
()
==
newScreen
)
// Don't use isOnScreen(), that's true even when only partially
if
(
screen
()
==
newScreen
&&
!
isFullScreen
()
)
// Don't use isOnScreen(), that's true even when only partially
return
;
GeometryUpdatesBlocker
blocker
(
this
);
...
...
@@ -3107,14 +3108,34 @@ void AbstractClient::sendToScreen(int newScreen)
keepInArea
(
screenArea
);
}
// align geom_restore - checkWorkspacePosition operates on it
setGeometryRestore
(
frameGeometry
());
if
(
isFullScreen
())
{
QRect
newFullScreenGeometryRestore
=
screenArea
;
if
(
!
(
maximizeMode
()
&
MaximizeVertical
))
{
newFullScreenGeometryRestore
.
setHeight
(
geometryRestore
().
height
());
}
if
(
!
(
maximizeMode
()
&
MaximizeHorizontal
))
{
newFullScreenGeometryRestore
.
setWidth
(
geometryRestore
().
width
());
}
newFullScreenGeometryRestore
.
setSize
(
newFullScreenGeometryRestore
.
size
().
boundedTo
(
screenArea
.
size
()));
QSize
move
=
(
screenArea
.
size
()
-
newFullScreenGeometryRestore
.
size
())
/
2
;
newFullScreenGeometryRestore
.
translate
(
move
.
width
(),
move
.
height
());
checkWorkspacePosition
(
oldGeom
);
QRect
newGeometryRestore
=
QRect
(
screenArea
.
topLeft
(),
geometryRestore
().
size
().
boundedTo
(
screenArea
.
size
()));
move
=
(
screenArea
.
size
()
-
newGeometryRestore
.
size
())
/
2
;
newGeometryRestore
.
translate
(
move
.
width
(),
move
.
height
());
// re-align geom_restore to constrained geometry
setGeometryRestore
(
frameGeometry
());
setFullscreenGeometryRestore
(
newFullScreenGeometryRestore
);
setGeometryRestore
(
newGeometryRestore
);
checkWorkspacePosition
(
oldGeom
);
}
else
{
// align geom_restore - checkWorkspacePosition operates on it
setGeometryRestore
(
frameGeometry
());
checkWorkspacePosition
(
oldGeom
);
// re-align geom_restore to constrained geometry
setGeometryRestore
(
frameGeometry
());
}
// finally reset special states
// NOTICE that MaximizeRestore/QuickTileFlag::None checks are required.
// eg. setting QuickTileFlag::None would break maximization
...
...
@@ -3142,7 +3163,7 @@ void AbstractClient::checkWorkspacePosition(QRect oldGeometry, int oldDesktop, Q
if
(
!
oldClientGeometry
.
isValid
())
oldClientGeometry
=
oldGeometry
.
adjusted
(
border
[
Left
],
border
[
Top
],
-
border
[
Right
],
-
border
[
Bottom
]);
if
(
isFullScreen
())
{
QRect
area
=
workspace
()
->
clientArea
(
FullScreenArea
,
g
eometryRestore
().
center
(),
desktop
());
QRect
area
=
workspace
()
->
clientArea
(
FullScreenArea
,
fullscreenG
eometryRestore
().
center
(),
desktop
());
if
(
frameGeometry
()
!=
area
)
setFrameGeometry
(
area
);
return
;
...
...
@@ -3560,4 +3581,13 @@ bool AbstractClient::isPlaceable() const
return
true
;
}
QRect
AbstractClient
::
fullscreenGeometryRestore
()
const
{
return
m_fullscreenGeometryRestore
;
}
void
AbstractClient
::
setFullscreenGeometryRestore
(
const
QRect
&
geom
)
{
m_fullscreenGeometryRestore
=
geom
;
}
}
abstract_client.h
View file @
5d548179
...
...
@@ -868,6 +868,8 @@ public:
return
m_windowManagementInterface
;
}
QRect
fullscreenGeometryRestore
()
const
;
public
Q_SLOTS
:
virtual
void
closeWindow
()
=
0
;
...
...
@@ -1222,6 +1224,8 @@ protected:
void
setKeyboardGeometryRestore
(
const
QRect
&
geom
);
QRect
m_virtualKeyboardGeometry
;
void
setFullscreenGeometryRestore
(
const
QRect
&
geom
);
private
Q_SLOTS
:
void
shadeHover
();
void
shadeUnhover
();
...
...
@@ -1278,6 +1282,7 @@ private:
QRect
m_clientGeometryBeforeUpdateBlocking
;
QRect
m_keyboardGeometryRestore
;
QRect
m_maximizeGeometryRestore
;
QRect
m_fullscreenGeometryRestore
;
struct
{
bool
enabled
=
false
;
...
...
effects/fullscreen/package/contents/code/fullscreen.js
View file @
5d548179
...
...
@@ -21,9 +21,6 @@ var fullScreenEffect = {
var
oldGeometry
,
newGeometry
;
oldGeometry
=
window
.
oldGeometry
;
newGeometry
=
window
.
geometry
;
if
(
oldGeometry
.
width
==
newGeometry
.
width
&&
oldGeometry
.
height
==
newGeometry
.
height
)
oldGeometry
=
window
.
olderGeometry
;
window
.
olderGeometry
=
window
.
oldGeometry
;
window
.
oldGeometry
=
newGeometry
;
window
.
fullScreenAnimation1
=
animate
({
window
:
window
,
...
...
@@ -81,7 +78,6 @@ var fullScreenEffect = {
}
}
window
.
oldGeometry
=
window
.
geometry
;
window
.
olderGeometry
=
oldGeometry
;
},
init
:
function
()
{
effect
.
configChanged
.
connect
(
fullScreenEffect
.
loadConfig
);
...
...
sm.cpp
View file @
5d548179
...
...
@@ -133,7 +133,7 @@ void Workspace::storeClient(KConfigGroup &cg, int num, X11Client *c)
cg
.
writeEntry
(
QLatin1String
(
"resourceClass"
)
+
n
,
c
->
resourceClass
().
constData
());
cg
.
writeEntry
(
QLatin1String
(
"geometry"
)
+
n
,
QRect
(
c
->
calculateGravitation
(
true
),
c
->
clientSize
()));
// FRAME
cg
.
writeEntry
(
QLatin1String
(
"restore"
)
+
n
,
c
->
geometryRestore
());
cg
.
writeEntry
(
QLatin1String
(
"fsrestore"
)
+
n
,
c
->
g
eometry
FS
Restore
());
cg
.
writeEntry
(
QLatin1String
(
"fsrestore"
)
+
n
,
c
->
fullscreenG
eometryRestore
());
cg
.
writeEntry
(
QLatin1String
(
"maximize"
)
+
n
,
(
int
)
c
->
maximizeMode
());
cg
.
writeEntry
(
QLatin1String
(
"fullscreen"
)
+
n
,
(
int
)
c
->
fullScreenMode
());
cg
.
writeEntry
(
QLatin1String
(
"desktop"
)
+
n
,
c
->
desktop
());
...
...
x11client.cpp
View file @
5d548179
...
...
@@ -743,12 +743,14 @@ bool X11Client::manage(xcb_window_t w, bool isMapped)
}
if
(
session
->
fullscreen
!=
FullScreenNone
)
{
setFullScreen
(
true
,
false
);
geom_fs_r
estore
=
session
->
fsrestore
;
setFullscreenGeometryR
estore
(
session
->
fsrestore
)
;
}
QRect
checkedGeometryRestore
=
geometryRestore
();
checkOffscreenPosition
(
&
checkedGeometryRestore
,
area
);
checkOffscreenPosition
(
&
geom_fs_restore
,
area
);
setGeometryRestore
(
checkedGeometryRestore
);
QRect
checkedFullscreenGeometryRestore
=
fullscreenGeometryRestore
();
checkOffscreenPosition
(
&
checkedFullscreenGeometryRestore
,
area
);
setFullscreenGeometryRestore
(
checkedFullscreenGeometryRestore
);
}
else
{
// Window may want to be maximized
// done after checking that the window isn't larger than the workarea, so that
...
...
@@ -4597,7 +4599,7 @@ void X11Client::setFullScreen(bool set, bool user)
if
(
wasFullscreen
)
{
workspace
()
->
updateFocusMousePosition
(
Cursors
::
self
()
->
mouse
()
->
pos
());
// may cause leave event
}
else
{
geom_fs_r
estore
=
frameGeometry
();
setFullscreenGeometryR
estore
(
frameGeometry
()
)
;
}
if
(
set
)
{
...
...
@@ -4623,9 +4625,9 @@ void X11Client::setFullScreen(bool set, bool user)
setFrameGeometry
(
workspace
()
->
clientArea
(
FullScreenArea
,
this
));
}
}
else
{
Q_ASSERT
(
!
geom_fs_r
estore
.
isNull
());
Q_ASSERT
(
!
fullscreenGeometryR
estore
()
.
isNull
());
const
int
currentScreen
=
screen
();
setFrameGeometry
(
QRect
(
geom_fs_r
estore
.
topLeft
(),
constrainFrameSize
(
geom_fs_r
estore
.
size
())));
setFrameGeometry
(
QRect
(
fullscreenGeometryR
estore
()
.
topLeft
(),
constrainFrameSize
(
fullscreenGeometryR
estore
()
.
size
())));
if
(
currentScreen
!=
screen
())
{
workspace
()
->
sendClientToScreen
(
this
,
currentScreen
);
}
...
...
x11client.h
View file @
5d548179
...
...
@@ -144,9 +144,6 @@ public:
void
setFullScreen
(
bool
set
,
bool
user
=
true
)
override
;
bool
isFullScreen
()
const
override
;
bool
userCanSetFullScreen
()
const
override
;
QRect
geometryFSRestore
()
const
{
return
geom_fs_restore
;
// only for session saving
}
int
fullScreenMode
()
const
{
return
m_fullscreenMode
;
// only for session saving
}
...
...
@@ -484,7 +481,6 @@ private:
MaximizeMode
max_mode
;
QRect
m_bufferGeometry
=
QRect
(
0
,
0
,
100
,
100
);
QRect
geom_fs_restore
;
xcb_colormap_t
m_colormap
;
QString
cap_normal
,
cap_iconic
,
cap_suffix
;
Group
*
in_group
;
...
...
xdgshellclient.cpp
View file @
5d548179
...
...
@@ -1545,7 +1545,7 @@ void XdgToplevelClient::setFullScreen(bool set, bool user)
if
(
wasFullscreen
)
{
workspace
()
->
updateFocusMousePosition
(
Cursors
::
self
()
->
mouse
()
->
pos
());
// may cause leave event
}
else
{
m_f
ull
S
creenGeometryRestore
=
frameGeometry
();
setF
ull
s
creenGeometryRestore
(
frameGeometry
()
)
;
}
m_isFullScreen
=
set
;
...
...
@@ -1566,10 +1566,10 @@ void XdgToplevelClient::setFullScreen(bool set, bool user)
setFrameGeometry
(
workspace
()
->
clientArea
(
FullScreenArea
,
screen
,
desktop
()));
}
else
{
m_fullScreenRequestedOutput
.
clear
();
if
(
m_
full
S
creenGeometryRestore
.
isValid
())
{
if
(
full
s
creenGeometryRestore
()
.
isValid
())
{
int
currentScreen
=
screen
();
setFrameGeometry
(
QRect
(
m_
full
S
creenGeometryRestore
.
topLeft
(),
constrainFrameSize
(
m_
full
S
creenGeometryRestore
.
size
())));
setFrameGeometry
(
QRect
(
full
s
creenGeometryRestore
()
.
topLeft
(),
constrainFrameSize
(
full
s
creenGeometryRestore
()
.
size
())));
if
(
currentScreen
!=
screen
())
workspace
()
->
sendClientToScreen
(
this
,
currentScreen
);
}
else
{
...
...
xdgshellclient.h
View file @
5d548179
...
...
@@ -208,7 +208,6 @@ private:
KWaylandServer
::
XdgToplevelInterface
::
States
m_acknowledgedStates
;
KWaylandServer
::
XdgToplevelInterface
::
States
m_initialStates
;
QMap
<
quint32
,
PingReason
>
m_pings
;
QRect
m_fullScreenGeometryRestore
;
NET
::
WindowType
m_windowType
=
NET
::
Normal
;
MaximizeMode
m_maximizeMode
=
MaximizeRestore
;
MaximizeMode
m_requestedMaximizeMode
=
MaximizeRestore
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment