mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
- improved behaviour for the shared appicon thing.
- added a 'Bool recursive' flag to WMMergePLDictionaries() in WINGs
This commit is contained in:
@@ -27,6 +27,8 @@ Changes since version 0.70.0:
|
|||||||
- Removed the collapse appicons thing.
|
- Removed the collapse appicons thing.
|
||||||
- Added real appicon sharing (apps of the same kind will have a single shared
|
- Added real appicon sharing (apps of the same kind will have a single shared
|
||||||
appicon).
|
appicon).
|
||||||
|
- Fixed user and global defaults domain merging to preserve values present in
|
||||||
|
global but not in user in subdictionaries.
|
||||||
|
|
||||||
|
|
||||||
Changes since version 0.65.1:
|
Changes since version 0.65.1:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Changes since wmaker 0.70.0:
|
|||||||
included too
|
included too
|
||||||
- removed a wsyserror() message when reading a property list from file
|
- removed a wsyserror() message when reading a property list from file
|
||||||
(the programmer should decide if to give that message or just ignore).
|
(the programmer should decide if to give that message or just ignore).
|
||||||
|
- added a 'Bool recursive' flag to WMMergePLDictionaries()
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.65.0:
|
Changes since wmaker 0.65.0:
|
||||||
|
|||||||
@@ -772,7 +772,8 @@ void WMRemoveFromPLDictionary(WMPropList *plist, WMPropList *key);
|
|||||||
/* It inserts all key/value pairs from source into dest, overwriting
|
/* It inserts all key/value pairs from source into dest, overwriting
|
||||||
* the values with the same keys from dest, keeping all values with keys
|
* the values with the same keys from dest, keeping all values with keys
|
||||||
* only present in dest unchanged */
|
* only present in dest unchanged */
|
||||||
WMPropList* WMMergePLDictionaries(WMPropList *dest, WMPropList *source);
|
WMPropList* WMMergePLDictionaries(WMPropList *dest, WMPropList *source,
|
||||||
|
Bool recursive);
|
||||||
|
|
||||||
int WMGetPropListItemCount(WMPropList *plist);
|
int WMGetPropListItemCount(WMPropList *plist);
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ typedef WMPropList* proplist_t;
|
|||||||
#define PLRemoveArrayElement(array, pos) WMDeleteFromPLArray(array, pos)
|
#define PLRemoveArrayElement(array, pos) WMDeleteFromPLArray(array, pos)
|
||||||
#define PLInsertDictionaryEntry(dict, key, value) WMPutInPLDictionary(dict, key, value)
|
#define PLInsertDictionaryEntry(dict, key, value) WMPutInPLDictionary(dict, key, value)
|
||||||
#define PLRemoveDictionaryEntry(dict, key) WMRemoveFromPLDictionary(dict, key)
|
#define PLRemoveDictionaryEntry(dict, key) WMRemoveFromPLDictionary(dict, key)
|
||||||
#define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source)
|
#define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source, False)
|
||||||
|
|
||||||
#define PLGetNumberOfElements(pl) WMGetPropListItemCount(pl)
|
#define PLGetNumberOfElements(pl) WMGetPropListItemCount(pl)
|
||||||
|
|
||||||
|
|||||||
@@ -1211,16 +1211,25 @@ WMRemoveFromPLDictionary(WMPropList *plist, WMPropList *key)
|
|||||||
|
|
||||||
|
|
||||||
WMPropList*
|
WMPropList*
|
||||||
WMMergePLDictionaries(WMPropList *dest, WMPropList *source)
|
WMMergePLDictionaries(WMPropList *dest, WMPropList *source, Bool recursive)
|
||||||
{
|
{
|
||||||
WMPropList *key, *value;
|
WMPropList *key, *value, *dvalue;
|
||||||
WMHashEnumerator e;
|
WMHashEnumerator e;
|
||||||
|
|
||||||
wassertr(source->type==WPLDictionary && dest->type==WPLDictionary);
|
wassertr(source->type==WPLDictionary && dest->type==WPLDictionary);
|
||||||
|
|
||||||
e = WMEnumerateHashTable(source->d.dict);
|
e = WMEnumerateHashTable(source->d.dict);
|
||||||
while (WMNextHashEnumeratorItemAndKey(&e, (void**)&value, (void**)&key)) {
|
while (WMNextHashEnumeratorItemAndKey(&e, (void**)&value, (void**)&key)) {
|
||||||
WMPutInPLDictionary(dest, key, value);
|
if (recursive && value->type==WPLDictionary) {
|
||||||
|
dvalue = WMGetFromPLDictionary(dest, key);
|
||||||
|
if (dvalue && dvalue->type==WPLDictionary) {
|
||||||
|
WMMergePLDictionaries(dvalue, value, recursive);
|
||||||
|
} else {
|
||||||
|
WMPutInPLDictionary(dest, key, value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
WMPutInPLDictionary(dest, key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ WMSynchronizeUserDefaults(WMUserDefaults *database)
|
|||||||
if (database->dirty && fileIsNewer) {
|
if (database->dirty && fileIsNewer) {
|
||||||
plF = WMReadPropListFromFile(path);
|
plF = WMReadPropListFromFile(path);
|
||||||
if (plF) {
|
if (plF) {
|
||||||
plF = WMMergePLDictionaries(plF, database->appDomain);
|
plF = WMMergePLDictionaries(plF, database->appDomain, False);
|
||||||
WMReleasePropList(database->appDomain);
|
WMReleasePropList(database->appDomain);
|
||||||
database->appDomain = plF;
|
database->appDomain = plF;
|
||||||
key = database->searchList[0];
|
key = database->searchList[0];
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
WSoundServer = {Icon = sound.#extension#;};
|
WSoundServer = {Icon = sound.#extension#;};
|
||||||
panel.Panel = {NoAppIcon = YES;};
|
panel.Panel = {NoAppIcon = YES;};
|
||||||
gmc.Gmc = {NoAppIcon = YES;};
|
gmc.Gmc = {NoAppIcon = YES;};
|
||||||
XTerm = {SharedAppIcon = Yes;Icon = Terminal.#extension#;};
|
XTerm = {Icon = Terminal.#extension#;};
|
||||||
NXTerm = {SharedAppIcon = Yes;Icon = Terminal.#extension#;};
|
NXTerm = {Icon = Terminal.#extension#;};
|
||||||
ScilabGraphic0.Xscilab = {KeepInsideScreen=YES;};
|
ScilabGraphic0.Xscilab = {KeepInsideScreen=YES;};
|
||||||
ScilabGraphic1.Xscilab = {KeepInsideScreen=YES;};
|
ScilabGraphic1.Xscilab = {KeepInsideScreen=YES;};
|
||||||
ScilabGraphic2.Xscilab = {KeepInsideScreen=YES;};
|
ScilabGraphic2.Xscilab = {KeepInsideScreen=YES;};
|
||||||
@@ -46,11 +46,11 @@
|
|||||||
Xmag = {Icon = inspect.xpm;};
|
Xmag = {Icon = inspect.xpm;};
|
||||||
Xmessage = {Icon = Reference.xpm;};
|
Xmessage = {Icon = Reference.xpm;};
|
||||||
XConsole = {Icon = inspect.xpm;Omnipresent = Yes;};
|
XConsole = {Icon = inspect.xpm;Omnipresent = Yes;};
|
||||||
Fte = {SharedAppIcon = Yes;Icon = Clipboard.tif;};
|
Fte = {Icon = Clipboard.tif;};
|
||||||
xjed = {Icon = Clipboard.xpm;};
|
xjed = {Icon = Clipboard.xpm;};
|
||||||
xedit = {Icon = notepad.#extension#;};
|
xedit = {Icon = notepad.#extension#;};
|
||||||
xmixer = {Icon = mixer.#extension#;};
|
xmixer = {Icon = mixer.#extension#;};
|
||||||
xmcd = {Icon = Radio.xpm;};
|
xmcd = {Icon = Radio.xpm;};
|
||||||
xplaycd = {Icon = Radio.xpm;};
|
xplaycd = {Icon = Radio.xpm;};
|
||||||
"*" = {Icon = defaultAppIcon.#extension#;};
|
"*" = {Icon = defaultAppIcon.#extension#;SharedAppIcon = Yes;};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
|
|||||||
else
|
else
|
||||||
wwin->flags.urgent = 0;
|
wwin->flags.urgent = 0;
|
||||||
} else if (wwin->fake_group!=NULL) {
|
} else if (wwin->fake_group!=NULL) {
|
||||||
wwin->group_id = wwin->fake_group->window;
|
wwin->group_id = wwin->fake_group->leader;
|
||||||
} else {
|
} else {
|
||||||
wwin->group_id = None;
|
wwin->group_id = None;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -989,7 +989,7 @@ wDefaultsInitDomain(char *domain, Bool requireDictionary)
|
|||||||
} else {
|
} else {
|
||||||
if (db->dictionary && WMIsPLDictionary(shared_dict) &&
|
if (db->dictionary && WMIsPLDictionary(shared_dict) &&
|
||||||
WMIsPLDictionary(db->dictionary)) {
|
WMIsPLDictionary(db->dictionary)) {
|
||||||
WMMergePLDictionaries(shared_dict, db->dictionary);
|
WMMergePLDictionaries(shared_dict, db->dictionary, True);
|
||||||
WMReleasePropList(db->dictionary);
|
WMReleasePropList(db->dictionary);
|
||||||
db->dictionary = shared_dict;
|
db->dictionary = shared_dict;
|
||||||
if (stbuf.st_mtime > db->timestamp)
|
if (stbuf.st_mtime > db->timestamp)
|
||||||
@@ -1087,7 +1087,7 @@ wDefaultsCheckDomains(void *foo)
|
|||||||
"WindowMaker", WDWindowMaker->path);
|
"WindowMaker", WDWindowMaker->path);
|
||||||
} else {
|
} else {
|
||||||
if (shared_dict) {
|
if (shared_dict) {
|
||||||
WMMergePLDictionaries(shared_dict, dict);
|
WMMergePLDictionaries(shared_dict, dict, True);
|
||||||
WMReleasePropList(dict);
|
WMReleasePropList(dict);
|
||||||
dict = shared_dict;
|
dict = shared_dict;
|
||||||
shared_dict = NULL;
|
shared_dict = NULL;
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ toggleLoweredCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
static int
|
static int
|
||||||
matchWindow(void *item, void *cdata)
|
matchWindow(void *item, void *cdata)
|
||||||
{
|
{
|
||||||
return (((WFakeGroupLeader*)item)->window == (Window)cdata);
|
return (((WFakeGroupLeader*)item)->leader == (Window)cdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
26
src/event.c
26
src/event.c
@@ -439,6 +439,13 @@ saveTimestamp(XEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
matchWindow(void *item, void *cdata)
|
||||||
|
{
|
||||||
|
return (((WFakeGroupLeader*)item)->origLeader == (Window)cdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handleExtensions(XEvent *event)
|
handleExtensions(XEvent *event)
|
||||||
{
|
{
|
||||||
@@ -538,6 +545,8 @@ handleDestroyNotify(XEvent *event)
|
|||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WApplication *app;
|
WApplication *app;
|
||||||
Window window = event->xdestroywindow.window;
|
Window window = event->xdestroywindow.window;
|
||||||
|
WScreen *scr = wScreenForRootWindow(event->xdestroywindow.event);
|
||||||
|
int index;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
L("got destroy notify");
|
L("got destroy notify");
|
||||||
@@ -547,6 +556,23 @@ handleDestroyNotify(XEvent *event)
|
|||||||
wUnmanageWindow(wwin, False, True);
|
wUnmanageWindow(wwin, False, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index = WMFindInArray(scr->fakeGroupLeaders, matchWindow, (void*)window);
|
||||||
|
if (index != WANotFound) {
|
||||||
|
WFakeGroupLeader *fPtr;
|
||||||
|
|
||||||
|
fPtr = WMGetFromArray(scr->fakeGroupLeaders, index);
|
||||||
|
if (fPtr->retainCount > 0) {
|
||||||
|
fPtr->retainCount--;
|
||||||
|
if (fPtr->retainCount==0 && fPtr->leader!=None) {
|
||||||
|
XDestroyWindow(dpy, fPtr->leader);
|
||||||
|
fPtr->leader = None;
|
||||||
|
XFlush(dpy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fPtr->origLeader = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
app = wApplicationOf(window);
|
app = wApplicationOf(window);
|
||||||
if (app) {
|
if (app) {
|
||||||
if (window == app->main_window) {
|
if (window == app->main_window) {
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
|
|||||||
if ((attr = WMGetFromPLDictionary(dict, key)) != NULL) {
|
if ((attr = WMGetFromPLDictionary(dict, key)) != NULL) {
|
||||||
if (WMIsPLDictionary(attr)) {
|
if (WMIsPLDictionary(attr)) {
|
||||||
if (icon_value!=NULL && !same)
|
if (icon_value!=NULL && !same)
|
||||||
WMMergePLDictionaries(attr, icon_value);
|
WMMergePLDictionaries(attr, icon_value, False);
|
||||||
else
|
else
|
||||||
WMRemoveFromPLDictionary(attr, AIcon);
|
WMRemoveFromPLDictionary(attr, AIcon);
|
||||||
}
|
}
|
||||||
|
|||||||
35
src/window.c
35
src/window.c
@@ -238,13 +238,13 @@ wWindowDestroy(WWindow *wwin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wwin->fake_group) {
|
if (wwin->fake_group && wwin->fake_group->retainCount>0) {
|
||||||
if (wwin->fake_group->retainCount > 0)
|
wwin->fake_group->retainCount--;
|
||||||
wwin->fake_group->retainCount--;
|
if (wwin->fake_group->retainCount==0 && wwin->fake_group->leader!=None) {
|
||||||
if (wwin->fake_group->retainCount==0 && wwin->fake_group->window!=None) {
|
XDestroyWindow(dpy, wwin->fake_group->leader);
|
||||||
XDestroyWindow(dpy, wwin->fake_group->window);
|
wwin->fake_group->leader = None;
|
||||||
wwin->fake_group->window = None;
|
wwin->fake_group->origLeader = None;
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -811,27 +811,36 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
if (index != WANotFound) {
|
if (index != WANotFound) {
|
||||||
fPtr = WMGetFromArray(scr->fakeGroupLeaders, index);
|
fPtr = WMGetFromArray(scr->fakeGroupLeaders, index);
|
||||||
if (fPtr->retainCount == 0) {
|
if (fPtr->retainCount == 0) {
|
||||||
fPtr->window = createFakeWindowGroupLeader(scr, wwin->main_window,
|
fPtr->leader = createFakeWindowGroupLeader(scr, wwin->main_window,
|
||||||
instance, class);
|
instance, class);
|
||||||
}
|
}
|
||||||
fPtr->retainCount++;
|
fPtr->retainCount++;
|
||||||
|
if (wwin->main_window!=wwin->client_win && fPtr->origLeader==None) {
|
||||||
|
fPtr->retainCount++;
|
||||||
|
fPtr->origLeader = wwin->main_window;
|
||||||
|
}
|
||||||
wwin->fake_group = fPtr;
|
wwin->fake_group = fPtr;
|
||||||
wwin->group_id = fPtr->window;
|
//wwin->group_id = fPtr->leader;
|
||||||
wwin->main_window = wwin->group_id;
|
wwin->main_window = fPtr->leader;
|
||||||
wfree(buffer);
|
wfree(buffer);
|
||||||
} else {
|
} else {
|
||||||
fPtr = (WFakeGroupLeader*)wmalloc(sizeof(WFakeGroupLeader));
|
fPtr = (WFakeGroupLeader*)wmalloc(sizeof(WFakeGroupLeader));
|
||||||
|
|
||||||
fPtr->identifier = buffer;
|
fPtr->identifier = buffer;
|
||||||
fPtr->window = createFakeWindowGroupLeader(scr, wwin->main_window,
|
fPtr->leader = createFakeWindowGroupLeader(scr, wwin->main_window,
|
||||||
instance, class);
|
instance, class);
|
||||||
|
fPtr->origLeader = None;
|
||||||
fPtr->retainCount = 1;
|
fPtr->retainCount = 1;
|
||||||
|
|
||||||
WMAddToArray(scr->fakeGroupLeaders, fPtr);
|
WMAddToArray(scr->fakeGroupLeaders, fPtr);
|
||||||
|
|
||||||
|
if (wwin->main_window!=wwin->client_win) {
|
||||||
|
fPtr->retainCount++;
|
||||||
|
fPtr->origLeader = wwin->main_window;
|
||||||
|
}
|
||||||
wwin->fake_group = fPtr;
|
wwin->fake_group = fPtr;
|
||||||
wwin->group_id = fPtr->window;
|
//wwin->group_id = fPtr->leader;
|
||||||
wwin->main_window = wwin->group_id;
|
wwin->main_window = fPtr->leader;
|
||||||
}
|
}
|
||||||
if (instance)
|
if (instance)
|
||||||
XFree(instance);
|
XFree(instance);
|
||||||
|
|||||||
@@ -171,7 +171,8 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef struct WFakeGroupLeader {
|
typedef struct WFakeGroupLeader {
|
||||||
char *identifier;
|
char *identifier;
|
||||||
Window window;
|
Window leader;
|
||||||
|
Window origLeader;
|
||||||
int retainCount;
|
int retainCount;
|
||||||
} WFakeGroupLeader;
|
} WFakeGroupLeader;
|
||||||
|
|
||||||
|
|||||||
@@ -597,7 +597,7 @@ main(int argc, char **argv)
|
|||||||
path = globalDefaultsPathForDomain("WindowMaker");
|
path = globalDefaultsPathForDomain("WindowMaker");
|
||||||
val = WMReadPropListFromFile(path);
|
val = WMReadPropListFromFile(path);
|
||||||
if (val) {
|
if (val) {
|
||||||
WMMergePLDictionaries(val, prop);
|
WMMergePLDictionaries(val, prop, True);
|
||||||
WMReleasePropList(prop);
|
WMReleasePropList(prop);
|
||||||
prop = val;
|
prop = val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ main(int argc, char **argv)
|
|||||||
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
|
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
|
||||||
if (window_attrs) {
|
if (window_attrs) {
|
||||||
if (WMIsPLDictionary(window_attrs)) {
|
if (WMIsPLDictionary(window_attrs)) {
|
||||||
WMMergePLDictionaries(window_attrs, icon_value);
|
WMMergePLDictionaries(window_attrs, icon_value, True);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WMPutInPLDictionary(all_windows, window_name, icon_value);
|
WMPutInPLDictionary(all_windows, window_name, icon_value);
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WMMergePLDictionaries(prop, style);
|
WMMergePLDictionaries(prop, style, True);
|
||||||
|
|
||||||
WMWritePropListToFile(prop, path, True);
|
WMWritePropListToFile(prop, path, True);
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user