summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2016-05-12 15:52:26 -0400
committerKen Brown <kbrown@cornell.edu>2016-05-12 15:52:26 -0400
commit6435f41f6d444243c87b7b52e5e7c0b5a40195ad (patch)
tree28f4ae0b8ffe047faea4198baba0ff8bb2b13baf /src/keyboard.c
parentec7a173e03729450bb9117e98d7e696c15994a84 (diff)
downloademacs-6435f41f6d444243c87b7b52e5e7c0b5a40195ad.tar.gz
emacs-6435f41f6d444243c87b7b52e5e7c0b5a40195ad.tar.bz2
emacs-6435f41f6d444243c87b7b52e5e7c0b5a40195ad.zip
Autosave buffers on logout if HAVE_NTGUI
* src/w32fns.c (w32_wnd_proc): Pass a WM_ENDSESSION message on to w32_read_socket. * src/w32term.c (w32_read_socket): Create an event of type END_SESSION_EVENT if a WM_ENDSESSION message is received. * src/termhooks.h [HAVE_NTGUI]: New event kind END_SESSION_EVENT. * src/keyboard.c [HAVE_NTGUI] (syms_of_keyboard): New symbol `end-session'. (kbd_buffer_get_event): Return an end-session event if an event of type END_SESSION_EVENT is read. (keys_of_keyboard): Bind the end-session event to kill-emacs in special-event-map. (Bug#23483)
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 92d5c3053a7..fe04b3f2b5e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3893,6 +3893,16 @@ kbd_buffer_get_event (KBOARD **kbp,
kbd_fetch_ptr = event + 1;
}
#endif
+
+#ifdef HAVE_NTGUI
+ else if (event->kind == END_SESSION_EVENT)
+ {
+ /* Make an event (end-session). */
+ obj = list1 (Qend_session);
+ kbd_fetch_ptr = event + 1;
+ }
+#endif
+
#if defined (HAVE_X11) || defined (HAVE_NTGUI) \
|| defined (HAVE_NS)
else if (event->kind == ICONIFY_EVENT)
@@ -10984,6 +10994,7 @@ syms_of_keyboard (void)
#ifdef HAVE_NTGUI
DEFSYM (Qlanguage_change, "language-change");
+ DEFSYM (Qend_session, "end-session");
#endif
#ifdef HAVE_DBUS
@@ -11758,6 +11769,10 @@ keys_of_keyboard (void)
initial_define_lispy_key (Vspecial_event_map, "delete-frame",
"handle-delete-frame");
+#ifdef HAVE_NTGUI
+ initial_define_lispy_key (Vspecial_event_map, "end-session",
+ "kill-emacs");
+#endif
initial_define_lispy_key (Vspecial_event_map, "ns-put-working-text",
"ns-put-working-text");
initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",