aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-05-28 20:22:40 +0300
committerEli Zaretskii2012-05-28 20:22:40 +0300
commit85d0efd175d95b4aa23d6eb22b8f8d18ed03ba75 (patch)
tree195f2f5f8062ca238d977e8ebb60f4714d6a2190 /src
parentc00ea352d81609789cc9e0a20effb1b6869ff284 (diff)
downloademacs-85d0efd175d95b4aa23d6eb22b8f8d18ed03ba75.tar.gz
emacs-85d0efd175d95b4aa23d6eb22b8f8d18ed03ba75.zip
Fix bug #11513 with raise-frame on MS-Windows.
src/w32term.c (my_bring_window_to_top): New function. (x_raise_frame): Use handle returned by DeferWindowPos, which could be different from the original one. Call my_bring_window_to_top instead of my_set_foreground_window. src/w32fns.c (w32_wnd_proc): Accept and process WM_EMACS_BRINGTOTOP by calling BringWindowToTop. src/w32term.h (WM_EMACS_BRINGTOTOP): New message. (WM_EMACS_END): Increase by one.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/w32fns.c3
-rw-r--r--src/w32term.c37
-rw-r--r--src/w32term.h3
4 files changed, 42 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f4447da7010..374da469203 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12012-05-28 Eli Zaretskii <eliz@gnu.org>
2
3 * w32term.c (my_bring_window_to_top): New function.
4 (x_raise_frame): Use handle returned by DeferWindowPos, which
5 could be different from the original one. Call
6 my_bring_window_to_top instead of my_set_foreground_window.
7 (Bug#11513)
8
9 * w32fns.c (w32_wnd_proc): Accept and process WM_EMACS_BRINGTOTOP
10 by calling BringWindowToTop.
11
12 * w32term.h (WM_EMACS_BRINGTOTOP): New message.
13 (WM_EMACS_END): Increase by one.
14
12012-05-28 Paul Eggert <eggert@cs.ucla.edu> 152012-05-28 Paul Eggert <eggert@cs.ucla.edu>
2 16
3 * bidi.c (bidi_mirror_char): Put eassert before conversion to int. 17 * bidi.c (bidi_mirror_char): Put eassert before conversion to int.
diff --git a/src/w32fns.c b/src/w32fns.c
index d7114f19b90..b8dc62f5250 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -3663,6 +3663,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3663 case WM_EMACS_SHOWWINDOW: 3663 case WM_EMACS_SHOWWINDOW:
3664 return ShowWindow ((HWND) wParam, (WPARAM) lParam); 3664 return ShowWindow ((HWND) wParam, (WPARAM) lParam);
3665 3665
3666 case WM_EMACS_BRINGTOTOP:
3666 case WM_EMACS_SETFOREGROUND: 3667 case WM_EMACS_SETFOREGROUND:
3667 { 3668 {
3668 HWND foreground_window; 3669 HWND foreground_window;
@@ -3680,6 +3681,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3680 foreground_thread = 0; 3681 foreground_thread = 0;
3681 3682
3682 retval = SetForegroundWindow ((HWND) wParam); 3683 retval = SetForegroundWindow ((HWND) wParam);
3684 if (msg == WM_EMACS_BRINGTOTOP)
3685 retval = BringWindowToTop ((HWND) wParam);
3683 3686
3684 /* Detach from the previous foreground thread. */ 3687 /* Detach from the previous foreground thread. */
3685 if (foreground_thread) 3688 if (foreground_thread)
diff --git a/src/w32term.c b/src/w32term.c
index 2ccd7574332..a90e067a3fd 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3492,6 +3492,12 @@ my_destroy_window (struct frame * f, HWND hwnd)
3492 (WPARAM) hwnd, 0); 3492 (WPARAM) hwnd, 0);
3493} 3493}
3494 3494
3495static void
3496my_bring_window_to_top (HWND hwnd)
3497{
3498 SendMessage (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0);
3499}
3500
3495/* Create a scroll bar and return the scroll bar vector for it. W is 3501/* Create a scroll bar and return the scroll bar vector for it. W is
3496 the Emacs window on which to create the scroll bar. TOP, LEFT, 3502 the Emacs window on which to create the scroll bar. TOP, LEFT,
3497 WIDTH and HEIGHT are the pixel coordinates and dimensions of the 3503 WIDTH and HEIGHT are the pixel coordinates and dimensions of the
@@ -5600,24 +5606,27 @@ x_raise_frame (struct frame *f)
5600 HDWP handle = BeginDeferWindowPos (2); 5606 HDWP handle = BeginDeferWindowPos (2);
5601 if (handle) 5607 if (handle)
5602 { 5608 {
5603 DeferWindowPos (handle, 5609 handle = DeferWindowPos (handle,
5604 FRAME_W32_WINDOW (f), 5610 FRAME_W32_WINDOW (f),
5605 HWND_TOP, 5611 HWND_TOP,
5606 0, 0, 0, 0, 5612 0, 0, 0, 0,
5607 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); 5613 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
5608 5614 if (handle)
5609 DeferWindowPos (handle, 5615 {
5610 GetForegroundWindow (), 5616 handle = DeferWindowPos (handle,
5611 FRAME_W32_WINDOW (f), 5617 GetForegroundWindow (),
5612 0, 0, 0, 0, 5618 FRAME_W32_WINDOW (f),
5613 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); 5619 0, 0, 0, 0,
5614 5620 SWP_NOSIZE | SWP_NOMOVE |
5615 EndDeferWindowPos (handle); 5621 SWP_NOACTIVATE);
5622 if (handle)
5623 EndDeferWindowPos (handle);
5624 }
5616 } 5625 }
5617 } 5626 }
5618 else 5627 else
5619 { 5628 {
5620 my_set_foreground_window (FRAME_W32_WINDOW (f)); 5629 my_bring_window_to_top (FRAME_W32_WINDOW (f));
5621 } 5630 }
5622 5631
5623 UNBLOCK_INPUT; 5632 UNBLOCK_INPUT;
diff --git a/src/w32term.h b/src/w32term.h
index 4528bbd5c0a..68e62b24144 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -576,7 +576,8 @@ do { \
576#define WM_EMACS_HIDE_CARET (WM_EMACS_START + 18) 576#define WM_EMACS_HIDE_CARET (WM_EMACS_START + 18)
577#define WM_EMACS_SETCURSOR (WM_EMACS_START + 19) 577#define WM_EMACS_SETCURSOR (WM_EMACS_START + 19)
578#define WM_EMACS_PAINT (WM_EMACS_START + 20) 578#define WM_EMACS_PAINT (WM_EMACS_START + 20)
579#define WM_EMACS_END (WM_EMACS_START + 21) 579#define WM_EMACS_BRINGTOTOP (WM_EMACS_START + 21)
580#define WM_EMACS_END (WM_EMACS_START + 22)
580 581
581#define WND_FONTWIDTH_INDEX (0) 582#define WND_FONTWIDTH_INDEX (0)
582#define WND_LINEHEIGHT_INDEX (4) 583#define WND_LINEHEIGHT_INDEX (4)