window_manager icon indicating copy to clipboard operation
window_manager copied to clipboard

onWindowEnterFullScreen and onWindowLeaveFullScreen are never called on windows.

Open j7126 opened this issue 6 months ago • 1 comments

On version 0.5.0, the enter-full-screen (onWindowEnterFullScreen) and leave-full-screen (onWindowLeaveFullScreen) events don't seem to ever be emitted on windows.

I am setting full screen using WindowManager.setFullScreen.

While debugging the behaviour, it seems that when HandleWindowProc is called after entering or leaving fullscreen with a WM_SIZE message, wParam is always 0 (SIZE_RESTORED), whereas it is expected to be 2 (SIZE_MAXIMIZED) in order to trigger the enter-full-screen event.

window_manager/windows/window_manager_plugin.cpp line 268

...
} else if (message == WM_SIZE) {
    if (window_manager->IsFullScreen() && wParam == SIZE_MAXIMIZED &&
        window_manager->last_state != STATE_FULLSCREEN_ENTERED) {
      _EmitEvent("enter-full-screen");
      window_manager->last_state = STATE_FULLSCREEN_ENTERED;
    } else if (!window_manager->IsFullScreen() && wParam == SIZE_RESTORED &&
               window_manager->last_state == STATE_FULLSCREEN_ENTERED) {
      window_manager->ForceChildRefresh();
      _EmitEvent("leave-full-screen");
      window_manager->last_state = STATE_NORMAL;
    } else if (window_manager->last_state != STATE_FULLSCREEN_ENTERED) {
...

There was also a similar issue from 2 years ago, which seems to have been resolved at the time #396

j7126 avatar Sep 02 '25 11:09 j7126

I also now see there is a PR open #559 which probably fixes this issue.

j7126 avatar Sep 02 '25 11:09 j7126