mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 20:45:36 +08:00
two version of ExitGUISafely for different runmods
This commit is contained in:
@@ -269,9 +269,11 @@ static void sig_handler (int v)
|
||||
else if (v == SIGINT) {
|
||||
_exit(1); /* force to quit */
|
||||
}
|
||||
#if 0 /* since 5.0.0, deprecated code */
|
||||
else if (v == SIGTERM) {
|
||||
ExitGUISafely (-1);
|
||||
}
|
||||
#endif /* since 5.0.0, deprecated code */
|
||||
else {
|
||||
exit(1); /* force to quit */
|
||||
}
|
||||
@@ -625,4 +627,24 @@ void TerminateGUI (int rcByGUI)
|
||||
}
|
||||
#endif /* ifndef _MG_MINIMALGDI */
|
||||
|
||||
/* XXX: We need a better policy to exit MiniGUI safely by giving a chance
|
||||
for all windows to save data. */
|
||||
void GUIAPI ExitGUISafely (int exitcode)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
if (mgIsServer)
|
||||
#endif
|
||||
{
|
||||
/* see src/kernel/desktop-*.c */
|
||||
# define IDM_CLOSEALLWIN (MINID_RESERVED + 1)
|
||||
|
||||
SendNotifyMessage (HWND_DESKTOP, MSG_COMMAND, IDM_CLOSEALLWIN, 0);
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
__mg_join_all_message_threads ();
|
||||
SendMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
|
||||
pthread_join (__mg_dsk_msg_queue->th, NULL);
|
||||
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !_MGRM_THREADS */
|
||||
|
||||
+15
-21
@@ -362,9 +362,11 @@ static void sig_handler (int v)
|
||||
else if (v == SIGINT) {
|
||||
_exit(1); /* force to quit */
|
||||
}
|
||||
#if 0 /* since 5.0.0, deprecated code */
|
||||
else if (v == SIGTERM) {
|
||||
ExitGUISafely(-1);
|
||||
}
|
||||
#endif /* since 5.0.0, deprecated code */
|
||||
else {
|
||||
exit(1); /* force to quit */
|
||||
}
|
||||
@@ -670,31 +672,23 @@ void GUIAPI TerminateGUI (int not_used)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _MGRM_THREADS */
|
||||
|
||||
/* XXX: We need a better policy to exit MiniGUI safely by giving a chance
|
||||
for all windows to save data. */
|
||||
|
||||
/* see src/kernel/desktop-*.c */
|
||||
#define IDM_CLOSEALLWIN (MINID_RESERVED + 1)
|
||||
|
||||
void GUIAPI ExitGUISafely (int exitcode)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
if (mgIsServer)
|
||||
#endif
|
||||
{
|
||||
/* see src/kernel/desktop-*.c */
|
||||
# define IDM_CLOSEALLWIN (MINID_RESERVED + 1)
|
||||
SendNotifyMessage (HWND_DESKTOP, MSG_COMMAND, IDM_CLOSEALLWIN, 0);
|
||||
__mg_join_all_message_threads ();
|
||||
SendMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
|
||||
pthread_join (__mg_dsk_msg_queue->th, NULL);
|
||||
|
||||
SendNotifyMessage (HWND_DESKTOP, MSG_COMMAND, IDM_CLOSEALLWIN, 0);
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
__mg_join_all_message_threads ();
|
||||
SendMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
|
||||
pthread_join (__mg_dsk_msg_queue->th, NULL);
|
||||
|
||||
# ifdef _MGRM_THREADS
|
||||
/* Tell event parsor quit */
|
||||
_is_minigui_running = 0;
|
||||
pthread_join (_th_parsor, NULL);
|
||||
# endif /* defined _MGRM_THREADS */
|
||||
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */
|
||||
}
|
||||
/* Tell event parsor quit */
|
||||
_is_minigui_running = 0;
|
||||
pthread_join (_th_parsor, NULL);
|
||||
}
|
||||
|
||||
#endif /* _MGRM_THREADS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user