Aetf / kwin-maxmize-to-new-desktop

KWin script that moves fullscreened window to a new virtual desktop
BSD 2-Clause "Simplified" License
55 stars 20 forks source link

When Wine window starts fulscreen it doesn't create a desktop #18

Open kerriganx opened 2 years ago

kerriganx commented 2 years ago
  1. Open any game through Wine.
  2. It starts fullscreen but new desktop does not appear.

It doesn't matter if you set it to Fullscreen or Fullscreen (borderless).

I use Wayland, didn't tested with Xorg.

Important: it should be a game that doesn't have a windowed splash screen or something like that. It should be a game that run fullscreen on start.

If you open a game that have windowed splash screen or just windowed (and then change mode to fullscreen/fullscreen borderless) - as soon as it enters fullscreen it will create new desktop and move to it. It works as expected in this scenario. The bug is observed only when new window opened already fullscreen.

Native games seems not affected. I tested vrrTest and CS:GO, it works fine.

Aetf commented 2 years ago

I bet that has something to do with wine's fullscreen implementation on wayland. Maybe wine just uses a maximized window for the game so the game never actually got fullscreen from kwin's perspective.

It should be a game that run fullscreen on start.

This sounds like games that change resolution on start, right? I remember on X11 wine has a feature to avoid the game directly messing with the real screen resolution (emulate virtual desktop? I may be wrong as I haven't used wine for years and I am not even sure this feature is available on wayland or not)

kerriganx commented 2 years ago

I bet that has something to do with wine's fullscreen implementation on wayland. Maybe wine just uses a maximized window for the game so the game never actually got fullscreen from kwin's perspective.

I don't think so. If you open window options by hotkey (menu with close/minimize/maximize etc actions) it will shown as fullscreen. Also I use Freesync and it works only in fullscreen. I will test if issue persist on Xorg tomorrow.

It should be a game that run fullscreen on start.

This sounds like games that change resolution on start, right? I remember on X11 wine has a feature to avoid the game directly messing with the real screen resolution (emulate virtual desktop? I may be wrong as I haven't used wine for years and I am not even sure this feature is available on wayland or not)

No, resolution is native. The games I tested are World of Warcraft (only borderless fullscreen available) and Sims 4 (you can set to true fullscreen, but it doesn't makes any difference). Didn't tested other Wine games. Maybe I will try to install some more.

Aetf commented 2 years ago

The game may achieve fullscreen using something else then. Either way, if somehow kwin doesn't think the game is fullscreen, or doesn't emit fullscreen signals for them, there's little this script can do...

kerriganx commented 2 years ago

Just tested, it doesn't work with Xorg either. Also I made simple script with following code:

print(workspace.activeClient.resourceName);
print(workspace.activeClient.fullScreen);

And what I got:

wow.exe
true
Aetf commented 2 years ago

Interesting. The script actually prints detailed states to debug outputs in kwin. It'd be great if you could get kwin logging outputs (either here: https://community.kde.org/KWin/Debugging#Getting_debug_log_output, or journalctl --user -u plasma-kwin_wayland if you use systemd activation) and paste the relevant parts here.

kerriganx commented 2 years ago

journalctl --user -u plasma-kwin_wayland:

Aug 05 18:27:19 user-desktop kwin_wayland[2051]: kwin_core: Adjusted client area would exclude a complete screen, ignore
Aug 05 18:27:19 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 476605 (current: 476608)
Aug 05 18:27:19 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 476768 (current: 476769)
Aug 05 18:27:19 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 476872 (current: 476874)
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_core: Denied set_cursor request from unfocused client
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_UP → DEBOUNCE_EVENT_PRESS → DEBOUNCE_STATE_IS_DOWN_WAITING
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_DOWN_WAITING → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_DOWN
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_DOWN → DEBOUNCE_EVENT_RELEASE → DEBOUNCE_STATE_IS_UP_DETECTING_SPURIOUS
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_UP_DETECTING_SPURIOUS → DEBOUNCE_EVENT_TIMEOUT_SHORT → DEBOUNCE_STATE_IS_UP_WAITING
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_core: Adjusted client area would exclude a complete screen, ignore
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_UP_WAITING → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_UP
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 477460 (current: 477461)
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 477472 (current: 477475)
Aug 05 18:27:20 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 477781 (current: 477782)
Aug 05 18:27:25 user-desktop kwin_wayland[2051]: kwin_core: User timestamp, ASN: 4294967295
Aug 05 18:27:25 user-desktop kwin_wayland[2051]: kwin_core: User timestamp, final: KWin::XwaylandWindow(0x557d62a8e3c0, windowId=0x3600001, caption="World of Warcraft") : 482090
Aug 05 18:27:25 user-desktop kwin_wayland[2051]: kwin_core: Adjusted client area would exclude a complete screen, ignore
Aug 05 18:27:26 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 482115 (current: 482343)
Aug 05 18:27:26 user-desktop kwin_wayland[2051]: kwin_core: Denied set_cursor request from unfocused client
Aug 05 18:27:27 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_UP → DEBOUNCE_EVENT_PRESS → DEBOUNCE_STATE_IS_DOWN_WAITING
Aug 05 18:27:27 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_DOWN_WAITING → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_DOWN
Aug 05 18:27:27 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_DOWN → DEBOUNCE_EVENT_RELEASE → DEBOUNCE_STATE_IS_UP_DETECTING_SPURIOUS
Aug 05 18:27:27 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_UP_DETECTING_SPURIOUS → DEBOUNCE_EVENT_TIMEOUT_SHORT → DEBOUNCE_STATE_IS_UP_WAITING
Aug 05 18:27:27 user-desktop kwin_wayland[2051]: kwin_libinput: Libinput: event7  - debounce state: DEBOUNCE_STATE_IS_UP_WAITING → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_UP
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: This plugin does not support raise()
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: This plugin does not support raise()
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: Adjusted client area would exclude a complete screen, ignore
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: void KWin::Item::stackBefore(KWin::Item*) requires a valid sibling
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: void KWin::Item::stackBefore(KWin::Item*) requires a valid sibling
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: void KWin::Item::stackBefore(KWin::Item*) requires a valid sibling
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: void KWin::Item::stackBefore(KWin::Item*) requires a valid sibling
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: void KWin::Item::stackBefore(KWin::Item*) requires a valid sibling
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: void KWin::Item::stackBefore(KWin::Item*) requires a valid sibling
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: Adjusted client area would exclude a complete screen, ignore
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_qpa_plugin: No default framebuffer object for internal window
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_qpa_plugin: No default framebuffer object for internal window
Aug 05 18:27:28 user-desktop kwin_wayland[2051]: kwin_core: void KWin::Item::stackBefore(KWin::Item*) requires a valid sibling
Aug 05 18:27:29 user-desktop kwin_wayland[2051]: kwin_core: Provided presentation timestamp is invalid: 486198 (current: 486200)
Aetf commented 2 years ago

I don't see any script related output. Probably you need to enable it first: https://develop.kde.org/docs/extend/plasma/kwin/#output

kerriganx commented 2 years ago

It's enabled because I can see output from other scripts. Here is output from journalctl -g "js:" -f:

Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: handle maximize
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop:
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: state: enabled true
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: state: triggerFull true
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: state: triggerMax false
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: state: cachedConfig: {"trigger":0,"newDesktopPosition":0,"keepNonEmptyDesktop":false,"blockWMClass":[""]}
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: state: savedDesktops size 0
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: workspace: activeClient is KWin::XdgToplevelWindow(0x56258d2a2510)
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop:
Aug 06 02:12:00 user-desktop kwin_wayland[2076]: js: KWinMax2NewVirtualDesktop: handle maximize return
Aug 06 02:12:09 user-desktop kwin_wayland[2076]: js: alwaysopenonfocusedscreen: focused screen 0
Aug 06 02:12:09 user-desktop kwin_wayland[2076]: js: alwaysopenonfocusedscreen: client {
                                                   "objectName": "",
                                                   "alpha": false,
                                                   "frameId": 0,
                                                   "bufferGeometry": {
                                                     "x": 940,
                                                     "y": 684,
                                                     "width": 680,
                                                     "height": 95,
                                                     "left": 940,
                                                     "right": 1619,
                                                     "top": 684,
                                                     "bottom": 778
                                                   },
                                                   "pos": {
                                                     "x": 940,
                                                     "y": 684
                                                   },
                                                   "size": {
                                                     "width": 680,
                                                     "height": 95
                                                   },
                                                   "x": 940,
                                                   "y": 684,
                                                   "width": 680,
                                                   "height": 95,
                                                   "visibleRect": {
                                                     "x": 940,
                                                     "y": 684,
                                                     "width": 680,
                                                     "height": 95,
                                                     "left": 940,
                                                     "right": 1619,
                                                     "top": 684,
                                                     "bottom": 778
                                                   },
                                                   "opacity": 1,
                                                   "screen": 0,
                                                   "windowId": 0,
                                                   "rect": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 680,
                                                     "height": 95,
                                                     "left": 0,
                                                     "right": 679,
                                                     "top": 0,
                                                     "bottom": 94
                                                   },
                                                   "clientPos": {
                                                     "x": 0,
                                                     "y": 0
                                                   },
                                                   "clientSize": {
                                                     "width": 680,
                                                     "height": 95
                                                   },
                                                   "resourceName": {},
                                                   "resourceClass": {},
                                                   "windowRole": {},
                                                   "desktopWindow": false,
                                                   "dock": false,
                                                   "toolbar": false,
                                                   "menu": false,
                                                   "normalWindow": true,
                                                   "dialog": false,
                                                   "splash": false,
                                                   "utility": false,
                                                   "dropdownMenu": false,
                                                   "popupMenu": false,
                                                   "tooltip": false,
                                                   "notification": false,
                                                   "criticalNotification": false,
                                                   "onScreenDisplay": false,
                                                   "comboBox": false,
                                                   "dndIcon": false,
                                                   "windowType": 0,
                                                   "managed": true,
                                                   "deleted": false,
                                                   "shaped": false,
                                                   "skipsCloseAnimation": false,
                                                   "surface": {
                                                     "objectName": "",
                                                     "damage": "",
                                                     "opaque": "",
                                                     "input": "",
                                                     "bufferScale": 1,
                                                     "bufferTransform": 0,
                                                     "size": {
                                                       "width": 680,
                                                       "height": 95
                                                     }
                                                   },
                                                   "popupWindow": false,
                                                   "outline": false,
                                                   "internalId": "{14b2ac62-1eec-4e9d-8cbe-13e38e02feb6}",
                                                   "pid": 2522,
                                                   "stackingOrder": 7,
                                                   "fullScreen": false,
                                                   "fullScreenable": true,
                                                   "active": true,
                                                   "desktop": 1,
                                                   "onAllDesktops": false,
                                                   "activities": [
                                                     "4f0eb282-bf45-49ae-b143-98a030c910b6"
                                                   ],
                                                   "x11DesktopIds": [
                                                     1
                                                   ],
                                                   "skipTaskbar": false,
                                                   "skipPager": false,
                                                   "skipSwitcher": false,
                                                   "closeable": true,
                                                   "icon": "",
                                                   "keepAbove": false,
                                                   "keepBelow": false,
                                                   "shadeable": false,
                                                   "shade": false,
                                                   "minimizable": true,
                                                   "minimized": false,
                                                   "iconGeometry": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 0,
                                                     "height": 0,
                                                     "left": 0,
                                                     "right": -1,
                                                     "top": 0,
                                                     "bottom": -1
                                                   },
                                                   "specialWindow": false,
                                                   "demandsAttention": false,
                                                   "caption": "albert — Albert",
                                                   "minSize": {
                                                     "width": 680,
                                                     "height": 95
                                                   },
                                                   "maxSize": {
                                                     "width": 680,
                                                     "height": 95
                                                   },
                                                   "wantsInput": true,
                                                   "transient": false,
                                                   "transientFor": null,
                                                   "modal": false,
                                                   "geometry": {
                                                     "x": 940,
                                                     "y": 684,
                                                     "width": 680,
                                                     "height": 95,
                                                     "left": 940,
                                                     "right": 1619,
                                                     "top": 684,
                                                     "bottom": 778
                                                   },
                                                   "frameGeometry": {
                                                     "x": 940,
                                                     "y": 684,
                                                     "width": 680,
                                                     "height": 95,
                                                     "left": 940,
                                                     "right": 1619,
                                                     "top": 684,
                                                     "bottom": 778
                                                   },
                                                   "move": false,
                                                   "resize": false,
                                                   "decorationHasAlpha": false,
                                                   "noBorder": false,
                                                   "providesContextHelp": false,
                                                   "maximizable": false,
                                                   "moveable": true,
                                                   "moveableAcrossScreens": true,
                                                   "resizeable": false,
                                                   "desktopFileName": {},
                                                   "hasApplicationMenu": false,
                                                   "applicationMenuActive": false,
                                                   "unresponsive": false,
                                                   "colorScheme": "kdeglobals",
                                                   "layer": 2,
                                                   "hidden": false
                                                 }
Aug 06 02:12:11 user-desktop kwin_wayland[2076]: js: alwaysopenonfocusedscreen: focused screen 0
Aug 06 02:12:15 user-desktop kwin_wayland[2076]: js: alwaysopenonfocusedscreen: client {
                                                   "objectName": "",
                                                   "alpha": false,
                                                   "frameId": 2097559,
                                                   "bufferGeometry": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 2560,
                                                     "height": 1440,
                                                     "left": 0,
                                                     "right": 2559,
                                                     "top": 0,
                                                     "bottom": 1439
                                                   },
                                                   "pos": {
                                                     "x": 0,
                                                     "y": 0
                                                   },
                                                   "size": {
                                                     "width": 2560,
                                                     "height": 1440
                                                   },
                                                   "x": 0,
                                                   "y": 0,
                                                   "width": 2560,
                                                   "height": 1440,
                                                   "visibleRect": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 0,
                                                     "height": 0,
                                                     "left": 0,
                                                     "right": -1,
                                                     "top": 0,
                                                     "bottom": -1
                                                   },
                                                   "opacity": 1,
                                                   "screen": 0,
                                                   "windowId": 71303169,
                                                   "rect": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 2560,
                                                     "height": 1440,
                                                     "left": 0,
                                                     "right": 2559,
                                                     "top": 0,
                                                     "bottom": 1439
                                                   },
                                                   "clientPos": {
                                                     "x": 0,
                                                     "y": 0
                                                   },
                                                   "clientSize": {
                                                     "width": 2560,
                                                     "height": 1440
                                                   },
                                                   "resourceName": {},
                                                   "resourceClass": {},
                                                   "windowRole": {},
                                                   "desktopWindow": false,
                                                   "dock": false,
                                                   "toolbar": false,
                                                   "menu": false,
                                                   "normalWindow": true,
                                                   "dialog": false,
                                                   "splash": false,
                                                   "utility": false,
                                                   "dropdownMenu": false,
                                                   "popupMenu": false,
                                                   "tooltip": false,
                                                   "notification": false,
                                                   "criticalNotification": false,
                                                   "onScreenDisplay": false,
                                                   "comboBox": false,
                                                   "dndIcon": false,
                                                   "windowType": 0,
                                                   "managed": true,
                                                   "deleted": false,
                                                   "shaped": false,
                                                   "skipsCloseAnimation": false,
                                                   "surface": null,
                                                   "popupWindow": false,
                                                   "outline": false,
                                                   "internalId": "{ccada6dd-2aed-4982-9264-866cb088a87a}",
                                                   "pid": 69268,
                                                   "stackingOrder": 0,
                                                   "fullScreen": true,
                                                   "fullScreenable": true,
                                                   "active": false,
                                                   "desktop": 1,
                                                   "onAllDesktops": false,
                                                   "activities": [
                                                     "4f0eb282-bf45-49ae-b143-98a030c910b6"
                                                   ],
                                                   "x11DesktopIds": [
                                                     1
                                                   ],
                                                   "skipTaskbar": false,
                                                   "skipPager": false,
                                                   "skipSwitcher": false,
                                                   "closeable": true,
                                                   "icon": "",
                                                   "keepAbove": false,
                                                   "keepBelow": false,
                                                   "shadeable": false,
                                                   "shade": false,
                                                   "minimizable": true,
                                                   "minimized": false,
                                                   "iconGeometry": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 0,
                                                     "height": 0,
                                                     "left": 0,
                                                     "right": -1,
                                                     "top": 0,
                                                     "bottom": -1
                                                   },
                                                   "specialWindow": false,
                                                   "demandsAttention": false,
                                                   "caption": "World of Warcraft",
                                                   "minSize": {
                                                     "width": 0,
                                                     "height": 0
                                                   },
                                                   "maxSize": {
                                                     "width": 2147483647,
                                                     "height": 2147483647
                                                   },
                                                   "wantsInput": true,
                                                   "transient": false,
                                                   "transientFor": null,
                                                   "modal": false,
                                                   "geometry": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 2560,
                                                     "height": 1440,
                                                     "left": 0,
                                                     "right": 2559,
                                                     "top": 0,
                                                     "bottom": 1439
                                                   },
                                                   "frameGeometry": {
                                                     "x": 0,
                                                     "y": 0,
                                                     "width": 2560,
                                                     "height": 1440,
                                                     "left": 0,
                                                     "right": 2559,
                                                     "top": 0,
                                                     "bottom": 1439
                                                   },
                                                   "move": false,
                                                   "resize": false,
                                                   "decorationHasAlpha": false,
                                                   "noBorder": true,
                                                   "providesContextHelp": false,
                                                   "maximizable": false,
                                                   "moveable": false,
                                                   "moveableAcrossScreens": true,
                                                   "resizeable": false,
                                                   "desktopFileName": {},
                                                   "hasApplicationMenu": false,
                                                   "applicationMenuActive": false,
                                                   "unresponsive": false,
                                                   "colorScheme": "kdeglobals",
                                                   "layer": 6,
                                                   "hidden": false,
                                                   "basicUnit": {
                                                     "width": 1,
                                                     "height": 1
                                                   },
                                                   "blocksCompositing": false,
                                                   "clientSideDecorated": false
                                                 }
Aug 06 02:12:15 user-desktop kwin_wayland[2076]: js: alwaysopenonfocusedscreen: focused screen 0
Aug 06 02:12:20 user-desktop kwin_wayland[2076]: js: alwaysopenonfocusedscreen: focused screen 0
Aetf commented 1 year ago

From the log it looks like the maximize handler got called correctly. But those lines with alwaysopenonfocusedscreen look suspecious.

Probably the window is first moved to a new desktop, but then moved back by this alwaysopenonfocusedscreen script.

@kerriganx, sorry for getting back to you so late. Is this still a problem? Could you try to disable the other script and see if it works?

kerriganx commented 11 months ago

I recorded video to better see the issue

https://github.com/Aetf/kwin-maxmize-to-new-desktop/assets/109820903/edb7673e-d6ce-4dcb-8788-1e2da86d1a97