Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #121: Improved window state tracking for Linux systems #150

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shwetd19
Copy link

Fixes #121

Problem

On Linux systems, window.isMaximized() returns false immediately after calling maximize(), and similar issues occur with setFullScreen(). This happens because the window state changes are not properly synchronized with the window manager's actions.

Solution

Implemented a WindowStateManager that:

  • Tracks window states through actual window dimensions and position
  • Periodically verifies states against system properties
  • Uses tolerance values to handle Linux window manager variations
  • Adds brief delays after state changes to ensure proper synchronization

Implementation Details

  • Added WindowStateManager singleton class for consistent state tracking
  • Implemented state verification using window dimensions and position
  • Added tolerance values (5px) to account for window manager variations
  • Added 200ms delay after state changes to ensure synchronization
  • Maintains state through periodic verification (every 100ms)

Testing

Tested on:

  • Ubuntu 22.04 with GNOME

Notes

  • The verification delay (100ms) can be tuned if needed
  • Added getDisplay() message handler dependency

- added WindowStateManager to reliably track window states
- implementation of  state verification using window dimensions
- added some tolerance values for Linux window manager variations 
- fixed isMaximized() and setFullScreen() state detection
@Sadaf-A
Copy link
Contributor

Sadaf-A commented Jan 27, 2025

@shwetd19 could you please add testcases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

window.isMaximized() returns false in linux right after calling themaximize() function
2 participants