aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-03-23 11:01:14 +0200
committerEli Zaretskii2013-03-23 11:01:14 +0200
commitb5b7745f1fde7cdd5fb76113a56b9d3c39ffffc8 (patch)
treec54c3dd4f4d5fe325d2d3b9b2d8829f6f14d4441 /src
parent7e74b0fb885b1283e8052db5012a61dab85a7b9a (diff)
downloademacs-b5b7745f1fde7cdd5fb76113a56b9d3c39ffffc8.tar.gz
emacs-b5b7745f1fde7cdd5fb76113a56b9d3c39ffffc8.zip
Fix bug #14032 with restoring frame dimensions on MS-Windows.
src/w32term.c (w32fullscreen_hook): Record last value of the frame's 'fullscreen' parameter. Always record previous width and height of the frame, except when switching out of maximized modes, so that they could be restored correctly, instead of resetting to the default frame dimensions. Send SC_RESTORE command to the frame, unless we are going to send SC_MAXIMIZE, to restore the frame resize hints in the mouse pointer shown by the window manager. src/frame.c (get_frame_param): Now extern for WINDOWSNT as well. src/lisp.h (get_frame_param): Adjust conditions for prototype declaration.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog16
-rw-r--r--src/frame.c2
-rw-r--r--src/lisp.h2
-rw-r--r--src/w32term.c44
4 files changed, 46 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a118678dba9..c60ff058e9d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,19 @@
12013-03-23 Eli Zaretskii <eliz@gnu.org>
2
3 * w32term.c (w32fullscreen_hook): Record last value of the frame's
4 'fullscreen' parameter. Always record previous width and height
5 of the frame, except when switching out of maximized modes, so
6 that they could be restored correctly, instead of resetting to the
7 default frame dimensions. Send SC_RESTORE command to the frame,
8 unless we are going to send SC_MAXIMIZE, to restore the frame
9 resize hints in the mouse pointer shown by the window manager.
10 (Bug#14032)
11
12 * frame.c (get_frame_param): Now extern for WINDOWSNT as well.
13
14 * lisp.h (get_frame_param): Adjust conditions for prototype
15 declaration.
16
12013-03-22 Ken Brown <kbrown@cornell.edu> 172013-03-22 Ken Brown <kbrown@cornell.edu>
2 18
3 * unexcw.c: Drop unneeded inclusion of w32common.h. 19 * unexcw.c: Drop unneeded inclusion of w32common.h.
diff --git a/src/frame.c b/src/frame.c
index 2ed2c5a2771..615b31c978d 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1819,7 +1819,7 @@ See `redirect-frame-focus'. */)
1819/* Return the value of frame parameter PROP in frame FRAME. */ 1819/* Return the value of frame parameter PROP in frame FRAME. */
1820 1820
1821#ifdef HAVE_WINDOW_SYSTEM 1821#ifdef HAVE_WINDOW_SYSTEM
1822#if !HAVE_NS 1822#if !HAVE_NS && !defined(WINDOWSNT)
1823static 1823static
1824#endif 1824#endif
1825Lisp_Object 1825Lisp_Object
diff --git a/src/lisp.h b/src/lisp.h
index 6838d4a93cb..467710f52f4 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3511,7 +3511,7 @@ extern Lisp_Object Qvisible;
3511extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); 3511extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
3512extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); 3512extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object);
3513extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object); 3513extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
3514#if HAVE_NS 3514#if HAVE_NS || defined(WINDOWSNT)
3515extern Lisp_Object get_frame_param (struct frame *, Lisp_Object); 3515extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
3516#endif 3516#endif
3517extern void frames_discard_buffer (Lisp_Object); 3517extern void frames_discard_buffer (Lisp_Object);
diff --git a/src/w32term.c b/src/w32term.c
index 989ceb0f847..3fe16b956bd 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5661,6 +5661,7 @@ static void
5661w32fullscreen_hook (FRAME_PTR f) 5661w32fullscreen_hook (FRAME_PTR f)
5662{ 5662{
5663 static int normal_width, normal_height; 5663 static int normal_width, normal_height;
5664 static Lisp_Object prev_full;
5664 5665
5665 if (FRAME_VISIBLE_P (f)) 5666 if (FRAME_VISIBLE_P (f))
5666 { 5667 {
@@ -5669,23 +5670,39 @@ w32fullscreen_hook (FRAME_PTR f)
5669 RECT workarea_rect; 5670 RECT workarea_rect;
5670 5671
5671 block_input (); 5672 block_input ();
5672 if (normal_height <= 0) 5673 if (!( EQ (prev_full, Qfullscreen)
5673 normal_height = cur_h; 5674 || EQ (prev_full, Qfullboth)
5674 if (normal_width <= 0) 5675 || EQ (prev_full, Qmaximized)))
5675 normal_width = cur_w; 5676 {
5677 if (!EQ (prev_full, Qfullheight))
5678 normal_height = cur_h;
5679 if (!EQ (prev_full, Qfullwidth))
5680 normal_width = cur_w;
5681 }
5682 eassert (normal_height > 0);
5683 eassert (normal_width > 0);
5676 x_real_positions (f, &f->left_pos, &f->top_pos); 5684 x_real_positions (f, &f->left_pos, &f->top_pos);
5677 x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos); 5685 x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos);
5678 5686
5679 SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0); 5687 SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
5680 pixel_height = workarea_rect.bottom - workarea_rect.top; 5688 pixel_height = workarea_rect.bottom - workarea_rect.top;
5681 pixel_width = workarea_rect.right - workarea_rect.left; 5689 pixel_width = workarea_rect.right - workarea_rect.left;
5690 /* Need to send SC_RESTORE to the window, in case we are
5691 resizing from FULLSCREEN_MAXIMIZED. Otherwise, the mouse
5692 resize hints will not be shown by the window manager when the
5693 mouse pointer hovers over the window edges, becaise the WM
5694 will still think the window is maximized. */
5695 if (f->want_fullscreen != FULLSCREEN_BOTH)
5696 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0);
5682 5697
5683 switch (f->want_fullscreen) 5698 switch (f->want_fullscreen)
5684 { 5699 {
5685 case FULLSCREEN_BOTH: 5700 case FULLSCREEN_BOTH:
5701 prev_full = Qfullboth;
5686 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0); 5702 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
5687 break; 5703 break;
5688 case FULLSCREEN_MAXIMIZED: 5704 case FULLSCREEN_MAXIMIZED:
5705 prev_full = Qmaximized;
5689 height = 5706 height =
5690 FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) 5707 FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
5691 - XINT (Ftool_bar_lines_needed (selected_frame)) 5708 - XINT (Ftool_bar_lines_needed (selected_frame))
@@ -5697,31 +5714,26 @@ w32fullscreen_hook (FRAME_PTR f)
5697 top_pos = workarea_rect.top; 5714 top_pos = workarea_rect.top;
5698 break; 5715 break;
5699 case FULLSCREEN_WIDTH: 5716 case FULLSCREEN_WIDTH:
5717 prev_full = Qfullwidth;
5700 width = 5718 width =
5701 FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width) 5719 FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
5702 - FRAME_SCROLL_BAR_COLS (f); 5720 - FRAME_SCROLL_BAR_COLS (f);
5703 if (normal_height > 0) 5721 height = normal_height;
5704 height = normal_height;
5705 left_pos = workarea_rect.left; 5722 left_pos = workarea_rect.left;
5706 break; 5723 break;
5707 case FULLSCREEN_HEIGHT: 5724 case FULLSCREEN_HEIGHT:
5725 prev_full = Qfullheight;
5708 height = 5726 height =
5709 FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) 5727 FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
5710 - XINT (Ftool_bar_lines_needed (selected_frame)) 5728 - XINT (Ftool_bar_lines_needed (selected_frame))
5711 + (NILP (Vmenu_bar_mode) ? 1 : 0); 5729 + (NILP (Vmenu_bar_mode) ? 1 : 0);
5712 if (normal_width > 0) 5730 width = normal_width;
5713 width = normal_width;
5714 top_pos = workarea_rect.top; 5731 top_pos = workarea_rect.top;
5715 break; 5732 break;
5716 case FULLSCREEN_NONE: 5733 case FULLSCREEN_NONE:
5717 if (normal_height > 0) 5734 prev_full = Qnil;
5718 height = normal_height; 5735 height = normal_height;
5719 else 5736 width = normal_width;
5720 normal_height = height;
5721 if (normal_width > 0)
5722 width = normal_width;
5723 else
5724 normal_width = width;
5725 /* FIXME: Should restore the original position of the frame. */ 5737 /* FIXME: Should restore the original position of the frame. */
5726 top_pos = left_pos = 0; 5738 top_pos = left_pos = 0;
5727 break; 5739 break;