From: Ken Brown <kbrown@cornell.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: strozzi2@llnl.gov, 23483@debbugs.gnu.org
Subject: bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down
Date: Thu, 12 May 2016 09:57:58 -0400 [thread overview]
Message-ID: <86773dca-93da-e643-74df-a80cafcbf716@cornell.edu> (raw)
In-Reply-To: <83y47hc1r9.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 287 bytes --]
On 5/10/2016 12:32 PM, Eli Zaretskii wrote:
> What I think we need to do instead is send a message to the main
> thread that will produce a special event, and then bind that event to
> kill-emacs (probably in special-event-map).
Thanks. My attempt to implement this is attached.
Ken
[-- Attachment #2: endsession.patch --]
[-- Type: text/plain, Size: 2730 bytes --]
diff --git a/src/keyboard.c b/src/keyboard.c
index 92d5c30..fe04b3f 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",
diff --git a/src/termhooks.h b/src/termhooks.h
index d21d6ce..ff74d99 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -158,6 +158,9 @@ enum event_kind
SELECTION_CLEAR_EVENT, /* Another X client cleared our selection. */
BUFFER_SWITCH_EVENT, /* A process filter has switched buffers. */
DELETE_WINDOW_EVENT, /* An X client said "delete this window". */
+#ifdef HAVE_NTGUI
+ END_SESSION_EVENT, /* The user is logging out or shutting down. */
+#endif
MENU_BAR_EVENT, /* An event generated by the menu bar.
The frame_or_window field's cdr holds the
Lisp-level event value.
diff --git a/src/w32fns.c b/src/w32fns.c
index ede8f6b..7a1f84a 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4795,6 +4795,11 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
return 0;
+ case WM_ENDSESSION:
+ my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
+ /* If we return, the process will be terminated immediately. */
+ sleep (1000);
+
case WM_WINDOWPOSCHANGING:
/* Don't restrict the sizing of any kind of frames. If the window
manager doesn't, there's no reason to do it ourselves. */
diff --git a/src/w32term.c b/src/w32term.c
index 74ea6b5..72e1245 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5260,6 +5260,10 @@ w32_read_socket (struct terminal *terminal,
}
break;
+ case WM_ENDSESSION:
+ inev.kind = END_SESSION_EVENT;
+ break;
+
case WM_INITMENU:
f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
next prev parent reply other threads:[~2016-05-12 13:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-08 13:33 bug#23483: 24.5; cygwin emacs w32 doesn not ask to save files when windows shuts down Strozzi, David J.
2016-05-08 18:40 ` Eli Zaretskii
2016-05-10 15:16 ` Ken Brown
2016-05-10 16:32 ` Eli Zaretskii
2016-05-12 13:57 ` Ken Brown [this message]
2016-05-12 16:56 ` Eli Zaretskii
2016-05-12 19:58 ` Ken Brown
2016-05-13 16:22 ` Strozzi, David J.
2016-05-13 17:46 ` Eli Zaretskii
2016-05-13 18:05 ` Ken Brown
2016-05-13 20:02 ` Strozzi, David J.
2016-05-13 23:12 ` Ken Brown
2016-05-14 7:56 ` Eli Zaretskii
2016-05-14 7:22 ` Eli Zaretskii
2016-05-14 20:02 ` Strozzi, David J.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86773dca-93da-e643-74df-a80cafcbf716@cornell.edu \
--to=kbrown@cornell.edu \
--cc=23483@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=strozzi2@llnl.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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.