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

- 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
  in their correct previous positions after a crash situation and also to
  preserve their state before the crash (minimized, shaded, hidden, ...)
This commit is contained in:
dan
2001-04-18 00:25:58 +00:00
parent 10e7985961
commit c3d2a890d7
14 changed files with 124 additions and 88 deletions

View File

@@ -24,6 +24,14 @@ Changes since version 0.64.0:
performance a bit. performance a bit.
- Made the Gnome tasklist skip the windows with the "Skip window list" flag - Made the Gnome tasklist skip the windows with the "Skip window list" flag
enabled. (Bastien Nocera <hadess@hadess.net>) enabled. (Bastien Nocera <hadess@hadess.net>)
- 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: Changes since version 0.63.1:
@@ -63,6 +71,7 @@ Changes since version 0.63.0:
- fixed WindozeCycling config in WPrefs - fixed WindozeCycling config in WPrefs
- fixed circulate raise withour WindozeCycling - fixed circulate raise withour WindozeCycling
Changes since version 0.62.1: Changes since version 0.62.1:
............................. .............................
- added blackbox style igradient (interwoven) - added blackbox style igradient (interwoven)
@@ -115,6 +124,7 @@ Changes since version 0.62.0:
- fixed sticky hint handling in GNOME - fixed sticky hint handling in GNOME
- fixed saving of maximized state for restart - fixed saving of maximized state for restart
Changes since version 0.61.1: Changes since version 0.61.1:
............................. .............................

6
TODO
View File

@@ -26,8 +26,8 @@ Need to do:
- remake internal string processing to use wchar? unicode? - remake internal string processing to use wchar? unicode?
- add new file for stuff like default commands and dnd commands for - add new file for stuff like default commands and dnd commands for
docked apps, balloons for the dock etc docked apps, balloons for the dock etc
- fix the #define MIN(a,b) stuff. defined in too many places, and maybe - check whether apps with name.class set to empty strings should be treated
replace with WMIN(a,b). like if name.class were NULL.NULL
Maybe some day: Maybe some day:
=============== ===============
@@ -41,7 +41,7 @@ Never: (so, dont even bother to ask)
with 2 CPUs ;). with 2 CPUs ;).
- anything that requires the mouse pointer to be jumped by WindowMaker to - anything that requires the mouse pointer to be jumped by WindowMaker to
somewhere. This is *terrible* behaviour. And it's not just IMO. somewhere. This is *terrible* behaviour. And it's not just IMO.
- rewrite to use Gtk... I wont even explain why... - 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 - ICCCM 2.0: ICCCM 2.0 (not 1.0, which is what everybody supports so so) is

View File

@@ -236,8 +236,6 @@ WSetColorWellBordered(WMColorWell *cPtr, Bool flag)
} }
#define MIN(a,b) ((a) > (b) ? (b) : (a))
static void static void
willResizeColorWell(W_ViewDelegate *self, WMView *view, willResizeColorWell(W_ViewDelegate *self, WMView *view,
unsigned int *width, unsigned int *height) unsigned int *width, unsigned int *height)
@@ -252,7 +250,7 @@ willResizeColorWell(W_ViewDelegate *self, WMView *view,
if (*height < MIN_HEIGHT) if (*height < MIN_HEIGHT)
*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); W_ResizeView(cPtr->colorView, *width-2*bw, *height-2*bw);

View File

