summaryrefslogtreecommitdiff
blob: 88006a28a2d4c4fbc4cc0601b82d90bc16df760e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff -dupr yadex-1.7.901-patched/src/gfx.cc yadex-1.7.901/src/gfx.cc
--- yadex-1.7.901-patched/src/gfx.cc	2015-11-23 15:53:56.087783740 +0100
+++ yadex-1.7.901/src/gfx.cc	2015-11-23 22:17:45.876127582 +0100
@@ -114,6 +114,7 @@ int      win_depth;	// The depth of win
 int      x_server_big_endian = 0;	// Is the X server big endian ?
 int      ximage_bpp;	// Number of bytes per pixels in XImages
 int      ximage_quantum;// Pad XImages lines to a multiple of that many bytes
+Atom     wm_delete;
 static pcolour_t *app_colour = 0;	// Pixel values for the app. colours
 static int DrawingMode    = 0;		// 0 = copy, 1 = xor
 static int LineThickness  = 0;		// 0 = thin, 1 = thick
@@ -471,6 +472,10 @@ int InitGfx (void)
     | ExposureMask
     | StructureNotifyMask);
 
+  // register for message from window manager if the window is closed
+  wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
+  XSetWMProtocols(dpy, win, &wm_delete, 1);
+
   /*
    *	Possibly load and query the font
    */
diff -dupr yadex-1.7.901-patched/src/gfx.h yadex-1.7.901/src/gfx.h
--- yadex-1.7.901-patched/src/gfx.h	2005-02-06 10:45:21.000000000 +0100
+++ yadex-1.7.901/src/gfx.h	2015-11-23 22:16:10.674721105 +0100
@@ -96,6 +96,7 @@ extern int      win_bpp;	// The depth of
 extern int	x_server_big_endian;	// Is the X server big-endian ?
 extern int      ximage_bpp;	// Number of bytes per pixels in XImages
 extern int      ximage_quantum;	// Pad XImage lines to a mult of that many B.
+extern Atom     wm_delete;
 #endif  // ifdef X_PROTOCOL
 #endif  // ifdef Y_X11
 extern int	text_dot;     // DrawScreenText()/DrawScreenString() debug flag
diff -dupr yadex-1.7.901-patched/src/input.cc yadex-1.7.901/src/input.cc
--- yadex-1.7.901-patched/src/input.cc	2006-11-03 14:49:01.000000000 +0100
+++ yadex-1.7.901/src/input.cc	2015-11-23 22:15:21.398133938 +0100
@@ -413,6 +413,12 @@ switch (ev.type)
 	 }
 #endif
       break;
+
+   case ClientMessage:
+      if ((Atom)ev.xclient.data.l[0] == wm_delete)
+        // window has been closed, simulate ESC keypress
+        is.key = YK_ESC;
+      break;
       }
    }  /* switch (ev.type) */
 }