summaryrefslogtreecommitdiffstats
path: root/games/yae/patches/allow_x_window_close.diff
blob: d596ce7b390a86c4fd589af8890c0092959a3c49 (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
diff -Naur -Naur yae-0.7/x_window.c yae-0.7.patched/x_window.c
--- yae-0.7/x_window.c	2007-04-03 17:47:59.000000000 -0400
+++ yae-0.7.patched/x_window.c	2021-10-12 00:23:48.765550342 -0400
@@ -57,6 +57,8 @@
 
 static	Cursor	InvisibleCursor;
 
+static Atom delete_atom;
+
 Visual *getVisual( Display *dpy, int screen, int depth, int class )
 {
 	XVisualInfo vinfo, *vinfoList;
@@ -219,6 +221,9 @@
 	XFlush( dc->display );
 #endif
 
+	delete_atom = XInternAtom(dc->display, "WM_DELETE_WINDOW", False);
+	XSetWMProtocols(dc->display, dc->window, &delete_atom, 1);
+
 	/*
 	 * startup micro job for X window
 	 */
@@ -313,6 +318,10 @@
 #endif
 	            refreshScreen();
 	         break;
+	      case ClientMessage:
+				if(event.xclient.data.l[0] == delete_atom)
+					shutdown_6502();
+				break;
 	      case DestroyNotify:
 	         Signal6502( SIG_6502_SHUTDOWN );
 	         break;