[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] adding maximize to fullscreen frame parameters
From: |
Ivan Kanis |
Subject: |
Re: [PATCH] adding maximize to fullscreen frame parameters |
Date: |
Tue, 26 Aug 2008 08:57:41 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Eli Zaretskii <address@hidden> wrote:
>> From: Ivan Kanis <address@hidden>
>> Date: Sun, 24 Aug 2008 10:23:21 +0200
>>
>> > Please leave two spaces after a period that ends a sentence.
>> >
>> > Also, I don't think "fullscreen" is a word (in "fullscreen mode"); I
>> > suggest to use "full-screen" in this context.
>> >
>>
>> The included patch fixed the document glitch.
>
> Thanks, but there's still one case of a single space between
> sentences.
Sorry if you get this twice. This patch fixes single space and
implement full-screen feature on Windows. Let know if you plan to
check it in I will write the ChangeLogs.
diff -r 7a34490312a4 doc/emacs/xresources.texi
--- a/doc/emacs/xresources.texi Thu Aug 21 08:23:02 2008 +0200
+++ b/doc/emacs/xresources.texi Mon Aug 25 10:30:20 2008 +0200
@@ -237,8 +237,8 @@ all frames.
@ifnottex
@item @code{fullscreen} (class @code{Fullscreen})
The desired fullscreen size. The value can be one of @code{fullboth},
address@hidden or @code{fullheight}, which correspond to
-the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh}
address@hidden, @code{fullwidth} or @code{maximize} which correspond to
+the command-line options @samp{-fs}, @samp{-fh}, @samp{-fw} and @samp{-fm}
(@pxref{Window Size X}).
Note that this applies to the initial frame only.
diff -r 7a34490312a4 doc/lispref/frames.texi
--- a/doc/lispref/frames.texi Thu Aug 21 08:23:02 2008 +0200
+++ b/doc/lispref/frames.texi Mon Aug 25 10:30:20 2008 +0200
@@ -481,8 +481,11 @@ Specify that width, height or both shall
Specify that width, height or both shall be set to the size of the screen.
The value @code{fullwidth} specifies that width shall be the size of the
screen. The value @code{fullheight} specifies that height shall be the
-size of the screen. The value @code{fullboth} specifies that both the
-width and the height shall be set to the size of the screen.
+size of the screen. The value @code{maximize} specifies that both the
+width and the height shall be set to the size of the screen. The value
address@hidden toggles full-screen mode, all windows decoration are hidden
+such as title bar and border. The desktop taskbar is also hidden so it
+looks like emacs is running on a console.
@end table
@node Layout Parameters
diff -r 7a34490312a4 doc/man/emacs.1
--- a/doc/man/emacs.1 Thu Aug 21 08:23:02 2008 +0200
+++ b/doc/man/emacs.1 Mon Aug 25 10:30:20 2008 +0200
@@ -443,11 +443,12 @@ The desired fullscreen size.
The desired fullscreen size.
The value can be one of
.IR fullboth ,
+.IR fullheight ,
.IR fullwidth ,
or
-.IR fullheight ,
-which correspond to the command-line options `\-fs', `\-fw', and
-`\-fh', respectively.
+.IR maximize ,
+which correspond to the command-line options `\-fs', `\-fh',
+`\-fw', and `\-fm' respectively.
Note that this applies to the initial frame only.
.TP
.BR geometry " (class " Geometry )
diff -r 7a34490312a4 lisp/startup.el
--- a/lisp/startup.el Thu Aug 21 08:23:02 2008 +0200
+++ b/lisp/startup.el Mon Aug 25 10:30:20 2008 +0200
@@ -134,6 +134,7 @@ This is normally copied from `default-di
("-fs" 0 x-handle-initial-switch fullscreen fullboth)
("-fw" 0 x-handle-initial-switch fullscreen fullwidth)
("-fh" 0 x-handle-initial-switch fullscreen fullheight)
+ ("-fm" 0 x-handle-initial-switch fullscreen maximize)
("-ib" 1 x-handle-numeric-switch internal-border-width)
("-g" 1 x-handle-geometry)
("-lsp" 1 x-handle-numeric-switch line-spacing)
@@ -159,6 +160,7 @@ This is normally copied from `default-di
("--fullscreen" 0 x-handle-initial-switch fullscreen fullboth)
("--fullwidth" 0 x-handle-initial-switch fullscreen fullwidth)
("--fullheight" 0 x-handle-initial-switch fullscreen fullheight)
+ ("--fullmax" 0 x-handle-initial-switch fullscreen maximize)
("--internal-border" 1 x-handle-numeric-switch internal-border-width)
("--geometry" 1 x-handle-geometry)
("--foreground-color" 1 x-handle-switch foreground-color)
diff -r 7a34490312a4 src/emacs.c
--- a/src/emacs.c Thu Aug 21 08:23:02 2008 +0200
+++ b/src/emacs.c Mon Aug 25 10:30:20 2008 +0200
@@ -304,7 +304,8 @@ Display options:\n\
--font, -fn FONT default font; must be fixed-width\n\
--foreground-color, -fg COLOR window foreground color\n\
--fullheight, -fh make the first frame high as the screen\n\
---fullscreen, -fs make first frame fullscreen\n\
+--fullmax, --fm make the fisrs frame maximized\n\
+--fullscreen, -fs make first frame full-screen\n\
--fullwidth, -fw make the first frame wide as the screen\n\
--geometry, -g GEOMETRY window geometry\n\
--no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\
diff -r 7a34490312a4 src/frame.c
--- a/src/frame.c Thu Aug 21 08:23:02 2008 +0200
+++ b/src/frame.c Mon Aug 25 10:30:21 2008 +0200
@@ -120,7 +120,7 @@ Lisp_Object Qtty_color_mode;
Lisp_Object Qtty_color_mode;
Lisp_Object Qtty, Qtty_type;
-Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
+Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth, Qmaximize;
Lisp_Object Qfont_backend;
Lisp_Object Qalpha;
@@ -3262,6 +3262,8 @@ x_set_fullscreen (f, new_value, old_valu
f->want_fullscreen = FULLSCREEN_WIDTH;
else if (EQ (new_value, Qfullheight))
f->want_fullscreen = FULLSCREEN_HEIGHT;
+ else if (EQ (new_value, Qmaximize))
+ f->want_fullscreen = FULLSCREEN_MAXIMIZE;
if (FRAME_TERMINAL (f)->fullscreen_hook != NULL)
FRAME_TERMINAL (f)->fullscreen_hook (f);
@@ -4423,6 +4425,8 @@ syms_of_frame ()
staticpro (&Qfullheight);
Qfullboth = intern ("fullboth");
staticpro (&Qfullboth);
+ Qmaximize = intern ("maximize");
+ staticpro (&Qmaximize);
Qx_resource_name = intern ("x-resource-name");
staticpro (&Qx_resource_name);
diff -r 7a34490312a4 src/frame.h
--- a/src/frame.h Thu Aug 21 08:23:02 2008 +0200
+++ b/src/frame.h Mon Aug 25 10:30:21 2008 +0200
@@ -75,12 +75,12 @@ enum text_cursor_kinds
enum fullscreen_type
{
- /* Values used as a bit mask, BOTH == WIDTH | HEIGHT. */
- FULLSCREEN_NONE = 0,
- FULLSCREEN_WIDTH = 1,
- FULLSCREEN_HEIGHT = 2,
- FULLSCREEN_BOTH = 3,
- FULLSCREEN_WAIT = 4
+ FULLSCREEN_NONE = 0x0,
+ FULLSCREEN_WIDTH = 0x1,
+ FULLSCREEN_HEIGHT = 0x2,
+ FULLSCREEN_BOTH = 0x4,
+ FULLSCREEN_WAIT = 0x8,
+ FULLSCREEN_MAXIMIZE = 0x10
};
diff -r 7a34490312a4 src/w32fns.c
--- a/src/w32fns.c Thu Aug 21 08:23:02 2008 +0200
+++ b/src/w32fns.c Mon Aug 25 10:30:21 2008 +0200
@@ -3690,6 +3690,10 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
return 0;
case WM_WINDOWPOSCHANGING:
+ /* Don't restrict full-screen window */
+ f = x_window_to_frame (dpyinfo, hwnd);
+ if (f && f->want_fullscreen & FULLSCREEN_BOTH)
+ goto dflt;
/* Don't restrict the sizing of tip frames. */
if (hwnd == tip_window)
return 0;
diff -r 7a34490312a4 src/w32term.c
--- a/src/w32term.c Thu Aug 21 08:23:02 2008 +0200
+++ b/src/w32term.c Mon Aug 25 10:30:21 2008 +0200
@@ -275,7 +275,8 @@ static void my_set_focus P_ ((struct fra
static void my_set_focus P_ ((struct frame *, HWND));
static void my_set_foreground_window P_ ((HWND));
static void my_destroy_window P_ ((struct frame *, HWND));
-
+static void w32_fullscreen_hook P_ ((struct frame *));
+static BOOL do_w32_fullscreen P_ ((struct frame *));
static Lisp_Object Qvendor_specific_keysyms;
@@ -3456,6 +3457,62 @@ my_destroy_window (f, hwnd)
{
SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,
(WPARAM) hwnd, 0);
+}
+
+static void
+w32_fullscreen_hook(f)
+ FRAME_PTR f;
+{
+ do_w32_fullscreen(f);
+}
+
+static BOOL
+do_w32_fullscreen(f)
+ FRAME_PTR f;
+{
+ DWORD style;
+ RECT workarea_rect, window_rect;
+ HWND hwnd;
+ BOOL ret = FALSE;
+
+ hwnd = FRAME_W32_WINDOW (f);
+ switch (f->want_fullscreen)
+ {
+ case FULLSCREEN_BOTH:
+ /* Remove the window furniture. */
+ my_show_window(f, hwnd, SW_MAXIMIZE);
+ style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ style &= ~(WS_CAPTION | WS_BORDER | WS_THICKFRAME);
+ SetWindowLongPtr(hwnd, GWL_STYLE, style);
+ /* Resize ourselves to exactly cover the nearest monitor. */
+ GetClientRect(GetDesktopWindow(), &workarea_rect);
+ SetWindowPos (hwnd,
+ HWND_TOP,
+ workarea_rect.left,
+ workarea_rect.top,
+ (workarea_rect.right - workarea_rect.left),
+ workarea_rect.bottom - workarea_rect.top,
+ SWP_FRAMECHANGED);
+ ret = TRUE;
+ break;
+ case FULLSCREEN_MAXIMIZE:
+ my_show_window(f, hwnd, SW_MAXIMIZE);
+ ret = TRUE;
+ break;
+ case FULLSCREEN_NONE:
+ /* Reinstate the window furniture. */
+ hwnd = FRAME_W32_WINDOW (f);
+ style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ style |= WS_CAPTION | WS_BORDER | WS_THICKFRAME;
+ SetWindowLongPtr(hwnd, GWL_STYLE, style);
+ my_show_window(f, hwnd, SW_RESTORE);
+ SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+ SWP_FRAMECHANGED);
+ ret = TRUE;
+ break;
+ }
+ return ret;
}
/* Create a scroll bar and return the scroll bar vector for it. W is
@@ -6091,7 +6148,7 @@ w32_create_terminal (struct w32_display_
terminal->mouse_position_hook = w32_mouse_position;
terminal->frame_rehighlight_hook = w32_frame_rehighlight;
terminal->frame_raise_lower_hook = w32_frame_raise_lower;
- // terminal->fullscreen_hook = XTfullscreen_hook;
+ terminal->fullscreen_hook = w32_fullscreen_hook;
terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar;
terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars;
terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar;
diff -r 7a34490312a4 src/xterm.c
--- a/src/xterm.c Thu Aug 21 08:23:02 2008 +0200
+++ b/src/xterm.c Mon Aug 25 10:30:21 2008 +0200
@@ -8580,9 +8580,10 @@ do_ewmh_fullscreen (f)
break;
}
- if (what != NULL && !wm_supports (f, what)) return 0;
-
-
+ /* Only remove element when setting to none so that maxmize
+ works properley */
+ if (f->want_fullscreen == FULLSCREEN_NONE)
+ {
Fx_send_client_event (frame, make_number (0), frame,
make_unibyte_string (atom, strlen (atom)),
make_number (32),
@@ -8607,6 +8608,10 @@ do_ewmh_fullscreen (f)
(make_unibyte_string (fw,
strlen (fw)),
Qnil)));
+ }
+
+ if (what != NULL && !wm_supports (f, what)) return 0;
+
f->want_fullscreen = FULLSCREEN_NONE;
if (what != NULL)
Fx_send_client_event (frame, make_number (0), frame,
@@ -8626,7 +8631,15 @@ XTfullscreen_hook (f)
XTfullscreen_hook (f)
FRAME_PTR f;
{
- if (f->async_visible)
+ /* Maximise in X is full height plus full width */
+ if (f->want_fullscreen == FULLSCREEN_MAXIMIZE)
+ {
+ f->want_fullscreen = FULLSCREEN_HEIGHT;
+ XTfullscreen_hook(f);
+ f->want_fullscreen = FULLSCREEN_WIDTH;
+ XTfullscreen_hook(f);
+ }
+ else if (f->async_visible)
{
BLOCK_INPUT;
do_ewmh_fullscreen (f);
Take care,
--
Ivan
http://kanis.fr
Never attribute to malice what can adequately be explained by
stupidity.
-- Robert J. Hanlon
- Re: Proposal for a new API to fullscreen, (continued)
Re: Proposal for a new API to fullscreen, Tom Tromey, 2008/08/19
Re: Proposal for a new API to fullscreen, Jason Rumney, 2008/08/19
- Re: Proposal for a new API to fullscreen, Ivan Kanis, 2008/08/19
- Re: Proposal for a new API to fullscreen, Jason Rumney, 2008/08/19
- Re: Proposal for a new API to fullscreen, Tassilo Horn, 2008/08/19
- Re: Proposal for a new API to fullscreen, Lennart Borgman (gmail), 2008/08/19
- Re: Proposal for a new API to fullscreen, Tassilo Horn, 2008/08/19
- Re: Proposal for a new API to fullscreen, Jason Rumney, 2008/08/19
- Re: Proposal for a new API to fullscreen, Lennart Borgman (gmail), 2008/08/19
- Re: Proposal for a new API to fullscreen, Lennart Borgman (gmail), 2008/08/19
Re: Proposal for a new API to fullscreen, Ivan Kanis, 2008/08/20