mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-26 00:12:31 +01:00
- Saving a domain file will first strip all entries that are also present in
the global domain as well and are exactly the same. This fixes a bug where settings from the global domain file were merged in the user domain file and further changes in the global domain file for those merged values was ignored making a system admin unable to set global defaults for all users using the global domains. - Fixed bug with not extracting the icon from the client when using shared appicons. - Added WMSubtractPLDictionaries() to WINGs (opposite for merging, it will remove all entries from dest if they are present in source and are exactly the same. Unique entries in dest and entries with different values from those present in source will be preserved).
This commit is contained in:
@@ -185,8 +185,9 @@ saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
|
||||
WMReleasePropList(key);
|
||||
WMReleasePropList(iconk);
|
||||
|
||||
if (val && !wPreferences.flags.noupdates)
|
||||
WMWritePropListToFile(dict, WDWindowAttributes->path, True);
|
||||
if (val && !wPreferences.flags.noupdates) {
|
||||
UpdateDomainFile(WDWindowAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -905,6 +905,29 @@ initDefaults()
|
||||
}
|
||||
|
||||
|
||||
static WMPropList*
|
||||
readGlobalDomain(char *domainName, Bool requireDictionary)
|
||||
{
|
||||
WMPropList *globalDict = NULL;
|
||||
char path[PATH_MAX];
|
||||
struct stat stbuf;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/WindowMaker/%s", SYSCONFDIR, domainName);
|
||||
if (stat(path, &stbuf)>=0) {
|
||||
globalDict = WMReadPropListFromFile(path);
|
||||
if (globalDict && requireDictionary && !WMIsPLDictionary(globalDict)) {
|
||||
wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
|
||||
domainName, path);
|
||||
WMReleasePropList(globalDict);
|
||||
globalDict = NULL;
|
||||
} else if (!globalDict) {
|
||||
wwarning(_("could not load domain %s from global defaults database"),
|
||||
domainName);
|
||||
}
|
||||
}
|
||||
|
||||
return globalDict;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
@@ -989,7 +1012,7 @@ wDefaultsInitDomain(char *domain, Bool requireDictionary)
|
||||
} else {
|
||||
if (db->dictionary && WMIsPLDictionary(shared_dict) &&
|
||||
WMIsPLDictionary(db->dictionary)) {
|
||||
WMMergePLDictionaries(shared_dict, db->dictionary, True);
|
||||
WMMergePLDictionaries(shared_dict, db->dictionary, True);
|
||||
WMReleasePropList(db->dictionary);
|
||||
db->dictionary = shared_dict;
|
||||
if (stbuf.st_mtime > db->timestamp)
|
||||
@@ -1048,35 +1071,22 @@ wDefaultsCheckDomains(void *foo)
|
||||
{
|
||||
WScreen *scr;
|
||||
struct stat stbuf;
|
||||
WMPropList *shared_dict = NULL;
|
||||
WMPropList *dict;
|
||||
int i;
|
||||
char path[PATH_MAX];
|
||||
|
||||
#ifdef HEARTBEAT
|
||||
puts("Checking domains...");
|
||||
#endif
|
||||
if (stat(WDWindowMaker->path, &stbuf)>=0
|
||||
&& WDWindowMaker->timestamp < stbuf.st_mtime) {
|
||||
WMPropList *shared_dict = NULL;
|
||||
#ifdef HEARTBEAT
|
||||
puts("Checking WindowMaker domain");
|
||||
#endif
|
||||
WDWindowMaker->timestamp = stbuf.st_mtime;
|
||||
|
||||
/* global dictionary */
|
||||
snprintf(path, sizeof(path), "%s/WindowMaker/WindowMaker", SYSCONFDIR);
|
||||
if (stat(path, &stbuf)>=0) {
|
||||
shared_dict = WMReadPropListFromFile(path);
|
||||
if (shared_dict && !WMIsPLDictionary(shared_dict)) {
|
||||
wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
|
||||
"WindowMaker", path);
|
||||
WMReleasePropList(shared_dict);
|
||||
shared_dict = NULL;
|
||||
} else if (!shared_dict) {
|
||||
wwarning(_("could not load domain %s from global defaults database"),
|
||||
"WindowMaker");
|
||||
}
|
||||
}
|
||||
shared_dict = readGlobalDomain("WindowMaker", True);
|
||||
/* user dictionary */
|
||||
dict = WMReadPropListFromFile(WDWindowMaker->path);
|
||||
if (dict) {
|
||||
@@ -1087,7 +1097,7 @@ wDefaultsCheckDomains(void *foo)
|
||||
"WindowMaker", WDWindowMaker->path);
|
||||
} else {
|
||||
if (shared_dict) {
|
||||
WMMergePLDictionaries(shared_dict, dict, True);
|
||||
WMMergePLDictionaries(shared_dict, dict, True);
|
||||
WMReleasePropList(dict);
|
||||
dict = shared_dict;
|
||||
shared_dict = NULL;
|
||||
@@ -1116,6 +1126,9 @@ wDefaultsCheckDomains(void *foo)
|
||||
#ifdef HEARTBEAT
|
||||
puts("Checking WMWindowAttributes domain");
|
||||
#endif
|
||||
/* global dictionary */
|
||||
shared_dict = readGlobalDomain("WMWindowAttributes", True);
|
||||
/* user dictionary */
|
||||
dict = WMReadPropListFromFile(WDWindowAttributes->path);
|
||||
if (dict) {
|
||||
if (!WMIsPLDictionary(dict)) {
|
||||
@@ -1124,8 +1137,15 @@ wDefaultsCheckDomains(void *foo)
|
||||
wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
|
||||
"WMWindowAttributes", WDWindowAttributes->path);
|
||||
} else {
|
||||
if (WDWindowAttributes->dictionary)
|
||||
WMReleasePropList(WDWindowAttributes->dictionary);
|
||||
if (shared_dict) {
|
||||
WMMergePLDictionaries(shared_dict, dict, True);
|
||||
WMReleasePropList(dict);
|
||||
dict = shared_dict;
|
||||
shared_dict = NULL;
|
||||
}
|
||||
if (WDWindowAttributes->dictionary) {
|
||||
WMReleasePropList(WDWindowAttributes->dictionary);
|
||||
}
|
||||
WDWindowAttributes->dictionary = dict;
|
||||
for (i=0; i<wScreenCount; i++) {
|
||||
scr = wScreenWithNumber(i);
|
||||
@@ -1154,6 +1174,9 @@ wDefaultsCheckDomains(void *foo)
|
||||
"WMWindowAttributes");
|
||||
}
|
||||
WDWindowAttributes->timestamp = stbuf.st_mtime;
|
||||
if (shared_dict) {
|
||||
WMReleasePropList(shared_dict);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef LITE
|
||||
|
||||
@@ -35,6 +35,9 @@ int wMessageDialog(WScreen *scr, char *title, char *message,
|
||||
char *defBtn, char *altBtn, char *othBtn);
|
||||
int wInputDialog(WScreen *scr, char *title, char *message, char **text);
|
||||
|
||||
int wExitDialog(WScreen *scr, char *title, char *message, char *defBtn,
|
||||
char *altBtn, char *othBtn);
|
||||
|
||||
Bool wIconChooserDialog(WScreen *scr, char **file, char *instance, char *class);
|
||||
|
||||
void wShowInfoPanel(WScreen *scr);
|
||||
|
||||
@@ -86,6 +86,7 @@ Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
|
||||
Bool wDockFindFreeSlot(WDock *dock, int *req_x, int *req_y);
|
||||
void wDockDetach(WDock *dock, WAppIcon *icon);
|
||||
|
||||
void wDockFinishLaunch(WDock *dock, WAppIcon *icon);
|
||||
void wDockTrackWindowLaunch(WDock *dock, Window window);
|
||||
WAppIcon *wDockFindIconForWindow(WDock *dock, Window window);
|
||||
void wDockDoAutoLaunch(WDock *dock, int workspace);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "window.h"
|
||||
#include "defaults.h"
|
||||
|
||||
typedef void (WCallBack)(void *cdata);
|
||||
|
||||
@@ -124,6 +125,8 @@ char *EscapeWM_CLASS(char *name, char *class);
|
||||
|
||||
void UnescapeWM_CLASS(char *str, char **name, char **class);
|
||||
|
||||
Bool UpdateDomainFile(WDDomain *domain);
|
||||
|
||||
#ifdef NUMLOCK_HACK
|
||||
void wHackedGrabKey(int keycode, unsigned int modifiers,
|
||||
Window grab_window, Bool owner_events, int pointer_mode,
|
||||
|
||||
35
src/misc.c
35
src/misc.c
@@ -1236,3 +1236,38 @@ SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
|
||||
}
|
||||
wfree(buffer);
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
UpdateDomainFile(WDDomain *domain)
|
||||
{
|
||||
struct stat stbuf;
|
||||
char path[PATH_MAX];
|
||||
WMPropList *shared_dict=NULL, *dict;
|
||||
Bool result, freeDict = False;
|
||||
|
||||
dict = domain->dictionary;
|
||||
if (WMIsPLDictionary(domain->dictionary)) {
|
||||
/* retrieve global system dictionary */
|
||||
snprintf(path, sizeof(path), "%s/WindowMaker/%s",
|
||||
SYSCONFDIR, domain->domain_name);
|
||||
if (stat(path, &stbuf) >= 0) {
|
||||
shared_dict = WMReadPropListFromFile(path);
|
||||
if (shared_dict && WMIsPLDictionary(shared_dict)) {
|
||||
freeDict = True;
|
||||
dict = WMDeepCopyPropList(domain->dictionary);
|
||||
WMSubtractPLDictionaries(dict, shared_dict, True);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = WMWritePropListToFile(dict, domain->path, True);
|
||||
|
||||
if (freeDict) {
|
||||
WMReleasePropList(dict);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -547,8 +547,9 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
|
||||
} else if (icon_value!=NULL && !same) {
|
||||
WMPutInPLDictionary(dict, key, icon_value);
|
||||
}
|
||||
if (!wPreferences.flags.noupdates)
|
||||
WMWritePropListToFile(dict, db->path, True);
|
||||
if (!wPreferences.flags.noupdates) {
|
||||
UpdateDomainFile(db);
|
||||
}
|
||||
|
||||
WMReleasePropList(key);
|
||||
if(icon_value)
|
||||
|
||||
@@ -551,10 +551,15 @@ createFakeWindowGroupLeader(WScreen *scr, Window win, char *instance, char *clas
|
||||
XSetClassHint(dpy, leader, classHint);
|
||||
XFree(classHint);
|
||||
|
||||
/* inherit these from the original leader if available */
|
||||
hints = XGetWMHints(dpy, win);
|
||||
if (!hints) {
|
||||
hints = XAllocWMHints();
|
||||
hints->flags = 0;
|
||||
}
|
||||
/* set window group leader to self */
|
||||
hints = XAllocWMHints();
|
||||
hints->window_group = leader;
|
||||
hints->flags = WindowGroupHint;
|
||||
hints->flags |= WindowGroupHint;
|
||||
XSetWMHints(dpy, leader, hints);
|
||||
XFree(hints);
|
||||
|
||||
|
||||
@@ -713,7 +713,7 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
||||
WMReleasePropList(key);
|
||||
WMReleasePropList(winDic);
|
||||
|
||||
WMWritePropListToFile(dict, db->path, True);
|
||||
UpdateDomainFile(db);
|
||||
|
||||
/* clean up */
|
||||
WMPLSetCaseSensitive(False);
|
||||
|
||||
Reference in New Issue
Block a user