| author | Erkin Bahceci <> | 03-29 19:28:53 (GMT) |
|---|---|---|
| committer | Erkin Bahceci <> | 03-29 19:28:53 (GMT) |
| commit | b392c55370fea346b9f1704eeeca56aeac1fdd08 (patch) | |
| tree | ad61dcebcc22710d1ff242e88ddb4f7da840db51 | |
| parent | 60756c9cdf1c7be1c73db6afa2d445a3ae49b2f6 (diff) | |
| download | libcompizconfig-master.tar.gz libcompizconfig-master.tar.bz2 | |
Remove display and multi-screen stuff.master
| -rw-r--r-- | backend/ini.c | 10 | ||||
| -rw-r--r-- | include/ccs.h | 29 | ||||
| -rw-r--r-- | plugin/ccp.cpp | 12 | ||||
| -rw-r--r-- | src/compiz.cpp | 22 | ||||
| -rw-r--r-- | src/main.c | 65 |
5 files changed, 31 insertions, 107 deletions
diff --git a/backend/ini.c b/backend/ini.c index 0bc560e..38c2566 100644 --- a/backend/ini.c +++ b/backend/ini.c @@ -258,10 +258,7 @@ readSetting (CCSContext *context, if (!data) return; - if (setting->isScreen) - asprintf (&keyName, "s%d_%s", setting->screenNum, setting->name); - else - asprintf (&keyName, "as_%s", setting->name); + asprintf (&keyName, "s%d_%s", context->screenNum, setting->name); switch (setting->type) { @@ -449,10 +446,7 @@ writeSetting (CCSContext *context, if (!data) return; - if (setting->isScreen) - asprintf (&keyName, "s%d_%s", setting->screenNum, setting->name); - else - asprintf (&keyName, "as_%s", setting->name); + asprintf (&keyName, "s%d_%s", context->screenNum, setting->name); if (setting->isDefault) { diff --git a/include/ccs.h b/include/ccs.h index 9d886d5..f301f25 100644 --- a/include/ccs.h +++ b/include/ccs.h @@ -136,8 +136,7 @@ struct _CCSContext CCSSettingList changedSettings; /* list of settings changed since last settings write */ - unsigned int *screens; /* numbers of the available screens */ - unsigned int numScreens; /* number of screens */ + unsigned int screenNum; /* screen number this context is assigned to */ }; struct _CCSBackendInfo @@ -250,8 +249,6 @@ struct _CCSStrExtension char *basePlugin; /* plugin this extension extends */ CCSStringList baseSettings; /* list of settings this extension extends */ CCSStrRestrictionList restriction; /* list of added restriction items */ - - Bool isScreen; /* is this extension a screen setting extension? */ }; typedef struct _CCSSettingIntInfo @@ -364,10 +361,6 @@ struct _CCSSetting CCSSettingType type; /* setting type */ - Bool isScreen; /* is this setting a screen setting? */ - unsigned int screenNum; /* screen number this setting is assigned to, valid - if isScreen is TRUE */ - CCSSettingInfo info; /* information assigned to this setting, valid if the setting is an int, float, string or list setting */ @@ -398,16 +391,13 @@ struct _CCSPluginCategory metadata informations will be parsed */ void ccsSetBasicMetadata (Bool value); -/* Creates a new context for the screens given in screens and numScreens. - Set numScreens to 0 to initialize for all screens. +/* Creates a new context for the given screen. All plugin settings are automatically enumerated. */ -CCSContext* ccsContextNew (unsigned int *screens, - unsigned int numScreens); +CCSContext* ccsContextNew (unsigned int screenNum); /* Creates a new context without auto-enumerating any plugin or setting. Behaves otherwise exactly like ccsContextNew. */ -CCSContext* ccsEmptyContextNew (unsigned int *screens, - unsigned int numScreens); +CCSContext* ccsEmptyContextNew (unsigned int screenNum); /* Destroys the allocated context. */ void ccsContextDestroy (CCSContext * context); @@ -422,14 +412,11 @@ Bool ccsLoadPlugin (CCSContext *context, CCSPlugin* ccsFindPlugin (CCSContext *context, const char *name); -/* Searches for a setting in a plugin. screenNum is only valid if isScreen is - TRUE. Returns the setting struct if the search was successful (setting with - name <name> found and isScreen and screenNum matched the values of the - setting), NULL otherwise. */ +/* Searches for a setting in a plugin. + Returns the setting struct if the search was successful (setting with + name <name> found), NULL otherwise. */ CCSSetting* ccsFindSetting (CCSPlugin *plugin, - const char *name, - Bool isScreen, - unsigned int screenNum); + const char *name); /* Returns TRUE if the named plugin is in the context and marked as currently active in Compiz, FALSE otherwise. */ diff --git a/plugin/ccp.cpp b/plugin/ccp.cpp index ced307a..8d0c4db 100644 --- a/plugin/ccp.cpp +++ b/plugin/ccp.cpp @@ -361,13 +361,11 @@ CcpScreen::setOptionFromContext (CompOption *o, CCSSetting *setting; CompOption::Value value; - int screenNum = screen->screenNum (); - bsp = ccsFindPlugin (mContext, (plugin) ? plugin : CORE_VTABLE_NAME); if (!bsp) return; - setting = ccsFindSetting (bsp, o->name ().c_str (), TRUE, screenNum); + setting = ccsFindSetting (bsp, o->name ().c_str ()); if (!setting) return; @@ -387,13 +385,11 @@ CcpScreen::setContextFromOption (CompOption *o, const char *plugin) CCSPlugin *bsp; CCSSetting *setting; - int screenNum = screen->screenNum (); - bsp = ccsFindPlugin (mContext, (plugin) ? plugin : CORE_VTABLE_NAME); if (!bsp) return; - setting = ccsFindSetting (bsp, o->name ().c_str (), TRUE, screenNum); + setting = ccsFindSetting (bsp, o->name ().c_str ()); if (!setting) return; @@ -512,9 +508,7 @@ CcpScreen::CcpScreen (CompScreen *screen) : { ccsSetBasicMetadata (TRUE); - unsigned int screenNum = screen->screenNum (); - - mContext = ccsContextNew (&screenNum, 1); + mContext = ccsContextNew (screen->screenNum ()); ccsReadSettings (mContext); mContext->changedSettings = diff --git a/src/compiz.cpp b/src/compiz.cpp index db43be8..b169beb 100644 --- a/src/compiz.cpp +++ b/src/compiz.cpp @@ -511,7 +511,6 @@ initActionInfoPB (CCSSettingInfo * i, const OptionMetadata & option) static void addOptionForPluginPB (CCSPlugin * plugin, const char * name, - unsigned int screen, const StringList & groups, const StringList & subgroups, const OptionMetadata & option) @@ -519,7 +518,7 @@ addOptionForPluginPB (CCSPlugin * plugin, int num = 0; CCSSetting *setting; - if (ccsFindSetting (plugin, name, TRUE, screen)) + if (ccsFindSetting (plugin, name)) { fprintf (stderr, "[ERROR]: Option \"%s\" already defined\n", name); return; @@ -530,8 +529,6 @@ addOptionForPluginPB (CCSPlugin * plugin, return; setting->parent = plugin; - setting->isScreen = TRUE; - setting->screenNum = screen; setting->isDefault = TRUE; setting->name = strdup (name); @@ -685,10 +682,8 @@ addOptionFromPB (CCSPlugin * plugin, if (!strlen (name) || readonly) return; - for (i = 0; i < plugin->context->numScreens; i++) - addOptionForPluginPB (plugin, name, - plugin->context->screens[i], - groups, subgroups, option); + addOptionForPluginPB (plugin, name, + groups, subgroups, option); } static void @@ -1940,7 +1935,6 @@ addOptionForPlugin (CCSPlugin * plugin, char * name, char * type, Bool isReadonly, - unsigned int screen, xmlNode * node, void * groupListPBv, void * subgroupListPBv, @@ -1950,7 +1944,7 @@ addOptionForPlugin (CCSPlugin * plugin, int num = 0; CCSSetting *setting; - if (ccsFindSetting (plugin, name, TRUE, screen)) + if (ccsFindSetting (plugin, name)) { fprintf (stderr, "[ERROR]: Option \"%s\" already defined\n", name); return; @@ -1964,8 +1958,6 @@ addOptionForPlugin (CCSPlugin * plugin, return; setting->parent = plugin; - setting->isScreen = TRUE; - setting->screenNum = screen; setting->isDefault = TRUE; setting->name = strdup (name); @@ -2175,10 +2167,8 @@ addOptionFromXMLNode (CCSPlugin * plugin, return; } - for (i = 0; i < plugin->context->numScreens; i++) - addOptionForPlugin (plugin, name, type, isReadonly, - plugin->context->screens[i], node, - groupListPBv, subgroupListPBv, optionPBv); + addOptionForPlugin (plugin, name, type, isReadonly, node, + groupListPBv, subgroupListPBv, optionPBv); free (name); free (type); @@ -94,7 +94,7 @@ configChangeNotify (unsigned int watchId, void *closure) } CCSContext * -ccsEmptyContextNew (unsigned int *screens, unsigned int numScreens) +ccsEmptyContextNew (unsigned int screenNum) { CCSContext *context; @@ -111,35 +111,7 @@ ccsEmptyContextNew (unsigned int *screens, unsigned int numScreens) CONTEXT_PRIV (context); - if (numScreens > 0 && screens) - { - int i; - - context->screens = calloc (1, sizeof (unsigned int) * numScreens); - if (!context->screens) - { - free (cPrivate); - free (context); - return NULL; - } - - context->numScreens = numScreens; - - for (i = 0; i < numScreens; i++) - context->screens[i] = screens[i]; - } - else - { - context->screens = calloc (1, sizeof (unsigned int)); - if (!context->screens) - { - free (cPrivate); - free (context); - return NULL; - } - context->screens[0] = 0; - context->numScreens = 1; - } + context->screenNum = screenNum; initGeneralOptions (context); cPrivate->configWatchId = ccsAddConfigWatch (context, configChangeNotify); @@ -187,10 +159,10 @@ ccsSetActivePluginList (CCSContext * context, CCSStringList list) } CCSContext * -ccsContextNew (unsigned int *screens, unsigned int numScreens) +ccsContextNew (unsigned int screenNum) { CCSPlugin *p; - CCSContext *context = ccsEmptyContextNew (screens, numScreens); + CCSContext *context = ccsEmptyContextNew (screenNum); if (!context) return NULL; @@ -204,7 +176,7 @@ ccsContextNew (unsigned int *screens, unsigned int numScreens) ccsLoadPluginSettings (p); /* initialize plugin->active values */ - s = ccsFindSetting (p, "active_plugins", TRUE, 0); + s = ccsFindSetting (p, "active_plugins"); if (s) { CCSStringList list; @@ -239,8 +211,7 @@ ccsFindPlugin (CCSContext * context, const char *name) } CCSSetting * -ccsFindSetting (CCSPlugin * plugin, const char *name, - Bool isScreen, unsigned int screenNum) +ccsFindSetting (CCSPlugin * plugin, const char *name) { if (!plugin) return NULL; @@ -257,10 +228,7 @@ ccsFindSetting (CCSPlugin * plugin, const char *name, while (l) { - if (!strcmp (l->data->name, name) && - ((!l->data->isScreen && !isScreen) || - (l->data->isScreen && isScreen)) && - (!isScreen || (l->data->screenNum == screenNum))) + if (!strcmp (l->data->name, name)) return l->data; l = l->next; @@ -366,9 +334,6 @@ ccsFreeContext (CCSContext * c) if (c->changedSettings) ccsSettingListFree (c->changedSettings, FALSE); - if (c->screens) - free (c->screens); - if (c->ccsPrivate) free (c->ccsPrivate); @@ -1718,7 +1683,7 @@ ccsWriteAutoSortedPluginList (CCSContext *context) { CCSSetting *s; - s = ccsFindSetting (p, "active_plugins", TRUE, 0); + s = ccsFindSetting (p, "active_plugins"); if (s) { CCSSettingValueList vl; @@ -2492,11 +2457,8 @@ ccsExportToFile (CCSContext *context, if (skipDefaults && setting->isDefault) continue; - if (setting->isScreen) - asprintf (&keyName, "s%d_%s", - setting->screenNum, setting->name); - else - asprintf (&keyName, "as_%s", setting->name); + asprintf (&keyName, "s%d_%s", + context->screenNum, setting->name); switch (setting->type) { @@ -2595,11 +2557,8 @@ ccsImportFromFile (CCSContext *context, if (!setting->isDefault && !overwriteNonDefault) continue; - if (setting->isScreen) - asprintf (&keyName, "s%d_%s", - setting->screenNum, setting->name); - else - asprintf (&keyName, "as_%s", setting->name); + asprintf (&keyName, "s%d_%s", + context->screenNum, setting->name); switch (setting->type) { |