From c667f9ccdecc2b07261d78c38751bd5a401c9899 Mon Sep 17 00:00:00 2001 From: Sean Middleditch Date: Fri, 4 Mar 2011 21:46:02 -0800 Subject: [PATCH] Hacky fix for invalid Xrandr configurations The display settings does not allow configuration placement of monitors. If disabling a monitor to the left of another monitor, the Xrandr position of the still-enabled monitor would be offset from the origin. This resulted in a large dead area still being available to the left of the display, and also caused xfdesktop to horribly misrender the desktop (that is a separate bug in xfdesktop). Even with this fix, there still appears to be an issue with libwnck or the xfce4 pager panel plugin, as its mini display still shows extra-wide screens. --- xfsettingsd/displays.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c index 5624131..522ffa5 100644 --- a/xfsettingsd/displays.c +++ b/xfsettingsd/displays.c @@ -491,6 +491,10 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper, gchar property[512]; gint min_width, min_height, max_width, max_height; gint mm_width, mm_height, width, height, mode_height, mode_width; + gint origin_x, origin_y; /* defines the upper-left corner of the viewport, + to compensate for having a left-hand monitor + turned off, which otherwise creates a big empty + area in the final xrandr config */ gint l, m, output_rot, nactive; guint n; GValue *value; @@ -515,6 +519,7 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper, /* get the range of screen sizes */ mm_width = mm_height = width = height = 0; + origin_x = origin_y = G_MAXINT; if (!XRRGetScreenSizeRange (xdisplay, GDK_WINDOW_XID (root_window), &min_width, &min_height, &max_width, &max_height)) { @@ -690,6 +695,10 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper, pending->y = g_value_get_int (value); else pending->y = 0; + + /* update origins */ + origin_x = MIN(origin_x, pending->x); + origin_y = MIN(origin_y, pending->y); } /* safety check */ @@ -708,6 +717,10 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper, if (output->pending == NULL) continue; + /* adjust position for origin */ + output->pending->x -= origin_x; + output->pending->y -= origin_y; + crtc = NULL; /* outputs to disable */ if (output->pending->mode == None) @@ -764,6 +777,8 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper, output->pending->y, &width, &height, &mm_width, &mm_height); + TRACE("Configuring %s: size=%dx%d pos=%dx%d", output->info->name, mode_width, mode_height, output->pending->x, output->pending->y); + /* check if we really need to do something */ if (crtc->mode != output->pending->mode || crtc->rotation != output->pending->rotation @@ -778,6 +793,8 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper, } } + TRACE("Desktop dimensions: %dx%d", width, height); + /* set the screen size only if it's really needed and valid */ if (width >= min_width && width <= max_width && height >= min_height && height <= max_height -- 1.7.4.1