Mercurial > emacs
comparison src/w32.c @ 72631:acfcb86a7b5e
(shutdown_handler): New function to exit cleanly on shutdown.
(globals_of_w32): Register it as a signal handler.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sun, 03 Sep 2006 22:51:22 +0000 |
parents | 95d41ccb4448 |
children | 4f26e07fd85d c358d0861b16 |
comparison
equal
deleted
inserted
replaced
72630:b6dcd16cf78c | 72631:acfcb86a7b5e |
---|---|
4111 /* Check to see if Emacs has been installed correctly. */ | 4111 /* Check to see if Emacs has been installed correctly. */ |
4112 check_windows_init_file (); | 4112 check_windows_init_file (); |
4113 } | 4113 } |
4114 | 4114 |
4115 /* | 4115 /* |
4116 shutdown_handler ensures that buffers' autosave files are | |
4117 up to date when the user logs off, or the system shuts down. | |
4118 */ | |
4119 BOOL WINAPI shutdown_handler(DWORD type) | |
4120 { | |
4121 /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */ | |
4122 if (type == CTRL_CLOSE_EVENT /* User closes console window. */ | |
4123 || type == CTRL_LOGOFF_EVENT /* User logs off. */ | |
4124 || type == CTRL_SHUTDOWN_EVENT) /* User shutsdown. */ | |
4125 { | |
4126 /* Shut down cleanly, making sure autosave files are up to date. */ | |
4127 shut_down_emacs (0, 0, Qnil); | |
4128 } | |
4129 | |
4130 /* Allow other handlers to handle this signal. */ | |
4131 return FALSE; | |
4132 } | |
4133 | |
4134 /* | |
4116 globals_of_w32 is used to initialize those global variables that | 4135 globals_of_w32 is used to initialize those global variables that |
4117 must always be initialized on startup even when the global variable | 4136 must always be initialized on startup even when the global variable |
4118 initialized is non zero (see the function main in emacs.c). | 4137 initialized is non zero (see the function main in emacs.c). |
4119 */ | 4138 */ |
4120 void globals_of_w32 () | 4139 void globals_of_w32 () |
4122 g_b_init_is_windows_9x = 0; | 4141 g_b_init_is_windows_9x = 0; |
4123 g_b_init_open_process_token = 0; | 4142 g_b_init_open_process_token = 0; |
4124 g_b_init_get_token_information = 0; | 4143 g_b_init_get_token_information = 0; |
4125 g_b_init_lookup_account_sid = 0; | 4144 g_b_init_lookup_account_sid = 0; |
4126 g_b_init_get_sid_identifier_authority = 0; | 4145 g_b_init_get_sid_identifier_authority = 0; |
4146 /* The following sets a handler for shutdown notifications for | |
4147 console apps. This actually applies to Emacs in both console and | |
4148 GUI modes, since we had to fool windows into thinking emacs is a | |
4149 console application to get console mode to work. */ | |
4150 SetConsoleCtrlHandler(shutdown_handler, TRUE); | |
4127 } | 4151 } |
4128 | 4152 |
4129 /* end of nt.c */ | 4153 /* end of nt.c */ |
4130 | 4154 |
4131 /* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1 | 4155 /* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1 |