emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112114: Fix bug #14032 with restorin


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112114: Fix bug #14032 with restoring frame dimensions on MS-Windows.
Date: Sat, 23 Mar 2013 11:01:14 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112114
fixes bug: http://debbugs.gnu.org/14032
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2013-03-23 11:01:14 +0200
message:
  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.
modified:
  src/ChangeLog
  src/frame.c
  src/lisp.h
  src/w32term.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-03-22 16:52:31 +0000
+++ b/src/ChangeLog     2013-03-23 09:01:14 +0000
@@ -1,3 +1,19 @@
+2013-03-23  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        * unexcw.c: Drop unneeded inclusion of w32common.h.

=== modified file 'src/frame.c'
--- a/src/frame.c       2013-03-20 11:29:37 +0000
+++ b/src/frame.c       2013-03-23 09:01:14 +0000
@@ -1819,7 +1819,7 @@
 /* Return the value of frame parameter PROP in frame FRAME.  */
 
 #ifdef HAVE_WINDOW_SYSTEM
-#if !HAVE_NS
+#if !HAVE_NS && !defined(WINDOWSNT)
 static
 #endif
 Lisp_Object

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2013-03-21 20:56:22 +0000
+++ b/src/lisp.h        2013-03-23 09:01:14 +0000
@@ -3511,7 +3511,7 @@
 extern void store_frame_param (struct frame *, 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);
-#if HAVE_NS
+#if HAVE_NS || defined(WINDOWSNT)
 extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
 #endif
 extern void frames_discard_buffer (Lisp_Object);

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2013-03-15 10:07:29 +0000
+++ b/src/w32term.c     2013-03-23 09:01:14 +0000
@@ -5661,6 +5661,7 @@
 w32fullscreen_hook (FRAME_PTR f)
 {
   static int normal_width, normal_height;
+  static Lisp_Object prev_full;
 
   if (FRAME_VISIBLE_P (f))
     {
@@ -5669,23 +5670,39 @@
       RECT workarea_rect;
 
       block_input ();
-      if (normal_height <= 0)
-       normal_height = cur_h;
-      if (normal_width <= 0)
-       normal_width = cur_w;
+      if (!(   EQ (prev_full, Qfullscreen)
+           || EQ (prev_full, Qfullboth)
+           || EQ (prev_full, Qmaximized)))
+       {
+         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_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos);
 
       SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
       pixel_height = workarea_rect.bottom - workarea_rect.top;
       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)
        {
        case FULLSCREEN_BOTH:
+         prev_full = Qfullboth;
          PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
          break;
        case FULLSCREEN_MAXIMIZED:
+         prev_full = Qmaximized;
          height =
            FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
            - XINT (Ftool_bar_lines_needed (selected_frame))
@@ -5697,31 +5714,26 @@
          top_pos = workarea_rect.top;
          break;
        case FULLSCREEN_WIDTH:
+         prev_full = Qfullwidth;
          width  =
            FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
            - FRAME_SCROLL_BAR_COLS (f);
-         if (normal_height > 0)
-           height = normal_height;
+         height = normal_height;
          left_pos = workarea_rect.left;
          break;
        case FULLSCREEN_HEIGHT:
+         prev_full = Qfullheight;
          height =
            FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
            - XINT (Ftool_bar_lines_needed (selected_frame))
            + (NILP (Vmenu_bar_mode) ? 1 : 0);
-         if (normal_width > 0)
-           width = normal_width;
+         width = normal_width;
          top_pos = workarea_rect.top;
          break;
        case FULLSCREEN_NONE:
-         if (normal_height > 0)
-           height = normal_height;
-         else
-           normal_height = height;
-         if (normal_width > 0)
-           width = normal_width;
-         else
-           normal_width = width;
+         prev_full = Qnil;
+         height = normal_height;
+         width = normal_width;
          /* FIXME: Should restore the original position of the frame.  */
          top_pos = left_pos = 0;
          break;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]