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:
10
ChangeLog
10
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 <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:
|
||||
@@ -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:
|
||||
.............................
|
||||
|
||||
|
||||
6
TODO
6
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:
|
||||
===============
|
||||
@@ -41,7 +41,7 @@ Never: (so, dont even bother to ask)
|
||||
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...
|
||||
- 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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -99,8 +99,6 @@ showIconLayout(WMWidget *widget, void *data)
|
||||
}
|
||||
|
||||
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
static void
|
||||
showData(_Panel *panel)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
TitleJustify = center;
|
||||
TitleJustify = left;
|
||||
HighlightColor = white;
|
||||
HighlightTextColor = black;
|
||||
ClipTitleColor = black;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
TitleJustify = center;
|
||||
TitleJustify = left;
|
||||
HighlightColor = white;
|
||||
HighlightTextColor = black;
|
||||
ClipTitleColor = black;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
10
src/dock.c
10
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<MAX(vcount, hcount); i++) {
|
||||
for (i=1; i<WMAX(vcount, hcount); i++) {
|
||||
if (i < vcount && vmap[i]==0) {
|
||||
/* found a slot */
|
||||
x = 0;
|
||||
@@ -2771,7 +2769,7 @@ wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
|
||||
slot_map = wmalloc(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
|
||||
* (for example, when all icons are placed in line), ignore them. */
|
||||
|
||||
@@ -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<l; i++) {
|
||||
if (name[i]=='\\') {
|
||||
@@ -1114,7 +1114,7 @@ EscapeWM_CLASS(char *name, char *class)
|
||||
}
|
||||
if (class) {
|
||||
l = strlen(class);
|
||||
eclass = wmalloc(l*2);
|
||||
eclass = wmalloc(l*2+1);
|
||||
j = 0;
|
||||
for (i=0; i<l; i++) {
|
||||
if (class[i]=='\\') {
|
||||
|
||||
@@ -144,9 +144,6 @@ static Shortcut *shortcutList = NULL;
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAX(a,b) ((a)>(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;
|
||||
}
|
||||
|
||||
11
src/screen.c
11
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,
|
||||
|
||||
@@ -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; 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);
|
||||
dpy = NULL;
|
||||
} else {
|
||||
@@ -442,11 +469,10 @@ getWorkspaceState(Window root, WWorkspaceState **state)
|
||||
(unsigned char **)&data)!=Success || !data)
|
||||
return 0;
|
||||
|
||||
*state = malloc(sizeof(WWorkspaceState));
|
||||
if (*state) {
|
||||
(*state)->flags = data[0];
|
||||
(*state)->workspace = data[1];
|
||||
}
|
||||
*state = wmalloc(sizeof(WWorkspaceState));
|
||||
(*state)->workspace = data[0];
|
||||
(*state)->flags = data[1];
|
||||
|
||||
XFree(data);
|
||||
|
||||
if (*state && type_ret==_XA_WINDOWMAKER_STATE)
|
||||
@@ -674,16 +700,18 @@ static char *atomNames[] = {
|
||||
"WM_CLIENT_LEADER",
|
||||
"WM_COLORMAP_WINDOWS",
|
||||
"WM_COLORMAP_NOTIFY",
|
||||
GNUSTEP_WM_ATTR_NAME,
|
||||
|
||||
"_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,6 +948,8 @@ StartUp(Bool defaultScreenOnly)
|
||||
|
||||
/* initialize/restore state for the screens */
|
||||
for (j = 0; j < wScreenCount; j++) {
|
||||
int crashed;
|
||||
|
||||
/* restore workspace state */
|
||||
if (!getWorkspaceState(wScreen[j]->root_win, &ws_state)) {
|
||||
ws_state = NULL;
|
||||
@@ -938,7 +961,12 @@ StartUp(Bool defaultScreenOnly)
|
||||
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;
|
||||
@@ -1078,6 +1106,15 @@ manageAllWindows(WScreen *scr)
|
||||
} 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);
|
||||
|
||||
@@ -2396,9 +2396,8 @@ getSavedState(Window window, WSavedState **state)
|
||||
(unsigned char **)&data)!=Success || !data)
|
||||
return 0;
|
||||
|
||||
*state = malloc(sizeof(WSavedState));
|
||||
*state = wmalloc(sizeof(WSavedState));
|
||||
|
||||
if (*state) {
|
||||
(*state)->workspace = data[0];
|
||||
(*state)->miniaturized = data[1];
|
||||
(*state)->shaded = data[2];
|
||||
@@ -2409,7 +2408,7 @@ getSavedState(Window window, WSavedState **state)
|
||||
(*state)->w = data[7];
|
||||
(*state)->h = data[8];
|
||||
(*state)->window_shortcuts = data[9];
|
||||
}
|
||||
|
||||
XFree(data);
|
||||
|
||||
if (*state && type_ret==_XA_WINDOWMAKER_STATE)
|
||||
|
||||
Reference in New Issue
Block a user