[PATCH] xfree86: Use last Screen section found to prefer xorg.conf (#32430)
Dan Nicholson
dbn.lists at gmail.com
Fri Jan 7 07:06:20 PST 2011
Allowing multiple .conf files with xorg.conf.d works well for
InputClass where any section in xorg.conf would override settings from
previous .conf files typically installed by the distro. This does not
work well with Screen sections where the first section found has been
used when there is no Layout or the Layout doesn't specify a Screen.
Instead, use the last Screen section found to give preference to
xorg.conf and match the InputScreen semantics.
X.Org Bug 32430 <https://bugs.freedesktop.org/show_bug.cgi?id=32430>
Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
---
Looking through this code, the same situation occurs with layouts and
devices. Not sure if those should get fixed in the same way.
hw/xfree86/common/xf86Config.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 49d8fa8..ff53386 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1588,14 +1588,18 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
}
- /* No screen was specified in the layout. take the first one from the
+ /* No screen was specified in the layout. take the last one from the
* config file, or - if it is NULL - configScreen autogenerates one for
* us */
if (!count)
{
+ XF86ConfScreenPtr s = xf86configptr->conf_screen_lst;
+
+ while (s && s->list.next)
+ s = s->list.next;
+
slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
- if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
- 0, X_CONFIG)) {
+ if (!configScreen(slp[0].screen, s, 0, X_CONFIG)) {
free(slp[0].screen);
free(slp);
return FALSE;
@@ -1676,7 +1680,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
}
/*
- * No layout section, so find the first Screen section and set that up as
+ * No layout section, so find the last Screen section and set that up as
* the only active screen.
*/
static Bool
@@ -1695,7 +1699,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
/*
* which screen section is the active one?
*
- * If there is a -screen option, use that one, otherwise use the first
+ * If there is a -screen option, use that one, otherwise use the last
* one.
*/
@@ -1708,6 +1712,12 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
}
conf_screen = s;
from = X_CMDLINE;
+ } else if (conf_screen) {
+ /* Use the last Screen in the list */
+ s = conf_screen;
+ while (s->list.next)
+ s = s->list.next;
+ conf_screen = s;
}
/* We have exactly one screen */
@@ -2428,7 +2438,7 @@ xf86HandleConfigFile(Bool autoconfig)
if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
if (xf86ScreenName == NULL) {
xf86Msg(X_DEFAULT,
- "No Layout section. Using the first Screen section.\n");
+ "No Layout section. Using the last Screen section.\n");
}
if (!configImpliedLayout(&xf86ConfigLayout,
xf86configptr->conf_screen_lst,
--
1.7.3.4
More information about the xorg-devel
mailing list