]> git.pld-linux.org Git - packages/dosemu.git/blame - dosemu-Xquit.patch
- obsolete
[packages/dosemu.git] / dosemu-Xquit.patch
CommitLineData
b79d35aa 1diff -Nur dosemu-1.4.0.orig/src/env/video/text.c dosemu-1.4.0.chng/src/env/video/text.c
2--- dosemu-1.4.0.orig/src/env/video/text.c 2007-05-04 07:59:48.000000000 +0200
3+++ dosemu-1.4.0.chng/src/env/video/text.c 2008-04-21 22:36:23.000000000 +0200
4@@ -96,6 +96,11 @@
5 return 1;
6 }
7
8+struct text_system* registered_text_system(void)
9+{
10+ return Text;
11+}
12+
13 /*
14 * Draw a text string.
15 * The attribute is the VGA color/mono text attribute.
9adcb6d3 16diff -Nur dosemu-1.4.0.orig/src/plugin/X/X.c dosemu-1.4.0.chng/src/plugin/X/X.c
17--- dosemu-1.4.0.orig/src/plugin/X/X.c 2007-05-04 07:59:48.000000000 +0200
b79d35aa 18+++ dosemu-1.4.0.chng/src/plugin/X/X.c 2008-04-21 23:03:06.000000000 +0200
19@@ -383,6 +383,12 @@
9adcb6d3 20 static Atom comm_atom = None;
21 static Boolean kdos_client = FALSE; /* started by kdos */
22
23+static Boolean about_to_quit = FALSE;
b79d35aa 24+static struct text_system* Text_Tmp;
25+extern struct text_system* registered_text_system(void);
9adcb6d3 26+void (*Draw_cursor_backup)(int x, int y, Bit8u attr, int first, int last, Boolean focus);
20dff5ec 27+void (*Draw_string_backup)(int x, int y , unsigned char *s, int len, Bit8u attr);
b79d35aa 28+
9adcb6d3 29
30 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
31
b79d35aa 32@@ -486,6 +492,16 @@
9adcb6d3 33
20dff5ec 34 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
35
36+void Draw_cursor_fake(int x, int y, Bit8u attr, int first, int last, Boolean focus)
37+{
38+ return;
39+}
40+
41+void Draw_string_fake(int x, int y , unsigned char *s, int len, Bit8u attr)
42+{
43+ return;
44+}
45+
46 /* utility function for opening a connection and making certain
47 * I am either using or not using the X keyboard Extension.
48 */
b79d35aa 49@@ -1458,9 +1474,40 @@
9adcb6d3 50 * atom, it means the window manager wants us to die.
51 */
52 if(e.xclient.message_type == proto_atom && *e.xclient.data.l == delete_atom) {
53+ int i;
54+
55 X_printf("X: got window delete message\n");
56- /* XXX - Is it ok to call this from a SIGALRM handler? */
57- leavedos(0);
58+
59+ if (about_to_quit)
60+ break;
b79d35aa 61+
9adcb6d3 62+ about_to_quit = TRUE;
b79d35aa 63+ Text_Tmp = registered_text_system();
9adcb6d3 64+
b79d35aa 65+ Draw_cursor_backup = Text_Tmp->Draw_cursor;
66+ Text_Tmp->Draw_cursor = Draw_cursor_fake;
9adcb6d3 67+
b79d35aa 68+ for (i = 0; i < 12; i++)
69+ Text_Tmp->Draw_string(14, i+6, " " , 52, 0xf0);
70+
71+ Text_Tmp->Draw_string(15, 7, " " , 50, 0x4f);
72+ Text_Tmp->Draw_string(15, 8, " You are about to abort DosEmu session. " , 50, 0x4f);
73+ Text_Tmp->Draw_string(15, 9, " This is not recomended way for closing DosEmu. " , 50, 0x4f);
74+ Text_Tmp->Draw_string(15, 10, " Close all your programs and use exitemu command. " , 50, 0x4f);
75+ Text_Tmp->Draw_string(15, 11, " " , 50, 0x4f);
76+ Text_Tmp->Draw_string(15, 12, " Do you still want to continue? " , 50, 0x4f);
77+ Text_Tmp->Draw_string(15, 13, " " , 50, 0x4f);
78+ Text_Tmp->Draw_string(15, 14, " Y - abort DosEmu session " , 50, 0x4f);
79+ Text_Tmp->Draw_string(15, 15, " N - continue DosEmu session " , 50, 0x4f);
80+ Text_Tmp->Draw_string(15, 16, " " , 50, 0x4f);
9adcb6d3 81+
b79d35aa 82+ Text_Tmp->Draw_string(48, 10, "exitemu" , 7, 0x4a);
83+ Text_Tmp->Draw_string(18, 14, "Y" , 1, 0x4e);
84+ Text_Tmp->Draw_string(18, 15, "N" , 1, 0x4e);
20dff5ec 85+
b79d35aa 86+ Draw_string_backup = Text_Tmp->Draw_string;
87+ Text_Tmp->Draw_string = Draw_string_fake;
9adcb6d3 88+
89 break;
90 }
91
b79d35aa 92@@ -1490,6 +1537,24 @@
9adcb6d3 93 keyrel_pending = 0;
94 }
95
96+ if (about_to_quit) {
97+ KeySym keysym = XKeycodeToKeysym(display, e.xkey.keycode, 0);
98+ if (keysym == XK_Y || keysym == XK_y) {
99+ leavedos(0);
100+ } else if (keysym == XK_N || keysym == XK_n) {
101+ about_to_quit = FALSE;
b79d35aa 102+ Text_Tmp->Draw_cursor = Draw_cursor_backup;
103+ Text_Tmp->Draw_string = Draw_string_backup;
9adcb6d3 104+ if(vga.mode_class == TEXT) {
105+ X_redraw_text_screen();
106+ } else {
107+ dirty_all_video_pages();
108+ X_update_screen();
109+ }
9adcb6d3 110+ }
111+ break;
112+ }
113+
114 if((e.xkey.state & ControlMask) && (e.xkey.state & Mod1Mask)) {
115 KeySym keysym = XKeycodeToKeysym(display, e.xkey.keycode, 0);
116 if (keysym == grab_keysym) {
b79d35aa 117@@ -1504,6 +1569,7 @@
9adcb6d3 118 break;
119 }
120 }
121+
122 /*
123 Clears the visible selection if the cursor is inside the selection
124 */
This page took 0.08794 seconds and 4 git commands to generate.