@@ -99,8 +99,6 @@ showIconLayout(WMWidget *widget, void *data)
} }
#define MIN(a,b) ((a) < (b) ? (a) : (b))
static void static void
showData(_Panel *panel) showData(_Panel *panel)
{ {

View File

@@ -1,5 +1,5 @@
{ {
TitleJustify = center; TitleJustify = left;
HighlightColor = white; HighlightColor = white;
HighlightTextColor = black; HighlightTextColor = black;
ClipTitleColor = black; ClipTitleColor = black;

View File

@@ -1,5 +1,5 @@
{ {
TitleJustify = center; TitleJustify = left;
HighlightColor = white; HighlightColor = white;
HighlightTextColor = black; HighlightTextColor = black;
ClipTitleColor = black; ClipTitleColor = black;

View File

@@ -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 */ /* notifications */
#ifdef MAINFILE #ifdef MAINFILE

View File

@@ -84,8 +84,7 @@ typedef struct _WBalloon {
#ifdef SHAPED_BALLOON #ifdef SHAPED_BALLOON
#define SPACE 12 #define SPACE 12
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
static void static void
drawBalloon(Pixmap pix, GC gc, int x, int y, int w, int h, int side) drawBalloon(Pixmap pix, GC gc, int x, int y, int w, int h, int side)

View File

@@ -2558,8 +2558,6 @@ wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
return False; 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) \ #define ON_SCREEN(x, y, sx, ex, sy, ey) \
((((x)+ICON_SIZE/2) >= (sx)) && (((y)+ICON_SIZE/2) >= (sy)) && \ ((((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; char *hmap, *vmap;
int hcount, vcount; int hcount, vcount;
hcount = MIN(dock->max_icons, scr->scr_width/ICON_SIZE); hcount = WMIN(dock->max_icons, scr->scr_width/ICON_SIZE);
vcount = MIN(dock->max_icons, scr->scr_height/ICON_SIZE); vcount = WMIN(dock->max_icons, scr->scr_height/ICON_SIZE);
hmap = wmalloc(hcount+1); hmap = wmalloc(hcount+1);
memset(hmap, 0, hcount+1); memset(hmap, 0, hcount+1);
vmap = wmalloc(vcount+1); vmap = wmalloc(vcount+1);
@@ -2722,7 +2720,7 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
x=0; y=0; x=0; y=0;
done = 0; done = 0;
/* search a vacant slot */ /* search a vacant slot */
for (i=1; i<MAX(vcount, hcount); i++) { for (i=1; i<WMAX(vcount, hcount); i++) {
if (i < vcount && vmap[i]==0) { if (i < vcount && vmap[i]==0) {
/* found a slot */ /* found a slot */
x = 0; x = 0;
@@ -2771,7 +2769,7 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
slot_map = wmalloc(mwidth*mwidth); slot_map = wmalloc(mwidth*mwidth);
memset(slot_map, 0, mwidth*mwidth); memset(slot_map, 0, mwidth*mwidth);
#define XY2OFS(x,y) (MAX(abs(x),abs(y)) > 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 /* mark used slots in the map. If the slot falls outside the map
* (for example, when all icons are placed in line), ignore them. */ * (for example, when all icons are placed in line), ignore them. */

View File

@@ -1100,7 +1100,7 @@ EscapeWM_CLASS(char *name, char *class)
if (name) { if (name) {
l = strlen(name); l = strlen(name);
ename = wmalloc(l*2); ename = wmalloc(l*2+1);
j = 0; j = 0;
for (i=0; i<l; i++) { for (i=0; i<l; i++) {
if (name[i]=='\\') { if (name[i]=='\\') {
@@ -1114,7 +1114,7 @@ EscapeWM_CLASS(char *name, char *class)
} }
if (class) { if (class) {
l = strlen(class); l = strlen(class);
eclass = wmalloc(l*2); eclass = wmalloc(l*2+1);
j = 0; j = 0;
for (i=0; i<l; i++) { for (i=0; i<l; i++) {
if (class[i]=='\\') { if (class[i]=='\\') {

View File

@@ -144,9 +144,6 @@ static Shortcut *shortcutList = NULL;
* *
*/ */
#define MAX(a,b) ((a)>(b) ? (a) : (b))
#define M_QUICK 1 #define M_QUICK 1
/* menu commands */ /* menu commands */
@@ -1610,7 +1607,7 @@ configureMenu(WScreen *scr, proplist_t definition)
menu = readMenuFile(scr, path); menu = readMenuFile(scr, path);
if (menu) if (menu)
menu->timestamp = MAX(stat_buf.st_mtime, WDRootMenu->timestamp); menu->timestamp = WMAX(stat_buf.st_mtime, WDRootMenu->timestamp);
} else { } else {
menu = NULL; menu = NULL;
} }

View File

@@ -1064,7 +1064,6 @@ wScreenRestoreState(WScreen *scr)
void void
wScreenSaveState(WScreen *scr) wScreenSaveState(WScreen *scr)
{ {
WWorkspaceState wstate;
WWindow *wwin; WWindow *wwin;
char *str; char *str;
proplist_t path, old_state, foo; proplist_t path, old_state, foo;
@@ -1073,13 +1072,9 @@ wScreenSaveState(WScreen *scr)
make_keys(); make_keys();
/* /* Save current workspace, so can go back to it upon restart. */
* Save current workspace, so can go back to it upon restart. data[0] = scr->current_workspace;
*/ data[1] = WFLAGS_NONE;
wstate.workspace = scr->current_workspace;
data[0] = wstate.flags;
data[1] = wstate.workspace;
XChangeProperty(dpy, scr->root_win, _XA_WINDOWMAKER_STATE, XChangeProperty(dpy, scr->root_win, _XA_WINDOWMAKER_STATE,
_XA_WINDOWMAKER_STATE, 32, PropModeReplace, _XA_WINDOWMAKER_STATE, 32, PropModeReplace,

View File

@@ -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); extern void NotifyDeadProcess(pid_t pid, unsigned char status);
@@ -353,8 +353,35 @@ handleSig(int sig)
XCloseDisplay(dpy); XCloseDisplay(dpy);
dpy = XOpenDisplay(""); dpy = XOpenDisplay("");
if (dpy) { if (dpy) {
CARD32 data[2];
WWindow *wwin;
int i;
XGrabServer(dpy); XGrabServer(dpy);
crashAction = wShowCrashingDialogPanel(sig); 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; i<wScreenCount; i++) {
data[0] = wScreen[i]->current_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); XCloseDisplay(dpy);
dpy = NULL; dpy = NULL;
} else { } else {
@@ -442,11 +469,10 @@ getWorkspaceState(Window root, WWorkspaceState **state)
(unsigned char **)&data)!=Success || !data) (unsigned char **)&data)!=Success || !data)
return 0; return 0;
*state = malloc(sizeof(WWorkspaceState)); *state = wmalloc(sizeof(WWorkspaceState));
if (*state) { (*state)->workspace = data[0];
(*state)->flags = data[0]; (*state)->flags = data[1];
(*state)->workspace = data[1];
}
XFree(data); XFree(data);
if (*state && type_ret==_XA_WINDOWMAKER_STATE) if (*state && type_ret==_XA_WINDOWMAKER_STATE)
@@ -674,16 +700,18 @@ static char *atomNames[] = {
"WM_CLIENT_LEADER", "WM_CLIENT_LEADER",
"WM_COLORMAP_WINDOWS", "WM_COLORMAP_WINDOWS",
"WM_COLORMAP_NOTIFY", "WM_COLORMAP_NOTIFY",
GNUSTEP_WM_ATTR_NAME,
"_WINDOWMAKER_MENU", "_WINDOWMAKER_MENU",
"_WINDOWMAKER_STATE", "_WINDOWMAKER_STATE",
"_WINDOWMAKER_WM_PROTOCOLS", "_WINDOWMAKER_WM_PROTOCOLS",
GNUSTEP_WM_MINIATURIZE_WINDOW,
"_WINDOWMAKER_WM_FUNCTION", "_WINDOWMAKER_WM_FUNCTION",
"_WINDOWMAKER_NOTICEBOARD", "_WINDOWMAKER_NOTICEBOARD",
"_WINDOWMAKER_COMMAND", "_WINDOWMAKER_COMMAND",
"_WINDOWMAKER_ICON_SIZE", "_WINDOWMAKER_ICON_SIZE",
"_WINDOWMAKER_ICON_TILE", "_WINDOWMAKER_ICON_TILE",
GNUSTEP_WM_ATTR_NAME,
GNUSTEP_WM_MINIATURIZE_WINDOW,
GNUSTEP_TITLEBAR_STATE GNUSTEP_TITLEBAR_STATE
}; };
@@ -749,24 +777,17 @@ StartUp(Bool defaultScreenOnly)
_XA_WM_COLORMAP_WINDOWS = atom[7]; _XA_WM_COLORMAP_WINDOWS = atom[7];
_XA_WM_COLORMAP_NOTIFY = atom[8]; _XA_WM_COLORMAP_NOTIFY = atom[8];
_XA_GNUSTEP_WM_ATTR = atom[9]; _XA_WINDOWMAKER_MENU = atom[9];
_XA_WINDOWMAKER_STATE = atom[10];
_XA_WINDOWMAKER_MENU = atom[10]; _XA_WINDOWMAKER_WM_PROTOCOLS = atom[11];
_XA_WINDOWMAKER_STATE = atom[11]; _XA_WINDOWMAKER_WM_FUNCTION = atom[12];
_XA_WINDOWMAKER_NOTICEBOARD = atom[13];
_XA_WINDOWMAKER_WM_PROTOCOLS = atom[12]; _XA_WINDOWMAKER_COMMAND = atom[14];
_XA_WINDOWMAKER_ICON_SIZE = atom[15];
_XA_GNUSTEP_WM_MINIATURIZE_WINDOW = atom[13]; _XA_WINDOWMAKER_ICON_TILE = atom[16];
_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_GNUSTEP_WM_ATTR = atom[17];
_XA_GNUSTEP_WM_MINIATURIZE_WINDOW = atom[18];
_XA_GNUSTEP_TITLEBAR_STATE = atom[19]; _XA_GNUSTEP_TITLEBAR_STATE = atom[19];
#ifdef OFFIX_DND #ifdef OFFIX_DND
@@ -927,6 +948,8 @@ StartUp(Bool defaultScreenOnly)
/* initialize/restore state for the screens */ /* initialize/restore state for the screens */
for (j = 0; j < wScreenCount; j++) { for (j = 0; j < wScreenCount; j++) {
int crashed;
/* restore workspace state */ /* restore workspace state */
if (!getWorkspaceState(wScreen[j]->root_win, &ws_state)) { if (!getWorkspaceState(wScreen[j]->root_win, &ws_state)) {
ws_state = NULL; ws_state = NULL;
@@ -938,7 +961,12 @@ StartUp(Bool defaultScreenOnly)
if (!wPreferences.flags.nodock && wScreen[j]->dock) if (!wPreferences.flags.nodock && wScreen[j]->dock)
wScreen[j]->last_dock = 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 */ /* restore saved menus */
wMenuRestoreState(wScreen[j]); wMenuRestoreState(wScreen[j]);
@@ -1014,7 +1042,7 @@ windowInList(Window window, Window *list, int count)
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static void static void
manageAllWindows(WScreen *scr) manageAllWindows(WScreen *scr, int crashRecovery)
{ {
Window root, parent; Window root, parent;
Window *children; Window *children;
@@ -1078,6 +1106,15 @@ manageAllWindows(WScreen *scr)
} else { } else {
wClientSetState(wwin, NormalState, None); 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); XUngrabServer(dpy);

View File

@@ -2396,9 +2396,8 @@ getSavedState(Window window, WSavedState **state)
(unsigned char **)&data)!=Success || !data) (unsigned char **)&data)!=Success || !data)
return 0; return 0;
*state = malloc(sizeof(WSavedState)); *state = wmalloc(sizeof(WSavedState));
if (*state) {
(*state)->workspace = data[0]; (*state)->workspace = data[0];
(*state)->miniaturized = data[1]; (*state)->miniaturized = data[1];
(*state)->shaded = data[2]; (*state)->shaded = data[2];
@@ -2409,7 +2408,7 @@ getSavedState(Window window, WSavedState **state)
(*state)->w = data[7]; (*state)->w = data[7];
(*state)->h = data[8]; (*state)->h = data[8];
(*state)->window_shortcuts = data[9]; (*state)->window_shortcuts = data[9];
}
XFree(data); XFree(data);
if (*state && type_ret==_XA_WINDOWMAKER_STATE) if (*state && type_ret==_XA_WINDOWMAKER_STATE)