Commit b5b7745f authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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.
parent 7e74b0fb
2013-03-23 Eli Zaretskii <eliz@gnu.org>
* 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.
(Bug#14032)
* frame.c (get_frame_param): Now extern for WINDOWSNT as well.
* lisp.h (get_frame_param): Adjust conditions for prototype
declaration.
2013-03-22 Ken Brown <kbrown@cornell.edu> 2013-03-22 Ken Brown <kbrown@cornell.edu>
   
* unexcw.c: Drop unneeded inclusion of w32common.h. * unexcw.c: Drop unneeded inclusion of w32common.h.
......
...@@ -1819,7 +1819,7 @@ See `redirect-frame-focus'. */) ...@@ -1819,7 +1819,7 @@ See `redirect-frame-focus'. */)
/* Return the value of frame parameter PROP in frame FRAME. */ /* Return the value of frame parameter PROP in frame FRAME. */
#ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_WINDOW_SYSTEM
#if !HAVE_NS #if !HAVE_NS && !defined(WINDOWSNT)
static static
#endif #endif
Lisp_Object Lisp_Object
......
...@@ -3511,7 +3511,7 @@ extern Lisp_Object Qvisible; ...@@ -3511,7 +3511,7 @@ extern Lisp_Object Qvisible;
extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object);
extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object); extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
#if HAVE_NS #if HAVE_NS || defined(WINDOWSNT)
extern Lisp_Object get_frame_param (struct frame *, Lisp_Object); extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
#endif #endif
extern void frames_discard_buffer (Lisp_Object); extern void frames_discard_buffer (Lisp_Object);
......
...@@ -5661,6 +5661,7 @@ static void ...@@ -5661,6 +5661,7 @@ static void
w32fullscreen_hook (FRAME_PTR f) w32fullscreen_hook (FRAME_PTR f)
{ {
static int normal_width, normal_height; static int normal_width, normal_height;
static Lisp_Object prev_full;
if (FRAME_VISIBLE_P (f)) if (FRAME_VISIBLE_P (f))
{ {
...@@ -5669,23 +5670,39 @@ w32fullscreen_hook (FRAME_PTR f) ...@@ -5669,23 +5670,39 @@ w32fullscreen_hook (FRAME_PTR f)
RECT workarea_rect; RECT workarea_rect;
block_input (); block_input ();
if (normal_height <= 0) if (!( EQ (prev_full, Qfullscreen)
normal_height = cur_h; || EQ (prev_full, Qfullboth)
if (normal_width <= 0) || EQ (prev_full, Qmaximized)))
normal_width = cur_w; {
if (!EQ (prev_full, Qfullheight))
normal_height = cur_h;
if (!EQ (prev_full, Qfullwidth))
normal_width = cur_w;
}
eassert (normal_height > 0);
eassert (normal_width > 0);
x_real_positions (f, &f->left_pos, &f->top_pos); x_real_positions (f, &f->left_pos, &f->top_pos);
x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos); x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos);
SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0); SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
pixel_height = workarea_rect.bottom - workarea_rect.top; pixel_height = workarea_rect.bottom - workarea_rect.top;
pixel_width = workarea_rect.right - workarea_rect.left; pixel_width = workarea_rect.right - workarea_rect.left;
/* Need to send SC_RESTORE to the window, in case we are
resizing from FULLSCREEN_MAXIMIZED. Otherwise, the mouse
resize hints will not be shown by the window manager when the
mouse pointer hovers over the window edges, becaise the WM
will still think the window is maximized. */
if (f->want_fullscreen != FULLSCREEN_BOTH)
PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0);
switch (f->want_fullscreen) switch (f->want_fullscreen)
{ {
case FULLSCREEN_BOTH: case FULLSCREEN_BOTH:
prev_full = Qfullboth;
PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0); PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
break; break;
case FULLSCREEN_MAXIMIZED: case FULLSCREEN_MAXIMIZED:
prev_full = Qmaximized;
height = height =
FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
- XINT (Ftool_bar_lines_needed (selected_frame)) - XINT (Ftool_bar_lines_needed (selected_frame))
...@@ -5697,31 +5714,26 @@ w32fullscreen_hook (FRAME_PTR f) ...@@ -5697,31 +5714,26 @@ w32fullscreen_hook (FRAME_PTR f)
top_pos = workarea_rect.top; top_pos = workarea_rect.top;
break; break;
case FULLSCREEN_WIDTH: case FULLSCREEN_WIDTH:
prev_full = Qfullwidth;
width = width =
FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width) FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
- FRAME_SCROLL_BAR_COLS (f); - FRAME_SCROLL_BAR_COLS (f);
if (normal_height > 0) height = normal_height;
height = normal_height;
left_pos = workarea_rect.left; left_pos = workarea_rect.left;
break; break;
case FULLSCREEN_HEIGHT: case FULLSCREEN_HEIGHT:
prev_full = Qfullheight;
height = height =
FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height) FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
- XINT (Ftool_bar_lines_needed (selected_frame)) - XINT (Ftool_bar_lines_needed (selected_frame))
+ (NILP (Vmenu_bar_mode) ? 1 : 0); + (NILP (Vmenu_bar_mode) ? 1 : 0);
if (normal_width > 0) width = normal_width;
width = normal_width;
top_pos = workarea_rect.top; top_pos = workarea_rect.top;
break; break;
case FULLSCREEN_NONE: case FULLSCREEN_NONE:
if (normal_height > 0) prev_full = Qnil;
height = normal_height; height = normal_height;
else width = normal_width;
normal_height = height;
if (normal_width > 0)
width = normal_width;
else
normal_width = width;
/* FIXME: Should restore the original position of the frame. */ /* FIXME: Should restore the original position of the frame. */
top_pos = left_pos = 0; top_pos = left_pos = 0;
break; break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment