mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +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:
@@ -39,6 +39,12 @@ Changes since version 0.70.0:
|
||||
adapt to newer/faster machines. Also used wusleep(10) when the delay was 0
|
||||
to get rid of the jerky animation when there was no delay.
|
||||
- Fixed bug with Unhide mapping windows from other workspaces.
|
||||
- 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.
|
||||
|
||||
|
||||
Changes since version 0.65.1:
|
||||
|
||||
6
TODO
6
TODO
@@ -27,9 +27,9 @@ Need to do:
|
||||
docked apps, balloons for the dock etc
|
||||
- check whether apps with name.class set to empty strings should be treated
|
||||
like if name.class is NULL.NULL
|
||||
- review the defaults handling code (not to save globals in user, not to
|
||||
reread after we update a domain if possible, check WINGs apps updating
|
||||
WMWindowAttributes after start making screen to flash on update)
|
||||
- review the defaults handling code (not to reread after we update a
|
||||
domain if possible, check WINGs apps updating WMWindowAttributes after
|
||||
start making screen to flash on update)
|
||||
|
||||
|
||||
Maybe some day:
|
||||
|
||||
@@ -7,6 +7,7 @@ Changes since wmaker 0.70.0:
|
||||
- removed a wsyserror() message when reading a property list from file
|
||||
(the programmer should decide if to give that message or just ignore).
|
||||
- added a 'Bool recursive' flag to WMMergePLDictionaries()
|
||||
- added WMSubtractPLDictionaries()
|
||||
|
||||
|
||||
Changes since wmaker 0.65.0:
|
||||
|
||||
@@ -769,12 +769,18 @@ void WMPutInPLDictionary(WMPropList *plist, WMPropList *key, WMPropList *value);
|
||||
|
||||
void WMRemoveFromPLDictionary(WMPropList *plist, WMPropList *key);
|
||||
|
||||
/* It inserts all key/value pairs from source into dest, overwriting
|
||||
/* It will insert all key/value pairs from source into dest, overwriting
|
||||
* the values with the same keys from dest, keeping all values with keys
|
||||
* only present in dest unchanged */
|
||||
WMPropList* WMMergePLDictionaries(WMPropList *dest, WMPropList *source,
|
||||
Bool recursive);
|
||||
|
||||
/* It will remove all key/value pairs from dest for which there is an
|
||||
* identical key/value present in source. Entires only present in dest, or
|
||||
* which have different values in dest than in source will be preserved. */
|
||||
WMPropList* WMSubtractPLDictionaries(WMPropList *dest, WMPropList *source,
|
||||
Bool recursive);
|
||||
|
||||
int WMGetPropListItemCount(WMPropList *plist);
|
||||
|
||||
Bool WMIsPLString(WMPropList *plist);
|
||||
|
||||
@@ -1218,12 +1218,15 @@ WMMergePLDictionaries(WMPropList *dest, WMPropList *source, Bool recursive)
|
||||
|
||||
wassertr(source->type==WPLDictionary && dest->type==WPLDictionary);
|
||||
|
||||
if (source == dest)
|
||||
return dest;
|
||||
|
||||
e = WMEnumerateHashTable(source->d.dict);
|
||||
while (WMNextHashEnumeratorItemAndKey(&e, (void**)&value, (void**)&key)) {
|
||||
if (recursive && value->type==WPLDictionary) {
|
||||
dvalue = WMGetFromPLDictionary(dest, key);
|
||||
dvalue = WMHashGet(dest->d.dict, key);
|
||||
if (dvalue && dvalue->type==WPLDictionary) {
|
||||
WMMergePLDictionaries(dvalue, value, recursive);
|
||||
WMMergePLDictionaries(dvalue, value, True);
|
||||
} else {
|
||||
WMPutInPLDictionary(dest, key, value);
|
||||
}
|
||||
@@ -1236,6 +1239,41 @@ WMMergePLDictionaries(WMPropList *dest, WMPropList *source, Bool recursive)
|
||||
}
|
||||
|
||||
|
||||
WMPropList*
|
||||
WMSubtractPLDictionaries(WMPropList *dest, WMPropList *source, Bool recursive)
|
||||
{
|
||||
WMPropList *key, *value, *dvalue;
|
||||
WMHashEnumerator e;
|
||||
|
||||
wassertr(source->type==WPLDictionary && dest->type==WPLDictionary);
|
||||
|
||||
if (source == dest) {
|
||||
WMPropList *keys = WMGetPLDictionaryKeys(dest);
|
||||
int i;
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(keys->d.array); i++) {
|
||||
WMRemoveFromPLDictionary(dest, WMGetFromArray(keys->d.array, i));
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
e = WMEnumerateHashTable(source->d.dict);
|
||||
while (WMNextHashEnumeratorItemAndKey(&e, (void**)&value, (void**)&key)) {
|
||||
dvalue = WMHashGet(dest->d.dict, key);
|
||||
if (!dvalue)
|
||||
continue;
|
||||
if (WMIsPropListEqualTo(value, dvalue)) {
|
||||
WMRemoveFromPLDictionary(dest, key);
|
||||
} else if (recursive && value->type==WPLDictionary &&
|
||||
dvalue->type==WPLDictionary) {
|
||||
WMSubtractPLDictionaries(dvalue, value, True);
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetPropListItemCount(WMPropList *plist)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -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) {
|
||||
@@ -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)
|
||||
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);
|
||||
|
||||
/* set window group leader to self */
|
||||
/* 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->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