kwin/convergentwindows: keep current window maximized bugfix

This fix maximizes the current window if it ever leaves a fullscreen or maximized state. This is to fix a bug where if a window exits fullscreen mode, it will not return back to a maximized state.
This commit is contained in:
Micah Stanley 2024-11-13 17:37:09 +00:00 committed by Devin Lin
parent c2f91fa407
commit 36f0d175fd

View file

@ -9,6 +9,8 @@ import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
Loader { Loader {
id: root id: root
property var currentWindow
function run(window) { function run(window) {
// HACK: don't maximize xwaylandvideobridge // HACK: don't maximize xwaylandvideobridge
// see: https://invent.kde.org/plasma/plasma-mobile/-/issues/324 // see: https://invent.kde.org/plasma/plasma-mobile/-/issues/324
@ -44,6 +46,27 @@ Loader {
} }
} }
Connections {
target: currentWindow
function onFullScreenChanged() {
currentWindow.interactiveMoveResizeFinished.connect((currentWindow) => {
root.run(currentWindow);
});
root.run(currentWindow);
}
function onMaximizedChanged() {
if (!currentWindow.maximizable) {
return;
}
currentWindow.interactiveMoveResizeFinished.connect((currentWindow) => {
root.run(currentWindow);
});
root.run(currentWindow);
}
}
Connections { Connections {
target: ShellSettings.Settings target: ShellSettings.Settings
@ -70,6 +93,16 @@ Loader {
} }
} }
function onWindowActivated(window) {
if (window.normalWindow) {
currentWindow = window;
window.interactiveMoveResizeFinished.connect((window) => {
root.run(window);
});
root.run(window);
}
}
function onScreensChanged() { function onScreensChanged() {
// Windows are moved from the external screen // Windows are moved from the external screen
// to the internal screen if the external screen // to the internal screen if the external screen