diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2009-10-16 23:00:39 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2009-10-16 23:00:39 -0700 |
commit | 21164c7cf7bd5ce06740472b9eea289fd65f3431 (patch) | |
tree | 130d7ae5631c4e9476f3e9ec9b001e15493208e0 | |
parent | 7825f4cb3e46ff126a97b0c7f66e82b9da2cbdbb (diff) |
190.40190.40
-rw-r--r-- | XF86Config-parser/Merge.c | 28 | ||||
-rw-r--r-- | XF86Config-parser/Module.c | 40 | ||||
-rw-r--r-- | XF86Config-parser/xf86Parser.h | 3 | ||||
-rw-r--r-- | XF86Config-parser/xf86tokens.h | 1 | ||||
-rw-r--r-- | multiple_screens.c | 21 |
5 files changed, 53 insertions, 40 deletions
diff --git a/XF86Config-parser/Merge.c b/XF86Config-parser/Merge.c index b3614ec..26521ee 100644 --- a/XF86Config-parser/Merge.c +++ b/XF86Config-parser/Merge.c @@ -129,15 +129,11 @@ static int xconfigOptionValuesDiffer(XConfigOptionPtr option0, * * Merging here means: * - * If the option is not in the source config, remove it from the dest - * config. - * - * If the option is in the source config, make sure the dest config - * contains the option with the same value as the source config. - * - * if "comments" is given, a comment will be added to note when - * an option has been removed/replaced. - * + * If the option is not in the source config, do nothing to the + * destination. Otherwise, either add or update the option in + * the dest. If the option is modified, and a comment is given, + * then the old option will be commented out instead of being + * simply removed/replaced. */ static void xconfigMergeOption(XConfigOptionPtr *dstHead, XConfigOptionPtr *srcHead, @@ -148,14 +144,14 @@ static void xconfigMergeOption(XConfigOptionPtr *dstHead, char *srcValue = NULL; - if (srcOption) srcValue = xconfigOptionValue(srcOption); - - if (!srcOption && dstOption) { + if (!srcOption) { + /* Option does not exist in src, do nothing to dst. */ + return; + } - /* option does not exist in src, but exists in dst: remove from dst */ - xconfigRemoveOption(dstHead, dstOption); + srcValue = xconfigOptionValue(srcOption); - } else if (srcOption && !dstOption) { + if (srcOption && !dstOption) { /* option exists in src but not in dst: add to dst */ xconfigAddNewOption(dstHead, name, srcValue); @@ -714,7 +710,7 @@ static int xconfigMergeLayout(XConfigPtr dstConfig, XConfigPtr srcConfig) */ int xconfigMergeConfigs(XConfigPtr dstConfig, XConfigPtr srcConfig) { - /* Make sure the X config is falid */ + /* Make sure the X config is valid */ // make_xconfig_usable(dstConfig); diff --git a/XF86Config-parser/Module.c b/XF86Config-parser/Module.c index 69dde1a..042a409 100644 --- a/XF86Config-parser/Module.c +++ b/XF86Config-parser/Module.c @@ -73,6 +73,7 @@ static XConfigSymTabRec ModuleTab[] = {ENDSECTION, "endsection"}, {LOAD, "load"}, {LOAD_DRIVER, "loaddriver"}, + {DISABLE, "disable"}, {SUBSECTION, "subsection"}, {-1, ""}, }; @@ -143,6 +144,12 @@ xconfigParseModuleSection (void) xconfigAddNewLoadDirective (&ptr->loads, val.str, XCONFIG_LOAD_DRIVER, NULL, TRUE); break; + case DISABLE: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "Disable"); + xconfigAddNewLoadDirective (&ptr->disables, val.str, + XCONFIG_DISABLE_MODULE, NULL, TRUE); + break; case SUBSECTION: if (xconfigGetSubToken (&(ptr->comment)) != STRING) Error (QUOTE_MSG, "SubSection"); @@ -208,6 +215,19 @@ xconfigPrintModuleSection (FILE * cf, XConfigModulePtr ptr) #endif } } + for (lptr = ptr->disables; lptr; lptr = lptr->next) + { + switch (lptr->type) + { + case XCONFIG_DISABLE_MODULE: + fprintf (cf, " Disable \"%s\"", lptr->name); + if (lptr->comment) + fprintf(cf, "%s", lptr->comment); + else + fputc('\n', cf); + break; + } + } } void @@ -245,16 +265,11 @@ xconfigRemoveLoadDirective(XConfigLoadPtr *pHead, XConfigLoadPtr load) free(load); } -void -xconfigFreeModules (XConfigModulePtr *ptr) +static void +FreeModule(XConfigLoadPtr lptr) { - XConfigLoadPtr lptr; XConfigLoadPtr prev; - if (ptr == NULL || *ptr == NULL) - return; - - lptr = (*ptr)->loads; while (lptr) { TEST_FREE (lptr->name); @@ -263,6 +278,17 @@ xconfigFreeModules (XConfigModulePtr *ptr) lptr = lptr->next; free (prev); } +} + +void +xconfigFreeModules (XConfigModulePtr *ptr) +{ + if (ptr == NULL || *ptr == NULL) + return; + + FreeModule((*ptr)->loads); + FreeModule((*ptr)->disables); + TEST_FREE ((*ptr)->comment); free (*ptr); *ptr = NULL; diff --git a/XF86Config-parser/xf86Parser.h b/XF86Config-parser/xf86Parser.h index 2e1e7b4..3369725 100644 --- a/XF86Config-parser/xf86Parser.h +++ b/XF86Config-parser/xf86Parser.h @@ -169,7 +169,7 @@ typedef struct { /* Values for load_type */ #define XCONFIG_LOAD_MODULE 0 #define XCONFIG_LOAD_DRIVER 1 - +#define XCONFIG_DISABLE_MODULE 2 /* @@ -186,6 +186,7 @@ typedef struct __xconfigloadrec { typedef struct { XConfigLoadPtr loads; + XConfigLoadPtr disables; char *comment; } XConfigModuleRec, *XConfigModulePtr; diff --git a/XF86Config-parser/xf86tokens.h b/XF86Config-parser/xf86tokens.h index 1189bc0..d44dcbf 100644 --- a/XF86Config-parser/xf86tokens.h +++ b/XF86Config-parser/xf86tokens.h @@ -167,6 +167,7 @@ typedef enum { /* Module tokens */ LOAD, LOAD_DRIVER, + DISABLE, /* Device tokens */ DRIVER, diff --git a/multiple_screens.c b/multiple_screens.c index b4a20cc..3f860fb 100644 --- a/multiple_screens.c +++ b/multiple_screens.c @@ -38,7 +38,7 @@ static int enable_separate_x_screens(Options *op, XConfigPtr config, static int disable_separate_x_screens(Options *op, XConfigPtr config, XConfigLayoutPtr layout); -static int set_xinerama(int xinerama_enabled, XConfigPtr config); +static int set_xinerama(int xinerama_enabled, XConfigLayoutPtr layout); static XConfigDisplayPtr clone_display_list(XConfigDisplayPtr display0); static XConfigDevicePtr clone_device(XConfigDevicePtr device0); @@ -90,7 +90,7 @@ int apply_multi_screen_options(Options *op, XConfigPtr config, XINERAMA_BOOL_OPTION)) { if (!set_xinerama(GET_BOOL_OPTION(op->boolean_option_values, XINERAMA_BOOL_OPTION), - config)) return FALSE; + layout)) return FALSE; } if (op->only_one_screen) { @@ -301,24 +301,13 @@ void free_devices(DevicesPtr pDevices) /* - * set_xinerama() - This makes sure there is a ServerFlags + * set_xinerama() - This makes sure there is a ServerLayout * section and sets the "Xinerama" option */ -static int set_xinerama(int xinerama_enabled, XConfigPtr config) +static int set_xinerama(int xinerama_enabled, XConfigLayoutPtr layout) { - if (!config->flags) { - config->flags = nvalloc(sizeof(XConfigFlagsRec)); - if ( !config->flags ) { - return FALSE; - } - } - - if (config->flags->options) { - xconfigRemoveNamedOption(&(config->flags->options), "Xinerama", NULL); - } - - xconfigAddNewOption(&config->flags->options, + xconfigAddNewOption(&(layout->options), "Xinerama", (xinerama_enabled ? "1" : "0")); |