xorg-x11-server/xserver-1.6.99-right-of.patch

125 lines
3.6 KiB
Diff
Raw Normal View History

From 9d16f202248b0ca29b832d28441871b96d0b040d Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Tue, 28 Jul 2009 11:07:13 -0400
Subject: [PATCH] RANDR: right-of placement by default
---
hw/xfree86/modes/xf86Crtc.c | 71 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 64 insertions(+), 7 deletions(-)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 94fc158..4f14a75 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1140,6 +1140,15 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
int o;
int min_x, min_y;
+ /* check for initial right-of heuristic */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (output->initial_x || output->initial_y)
+ return TRUE;
+ }
+
for (o = 0; o < config->num_output; o++)
{
xf86OutputPtr output = config->output[o];
@@ -2025,6 +2034,54 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
return match;
}
+static int
+numEnabledOutputs(xf86CrtcConfigPtr config, Bool *enabled)
+{
+ int i = 0, p;
+
+ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
+
+ return i;
+}
+
+static Bool
+xf86TargetRightOf(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+ int w = 0;
+
+ if (numEnabledOutputs(config, enabled) < 2)
+ return FALSE;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ DisplayModePtr mode =
+ xf86OutputHasPreferredMode(config->output[o], width, height);
+
+ if (!mode)
+ return FALSE;
+
+ w += mode->HDisplay;
+ }
+
+ if (w > width)
+ return FALSE;
+
+ w = 0;
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ DisplayModePtr mode =
+ xf86OutputHasPreferredMode(config->output[o], width, height);
+
+ config->output[o]->initial_x = w;
+ w += mode->HDisplay;
+
+ modes[o] = mode;
+ }
+
+ return TRUE;
+}
+
static Bool
xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
DisplayModePtr *modes, Bool *enabled,
@@ -2082,13 +2139,9 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
* biggest mode for its aspect ratio, assuming one exists.
*/
if (!ret) do {
- int i = 0;
float aspect = 0.0;
- /* count the number of enabled outputs */
- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
-
- if (i != 1)
+ if (numEnabledOutputs(config, enabled) != 1)
break;
p = -1;
@@ -2375,6 +2428,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n");
else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
@@ -2391,8 +2446,10 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
config->output[o]->name);
else
xf86DrvMsg (scrn->scrnIndex, X_INFO,
- "Output %s using initial mode %s\n",
- config->output[o]->name, modes[o]->name);
+ "Output %s using initial mode %s +%d+%d\n",
+ config->output[o]->name, modes[o]->name,
+ config->output[o]->initial_x,
+ config->output[o]->initial_y);
}
/*
--
1.6.3.3