1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

- 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
This commit is contained in:
dan
2003-02-11 00:32:17 +00:00
parent e54a0954e6
commit b381674375
6 changed files with 70 additions and 57 deletions

View File

@@ -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. - 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 - Fixed a problem in the stacking code which could lead to segmentation faults
(Jeff Teunissen <deek@d2dc.net>) (Jeff Teunissen <deek@d2dc.net>)
- Fixed a crashing bug in the menu code when modal panel are involved. - 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: Changes since version 0.80.0:

View File

@@ -477,24 +477,24 @@ typedef void (*releaseFunc)(const void*);
const WMHashTableCallbacks WMIntHashCallbacks = { const WMHashTableCallbacks WMIntHashCallbacks = {
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL NULL
}; };
const WMHashTableCallbacks WMStringHashCallbacks = { const WMHashTableCallbacks WMStringHashCallbacks = {
(hashFunc)hashString, (hashFunc)hashString,
(isEqualFunc)compareStrings, (isEqualFunc)compareStrings,
(retainFunc)wstrdup, (retainFunc)wstrdup,
(releaseFunc)wfree (releaseFunc)wfree
}; };
const WMHashTableCallbacks WMStringPointerHashCallbacks = { const WMHashTableCallbacks WMStringPointerHashCallbacks = {
(hashFunc)hashString, (hashFunc)hashString,
(isEqualFunc)compareStrings, (isEqualFunc)compareStrings,
NULL, NULL,
NULL NULL
}; };

View File

@@ -1362,42 +1362,53 @@ wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurrentWS)
WWindow *wlist, *next; WWindow *wlist, *next;
WWindow *focused=NULL; WWindow *focused=NULL;
if (!wapp) { if (!wapp)
return; return;
}
scr = wapp->main_window_desc->screen_ptr; scr = wapp->main_window_desc->screen_ptr;
wlist = scr->focused_window; wlist = scr->focused_window;
if (!wlist) return; if (!wlist)
return;
/* goto beginning of list */ /* goto beginning of list */
while (wlist->prev) while (wlist->prev)
wlist = wlist->prev; wlist = wlist->prev;
while (wlist) { while (wlist) {
next = wlist->next; next = wlist->next;
if (wlist->main_window == wapp->main_window) { if (wlist->main_window == wapp->main_window) {
if (wlist->flags.focused) if (wlist->flags.focused)
focused = wlist; focused = wlist;
else if (!focused || !focused->flags.focused) else if (!focused || !focused->flags.focused)
focused = wlist; 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->flags.miniaturized) {
if (bringToCurrentWS || wPreferences.sticky_icons ||
if (wlist->frame->workspace != scr->current_workspace) wlist->frame->workspace == scr->current_workspace) {
wWindowChangeWorkspace(wlist, scr->current_workspace); if (wlist->icon && !wlist->icon->mapped) {
} XMapWindow(dpy, wlist->icon->core->window);
if (miniwindows) { wlist->icon->mapped = 1;
wDeiconifyWindow(wlist); }
} }
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) { } else if (wlist->flags.hidden) {
unhideWindow(wapp->app_icon->icon, wapp->app_icon->x_pos, unhideWindow(wapp->app_icon->icon, wapp->app_icon->x_pos,
wapp->app_icon->y_pos, wlist, 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.skip_next_animation = 0;
wapp->flags.hidden = 0; wapp->flags.hidden = 0;
if (focused) if (wapp->last_focused && wapp->last_focused->flags.mapped) {
wSetFocusTo(scr, focused); wRaiseFrame(wapp->last_focused->frame->core);
else if (wapp->last_focused && wapp->last_focused->flags.mapped) wSetFocusTo(scr, wapp->last_focused);
wSetFocusTo(scr, wapp->last_focused); } else if (focused) {
wSetFocusTo(scr, focused);
}
wapp->last_focused = NULL; wapp->last_focused = NULL;
if (wPreferences.auto_arrange_icons) { if (wPreferences.auto_arrange_icons) {
wArrangeIcons(scr, True); wArrangeIcons(scr, True);
@@ -1678,8 +1691,11 @@ wMakeWindowVisible(WWindow *wwin)
WApplication *app; WApplication *app;
app = wApplicationOf(wwin->main_window); app = wApplicationOf(wwin->main_window);
if (app) if (app) {
wUnhideApplication(app, False, False); /* trick to get focus to this window */
app->last_focused = wwin;
wUnhideApplication(app, False, False);
}
} else if (wwin->flags.miniaturized) { } else if (wwin->flags.miniaturized) {
wDeiconifyWindow(wwin); wDeiconifyWindow(wwin);
} else { } else {

View File

@@ -120,8 +120,6 @@ char *FindImage(char *paths, char *file);
RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass); RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
int IsEof(FILE * stream); /* feof that stats pipes */
void ParseWindowName(WMPropList *value, char **winstance, char **wclass, void ParseWindowName(WMPropList *value, char **winstance, char **wclass,
char *where); char *where);

View File

@@ -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 void
ParseWindowName(WMPropList *value, char **winstance, char **wclass, char *where) ParseWindowName(WMPropList *value, char **winstance, char **wclass, char *where)
{ {

View File

@@ -1094,7 +1094,7 @@ parseCascade(WScreen *scr, WMenu *menu, FILE *file, char *file_name)
char params[MAXLINE]; char params[MAXLINE];
char *line; char *line;
while (!IsEof(file)) { while (!feof(file)) {
int lsize, ok; int lsize, ok;
ok = 0; ok = 0;
@@ -1120,7 +1120,7 @@ parseCascade(WScreen *scr, WMenu *menu, FILE *file, char *file_name)
} else { } else {
ok=1; ok=1;
} }
} while (!ok && !IsEof(file)); } while (!ok && !feof(file));
if (ok==2) if (ok==2)
continue; continue;
@@ -1214,7 +1214,7 @@ readMenuFile(WScreen *scr, char *file_name)
} }
} }
while (!IsEof(file)) { while (!feof(file)) {
if (!fgets(linebuf, MAXLINE, file)) if (!fgets(linebuf, MAXLINE, file))
break; break;
line = cropline(linebuf); line = cropline(linebuf);
@@ -1317,7 +1317,7 @@ readMenuPipe(WScreen *scr, char **file_name)
} }
} }
while (!IsEof(file)) { while (!feof(file)) {
if (!fgets(linebuf, MAXLINE, file)) if (!fgets(linebuf, MAXLINE, file))
break; break;
line = cropline(linebuf); line = cropline(linebuf);