mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
SOme fixes, and added WMGetDefaultsFromPath().
This commit is contained in:
@@ -24,6 +24,8 @@ Changes since version 0.52.0:
|
||||
- fixed the problem with showing a window as focused in the window list menu
|
||||
while it was on another workspace.
|
||||
- show workspace name on screen when switching workspaces
|
||||
- Fixed bug in WPrefs that added a new line at the end of autostart script
|
||||
at every save, growing it indefinitely.
|
||||
|
||||
|
||||
Changes since version 0.51.2:
|
||||
|
||||
@@ -251,6 +251,8 @@ void WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
|
||||
|
||||
WMUserDefaults *WMGetStandardUserDefaults(void);
|
||||
|
||||
WMUserDefaults *WMGetDefaultsFromPath(char *path);
|
||||
|
||||
void WMSynchronizeUserDefaults(WMUserDefaults *database);
|
||||
|
||||
proplist_t WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
@@ -22,10 +22,17 @@ typedef struct W_UserDefaults {
|
||||
|
||||
char dirty;
|
||||
|
||||
char *path; /* where is db located */
|
||||
|
||||
struct W_UserDefaults *next;
|
||||
|
||||
} UserDefaults;
|
||||
|
||||
|
||||
static UserDefaults *sharedUserDefaults = NULL;
|
||||
static UserDefaults **sharedDefaultsList = NULL;
|
||||
static Bool registeredSaveOnExit = False;
|
||||
|
||||
|
||||
extern char *WMGetApplicationName();
|
||||
|
||||
@@ -83,12 +90,38 @@ saveDefaultsChanges(int foo, void *bar)
|
||||
saveDefaultsChanges(void)
|
||||
#endif
|
||||
{
|
||||
/* save the user defaults database */
|
||||
if (sharedUserDefaults && sharedUserDefaults->dirty) {
|
||||
PLSave(sharedUserDefaults->appDomain, YES);
|
||||
}
|
||||
|
||||
/* now save the extra defaults databases we may have */
|
||||
if (sharedDefaultsList) {
|
||||
UserDefaults *tmp = *sharedDefaultsList;
|
||||
|
||||
while (tmp) {
|
||||
if (tmp->dirty)
|
||||
PLSave(tmp->appDomain, YES);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* set to save changes in defaults when program is exited */
|
||||
static void
|
||||
registerSaveOnExit(void)
|
||||
{
|
||||
if (!registeredSaveOnExit) {
|
||||
#ifndef HAVE_ATEXIT
|
||||
on_exit(saveDefaultsChanges, (void*)NULL);
|
||||
#else
|
||||
atexit(saveDefaultsChanges);
|
||||
#endif
|
||||
registeredSaveOnExit = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSynchronizeUserDefaults(WMUserDefaults *database)
|
||||
@@ -182,20 +215,96 @@ WMGetStandardUserDefaults(void)
|
||||
|
||||
sharedUserDefaults = defaults;
|
||||
|
||||
/* set to save changes in defaults when program is exited */
|
||||
registerSaveOnExit();
|
||||
|
||||
|
||||
#ifndef HAVE_ATEXIT
|
||||
on_exit(saveDefaultsChanges, (void*)NULL);
|
||||
#else
|
||||
atexit(saveDefaultsChanges);
|
||||
#endif
|
||||
}
|
||||
|
||||
return sharedUserDefaults;
|
||||
}
|
||||
|
||||
|
||||
WMUserDefaults*
|
||||
WMGetDefaultsFromPath(char *path)
|
||||
{
|
||||
WMUserDefaults *defaults;
|
||||
proplist_t domain;
|
||||
proplist_t key;
|
||||
char *name;
|
||||
int i;
|
||||
|
||||
assert(path != NULL);
|
||||
|
||||
if (sharedDefaultsList) {
|
||||
defaults = *sharedDefaultsList;
|
||||
while (defaults) {
|
||||
if (strcmp(defaults->path, path) == 0)
|
||||
return defaults;
|
||||
defaults = defaults->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* we didn't found the database we are looking for. Go read it. */
|
||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||
memset(defaults, 0, sizeof(WMUserDefaults));
|
||||
|
||||
defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
|
||||
defaults->searchList = wmalloc(sizeof(proplist_t)*2);
|
||||
|
||||
/* the domain we want go first */
|
||||
name = strrchr(path, '/');
|
||||
if (!name)
|
||||
name = path;
|
||||
else
|
||||
name++;
|
||||
key = PLMakeString(name);
|
||||
defaults->searchList[0] = key;
|
||||
|
||||
domain = PLGetProplistWithPath(path);
|
||||
|
||||
if (!domain) {
|
||||
proplist_t p;
|
||||
|
||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
p = PLMakeString(path);
|
||||
PLSetFilename(domain, p);
|
||||
PLRelease(p);
|
||||
}
|
||||
|
||||
defaults->path = wstrdup(path);
|
||||
|
||||
defaults->appDomain = domain;
|
||||
|
||||
if (domain)
|
||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
||||
|
||||
PLRelease(key);
|
||||
|
||||
/* terminate list */
|
||||
defaults->searchList[1] = NULL;
|
||||
|
||||
defaults->searchListArray=PLMakeArrayFromElements(NULL,NULL);
|
||||
|
||||
i = 0;
|
||||
while (defaults->searchList[i]) {
|
||||
PLAppendArrayElement(defaults->searchListArray,
|
||||
defaults->searchList[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (sharedDefaultsList)
|
||||
defaults->next = *sharedDefaultsList;
|
||||
sharedDefaultsList = &defaults;
|
||||
|
||||
registerSaveOnExit();
|
||||
|
||||
name = PLGetDescriptionIndent(defaults->defaults, 0);
|
||||
puts(name);
|
||||
free(name);
|
||||
|
||||
return defaults;
|
||||
}
|
||||
|
||||
|
||||
proplist_t
|
||||
WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
||||
|
||||
@@ -812,7 +812,13 @@ storeCommandInScript(char *cmd, char *line)
|
||||
while (!feof(f)) {
|
||||
if (!fgets(buffer, 127, f)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (buffer[0] == '\n') {
|
||||
/* don't write empty lines, else the file will grow
|
||||
* indefinitely (one '\n' added at end of file on each save).
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
if (strncmp(buffer, cmd, len)==0) {
|
||||
if (!ok) {
|
||||
fputs(line, fo);
|
||||
|
||||
2
configure
vendored
2
configure
vendored
@@ -751,7 +751,7 @@ fi
|
||||
|
||||
PACKAGE=WindowMaker
|
||||
|
||||
VERSION=0.52.1
|
||||
VERSION=0.53.0
|
||||
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
|
||||
|
||||
16
src/dock.c
16
src/dock.c
@@ -425,10 +425,12 @@ wClipMakeTile(WScreen *scr, RImage *normalTile)
|
||||
ROperateLine(tile, RAddOperation, tp, 2, wPreferences.icon_size-3,
|
||||
pt, &light);
|
||||
|
||||
RDrawLine(tile, ICON_SIZE - 6 - as, 5, ICON_SIZE - 6, 5, &black);
|
||||
//RDrawLine(tile, ICON_SIZE - 6 - as, 5, ICON_SIZE - 6, 5, &black);
|
||||
ROperateLine(tile, RSubtractOperation, ICON_SIZE - 5 - as, 5,
|
||||
ICON_SIZE - 6, 5, &dark);
|
||||
ROperateLine(tile, RSubtractOperation, ICON_SIZE - 6 - as, 5,
|
||||
ICON_SIZE - 7, 4 + as, &dark);
|
||||
ROperateLine(tile, RAddOperation, ICON_SIZE - 6, 6, ICON_SIZE - 6, 5 + as,
|
||||
ICON_SIZE - 6, 5 + as, &dark);
|
||||
ROperateLine(tile, RAddOperation, ICON_SIZE - 6, 5, ICON_SIZE - 6, 5 + as,
|
||||
&light);
|
||||
|
||||
|
||||
@@ -440,10 +442,12 @@ wClipMakeTile(WScreen *scr, RImage *normalTile)
|
||||
wPreferences.icon_size-2, &light);
|
||||
|
||||
ROperateLine(tile, RSubtractOperation, 5, ICON_SIZE - 6 - as,
|
||||
4 + as, ICON_SIZE - 7, &dark);
|
||||
RDrawLine(tile, 5, ICON_SIZE - 6 - as, 5, ICON_SIZE - 6, &black);
|
||||
5 + as, ICON_SIZE - 6, &dark);
|
||||
//RDrawLine(tile, 5, ICON_SIZE - 6 - as, 5, ICON_SIZE - 6, &black);
|
||||
ROperateLine(tile, RSubtractOperation, 5, ICON_SIZE - 5 - as, 5,
|
||||
ICON_SIZE - 6, &dark);
|
||||
|
||||
ROperateLine(tile, RAddOperation, 6, ICON_SIZE - 6, 5 + as, ICON_SIZE - 6,
|
||||
ROperateLine(tile, RAddOperation, 5, ICON_SIZE - 6, 5 + as, ICON_SIZE - 6,
|
||||
&light);
|
||||
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@
|
||||
#define DEF_CLIP_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*\""
|
||||
#define DEF_INFO_TEXT_FONT "\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\""
|
||||
|
||||
#define DEF_WORKSPACE_NAME_FONT "-*-lucida-bold-r-normal--24-*"
|
||||
#define DEF_WORKSPACE_NAME_FONT "-*-lucida-bold-r-*-*-24-*-*-*-*-*-*-*"
|
||||
#endif /* !I18N_MB */
|
||||
|
||||
#define HELVETICA10_FONT "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*"
|
||||
|
||||
Reference in New Issue
Block a user