- fix [ 629606 ] BX_WITH_TERM affects ^C handling :

. if BX_GUI_SIGHANDLER is true and the term gui is selected at run time,
    a new global boolean (bx_gui_sighandler) variable is set to true.
    Special signal handling is done if bx_gui_sighandler is true.
  . if BX_GUI_SIGHANDLER is not true, bx_gui_sighandler is not compiled in.
This commit is contained in:
Christophe Bothamy 2002-11-11 17:09:57 +00:00
parent 1a089af9ea
commit 052ee134b7
3 changed files with 38 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.106 2002-11-03 17:17:09 vruppert Exp $
// $Id: bochs.h,v 1.107 2002-11-11 17:09:45 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -512,6 +512,10 @@ enum PCS_OP { PCS_CLEAR, PCS_SET, PCS_TOGGLE };
BOCHSAPI extern bx_devices_c bx_devices;
#endif
#if BX_GUI_SIGHANDLER
extern bx_bool bx_gui_sighandler;
#endif
// This value controls how often each I/O device's periodic() method
// gets called. The timer is set up in iodev/devices.cc.
#define BX_IODEV_HANDLER_PERIOD 100 // microseconds

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.55 2002-11-09 06:41:34 vruppert Exp $
// $Id: gui.cc,v 1.56 2002-11-11 17:09:57 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -497,11 +497,14 @@ void
bx_gui_c::init_signal_handlers ()
{
#if BX_GUI_SIGHANDLER
Bit32u mask = bx_gui->get_sighandler_mask ();
for (Bit32u sig=0; sig<32; sig++)
if (bx_gui_sighandler)
{
if (mask & (1<<sig))
signal (sig, bx_signal_handler);
Bit32u mask = bx_gui->get_sighandler_mask ();
for (Bit32u sig=0; sig<32; sig++)
{
if (mask & (1<<sig))
signal (sig, bx_signal_handler);
}
}
#endif
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.176 2002-11-09 20:51:39 vruppert Exp $
// $Id: main.cc,v 1.177 2002-11-11 17:09:50 cbothamy Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -57,6 +57,9 @@ extern "C" {
void alarm(int);
#endif
#if BX_GUI_SIGHANDLER
bx_bool bx_gui_sighandler = 0;
#endif
#if BX_PROVIDE_DEVICE_MODELS==1
// some prototypes from iodev/
@ -1700,6 +1703,16 @@ bx_bool load_and_init_display_lib () {
if (!strcmp (gui_name, "x"))
PLUG_load_plugin (x, PLUGTYPE_OPTIONAL);
#endif
#if BX_GUI_SIGHANDLER
// set the flag for guis requiring a GUI sighandler.
// useful when guis are compiled as plugins
// only term for now
if (!strcmp (gui_name, "term")) {
bx_gui_sighandler = 1;
}
#endif
BX_ASSERT (bx_gui != NULL);
return true;
}
@ -3462,10 +3475,12 @@ bx_signal_handler( int signum)
return;
}
#if BX_GUI_SIGHANDLER
// GUI signal handler gets first priority, if the mask says it's wanted
if ((1<<signum) & bx_gui->get_sighandler_mask ()) {
bx_gui->sighandler (signum);
return;
if (bx_gui_sighandler) {
// GUI signal handler gets first priority, if the mask says it's wanted
if ((1<<signum) & bx_gui->get_sighandler_mask ()) {
bx_gui->sighandler (signum);
return;
}
}
#endif
@ -3484,9 +3499,11 @@ bx_signal_handler( int signum)
#endif
#if BX_GUI_SIGHANDLER
if ((1<<signum) & bx_gui->get_sighandler_mask ()) {
bx_gui->sighandler (signum);
return;
if (bx_gui_sighandler) {
if ((1<<signum) & bx_gui->get_sighandler_mask ()) {
bx_gui->sighandler (signum);
return;
}
}
#endif
BX_PANIC(("SIGNAL %u caught", signum));