From c8b3933c19afea75abeb0e6ba2bd1644ba5462e2 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 18 Dec 2001 05:18:35 +0000 Subject: [PATCH] - Fixed xmms problem with shared appicons - Fixed a problem with saving user defaults for windows after the shared appicon changes. - Fixed GNUstep apps not to show 2 appicons. --- WindowMaker/Defaults/WMWindowAttributes.in | 1 + src/dock.c | 2 +- src/event.c | 4 +- src/window.c | 45 ++++++++++- src/winspector.c | 116 +++++++++++++---------------- 5 files changed, 96 insertions(+), 72 deletions(-) diff --git a/WindowMaker/Defaults/WMWindowAttributes.in b/WindowMaker/Defaults/WMWindowAttributes.in index 77d2c1df..e22ed59b 100644 --- a/WindowMaker/Defaults/WMWindowAttributes.in +++ b/WindowMaker/Defaults/WMWindowAttributes.in @@ -52,5 +52,6 @@ xmixer = {Icon = mixer.#extension#;}; xmcd = {Icon = Radio.xpm;}; xplaycd = {Icon = Radio.xpm;}; + xmms.Xmms = {NoAppIcon = Yes;}; "*" = {Icon = defaultAppIcon.#extension#;SharedAppIcon = Yes;}; } diff --git a/src/dock.c b/src/dock.c index 44a6f614..4478ab18 100644 --- a/src/dock.c +++ b/src/dock.c @@ -3203,7 +3203,7 @@ retry: } found = True; if (!wPreferences.no_animations && !icon->launching && - !dock->screen_ptr->flags.startup) { + !dock->screen_ptr->flags.startup && !dock->collapsed) { WAppIcon *aicon; int x0, y0; diff --git a/src/event.c b/src/event.c index 5bfec568..8958d2ef 100644 --- a/src/event.c +++ b/src/event.c @@ -556,8 +556,8 @@ handleDestroyNotify(XEvent *event) wUnmanageWindow(wwin, False, True); } - index = WMFindInArray(scr->fakeGroupLeaders, matchWindow, (void*)window); - if (index != WANotFound) { + while ((index = WMFindInArray(scr->fakeGroupLeaders, matchWindow, + (void*)window)) != WANotFound) { WFakeGroupLeader *fPtr; fPtr = WMGetFromArray(scr->fakeGroupLeaders, index); diff --git a/src/window.c b/src/window.c index 7b589089..b968778a 100644 --- a/src/window.c +++ b/src/window.c @@ -793,6 +793,10 @@ wManageWindow(WScreen *scr, Window window) } #endif /* OLWM_HINTS */ + if (wwin->flags.is_gnustep) { + WSETUFLAG(wwin, shared_appicon, 0); + } + /* Make broken apps behave as a nice app. */ if (WFLAGP(wwin, emulate_appicon)) { wwin->main_window = wwin->client_win; @@ -803,6 +807,8 @@ wManageWindow(WScreen *scr, Window window) WFakeGroupLeader *fPtr; int index; +#define ADEQUATE(x) ((x)!=None && (x)!=wwin->client_win && (x)!=fPtr->leader) + PropGetWMClass(wwin->main_window, &class, &instance); buffer = wmalloc(strlen(instance)+strlen(class)+2); sprintf(buffer, "%s.%s", instance, class); @@ -815,9 +821,25 @@ wManageWindow(WScreen *scr, Window window) instance, class); } fPtr->retainCount++; - if (wwin->main_window!=wwin->client_win && fPtr->origLeader==None) { - fPtr->retainCount++; - fPtr->origLeader = wwin->main_window; +#undef method2 + if (fPtr->origLeader==None) { +#ifdef method2 + if (ADEQUATE(wwin->group_id)) { + fPtr->retainCount++; + fPtr->origLeader = wwin->group_id; + } else if (ADEQUATE(wwin->client_leader)) { + fPtr->retainCount++; + fPtr->origLeader = wwin->client_leader; + } else if (ADEQUATE(wwin->main_window)) { + fPtr->retainCount++; + fPtr->origLeader = wwin->main_window; + } +#else + if (ADEQUATE(wwin->main_window)) { + fPtr->retainCount++; + fPtr->origLeader = wwin->main_window; + } +#endif } wwin->fake_group = fPtr; /*wwin->group_id = fPtr->leader;*/ @@ -834,10 +856,23 @@ wManageWindow(WScreen *scr, Window window) WMAddToArray(scr->fakeGroupLeaders, fPtr); - if (wwin->main_window!=wwin->client_win) { +#ifdef method2 + if (ADEQUATE(wwin->group_id)) { + fPtr->retainCount++; + fPtr->origLeader = wwin->group_id; + } else if (ADEQUATE(wwin->client_leader)) { + fPtr->retainCount++; + fPtr->origLeader = wwin->client_leader; + } else if (ADEQUATE(wwin->main_window)) { + fPtr->retainCount++; + fPtr->origLeader = wwin->main_window; + } +#else + if (ADEQUATE(wwin->main_window)) { fPtr->retainCount++; fPtr->origLeader = wwin->main_window; } +#endif wwin->fake_group = fPtr; /*wwin->group_id = fPtr->leader;*/ wwin->main_window = fPtr->leader; @@ -847,6 +882,8 @@ wManageWindow(WScreen *scr, Window window) if (class) XFree(class); +#undef method2 +#undef ADEQUATE } /* diff --git a/src/winspector.c b/src/winspector.c index 1b2cd83b..9cab3f07 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -512,14 +512,14 @@ saveSettings(WMButton *button, InspectorPanel *panel) WWindow *wwin = panel->inspected; WDDomain *db = WDWindowAttributes; WMPropList *dict = db->dictionary; - WMPropList *winDic, *value, *key; + WMPropList *winDic, *appDic, *value, *key, *key2; char *icon_file; int flags = 0; - int different = 0; + int different = 0, different2 = 0; /* Save will apply the changes and save them */ applySettings(panel->applyBtn, panel); - + if (WMGetButtonSelected(panel->instRb) != 0) key = WMCreatePLString(wwin->wm_instance); else if (WMGetButtonSelected(panel->clsRb) != 0) @@ -557,6 +557,7 @@ saveSettings(WMButton *button, InspectorPanel *panel) WMPLSetCaseSensitive(True); winDic = WMCreatePLDictionary(NULL, NULL, NULL); + appDic = WMCreatePLDictionary(NULL, NULL, NULL); /* Update icon for window */ icon_file = WMGetTextFieldText(panel->fileText); @@ -564,6 +565,7 @@ saveSettings(WMButton *button, InspectorPanel *panel) if (icon_file[0] != 0) { value = WMCreatePLString(icon_file); different |= insertAttribute(dict, winDic, AIcon, value, flags); + different2 |= insertAttribute(dict, appDic, AIcon, value, flags); WMReleasePropList(value); } wfree(icon_file); @@ -650,83 +652,67 @@ saveSettings(WMButton *button, InspectorPanel *panel) different |= insertAttribute(dict, winDic, ANoLanguageButton, value, flags); #endif - /* application wide settings for when */ - /* the window is the leader, save the attribute with the others */ - if (panel->inspected->main_window == panel->inspected->client_win) { - - value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No; - different |= insertAttribute(dict, winDic, AStartHidden, value, flags); + value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No; + different2 |= insertAttribute(dict, appDic, AStartHidden, value, flags); - value = (WMGetButtonSelected(panel->appChk[1])!=0) ? Yes : No; - different |= insertAttribute(dict, winDic, ANoAppIcon, value, flags); - - value = (WMGetButtonSelected(panel->appChk[2])!=0) ? Yes : No; - different |= insertAttribute(dict, winDic, ASharedAppIcon, value, flags); - } + value = (WMGetButtonSelected(panel->appChk[1])!=0) ? Yes : No; + different2 |= insertAttribute(dict, appDic, ANoAppIcon, value, flags); - WMRemoveFromPLDictionary(dict, key); - if (different) { - WMPutInPLDictionary(dict, key, winDic); - } + value = (WMGetButtonSelected(panel->appChk[2])!=0) ? Yes : No; + different2 |= insertAttribute(dict, appDic, ASharedAppIcon, value, flags); - WMReleasePropList(key); - WMReleasePropList(winDic); - - different = 0; - - /* application wide settings */ - if (panel->inspected->main_window != panel->inspected->client_win - && !(flags & UPDATE_DEFAULTS)) { - WApplication *wapp; - WMPropList *appDic; + if (panel->inspected->fake_group) { + key2 = WMCreatePLString(panel->inspected->fake_group->identifier); + if (WMIsPropListEqualTo(key, key2)) { + WMMergePLDictionaries(winDic, appDic, True); + different |= different2; + } else { + WMRemoveFromPLDictionary(dict, key2); + if (different2) { + WMPutInPLDictionary(dict, key2, appDic); + } + } + WMReleasePropList(key2); + WMReleasePropList(appDic); + } else if (panel->inspected->main_window != panel->inspected->client_win) { + WApplication *wapp = wApplicationOf(panel->inspected->main_window); - wapp = wApplicationOf(panel->inspected->main_window); if (wapp) { char *instance = wapp->main_window_desc->wm_instance; char *class = wapp->main_window_desc->wm_class; - char *iconFile, *buffer; - - appDic = WMCreatePLDictionary(NULL, NULL, NULL); - - assert(instance!=NULL); - assert(class!=NULL); + char *buffer; buffer = wmalloc(strlen(instance)+strlen(class)+2); sprintf(buffer, "%s.%s", instance, class); - key = WMCreatePLString(buffer); + key2 = WMCreatePLString(buffer); wfree(buffer); - iconFile = wDefaultGetIconFile(wwin->screen_ptr, - instance, class, False); - - if (iconFile && iconFile[0]!=0) { - value = WMCreatePLString(iconFile); - different |= insertAttribute(dict, appDic, AIcon, value, - flags&~IS_BOOLEAN); - WMReleasePropList(value); - } - - value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No; - different |= insertAttribute(dict, appDic, AStartHidden, value, - flags); - - value = (WMGetButtonSelected(panel->appChk[1])!=0) ? Yes : No; - different |= insertAttribute(dict, appDic, ANoAppIcon, value, - flags); + if (WMIsPropListEqualTo(key, key2)) { + WMMergePLDictionaries(winDic, appDic, True); + different |= different2; + } else { + WMRemoveFromPLDictionary(dict, key2); + if (different2) { + WMPutInPLDictionary(dict, key2, appDic); + } + } + WMReleasePropList(key2); + WMReleasePropList(appDic); + } + } else { + WMMergePLDictionaries(winDic, appDic, True); + different |= different2; + WMReleasePropList(appDic); + } - value = (WMGetButtonSelected(panel->appChk[2])!=0) ? Yes : No; - different |= insertAttribute(dict, appDic, ASharedAppIcon, value, - flags); - - WMRemoveFromPLDictionary(dict, key); - if (different) { - WMPutInPLDictionary(dict, key, appDic); - } - WMReleasePropList(key); - WMReleasePropList(appDic); - } + WMRemoveFromPLDictionary(dict, key); + if (different) { + WMPutInPLDictionary(dict, key, winDic); } + WMReleasePropList(key); + WMReleasePropList(winDic); + WMWritePropListToFile(dict, db->path, True); /* clean up */ -- 2.11.4.GIT