From 0ce993c7f1eb0dbf7a71b0951d097879d2d3f411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=BCller?= Date: Sun, 17 Dec 2017 20:56:23 +0100 Subject: [PATCH] display: Leave the monitor where it was if possible If a monitor is known and re-attaching it would not lead to a gap don't move it to (x=0, y=0) --- xfsettingsd/displays.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c index a035450..146014b 100644 --- a/xfsettingsd/displays.c +++ b/xfsettingsd/displays.c @@ -506,7 +506,9 @@ xfce_displays_helper_screen_on_event (GdkXEvent *xevent, { crtc->mode = output->preferred_mode; crtc->rotation = RR_Rotate_0; - crtc->x = crtc->y = 0; + if ((crtc->x > gdk_screen_width() + 1) || (crtc->y > gdk_screen_height() + 1)) { + crtc->x = crtc->y = 0; + } /* else - leave values from last time we saw the monitor */ /* set width and height */ for (j = 0; j < helper->resources->nmode; ++j) { @@ -1406,7 +1408,9 @@ xfce_displays_helper_toggle_internal (gpointer *power, return; crtc->mode = lvds->preferred_mode; crtc->rotation = RR_Rotate_0; - crtc->x = crtc->y = 0; + if ((crtc->x > gdk_screen_width() + 1) || (crtc->y > gdk_screen_height() + 1)) { + crtc->x = crtc->y = 0; + } /* else - leave values from last time we saw the monitor */ /* set width and height */ for (m = 0; m < helper->resources->nmode; ++m) { -- 2.14.1