feat: open the main window on the screen under the mouse cursor - #1512
Open
obook wants to merge 1 commit into
Open
feat: open the main window on the screen under the mouse cursor#1512obook wants to merge 1 commit into
obook wants to merge 1 commit into
Conversation
When no explicit screen configuration is stored, the main OpenBoard window always opened on the primary screen. On a multi-monitor setup this forces the user to drag it to the monitor they work on every time the application starts. The control screen is now chosen from the screen under the mouse cursor. Only the role-assignment order is affected: the screen numbers shown in the preferences keep the system order, and an explicit screen list still takes precedence. On X11, Windows and macOS the cursor position is read directly with QCursor::pos(). Wayland does not expose the global cursor position before the application has received a pointer event, so a short-lived transparent probe window is shown and the output the compositor places it on is used instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a multi-monitor setup, OpenBoard always opens its main window on the primary screen. If you work on another monitor, you have to drag the window over every time you start the app. This makes it open on the screen where the mouse is instead.
A few things worth noting:
On X11, Windows and macOS the cursor position is read directly with
QCursor::pos(). Wayland doesn't allow that before the app has received a pointer event, so I show a tiny transparent probe window and use whichever output the compositor places it on.Tested on a 3-monitor Wayland session (KDE Plasma, Qt 6). The X11, Windows and macOS paths are structurally unchanged, but I haven't run them on those systems, so feedback there would be welcome.
Regards,