Index: nvidia-settings-1.0/src/XF86Config-parser/Merge.c =================================================================== --- nvidia-settings-1.0/src/XF86Config-parser/Merge.c +++ nvidia-settings-1.0/src/XF86Config-parser/Merge.c 2009-10-18 14:36:00.815548724 +0300 @@ -129,15 +129,11 @@ * * 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,12 @@ char *srcValue = NULL; - if (srcOption) srcValue = xconfigOptionValue(srcOption); - - if (!srcOption && dstOption) { + if (!srcOption) + return; - /* option does not exist in src, but exists in dst: remove from dst */ - *dstHead = xconfigRemoveOption(*dstHead, dstOption); + srcValue = xconfigOptionValue(srcOption); - } else if (srcOption && !dstOption) { + if (srcOption && !dstOption) { /* option exists in src but not in dst: add to dst */ *dstHead = xconfigAddNewOption(*dstHead, name, srcValue); @@ -716,7 +710,7 @@ */ int xconfigMergeConfigs(XConfigPtr dstConfig, XConfigPtr srcConfig) { - /* Make sure the X config is falid */ + /* Make sure the X config is valid */ // make_xconfig_usable(dstConfig); Index: nvidia-settings-1.0/src/XF86Config-parser/Module.c =================================================================== --- nvidia-settings-1.0/src/XF86Config-parser/Module.c +++ nvidia-settings-1.0/src/XF86Config-parser/Module.c 2009-10-18 14:36:06.938394779 +0300 @@ -73,6 +73,7 @@ {ENDSECTION, "endsection"}, {LOAD, "load"}, {LOAD_DRIVER, "loaddriver"}, + {DISABLE, "disable"}, {SUBSECTION, "subsection"}, {-1, ""}, }; @@ -145,6 +146,12 @@ xconfigAddNewLoadDirective (ptr->loads, val.str, XCONFIG_LOAD_DRIVER, NULL, TRUE); break; + case DISABLE: + if (xconfigGetSubToken (&(ptr->comment)) != STRING) + Error (QUOTE_MSG, "Disable"); + ptr->disables = xconfigAddNewLoadDirective (ptr->disables, val.str, + XCONFIG_DISABLE_MODULE, NULL, TRUE); + break; case SUBSECTION: if (xconfigGetSubToken (&(ptr->comment)) != STRING) Error (QUOTE_MSG, "SubSection"); @@ -210,6 +217,19 @@ #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; + } + } } XConfigLoadPtr @@ -260,15 +280,11 @@ return head; } -void -xconfigFreeModules (XConfigModulePtr ptr) +static void +FreeModule (XConfigLoadPtr lptr) { - XConfigLoadPtr lptr; XConfigLoadPtr prev; - if (ptr == NULL) - return; - lptr = ptr->loads; while (lptr) { TEST_FREE (lptr->name); @@ -277,6 +293,17 @@ lptr = lptr->next; free (prev); } +} + +void +xconfigFreeModules (XConfigModulePtr ptr) +{ + if (ptr == NULL) + return; + + FreeModule(ptr->loads); + FreeModule(ptr->disables); + TEST_FREE (ptr->comment); free (ptr); } Index: nvidia-settings-1.0/src/XF86Config-parser/xf86Parser.h =================================================================== --- nvidia-settings-1.0/src/XF86Config-parser/xf86Parser.h +++ nvidia-settings-1.0/src/XF86Config-parser/xf86Parser.h 2009-10-18 14:36:00.842551051 +0300 @@ -169,7 +169,7 @@ /* 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 { XConfigLoadPtr loads; + XConfigLoadPtr disables; char *comment; } XConfigModuleRec, *XConfigModulePtr; Index: nvidia-settings-1.0/src/XF86Config-parser/xf86tokens.h =================================================================== --- nvidia-settings-1.0/src/XF86Config-parser/xf86tokens.h +++ nvidia-settings-1.0/src/XF86Config-parser/xf86tokens.h 2009-10-18 14:36:00.845548412 +0300 @@ -167,6 +167,7 @@ /* Module tokens */ LOAD, LOAD_DRIVER, + DISABLE, /* Device tokens */ DRIVER,