Wen you connect or disconnect a monitor to the system, display settings tries to re-configure the screen appropriately. It looks for a saved profile matching the set of connected monitors to apply. If there is no such saved profile it attempts to come up with a reasonable default. The problem happens because during this process it tries to calculate the screen size required to contain all monitors. In doing this it takes in to account the monitor's scalex and scaley. These are crtc->scalex and crtc->scaley in the code. The calculation looks like this: https://git.xfce.org/xfce/xfce4-settings/tree/xfsettingsd/displays.c?id=a5ed05fe5e65a501a56eb632c5301e806633902e#n1265 helper->width = MAX (helper->width, crtc->x + crtc->width * crtc->scalex); helper->height = MAX (helper->height, crtc->y + crtc->height * crtc->scaley); This runs for each monitor to accumulate the right-most and bottom-most coordinates of all monitors. The crtc struct is initialized here: https://git.xfce.org/xfce/xfce4-settings/tree/xfsettingsd/displays.c?id=a5ed05fe5e65a501a56eb632c5301e806633902e#n1113 Notice that scalex and scaley are not initialized in this code. They are only initialized here: https://github.com/xfce-mirror/xfce4-settings/blob/master/xfsettingsd/displays.c#L849 That piece of code runs when loading a profile from xfconf, and that only happens if your monitor configuration has a matching profile. If you add or remove a monitor such that you are in a state that doesn't match any profile, then scalex and scaley are used uninitialized in the screen calculation, meaning that they have value 0, and it thinks that all your monitors are 0x0. The screen size then ends up as the rectangle containing all the top left coordinates of all monitors. Display settings then thinks your monitors cannot fit on the screen, so it turns them off. Now all your monitors are turned off and you can't turn them back on unless you can put them back into a state that matches a saved profile, or you reboot. So the question is how to fix this. It would be trivial to initialize the crtc struct with 1 instead of 0 for scale. This prevents the problem from happening for me, however I do not use the scale feature at all, and this may have side-effects for people who do.
Created attachment 9034 Trivial but possibly wrong patch This patch initializes the fields to 1 when the struct is first created. This fixes the problem at least if you don't use monitor scaling. I have not tested what happens if you do.
Alistair Buxton referenced this bugreport in commit 8f46eb503d60c1b2ded00d7888c47a6ff3702546 display: Initialize crtc->scalex/y (Bug #15971) https://git.xfce.org/xfce/xfce4-settings/commit?id=8f46eb503d60c1b2ded00d7888c47a6ff3702546
Alistair Buxton referenced this bugreport in commit db3ca3c489ca33bdca8b616fe321af196462f1ae display: Initialize crtc->scalex/y (Bug #15971) https://git.xfce.org/xfce/xfce4-settings/commit?id=db3ca3c489ca33bdca8b616fe321af196462f1ae
I pushed the patch because it's always safe to initialize the value (it doesn't override anything else further down the road). We probably still need a proper patch which gets the scale in those cases.
-- GitLab Migration Automatic Message -- This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/146. Please create an account or use an existing account on one of our supported OAuth providers. If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev