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