aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2015-02-11 09:07:24 +0100
committerMartin Rudalics2015-02-11 09:07:24 +0100
commit02138cb0b88c5f6addf891d725967d9867eda3f9 (patch)
tree073bd7e1c58cee1f02a52ff8eabcfa6dd24a6fb2
parent6ebbeafc94a35e49fc3a842b5f5fbd7b069ce936 (diff)
downloademacs-02138cb0b88c5f6addf891d725967d9867eda3f9.tar.gz
emacs-02138cb0b88c5f6addf891d725967d9867eda3f9.zip
Improve toggling fullscreen state of frames.
* frame.el (toggle-frame-maximized, toggle-frame-fullscreen): Rename frame parameter `maximized' to `fullscreen-restore'. Restore fullwidth/-height after fullboth state. Update doc-strings. * w32term.c (w32_read_socket): In SIZE_MAXIMIZED and SIZE_RESTORED cases correctly handle `maximized' value for the `fullscreen' parameter. Don't use the 'maximized' parameter any more. (w32fullscreen_hook): Include menu bar height when calculating new text height in FULLSCREEN_BOTH case. * xterm.c (do_ewmh_fullscreen): Handle transition from FULLSCREEN_BOTH to FULLSCREEN_MAXIMIZED when x_frame_normalize_before_maximize is set. * frames.texi (Size Parameters): Update description of fullscreen frame parameter.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/frames.texi33
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/frame.el73
-rw-r--r--src/ChangeLog12
-rw-r--r--src/w32term.c30
-rw-r--r--src/xterm.c10
7 files changed, 113 insertions, 57 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 0c76a6b8b34..3e5d9acba86 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12015-02-11 Martin Rudalics <rudalics@gmx.at>
2
3 * frames.texi (Size Parameters): Update description of
4 fullscreen frame parameter.
5
12015-02-09 Eli Zaretskii <eliz@gnu.org> 62015-02-09 Eli Zaretskii <eliz@gnu.org>
2 7
3 * positions.texi (Screen Lines): Update the documentation of 8 * positions.texi (Screen Lines): Update the documentation of
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index a6f4081532d..559f4cc56dc 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -701,6 +701,7 @@ parameters represent the user's stated preference; otherwise, use
701@code{nil}. 701@code{nil}.
702@end table 702@end table
703 703
704
704@node Size Parameters 705@node Size Parameters
705@subsubsection Size Parameters 706@subsubsection Size Parameters
706@cindex window size on display 707@cindex window size on display
@@ -731,22 +732,34 @@ user-position}) does for the position parameters @code{top} and
731@vindex fullscreen, a frame parameter 732@vindex fullscreen, a frame parameter
732@item fullscreen 733@item fullscreen
733Specify that width, height or both shall be maximized. The value 734Specify that width, height or both shall be maximized. The value
734@code{fullwidth} specifies that width shall be as wide as possible. 735@code{fullwidth} specifies that width shall be as wide as possible. The
735The value @code{fullheight} specifies that height shall be as tall as 736value @code{fullheight} specifies that height shall be as tall as
736possible. The value @code{fullboth} specifies that both the width and 737possible. The value @code{fullboth} specifies that both the width and
737the height shall be set to the size of the screen. The value 738the height shall be set to the size of the screen. The value
738@code{maximized} specifies that the frame shall be maximized. The 739@code{maximized} specifies that the frame shall be maximized.
739difference between @code{maximized} and @code{fullboth} is that the 740
740former can still be resized by dragging window manager decorations 741The difference between @code{maximized} and @code{fullboth} is that a
741with the mouse, while the latter really covers the whole screen and 742maximized frame usually keeps its title bar and the buttons for resizing
742does not allow resizing by mouse dragging. 743and closing the frame. Also, maximized frames typically avoid hiding
744any task bar or panels displayed on the desktop. ``Fullboth'' frames,
745on the other hand, usually omit the title bar and occupy the entire
746available screen space.
747
748``Fullheight'' and ``fullwidth'' frames are more similar to maximized
749frames in this regard. However, these typically display an external
750border which might be absent with maximized frames. Hence the heights
751of maximized and fullheight frames and the widths of maximized and
752fullwidth frames often differ by a few pixels.
743 753
744With some window managers you may have to customize the variable 754With some window managers you may have to customize the variable
745@code{frame-resize-pixelwise} (@pxref{Size and Position}) to a 755@code{frame-resize-pixelwise} (@pxref{Size and Position}) in order to
746non-@code{nil} value in order to make a frame appear ``maximized'' or 756make a frame truly appear ``maximized'' or ``fullscreen''. Moreover,
747``fullscreen''. 757some window managers might not support smooth transition between the
758various fullscreen or maximization states. Customizing the variable
759@code{x-frame-normalize-before-maximize} can help to overcome that.
748@end table 760@end table
749 761
762
750@node Layout Parameters 763@node Layout Parameters
751@subsubsection Layout Parameters 764@subsubsection Layout Parameters
752@cindex layout parameters of frames 765@cindex layout parameters of frames
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 03b465e8030..a6e5f59503e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12015-02-11 Martin Rudalics <rudalics@gmx.at>
2
3 * frame.el (toggle-frame-maximized, toggle-frame-fullscreen):
4 Rename frame parameter `maximized' to `fullscreen-restore'.
5 Restore fullwidth/-height after fullboth state. Update
6 doc-strings.
7
12015-02-11 Lars Ingebrigtsen <larsi@gnus.org> 82015-02-11 Lars Ingebrigtsen <larsi@gnus.org>
2 9
3 * net/shr.el (shr-insert): Make sure the space inserted has the 10 * net/shr.el (shr-insert): Make sure the space inserted has the
diff --git a/lisp/frame.el b/lisp/frame.el
index ecb433e8335..dfcebf16455 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1874,57 +1874,56 @@ terminals, cursor blinking is controlled by the terminal."
1874;; Frame maximization/fullscreen 1874;; Frame maximization/fullscreen
1875 1875
1876(defun toggle-frame-maximized () 1876(defun toggle-frame-maximized ()
1877 "Toggle maximization state of the selected frame. 1877 "Toggle maximization state of selected frame.
1878Maximize the selected frame or un-maximize if it is already maximized. 1878Maximize selected frame or un-maximize if it is already maximized.
1879Respect window manager screen decorations. 1879
1880If the frame is in fullscreen mode, don't change its mode, 1880If the frame is in fullscreen state, don't change its state, but
1881just toggle the temporary frame parameter `maximized', 1881set the frame's `fullscreen-restore' parameter to `maximized', so
1882so the frame will go to the right maximization state 1882the frame will be maximized after disabling fullscreen state.
1883after disabling fullscreen mode.
1884 1883
1885Note that with some window managers you may have to set 1884Note that with some window managers you may have to set
1886`frame-resize-pixelwise' to non-nil in order to make a frame 1885`frame-resize-pixelwise' to non-nil in order to make a frame
1887appear truly maximized. 1886appear truly maximized. In addition, you may have to set
1887`x-frame-normalize-before-maximize' in order to enable
1888transitions from one fullscreen state to another.
1888 1889
1889See also `toggle-frame-fullscreen'." 1890See also `toggle-frame-fullscreen'."
1890 (interactive) 1891 (interactive)
1891 (if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth)) 1892 (let ((fullscreen (frame-parameter nil 'fullscreen)))
1892 (modify-frame-parameters 1893 (cond
1893 nil 1894 ((memq fullscreen '(fullscreen fullboth))
1894 `((maximized 1895 (set-frame-parameter nil 'fullscreen-restore 'maximized))
1895 . ,(unless (eq (frame-parameter nil 'maximized) 'maximized) 1896 ((eq fullscreen 'maximized)
1896 'maximized)))) 1897 (set-frame-parameter nil 'fullscreen nil))
1897 (modify-frame-parameters 1898 (t
1898 nil 1899 (set-frame-parameter nil 'fullscreen 'maximized)))))
1899 `((fullscreen
1900 . ,(unless (eq (frame-parameter nil 'fullscreen) 'maximized)
1901 'maximized))))))
1902 1900
1903(defun toggle-frame-fullscreen () 1901(defun toggle-frame-fullscreen ()
1904 "Toggle fullscreen mode of the selected frame. 1902 "Toggle fullscreen state of selected frame.
1905Enable fullscreen mode of the selected frame or disable if it is 1903Make selected frame fullscreen or restore its previous size if it
1906already fullscreen. Ignore window manager screen decorations. 1904is already fullscreen.
1907When turning on fullscreen mode, remember the previous value of the 1905
1908maximization state in the temporary frame parameter `maximized'. 1906Before making the frame fullscreen remember the current value of
1909Restore the maximization state when turning off fullscreen mode. 1907the frame's `fullscreen' parameter in the `fullscreen-restore'
1908parameter of the frame. That value is used to restore the
1909frame's size when toggling fullscreen the next time.
1910 1910
1911Note that with some window managers you may have to set 1911Note that with some window managers you may have to set
1912`frame-resize-pixelwise' to non-nil in order to make a frame 1912`frame-resize-pixelwise' to non-nil in order to make a frame
1913appear truly fullscreen. 1913appear truly fullscreen. In addition, you may have to set
1914`x-frame-normalize-before-maximize' in order to enable
1915transitions from one fullscreen state to another.
1914 1916
1915See also `toggle-frame-maximized'." 1917See also `toggle-frame-maximized'."
1916 (interactive) 1918 (interactive)
1917 (modify-frame-parameters 1919 (let ((fullscreen (frame-parameter nil 'fullscreen)))
1918 nil 1920 (if (memq fullscreen '(fullscreen fullboth))
1919 `((maximized 1921 (let ((fullscreen-restore (frame-parameter nil 'fullscreen-restore)))
1920 . ,(unless (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth)) 1922 (if (memq fullscreen-restore '(maximized fullheight fullwidth))
1921 (frame-parameter nil 'fullscreen))) 1923 (set-frame-parameter nil 'fullscreen fullscreen-restore)
1922 (fullscreen 1924 (set-frame-parameter nil 'fullscreen nil)))
1923 . ,(if (memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth)) 1925 (modify-frame-parameters
1924 (if (eq (frame-parameter nil 'maximized) 'maximized) 1926 nil `((fullscreen . fullboth) (fullscreen-restore . ,fullscreen))))))
1925 'maximized)
1926 'fullscreen)))))
1927
1928 1927
1929;;;; Key bindings 1928;;;; Key bindings
1930 1929
diff --git a/src/ChangeLog b/src/ChangeLog
index b4abdc59045..f8e65d5d91d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12015-02-11 Martin Rudalics <rudalics@gmx.at>
2
3 * w32term.c (w32_read_socket): In SIZE_MAXIMIZED and
4 SIZE_RESTORED cases correctly handle `maximized' value for the
5 `fullscreen' parameter. Don't use 'maximized' frame parameter
6 any more.
7 (w32fullscreen_hook): Include menu bar height when calculating
8 new text height in FULLSCREEN_BOTH case.
9 * xterm.c (do_ewmh_fullscreen): Handle transition from
10 FULLSCREEN_BOTH to FULLSCREEN_MAXIMIZED when
11 x_frame_normalize_before_maximize is set.
12
12015-02-10 Paul Eggert <eggert@cs.ucla.edu> 132015-02-10 Paul Eggert <eggert@cs.ucla.edu>
2 14
3 Use bool for boolean in xdisp.c 15 Use bool for boolean in xdisp.c
diff --git a/src/w32term.c b/src/w32term.c
index fb9d2388d6b..a9ed2a852da 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5052,6 +5052,7 @@ w32_read_socket (struct terminal *terminal,
5052 case SIZE_MAXIMIZED: 5052 case SIZE_MAXIMIZED:
5053 { 5053 {
5054 bool iconified = FRAME_ICONIFIED_P (f); 5054 bool iconified = FRAME_ICONIFIED_P (f);
5055 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
5055 5056
5056 SET_FRAME_VISIBLE (f, 1); 5057 SET_FRAME_VISIBLE (f, 1);
5057 SET_FRAME_ICONIFIED (f, false); 5058 SET_FRAME_ICONIFIED (f, false);
@@ -5082,12 +5083,22 @@ w32_read_socket (struct terminal *terminal,
5082 to update the frame titles 5083 to update the frame titles
5083 in case this is the second frame. */ 5084 in case this is the second frame. */
5084 record_asynch_buffer_change (); 5085 record_asynch_buffer_change ();
5085 }
5086 5086
5087 if (EQ (get_frame_param (f, Qfullscreen), Qnil)) 5087 /* Windows can send us a SIZE_MAXIMIZED message even
5088 set_frame_param (f, Qfullscreen, Qmaximized); 5088 when fullscreen is fullboth. The following is a
5089 else if (! EQ (get_frame_param (f, Qfullscreen), Qmaximized)) 5089 simple hack to check that based on the fact that
5090 set_frame_param (f, Qmaximized, Qmaximized); 5090 only a maximized fullscreen frame should have both
5091 top/left outside the screen. */
5092 if (EQ (fullscreen, Qfullwidth) || EQ (fullscreen, Qfullheight)
5093 || NILP (fullscreen))
5094 {
5095 int x, y;
5096
5097 x_real_positions (f, &x, &y);
5098 if (x < 0 && y < 0)
5099 store_frame_param (f, Qfullscreen, Qmaximized);
5100 }
5101 }
5091 5102
5092 break; 5103 break;
5093 5104
@@ -5128,9 +5139,7 @@ w32_read_socket (struct terminal *terminal,
5128 } 5139 }
5129 5140
5130 if (EQ (get_frame_param (f, Qfullscreen), Qmaximized)) 5141 if (EQ (get_frame_param (f, Qfullscreen), Qmaximized))
5131 set_frame_param (f, Qfullscreen, Qnil); 5142 store_frame_param (f, Qfullscreen, Qnil);
5132 else if (! EQ (get_frame_param (f, Qmaximized), Qnil))
5133 set_frame_param (f, Qmaximized, Qnil);
5134 5143
5135 break; 5144 break;
5136 } 5145 }
@@ -6008,6 +6017,8 @@ w32fullscreen_hook (struct frame *f)
6008 } 6017 }
6009 else if (f->want_fullscreen == FULLSCREEN_BOTH) 6018 else if (f->want_fullscreen == FULLSCREEN_BOTH)
6010 { 6019 {
6020 int menu_bar_height = GetSystemMetrics (SM_CYMENU);
6021
6011 w32_fullscreen_rect (hwnd, f->want_fullscreen, 6022 w32_fullscreen_rect (hwnd, f->want_fullscreen,
6012 FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); 6023 FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect);
6013 SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW); 6024 SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
@@ -6016,7 +6027,8 @@ w32fullscreen_hook (struct frame *f)
6016 SWP_NOOWNERZORDER | SWP_FRAMECHANGED); 6027 SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
6017 change_frame_size 6028 change_frame_size
6018 (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, rect.right - rect.left), 6029 (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, rect.right - rect.left),
6019 FRAME_PIXEL_TO_TEXT_HEIGHT (f, rect.bottom - rect.top), 6030 FRAME_PIXEL_TO_TEXT_HEIGHT (f, (rect.bottom - rect.top
6031 - menu_bar_height)),
6020 0, 1, 0, 1); 6032 0, 1, 0, 1);
6021 } 6033 }
6022 else 6034 else
diff --git a/src/xterm.c b/src/xterm.c
index 6a63a454bac..0b3efe7b4b6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9271,7 +9271,15 @@ do_ewmh_fullscreen (struct frame *f)
9271 } 9271 }
9272 break; 9272 break;
9273 case FULLSCREEN_MAXIMIZED: 9273 case FULLSCREEN_MAXIMIZED:
9274 if (x_frame_normalize_before_maximize && cur == FULLSCREEN_WIDTH) 9274 if (x_frame_normalize_before_maximize && cur == FULLSCREEN_BOTH)
9275 {
9276 set_wm_state (frame, false,
9277 dpyinfo->Xatom_net_wm_state_fullscreen, None);
9278 set_wm_state (frame, true,
9279 dpyinfo->Xatom_net_wm_state_maximized_horz,
9280 dpyinfo->Xatom_net_wm_state_maximized_vert);
9281 }
9282 else if (x_frame_normalize_before_maximize && cur == FULLSCREEN_WIDTH)
9275 { 9283 {
9276 set_wm_state (frame, false, 9284 set_wm_state (frame, false,
9277 dpyinfo->Xatom_net_wm_state_maximized_horz, None); 9285 dpyinfo->Xatom_net_wm_state_maximized_horz, None);