From f0ee12732f19e3a8aca51482e20f3428a5318461 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 1 Jul 2008 13:18:54 +0930 Subject: [PATCH] xfree86: handle missing Screen lines in the ServerLayout #16301 If no Screen is specified in the ServerLayout section, either take the first one from the config file or autogenerate a default screen. X.Org Bug 16301 --- hw/xfree86/common/xf86Config.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index ee018eb..e26cd99 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -1606,10 +1606,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, count++; adjp = (XF86ConfAdjacencyPtr)adjp->list.next; } + #ifdef DEBUG ErrorF("Found %d screens in the layout section %s", count, conf_layout->lay_identifier); #endif + if (!count) /* alloc enough storage even if no screen is specified */ + count = 1; + slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec)); slp[count].screen = NULL; /* @@ -1664,6 +1668,20 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, adjp = (XF86ConfAdjacencyPtr)adjp->list.next; } + /* No screen was specified in the layout. take the first one from the + * config file, or - if it is NULL - configScreen autogenerates one for + * us */ + if (!count) + { + slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); + if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst, + 0, X_CONFIG)) { + xfree(slp[0].screen); + xfree(slp); + return FALSE; + } + } + /* XXX Need to tie down the upper left screen. */ /* Fill in the refscreen and top/bottom/left/right values */ -- 1.5.4.3