Skip to content

xrandr: always try to update primary

Harald Sitter requested to merge work/sitter/xrandrprimary into master

When screen0 gets disconnected the atom essentially says it is priority 1 but we ignore it on account of being disconnected/disabled (this happens inside priority()). This caused setPriority to exit early and not do anything. Upon plugging screen0 back in the atom comes into play again and it is still saying the screen is priority 1, but really another screen was/is priority 1. What happens then is that since the atom says the screen is priority1 == newpriority == noop.

tldr:

  • screen0 disconnect: priority=0 == newPrirority=0 -> noop
  • screen1: priority=2 != newPriority=1 -> set_primary
  • screen0 reconnect: priority=1 == newPriority=1 -> noop
  • screen1 is now primary but the entire kscreen system thinks it should be screen0

to solve this problem simply update the primary regardless of the property change, at worst this is noop on the xcb side of things, at best we ensure the primary is in sync

Merge request reports