diff --git a/ChangeLog b/ChangeLog index 38e9d0cf..239e849a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,14 @@ Changes since version 0.64.0: performance a bit. - Made the Gnome tasklist skip the windows with the "Skip window list" flag enabled. (Bastien Nocera ) +- Fixed crashing bug when name and class were empty for a docked app. +- Removed MIN() and MAX() macros and replaced them with WMIN() and WMAX() from + WINGs. +- Added a hint that Window Maker crashed, to allow windows to be placed + correctly after a crash situation. +- Added a hint that Window Maker crashed, to allow windows to be placed + in their correct previous positions after a crash situation and also to + preserve their state before the crash (minimized, shaded, hidden, ...) Changes since version 0.63.1: @@ -63,6 +71,7 @@ Changes since version 0.63.0: - fixed WindozeCycling config in WPrefs - fixed circulate raise withour WindozeCycling + Changes since version 0.62.1: ............................. - added blackbox style igradient (interwoven) @@ -115,6 +124,7 @@ Changes since version 0.62.0: - fixed sticky hint handling in GNOME - fixed saving of maximized state for restart + Changes since version 0.61.1: ............................. diff --git a/TODO b/TODO index d75d96ae..03350b93 100644 --- a/TODO +++ b/TODO @@ -26,8 +26,8 @@ Need to do: - remake internal string processing to use wchar? unicode? - add new file for stuff like default commands and dnd commands for docked apps, balloons for the dock etc -- fix the #define MIN(a,b) stuff. defined in too many places, and maybe - replace with WMIN(a,b). +- check whether apps with name.class set to empty strings should be treated + like if name.class were NULL.NULL Maybe some day: =============== @@ -38,10 +38,10 @@ Maybe some day: Never: (so, dont even bother to ask) ====== - different themes for each workspace. Unless you give us a SGI/Power Onyx -with 2 CPUs ;). + with 2 CPUs ;). - anything that requires the mouse pointer to be jumped by WindowMaker to -somewhere. This is *terrible* behaviour. And it's not just IMO. -- rewrite to use Gtk... I wont even explain why... + somewhere. This is *terrible* behaviour. And it's not just IMO. +- rewrite to use Gtk... I wont even bother to explain why... - ICCCM 2.0: ICCCM 2.0 (not 1.0, which is what everybody supports so so) is diff --git a/WINGs/wcolorwell.c b/WINGs/wcolorwell.c index 25934352..0475dfe2 100644 --- a/WINGs/wcolorwell.c +++ b/WINGs/wcolorwell.c @@ -236,8 +236,6 @@ WSetColorWellBordered(WMColorWell *cPtr, Bool flag) } -#define MIN(a,b) ((a) > (b) ? (b) : (a)) - static void willResizeColorWell(W_ViewDelegate *self, WMView *view, unsigned int *width, unsigned int *height) @@ -252,7 +250,7 @@ willResizeColorWell(W_ViewDelegate *self, WMView *view, if (*height < MIN_HEIGHT) *height = MIN_HEIGHT; - bw = (int)((float)MIN(*width, *height)*0.24); + bw = (int)((float)WMIN(*width, *height)*0.24); W_ResizeView(cPtr->colorView, *width-2*bw, *height-2*bw); diff --git a/WPrefs.app/Icons.c b/WPrefs.app/Icons.c index 1a890d8e..62fa0643 100644 --- a/WPrefs.app/Icons.c +++ b/WPrefs.app/Icons.c @@ -99,8 +99,6 @@ showIconLayout(WMWidget *widget, void *data) } -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - static void showData(_Panel *panel) { diff --git a/WindowMaker/Styles/Blue.style b/WindowMaker/Styles/Blue.style index a63af6ba..6ac7a042 100644 --- a/WindowMaker/Styles/Blue.style +++ b/WindowMaker/Styles/Blue.style @@ -1,5 +1,5 @@ { - TitleJustify = center; + TitleJustify = left; HighlightColor = white; HighlightTextColor = black; ClipTitleColor = black; diff --git a/WindowMaker/Styles/IRednBlue.style b/WindowMaker/Styles/IRednBlue.style index d7f25f92..74a99999 100644 --- a/WindowMaker/Styles/IRednBlue.style +++ b/WindowMaker/Styles/IRednBlue.style @@ -1,5 +1,5 @@ { - TitleJustify = center; + TitleJustify = left; HighlightColor = white; HighlightTextColor = black; ClipTitleColor = black; diff --git a/src/WindowMaker.h b/src/WindowMaker.h index b5f29f11..c675f20f 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -265,6 +265,11 @@ typedef enum { } +/* Flags for the Window Maker state when restarting/crash situations */ +#define WFLAGS_NONE (0) +#define WFLAGS_CRASHED (1<<0) + + /* notifications */ #ifdef MAINFILE diff --git a/src/balloon.c b/src/balloon.c index 79259bf9..977f91bf 100644 --- a/src/balloon.c +++ b/src/balloon.c @@ -84,8 +84,7 @@ typedef struct _WBalloon { #ifdef SHAPED_BALLOON #define SPACE 12 -#define MIN(a,b) ((a)<(b)?(a):(b)) -#define MAX(a,b) ((a)>(b)?(a):(b)) + static void drawBalloon(Pixmap pix, GC gc, int x, int y, int w, int h, int side) diff --git a/src/dock.c b/src/dock.c index 112224e4..e0ec3691 100644 --- a/src/dock.c +++ b/src/dock.c @@ -2558,8 +2558,6 @@ wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y, return False; } -#define MIN(x, y) ((x) > (y) ? (y) : (x)) -#define MAX(x, y) ((x) < (y) ? (y) : (x)) #define ON_SCREEN(x, y, sx, ex, sy, ey) \ ((((x)+ICON_SIZE/2) >= (sx)) && (((y)+ICON_SIZE/2) >= (sy)) && \ @@ -2633,8 +2631,8 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos) char *hmap, *vmap; int hcount, vcount; - hcount = MIN(dock->max_icons, scr->scr_width/ICON_SIZE); - vcount = MIN(dock->max_icons, scr->scr_height/ICON_SIZE); + hcount = WMIN(dock->max_icons, scr->scr_width/ICON_SIZE); + vcount = WMIN(dock->max_icons, scr->scr_height/ICON_SIZE); hmap = wmalloc(hcount+1); memset(hmap, 0, hcount+1); vmap = wmalloc(vcount+1); @@ -2722,7 +2720,7 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos) x=0; y=0; done = 0; /* search a vacant slot */ - for (i=1; i r) ? 0 : (((y)+r)*(mwidth)+(x)+r) +#define XY2OFS(x,y) (WMAX(abs(x),abs(y)) > r) ? 0 : (((y)+r)*(mwidth)+(x)+r) /* mark used slots in the map. If the slot falls outside the map * (for example, when all icons are placed in line), ignore them. */ diff --git a/src/misc.c b/src/misc.c index 28f5a195..1df43f50 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1100,7 +1100,7 @@ EscapeWM_CLASS(char *name, char *class) if (name) { l = strlen(name); - ename = wmalloc(l*2); + ename = wmalloc(l*2+1); j = 0; for (i=0; i(b) ? (a) : (b)) - - #define M_QUICK 1 /* menu commands */ @@ -1610,7 +1607,7 @@ configureMenu(WScreen *scr, proplist_t definition) menu = readMenuFile(scr, path); if (menu) - menu->timestamp = MAX(stat_buf.st_mtime, WDRootMenu->timestamp); + menu->timestamp = WMAX(stat_buf.st_mtime, WDRootMenu->timestamp); } else { menu = NULL; } diff --git a/src/screen.c b/src/screen.c index 465abcf0..1eaf8f65 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1064,7 +1064,6 @@ wScreenRestoreState(WScreen *scr) void wScreenSaveState(WScreen *scr) { - WWorkspaceState wstate; WWindow *wwin; char *str; proplist_t path, old_state, foo; @@ -1073,13 +1072,9 @@ wScreenSaveState(WScreen *scr) make_keys(); -/* - * Save current workspace, so can go back to it upon restart. - */ - wstate.workspace = scr->current_workspace; - - data[0] = wstate.flags; - data[1] = wstate.workspace; + /* Save current workspace, so can go back to it upon restart. */ + data[0] = scr->current_workspace; + data[1] = WFLAGS_NONE; XChangeProperty(dpy, scr->root_win, _XA_WINDOWMAKER_STATE, _XA_WINDOWMAKER_STATE, 32, PropModeReplace, diff --git a/src/startup.c b/src/startup.c index be46f548..7455a945 100644 --- a/src/startup.c +++ b/src/startup.c @@ -159,7 +159,7 @@ static unsigned int _ScrollLockMask = 0; -static void manageAllWindows(); +static void manageAllWindows(WScreen *scr, int crashed); extern void NotifyDeadProcess(pid_t pid, unsigned char status); @@ -353,8 +353,35 @@ handleSig(int sig) XCloseDisplay(dpy); dpy = XOpenDisplay(""); if (dpy) { + CARD32 data[2]; + WWindow *wwin; + int i; + XGrabServer(dpy); crashAction = wShowCrashingDialogPanel(sig); + + /* + * Save current workspace, so can go back to it if restarting. + * Also add hint that we crashed, so that windows will be placed + * correctly upon restart. + */ + for (i=0; icurrent_workspace; /* workspace number */ + data[1] = WFLAGS_CRASHED; /* signal that we crashed */ + + XChangeProperty(dpy, wScreen[i]->root_win, + _XA_WINDOWMAKER_STATE, _XA_WINDOWMAKER_STATE, + 32, PropModeReplace, (unsigned char*) data, 2); + + /* save state of windows */ + wwin = wScreen[i]->focused_window; + while (wwin) { + wWindowSaveState(wwin); + wwin = wwin->prev; + } + + } + XCloseDisplay(dpy); dpy = NULL; } else { @@ -428,7 +455,7 @@ buryChild(int foo) static int -getWorkspaceState(Window root, WWorkspaceState **state) +getWorkspaceState(Window root, WWorkspaceState **state) { Atom type_ret; int fmt_ret; @@ -440,19 +467,18 @@ getWorkspaceState(Window root, WWorkspaceState **state) True, _XA_WINDOWMAKER_STATE, &type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret, (unsigned char **)&data)!=Success || !data) - return 0; + return 0; + + *state = wmalloc(sizeof(WWorkspaceState)); + (*state)->workspace = data[0]; + (*state)->flags = data[1]; - *state = malloc(sizeof(WWorkspaceState)); - if (*state) { - (*state)->flags = data[0]; - (*state)->workspace = data[1]; - } XFree(data); if (*state && type_ret==_XA_WINDOWMAKER_STATE) - return 1; + return 1; else - return 0; + return 0; } @@ -674,16 +700,18 @@ static char *atomNames[] = { "WM_CLIENT_LEADER", "WM_COLORMAP_WINDOWS", "WM_COLORMAP_NOTIFY", - GNUSTEP_WM_ATTR_NAME, - "_WINDOWMAKER_MENU", + + "_WINDOWMAKER_MENU", "_WINDOWMAKER_STATE", "_WINDOWMAKER_WM_PROTOCOLS", - GNUSTEP_WM_MINIATURIZE_WINDOW, "_WINDOWMAKER_WM_FUNCTION", "_WINDOWMAKER_NOTICEBOARD", "_WINDOWMAKER_COMMAND", "_WINDOWMAKER_ICON_SIZE", "_WINDOWMAKER_ICON_TILE", + + GNUSTEP_WM_ATTR_NAME, + GNUSTEP_WM_MINIATURIZE_WINDOW, GNUSTEP_TITLEBAR_STATE }; @@ -749,24 +777,17 @@ StartUp(Bool defaultScreenOnly) _XA_WM_COLORMAP_WINDOWS = atom[7]; _XA_WM_COLORMAP_NOTIFY = atom[8]; - _XA_GNUSTEP_WM_ATTR = atom[9]; - - _XA_WINDOWMAKER_MENU = atom[10]; - _XA_WINDOWMAKER_STATE = atom[11]; - - _XA_WINDOWMAKER_WM_PROTOCOLS = atom[12]; - - _XA_GNUSTEP_WM_MINIATURIZE_WINDOW = atom[13]; - - _XA_WINDOWMAKER_WM_FUNCTION = atom[14]; - - _XA_WINDOWMAKER_NOTICEBOARD = atom[15]; - - _XA_WINDOWMAKER_COMMAND = atom[16]; - - _XA_WINDOWMAKER_ICON_SIZE = atom[17]; - _XA_WINDOWMAKER_ICON_TILE = atom[18]; + _XA_WINDOWMAKER_MENU = atom[9]; + _XA_WINDOWMAKER_STATE = atom[10]; + _XA_WINDOWMAKER_WM_PROTOCOLS = atom[11]; + _XA_WINDOWMAKER_WM_FUNCTION = atom[12]; + _XA_WINDOWMAKER_NOTICEBOARD = atom[13]; + _XA_WINDOWMAKER_COMMAND = atom[14]; + _XA_WINDOWMAKER_ICON_SIZE = atom[15]; + _XA_WINDOWMAKER_ICON_TILE = atom[16]; + _XA_GNUSTEP_WM_ATTR = atom[17]; + _XA_GNUSTEP_WM_MINIATURIZE_WINDOW = atom[18]; _XA_GNUSTEP_TITLEBAR_STATE = atom[19]; #ifdef OFFIX_DND @@ -927,7 +948,9 @@ StartUp(Bool defaultScreenOnly) /* initialize/restore state for the screens */ for (j = 0; j < wScreenCount; j++) { - /* restore workspace state */ + int crashed; + + /* restore workspace state */ if (!getWorkspaceState(wScreen[j]->root_win, &ws_state)) { ws_state = NULL; } @@ -937,9 +960,14 @@ StartUp(Bool defaultScreenOnly) /* manage all windows that were already here before us */ if (!wPreferences.flags.nodock && wScreen[j]->dock) wScreen[j]->last_dock = wScreen[j]->dock; - - manageAllWindows(wScreen[j]); - + + if (ws_state && (ws_state->flags & WFLAGS_CRASHED)!=0) + crashed = 1; + else + crashed = 0; + + manageAllWindows(wScreen[j], crashed); + /* restore saved menus */ wMenuRestoreState(wScreen[j]); @@ -1014,7 +1042,7 @@ windowInList(Window window, Window *list, int count) *----------------------------------------------------------------------- */ static void -manageAllWindows(WScreen *scr) +manageAllWindows(WScreen *scr, int crashRecovery) { Window root, parent; Window *children; @@ -1077,7 +1105,16 @@ manageAllWindows(WScreen *scr) wIconifyWindow(wwin); } else { wClientSetState(wwin, NormalState, None); - } + } + if (crashRecovery) { + int border; + + border = (WFLAGP(wwin, no_border) ? 0 : FRAME_BORDER_WIDTH); + + wWindowMove(wwin, wwin->frame_x - border, + wwin->frame_y - border - + wwin->frame->titlebar->height); + } } } XUngrabServer(dpy); diff --git a/src/window.c b/src/window.c index 5e456f21..7c4a6662 100644 --- a/src/window.c +++ b/src/window.c @@ -2394,28 +2394,27 @@ getSavedState(Window window, WSavedState **state) True, _XA_WINDOWMAKER_STATE, &type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret, (unsigned char **)&data)!=Success || !data) - return 0; - - *state = malloc(sizeof(WSavedState)); + return 0; + + *state = wmalloc(sizeof(WSavedState)); + + (*state)->workspace = data[0]; + (*state)->miniaturized = data[1]; + (*state)->shaded = data[2]; + (*state)->hidden = data[3]; + (*state)->maximized = data[4]; + (*state)->x = data[5]; + (*state)->y = data[6]; + (*state)->w = data[7]; + (*state)->h = data[8]; + (*state)->window_shortcuts = data[9]; - if (*state) { - (*state)->workspace = data[0]; - (*state)->miniaturized = data[1]; - (*state)->shaded = data[2]; - (*state)->hidden = data[3]; - (*state)->maximized = data[4]; - (*state)->x = data[5]; - (*state)->y = data[6]; - (*state)->w = data[7]; - (*state)->h = data[8]; - (*state)->window_shortcuts = data[9]; - } XFree(data); - + if (*state && type_ret==_XA_WINDOWMAKER_STATE) - return 1; + return 1; else - return 0; + return 0; }