From b381674375ab3cac71cc5b1fa1d6f325253659a7 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 11 Feb 2003 00:32:17 +0000 Subject: [PATCH] - Fixed incorrect focusing of application's windows after an unhide (sometimes the incorrect window got focus instead of the apps's last focused window) - Unshade application's shaded windows when Dbl-MiddleClick-ing its appicon. (this is to be consistent with deminiaturizing application's miniwindows which also happens in this case, since shading is a form of miniaturization) - misc fixes --- ChangeLog | 13 +++++++++- WINGs/hashtable.c | 18 ++++++------- src/actions.c | 76 +++++++++++++++++++++++++++++++++---------------------- src/funcs.h | 2 -- src/misc.c | 12 --------- src/rootmenu.c | 8 +++--- 6 files changed, 71 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 221b84f5..fdac9186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Changes since version 0.80.1: +Changes since version 0.80.2: ............................. - Some updates to WINGs WMConnection. See WINGs/ChangeLog for details. @@ -43,6 +43,17 @@ Changes since version 0.80.1: - Fixed a problem in the stacking code which could lead to segmentation faults (Jeff Teunissen ) - Fixed a crashing bug in the menu code when modal panel are involved. +- Fixed incorrect focusing of application's windows after an unhide (sometimes + the incorrect window got focus instead of the apps's last focused window) +- Unshade application's shaded windows when Dbl-MiddleClick-ing its appicon. + (this is to be consistent with deminiaturizing application's miniwindows + which also happens in this case, since shading is a form of miniaturization) + + +Changes since version 0.80.1: +............................. + +- Fixed a buffer overflow when allocating an RImage struct. Changes since version 0.80.0: diff --git a/WINGs/hashtable.c b/WINGs/hashtable.c index 25954031..e8527496 100644 --- a/WINGs/hashtable.c +++ b/WINGs/hashtable.c @@ -477,24 +477,24 @@ typedef void (*releaseFunc)(const void*); const WMHashTableCallbacks WMIntHashCallbacks = { NULL, - NULL, - NULL, - NULL + NULL, + NULL, + NULL }; const WMHashTableCallbacks WMStringHashCallbacks = { (hashFunc)hashString, - (isEqualFunc)compareStrings, - (retainFunc)wstrdup, - (releaseFunc)wfree + (isEqualFunc)compareStrings, + (retainFunc)wstrdup, + (releaseFunc)wfree }; const WMHashTableCallbacks WMStringPointerHashCallbacks = { (hashFunc)hashString, - (isEqualFunc)compareStrings, - NULL, - NULL + (isEqualFunc)compareStrings, + NULL, + NULL }; diff --git a/src/actions.c b/src/actions.c index f32b3254..8365ded6 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1362,42 +1362,53 @@ wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurrentWS) WWindow *wlist, *next; WWindow *focused=NULL; - if (!wapp) { + if (!wapp) return; - } + scr = wapp->main_window_desc->screen_ptr; wlist = scr->focused_window; - if (!wlist) return; + if (!wlist) + return; + /* goto beginning of list */ while (wlist->prev) wlist = wlist->prev; - + while (wlist) { next = wlist->next; if (wlist->main_window == wapp->main_window) { if (wlist->flags.focused) - focused = wlist; + focused = wlist; else if (!focused || !focused->flags.focused) - focused = wlist; - - if (wlist->flags.miniaturized && wlist->icon) { - if (bringToCurrentWS || wPreferences.sticky_icons - || wlist->frame->workspace == scr->current_workspace) { - if (!wlist->icon->mapped) { - XMapWindow(dpy, wlist->icon->core->window); - wlist->icon->mapped = 1; - } - wlist->flags.hidden = 0; - - WMPostNotificationName(WMNChangedState, wlist, "hide"); - - if (wlist->frame->workspace != scr->current_workspace) - wWindowChangeWorkspace(wlist, scr->current_workspace); - } - if (miniwindows) { - wDeiconifyWindow(wlist); - } + focused = wlist; + + if (wlist->flags.miniaturized) { + if (bringToCurrentWS || wPreferences.sticky_icons || + wlist->frame->workspace == scr->current_workspace) { + if (wlist->icon && !wlist->icon->mapped) { + XMapWindow(dpy, wlist->icon->core->window); + wlist->icon->mapped = 1; + } + } + if (bringToCurrentWS) + wWindowChangeWorkspace(wlist, scr->current_workspace); + wlist->flags.hidden = 0; + if (miniwindows && + wlist->frame->workspace == scr->current_workspace) { + wDeiconifyWindow(wlist); + } + WMPostNotificationName(WMNChangedState, wlist, "hide"); + } else if (wlist->flags.shaded) { + if (bringToCurrentWS) + wWindowChangeWorkspace(wlist, scr->current_workspace); + wlist->flags.hidden = 0; + if (miniwindows && + wlist->frame->workspace == scr->current_workspace) { + wUnshadeWindow(wlist); + wRaiseFrame(wlist->frame->core); + } + WMPostNotificationName(WMNChangedState, wlist, "hide"); } else if (wlist->flags.hidden) { unhideWindow(wapp->app_icon->icon, wapp->app_icon->x_pos, wapp->app_icon->y_pos, wlist, @@ -1417,10 +1428,12 @@ wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurrentWS) wapp->flags.skip_next_animation = 0; wapp->flags.hidden = 0; - if (focused) - wSetFocusTo(scr, focused); - else if (wapp->last_focused && wapp->last_focused->flags.mapped) - wSetFocusTo(scr, wapp->last_focused); + if (wapp->last_focused && wapp->last_focused->flags.mapped) { + wRaiseFrame(wapp->last_focused->frame->core); + wSetFocusTo(scr, wapp->last_focused); + } else if (focused) { + wSetFocusTo(scr, focused); + } wapp->last_focused = NULL; if (wPreferences.auto_arrange_icons) { wArrangeIcons(scr, True); @@ -1678,8 +1691,11 @@ wMakeWindowVisible(WWindow *wwin) WApplication *app; app = wApplicationOf(wwin->main_window); - if (app) - wUnhideApplication(app, False, False); + if (app) { + /* trick to get focus to this window */ + app->last_focused = wwin; + wUnhideApplication(app, False, False); + } } else if (wwin->flags.miniaturized) { wDeiconifyWindow(wwin); } else { diff --git a/src/funcs.h b/src/funcs.h index 918c2de0..9f3c87c8 100644 --- a/src/funcs.h +++ b/src/funcs.h @@ -120,8 +120,6 @@ char *FindImage(char *paths, char *file); RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass); -int IsEof(FILE * stream); /* feof that stats pipes */ - void ParseWindowName(WMPropList *value, char **winstance, char **wclass, char *where); diff --git a/src/misc.c b/src/misc.c index f27e1bf5..05954885 100644 --- a/src/misc.c +++ b/src/misc.c @@ -949,18 +949,6 @@ ExpandOptions(WScreen *scr, char *cmdline) } -/* feof doesn't seem to work on pipes */ -int -IsEof(FILE * stream) -{ - static struct stat stinfo; - - fstat(fileno(stream), &stinfo); - return ((S_ISFIFO(stinfo.st_dev) && stinfo.st_size == 0) || - feof(stream)); -} - - void ParseWindowName(WMPropList *value, char **winstance, char **wclass, char *where) { diff --git a/src/rootmenu.c b/src/rootmenu.c index a2713a82..ca8d2fb4 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -1094,7 +1094,7 @@ parseCascade(WScreen *scr, WMenu *menu, FILE *file, char *file_name) char params[MAXLINE]; char *line; - while (!IsEof(file)) { + while (!feof(file)) { int lsize, ok; ok = 0; @@ -1120,7 +1120,7 @@ parseCascade(WScreen *scr, WMenu *menu, FILE *file, char *file_name) } else { ok=1; } - } while (!ok && !IsEof(file)); + } while (!ok && !feof(file)); if (ok==2) continue; @@ -1214,7 +1214,7 @@ readMenuFile(WScreen *scr, char *file_name) } } - while (!IsEof(file)) { + while (!feof(file)) { if (!fgets(linebuf, MAXLINE, file)) break; line = cropline(linebuf); @@ -1317,7 +1317,7 @@ readMenuPipe(WScreen *scr, char **file_name) } } - while (!IsEof(file)) { + while (!feof(file)) { if (!fgets(linebuf, MAXLINE, file)) break; line = cropline(linebuf); -- 2.11.4.GIT