diff --git a/src/gd3.x11/createwindo3.c b/src/gd3.x11/createwindo3.c index 89dbb23..b8501bb 100755 --- a/src/gd3.x11/createwindo3.c +++ b/src/gd3.x11/createwindo3.c @@ -71,6 +71,7 @@ createwindow3(win_num, xmin_vp, xmax_vp, ymin_vp, ymax_vp, nerr) int xul_p, yul_p; unsigned int width_p, height_p; char title_label[32], *ptitle_label; + Atom wm_delete_window; XSetWindowAttributes winatt; XGCValues xgcval, xgccurs, xgcdef,xgcicon; unsigned long valuemask; @@ -85,6 +86,8 @@ createwindow3(win_num, xmin_vp, xmax_vp, ymin_vp, ymax_vp, nerr) *nerr = 0; ptitle_label = title_label; + wm_delete_window = XInternAtom(display3, "WM_DELETE_WINDOW", False); + /* Set up boundaries of window */ xul_p = (int) ((float) (scr_width_p3-1) * *xmin_vp); @@ -210,8 +213,10 @@ createwindow3(win_num, xmin_vp, xmax_vp, ymin_vp, ymax_vp, nerr) #endif /* USE_X11_DOUBLE_BUFFER */ -/* Select events will be accepted by each window */ +/* Select events will be accepted by each window; notify window manager + that we will handle window deletions, not it. */ + XSetWMProtocols(display3, basew3[*win_num].win, &wm_delete_window, 1); XSelectInput(display3,basew3[*win_num].win, (ExposureMask | StructureNotifyMask)); diff --git a/src/gd3.x11/dispatcheve3.c b/src/gd3.x11/dispatcheve3.c index c7fc6f4..fed1e66 100755 --- a/src/gd3.x11/dispatcheve3.c +++ b/src/gd3.x11/dispatcheve3.c @@ -161,6 +161,16 @@ dispatchevent3(nerr) break; #endif + /* George Helffrich + If you can, handle window destroy events triggered by window manager + here. These are clicks on the close button on the window frame. I + choose to ignore them and leave the window active -- SAC has no + semantics for closing windows except enddevice. + + case ClientMessage: + *nerr = 1; + break; + */ case ConfigureNotify: if (is_basew) {