* Trapping dosemu exit
@ 2007-12-05 4:35 bambang
2008-01-30 11:19 ` Rafał Cygnarowski
2008-01-31 0:14 ` James Courtier-Dutton
0 siblings, 2 replies; 5+ messages in thread
From: bambang @ 2007-12-05 4:35 UTC (permalink / raw)
To: FreeDOS
Hi all,
We use dosemu 1.4.0 to access Novell Netware in Graphics terminal.
Everything goes well except one little problem: It's often the users
exit the dosemu by directly closing the dosemu window thus not logging
out from the novell connection. Obviously, the novell connection still
left opened and causing problems.
Is there a way to trap dosemu terminating event, so we can force a
logout or warn the user and reject the termination.
TIA,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trapping dosemu exit
2007-12-05 4:35 Trapping dosemu exit bambang
@ 2008-01-30 11:19 ` Rafał Cygnarowski
2008-01-30 22:38 ` Rafał Cygnarowski
2008-01-31 0:14 ` James Courtier-Dutton
1 sibling, 1 reply; 5+ messages in thread
From: Rafał Cygnarowski @ 2008-01-30 11:19 UTC (permalink / raw)
To: linux-msdos, bambang
[-- Attachment #1: Type: text/plain, Size: 5443 bytes --]
Dnia środa, 5 grudnia 2007, bambang napisał:
> Hi all,
>
> We use dosemu 1.4.0 to access Novell Netware in Graphics terminal.
>
> Everything goes well except one little problem: It's often the users
> exit the dosemu by directly closing the dosemu window thus not logging
> out from the novell connection. Obviously, the novell connection still
> left opened and causing problems.
>
> Is there a way to trap dosemu terminating event, so we can force a
> logout or warn the user and reject the termination.
Because I suffer from the same reason and I found a little bit time to solve
this problem, here is a patch for X plugin (and only X and not SDL).
Please use it with caution - it's not well tested yet.
---------------------------------------------------------------------------------
diff -Nur dosemu-1.4.0.orig/src/plugin/X/X.c dosemu-1.4.0.chng/src/plugin/X/X.c
--- dosemu-1.4.0.orig/src/plugin/X/X.c 2007-05-04 07:59:48.000000000 +0200
+++ dosemu-1.4.0.chng/src/plugin/X/X.c 2008-01-30 12:09:47.000000000 +0100
@@ -383,6 +383,9 @@
static Atom comm_atom = None;
static Boolean kdos_client = FALSE; /* started by kdos */
+static Boolean about_to_quit = FALSE;
+extern struct text_system Text_X;
+void (*Draw_cursor_backup)(int x, int y, Bit8u attr, int first, int last, Boolean focus);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -1434,6 +1437,7 @@
case FocusIn:
X_printf("X: focus in\n");
+ if (about_to_quit) break;
if (vga.mode_class == TEXT) text_gain_focus();
if (config.X_background_pause && !dosemu_user_froze) unfreeze_dosemu ();
have_focus = TRUE;
@@ -1441,6 +1445,7 @@
case FocusOut:
X_printf("X: focus out\n");
+ if (about_to_quit) break;
if (mainwindow == fullscreenwindow) break;
if (vga.mode_class == TEXT) text_lose_focus();
output_byte_8042(port60_buffer | 0x80);
@@ -1458,9 +1463,36 @@
* atom, it means the window manager wants us to die.
*/
if(e.xclient.message_type == proto_atom && *e.xclient.data.l == delete_atom) {
+ int i;
+
X_printf("X: got window delete message\n");
- /* XXX - Is it ok to call this from a SIGALRM handler? */
- leavedos(0);
+
+ if (about_to_quit)
+ break;
+
+ about_to_quit = TRUE;
+ Draw_cursor_backup = Text_X.Draw_cursor;
+ Text_X.Draw_cursor = NULL;
+ freeze_dosemu();
+
+ for (i = 0; i < 12; i++)
+ Text_X.Draw_string(14, i+6, " " , 52, 0xf0);
+
+ Text_X.Draw_string(15, 7, " " , 50, 0x4f);
+ Text_X.Draw_string(15, 8, " You are about to abort DosEmu session. " , 50, 0x4f);
+ Text_X.Draw_string(15, 9, " This is not recomended way for closing DosEmu. " , 50, 0x4f);
+ Text_X.Draw_string(15, 10, " Close all your programs and use exitemu command. " , 50, 0x4f);
+ Text_X.Draw_string(15, 11, " " , 50, 0x4f);
+ Text_X.Draw_string(15, 12, " Do you still want to continue? " , 50, 0x4f);
+ Text_X.Draw_string(15, 13, " " , 50, 0x4f);
+ Text_X.Draw_string(15, 14, " Y - abort DosEmu session " , 50, 0x4f);
+ Text_X.Draw_string(15, 15, " N - continue DosEmu session " , 50, 0x4f);
+ Text_X.Draw_string(15, 16, " " , 50, 0x4f);
+
+ Text_X.Draw_string(48, 10, "exitemu" , 7, 0x4a);
+ Text_X.Draw_string(18, 14, "Y" , 1, 0x4e);
+ Text_X.Draw_string(18, 15, "N" , 1, 0x4e);
+
break;
}
@@ -1490,6 +1522,24 @@
keyrel_pending = 0;
}
+ if (about_to_quit) {
+ KeySym keysym = XKeycodeToKeysym(display, e.xkey.keycode, 0);
+ if (keysym == XK_Y || keysym == XK_y) {
+ leavedos(0);
+ } else if (keysym == XK_N || keysym == XK_n) {
+ about_to_quit = FALSE;
+ Text_X.Draw_cursor = Draw_cursor_backup;
+ if(vga.mode_class == TEXT) {
+ X_redraw_text_screen();
+ } else {
+ dirty_all_video_pages();
+ X_update_screen();
+ }
+ unfreeze_dosemu();
+ }
+ break;
+ }
+
if((e.xkey.state & ControlMask) && (e.xkey.state & Mod1Mask)) {
KeySym keysym = XKeycodeToKeysym(display, e.xkey.keycode, 0);
if (keysym == grab_keysym) {
@@ -1504,6 +1554,7 @@
break;
}
}
+
/*
Clears the visible selection if the cursor is inside the selection
*/
diff -Nur dosemu-1.4.0.orig/src/plugin/X/X_font.c dosemu-1.4.0.chng/src/plugin/X/X_font.c
--- dosemu-1.4.0.orig/src/plugin/X/X_font.c 2007-05-04 07:59:48.000000000 +0200
+++ dosemu-1.4.0.chng/src/plugin/X/X_font.c 2008-01-30 10:04:00.000000000 +0100
@@ -195,8 +195,7 @@
text_colors[i] = xc.pixel;
}
-
-static struct text_system Text_X =
+struct text_system Text_X =
{
X_draw_string,
X_draw_line,
---------------------------------------------------------------------------------
Regards,
--
Rafał Cygnarowski
rafi@pers.pl
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trapping dosemu exit
2008-01-30 11:19 ` Rafał Cygnarowski
@ 2008-01-30 22:38 ` Rafał Cygnarowski
0 siblings, 0 replies; 5+ messages in thread
From: Rafał Cygnarowski @ 2008-01-30 22:38 UTC (permalink / raw)
To: linux-msdos
[-- Attachment #1: Type: text/plain, Size: 5180 bytes --]
Dnia środa, 30 stycznia 2008, Rafał Cygnarowski napisał:
> Because I suffer from the same reason and I found a little bit time to
> solve this problem, here is a patch for X plugin (and only X and not SDL).
> Please use it with caution - it's not well tested yet.
Updated patch without freeze_dosemu() and unfreeze_dosemu() functions:
--------------------------------------------------------------------------
diff -Nur dosemu-1.4.0.orig/src/plugin/X/X.c dosemu-1.4.0.chng/src/plugin/X/X.c
--- dosemu-1.4.0.orig/src/plugin/X/X.c 2007-05-04 07:59:48.000000000 +0200
+++ dosemu-1.4.0.chng/src/plugin/X/X.c 2008-01-30 22:27:07.000000000 +0100
@@ -383,6 +383,10 @@
static Atom comm_atom = None;
static Boolean kdos_client = FALSE; /* started by kdos */
+static Boolean about_to_quit = FALSE;
+extern struct text_system Text_X;
+void (*Draw_cursor_backup)(int x, int y, Bit8u attr, int first, int last, Boolean focus);
+void (*Draw_string_backup)(int x, int y , unsigned char *s, int len, Bit8u attr);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -486,6 +490,16 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+void Draw_cursor_fake(int x, int y, Bit8u attr, int first, int last, Boolean focus)
+{
+ return;
+}
+
+void Draw_string_fake(int x, int y , unsigned char *s, int len, Bit8u attr)
+{
+ return;
+}
+
/* utility function for opening a connection and making certain
* I am either using or not using the X keyboard Extension.
*/
@@ -1458,9 +1472,38 @@
* atom, it means the window manager wants us to die.
*/
if(e.xclient.message_type == proto_atom && *e.xclient.data.l == delete_atom) {
+ int i;
+
X_printf("X: got window delete message\n");
- /* XXX - Is it ok to call this from a SIGALRM handler? */
- leavedos(0);
+
+ if (about_to_quit)
+ break;
+
+ about_to_quit = TRUE;
+ Draw_cursor_backup = Text_X.Draw_cursor;
+ Text_X.Draw_cursor = Draw_cursor_fake;
+
+ for (i = 0; i < 12; i++)
+ Text_X.Draw_string(14, i+6, " " , 52, 0xf0);
+
+ Text_X.Draw_string(15, 7, " " , 50, 0x4f);
+ Text_X.Draw_string(15, 8, " You are about to abort DosEmu session. " , 50, 0x4f);
+ Text_X.Draw_string(15, 9, " This is not recomended way for closing DosEmu. " , 50, 0x4f);
+ Text_X.Draw_string(15, 10, " Close all your programs and use exitemu command. " , 50, 0x4f);
+ Text_X.Draw_string(15, 11, " " , 50, 0x4f);
+ Text_X.Draw_string(15, 12, " Do you still want to continue? " , 50, 0x4f);
+ Text_X.Draw_string(15, 13, " " , 50, 0x4f);
+ Text_X.Draw_string(15, 14, " Y - abort DosEmu session " , 50, 0x4f);
+ Text_X.Draw_string(15, 15, " N - continue DosEmu session " , 50, 0x4f);
+ Text_X.Draw_string(15, 16, " " , 50, 0x4f);
+
+ Text_X.Draw_string(48, 10, "exitemu" , 7, 0x4a);
+ Text_X.Draw_string(18, 14, "Y" , 1, 0x4e);
+ Text_X.Draw_string(18, 15, "N" , 1, 0x4e);
+
+ Draw_string_backup = Text_X.Draw_string;
+ Text_X.Draw_string = Draw_string_fake;
+
break;
}
@@ -1490,6 +1533,24 @@
keyrel_pending = 0;
}
+ if (about_to_quit) {
+ KeySym keysym = XKeycodeToKeysym(display, e.xkey.keycode, 0);
+ if (keysym == XK_Y || keysym == XK_y) {
+ leavedos(0);
+ } else if (keysym == XK_N || keysym == XK_n) {
+ about_to_quit = FALSE;
+ Text_X.Draw_cursor = Draw_cursor_backup;
+ Text_X.Draw_string = Draw_string_backup;
+ if(vga.mode_class == TEXT) {
+ X_redraw_text_screen();
+ } else {
+ dirty_all_video_pages();
+ X_update_screen();
+ }
+ }
+ break;
+ }
+
if((e.xkey.state & ControlMask) && (e.xkey.state & Mod1Mask)) {
KeySym keysym = XKeycodeToKeysym(display, e.xkey.keycode, 0);
if (keysym == grab_keysym) {
@@ -1504,6 +1565,7 @@
break;
}
}
+
/*
Clears the visible selection if the cursor is inside the selection
*/
diff -Nur dosemu-1.4.0.orig/src/plugin/X/X_font.c dosemu-1.4.0.chng/src/plugin/X/X_font.c
--- dosemu-1.4.0.orig/src/plugin/X/X_font.c 2007-05-04 07:59:48.000000000 +0200
+++ dosemu-1.4.0.chng/src/plugin/X/X_font.c 2008-01-30 10:04:00.000000000 +0100
@@ -195,8 +195,7 @@
text_colors[i] = xc.pixel;
}
-
-static struct text_system Text_X =
+struct text_system Text_X =
{
X_draw_string,
X_draw_line,
--------------------------------------------------------------------------
Regards,
--
Rafał Cygnarowski
rafi@pers.pl
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trapping dosemu exit
2007-12-05 4:35 Trapping dosemu exit bambang
2008-01-30 11:19 ` Rafał Cygnarowski
@ 2008-01-31 0:14 ` James Courtier-Dutton
2008-01-31 7:46 ` Bambang P
1 sibling, 1 reply; 5+ messages in thread
From: James Courtier-Dutton @ 2008-01-31 0:14 UTC (permalink / raw)
To: bambang; +Cc: FreeDOS
bambang wrote:
> Hi all,
>
> We use dosemu 1.4.0 to access Novell Netware in Graphics terminal.
>
> Everything goes well except one little problem: It's often the users
> exit the dosemu by directly closing the dosemu window thus not logging
> out from the novell connection. Obviously, the novell connection still
> left opened and causing problems.
>
> Is there a way to trap dosemu terminating event, so we can force a
> logout or warn the user and reject the termination.
>
> TIA,
>
>
Why do you need dosemu to access Novell Netware?
Linux supports Novell Netware natively, or are you running dosemu on
windows?
In any case, when dos exits, Novell will stop getting it's keepalives so
should log that person out.
For example, I don't remember Novell having problems with people just
switching off their old DOS PCs.
James
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trapping dosemu exit
2008-01-31 0:14 ` James Courtier-Dutton
@ 2008-01-31 7:46 ` Bambang P
0 siblings, 0 replies; 5+ messages in thread
From: Bambang P @ 2008-01-31 7:46 UTC (permalink / raw)
To: James Courtier-Dutton; +Cc: FreeDOS
On 1/31/08, James Courtier-Dutton <James@superbug.co.uk> wrote:
> bambang wrote:
> > Hi all,
> >
> > We use dosemu 1.4.0 to access Novell Netware in Graphics terminal.
> >
> >
> >
> Why do you need dosemu to access Novell Netware?
> Linux supports Novell Netware natively,
because the application is dos application and we avoid microsoft
product as much as possible.
>
> or are you running dosemu on windows?
>
afaik there is no dosemu for windows.
>
> In any case, when dos exits, Novell will stop getting it's keepalives so
> should log that person out.
> For example, I don't remember Novell having problems with people just
> switching off their old DOS PCs.
>
.. but the server needs some time to realize that the workstation already died.
--
Bambang P
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-31 7:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 4:35 Trapping dosemu exit bambang
2008-01-30 11:19 ` Rafał Cygnarowski
2008-01-30 22:38 ` Rafał Cygnarowski
2008-01-31 0:14 ` James Courtier-Dutton
2008-01-31 7:46 ` Bambang P
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.