aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Brown2017-02-28 11:25:00 -0500
committerKen Brown2017-02-28 11:25:00 -0500
commit57f5ab8c4057d82c8fbc6a414169a44f5e181280 (patch)
tree056be0f08e4ad8548a934a53393648b8a05014b0 /src
parent122d2d675c77138cdde34347930a70b299d95363 (diff)
downloademacs-57f5ab8c4057d82c8fbc6a414169a44f5e181280.tar.gz
emacs-57f5ab8c4057d82c8fbc6a414169a44f5e181280.zip
Try to avoid hang when logging out of MS-Windows
* src/w32term.c (x_update_window_begin, x_update_window_end) (my_show_window, my_set_window_pos, my_set_focus) (my_set_foreground_window, my_destroy_window) (my_bring_window_to_top, x_iconify_frame): Replace calls to SendMessage by calls to SendMessageTimeout with a 6-second timeout. (Bug#25875)
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/w32term.c b/src/w32term.c
index d6b78fd7e0c..3d41c30dfe0 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -548,7 +548,8 @@ x_update_window_begin (struct window *w)
548 /* Hide the system caret during an update. */ 548 /* Hide the system caret during an update. */
549 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 549 if (w32_use_visible_system_caret && w32_system_caret_hwnd)
550 { 550 {
551 SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); 551 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0,
552 0, 6000, NULL);
552 } 553 }
553 554
554 w->output_cursor = w->cursor; 555 w->output_cursor = w->cursor;
@@ -714,7 +715,8 @@ x_update_window_end (struct window *w, bool cursor_on_p,
714 x_update_window_begin. */ 715 x_update_window_begin. */
715 if (w32_use_visible_system_caret && w32_system_caret_hwnd) 716 if (w32_use_visible_system_caret && w32_system_caret_hwnd)
716 { 717 {
717 SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0); 718 SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0,
719 0, 6000, NULL);
718 } 720 }
719} 721}
720 722
@@ -3668,8 +3670,8 @@ static BOOL
3668my_show_window (struct frame *f, HWND hwnd, int how) 3670my_show_window (struct frame *f, HWND hwnd, int how)
3669{ 3671{
3670#ifndef ATTACH_THREADS 3672#ifndef ATTACH_THREADS
3671 return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW, 3673 return SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW,
3672 (WPARAM) hwnd, (LPARAM) how); 3674 (WPARAM) hwnd, (LPARAM) how, 0, 6000, NULL);
3673#else 3675#else
3674 return ShowWindow (hwnd, how); 3676 return ShowWindow (hwnd, how);
3675#endif 3677#endif
@@ -3687,7 +3689,8 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter,
3687 pos.cx = cx; 3689 pos.cx = cx;
3688 pos.cy = cy; 3690 pos.cy = cy;
3689 pos.flags = flags; 3691 pos.flags = flags;
3690 SendMessage (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0); 3692 SendMessageTimeout (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0,
3693 0, 6000, NULL);
3691#else 3694#else
3692 SetWindowPos (hwnd, hwndAfter, x, y, cx, cy, flags); 3695 SetWindowPos (hwnd, hwndAfter, x, y, cx, cy, flags);
3693#endif 3696#endif
@@ -3697,29 +3700,31 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter,
3697static void 3700static void
3698my_set_focus (struct frame * f, HWND hwnd) 3701my_set_focus (struct frame * f, HWND hwnd)
3699{ 3702{
3700 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS, 3703 SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,
3701 (WPARAM) hwnd, 0); 3704 (WPARAM) hwnd, 0, 0, 6000, NULL);
3702} 3705}
3703#endif 3706#endif
3704 3707
3705static void 3708static void
3706my_set_foreground_window (HWND hwnd) 3709my_set_foreground_window (HWND hwnd)
3707{ 3710{
3708 SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0); 3711 SendMessageTimeout (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0,
3712 0, 6000, NULL);
3709} 3713}
3710 3714
3711 3715
3712static void 3716static void
3713my_destroy_window (struct frame * f, HWND hwnd) 3717my_destroy_window (struct frame * f, HWND hwnd)
3714{ 3718{
3715 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, 3719 SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,
3716 (WPARAM) hwnd, 0); 3720 (WPARAM) hwnd, 0, 0, 6000, NULL);
3717} 3721}
3718 3722
3719static void 3723static void
3720my_bring_window_to_top (HWND hwnd) 3724my_bring_window_to_top (HWND hwnd)
3721{ 3725{
3722 SendMessage (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0); 3726 SendMessageTimeout (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0,
3727 0, 6000, NULL);
3723} 3728}
3724 3729
3725/* Create a scroll bar and return the scroll bar vector for it. W is 3730/* Create a scroll bar and return the scroll bar vector for it. W is
@@ -6538,7 +6543,8 @@ x_iconify_frame (struct frame *f)
6538 x_set_bitmap_icon (f); 6543 x_set_bitmap_icon (f);
6539 6544
6540 /* Simulate the user minimizing the frame. */ 6545 /* Simulate the user minimizing the frame. */
6541 SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); 6546 SendMessageTimeout (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0,
6547 0, 6000, NULL);
6542 6548
6543 SET_FRAME_VISIBLE (f, 0); 6549 SET_FRAME_VISIBLE (f, 0);
6544 SET_FRAME_ICONIFIED (f, true); 6550 SET_FRAME_ICONIFIED (f, true);