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

RandR: handle monitor {dis,}connection better #953

Merged
merged 3 commits into from
Feb 22, 2024

Conversation

ThomasAdam
Copy link
Member

When monitors are connected and disconnected, the monitor is deleted and reinserted into the RB_TREE. This has to happen as the key has changed and a monitor could have changed position.

In doing so, ensure the windows which were on the existing monitors are properly updated. This means keeping a separate list of monitors which have been altered, and reassigning windows on the old monitor to the new one. This is done using monitor names, which seems consistent if one undocks a laptop from a docking station and then reattaches, for example.

Without this change, windows would lose which desk they were previously on.

@ThomasAdam ThomasAdam added the type:bug Something's broken! label Feb 18, 2024
@ThomasAdam ThomasAdam added this to the 1.1.0 milestone Feb 18, 2024
@ThomasAdam ThomasAdam self-assigned this Feb 18, 2024
When monitors are connected and disconnected, the monitor is deleted and
reinserted into the RB_TREE.  This has to happen as the key has changed
and a monitor could have changed position.

In doing so, ensure the windows which were on the existing monitors are
properly updated.  This means keeping a separate list of monitors which
have been altered, and reassigning windows on the old monitor to the new
one.  This is done using monitor names, which seems consistent if one
undocks a laptop from a docking station and then reattaches, for
example.

Without this change, windows would lose which desk they were previously
on.
When two monitors go to one monitor (undocking a laptop with one
external display, for example), don't set the previous monitor if it's
the same as the current monitor.

Fixes #947
@ThomasAdam ThomasAdam merged commit 52b29ef into main Feb 22, 2024
5 checks passed
@ThomasAdam ThomasAdam deleted the ta/monitor-insert-reorder branch February 22, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something's broken!
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant