52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
--- src/frontend/help/x11disp.c 2005-09-06 22:21:09.000000000 +0200
|
|
+++ x11disp.c 2009-02-21 18:58:58.000000000 +0100
|
|
@@ -2,7 +2,7 @@
|
|
Copyright 1990 Regents of the University of California. All rights reserved.
|
|
Author: Jeffrey M. Hsu
|
|
Modified 1999 Emmanuel Rouat
|
|
-$Id: x11disp.c,v 1.3 2005/09/06 20:21:09 sjborley Exp $
|
|
+$Id: x11disp.c,v 1.4 2009/02/20 18:25:21 h_vogt Exp $
|
|
**********/
|
|
|
|
#include <config.h>
|
|
@@ -25,6 +25,24 @@
|
|
static topic *topics = NULL;
|
|
void newtopic(Widget w, caddr_t client_data, caddr_t call_data), delete(Widget w, caddr_t client_data, caddr_t call_data), quit(Widget w, caddr_t client_data, caddr_t call_data);
|
|
static void sputline(char *buf, char *s);
|
|
+/* atoms for catching window delet by WM x-button */
|
|
+static Atom atom_wm_delete_window;
|
|
+static Atom atom_wm_protocols;
|
|
+static Display *display;
|
|
+
|
|
+/* callback function for catching window deletion by WM x-button */
|
|
+static void handle_wm_messages(Widget w, XtPointer client_data, XEvent *event, Boolean *cont) {
|
|
+ topic *top = (topic *) client_data;
|
|
+
|
|
+ if (event->type == ClientMessage
|
|
+ && event->xclient.message_type == atom_wm_protocols
|
|
+ && event->xclient.data.l[0] == atom_wm_delete_window)
|
|
+ {
|
|
+ hlp_killfamily(top);
|
|
+ hlp_fixchildren(top);
|
|
+ }
|
|
+}
|
|
+
|
|
|
|
/* Create a new window... */
|
|
bool
|
|
@@ -191,6 +209,14 @@
|
|
top->winlink = topics;
|
|
topics = top;
|
|
|
|
+
|
|
+ /* WM_DELETE_WINDOW protocol */
|
|
+ display = XtDisplay(top->shellwidget);
|
|
+ atom_wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False);
|
|
+ atom_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
|
|
+ XtAddEventHandler(top->shellwidget, NoEventMask, True, handle_wm_messages, top);
|
|
+ XSetWMProtocols(display, XtWindow(top->shellwidget), &atom_wm_delete_window, 1);
|
|
+
|
|
return (TRUE);
|
|
|
|
}
|