From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Kanis Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] adding maximize to fullscreen frame parameters Date: Tue, 26 Aug 2008 08:57:41 +0200 Message-ID: <87abf0gt5m.fsf@kanis.fr> References: <87wsidphul.fsf@kanis.fr> <87fxowma4d.fsf_-_@kanis.fr> <87ej4eom86.fsf@kanis.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1219734023 32051 80.91.229.12 (26 Aug 2008 07:00:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Aug 2008 07:00:23 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 26 09:01:16 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KXsYF-0004Sj-Ep for ged-emacs-devel@m.gmane.org; Tue, 26 Aug 2008 09:01:16 +0200 Original-Received: from localhost ([127.0.0.1]:36630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KXsXG-0003fP-Rl for ged-emacs-devel@m.gmane.org; Tue, 26 Aug 2008 03:00:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KXsXD-0003fH-F0 for emacs-devel@gnu.org; Tue, 26 Aug 2008 03:00:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KXsXC-0003eK-09 for emacs-devel@gnu.org; Tue, 26 Aug 2008 03:00:10 -0400 Original-Received: from [199.232.76.173] (port=45017 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KXsXB-0003e4-PH for emacs-devel@gnu.org; Tue, 26 Aug 2008 03:00:09 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:19858) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KXsXA-00019H-K3 for emacs-devel@gnu.org; Tue, 26 Aug 2008 03:00:09 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KXsX8-0006Q9-Oy for emacs-devel@gnu.org; Tue, 26 Aug 2008 03:00:07 -0400 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1KXsX4-0001Co-Ug for emacs-devel@gnu.org; Tue, 26 Aug 2008 07:00:03 +0000 Original-Received: from pir44-1-89-87-99-142.dsl.club-internet.fr ([89.87.99.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Aug 2008 07:00:02 +0000 Original-Received: from expire-by-2008-08-31 by pir44-1-89-87-99-142.dsl.club-internet.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Aug 2008 07:00:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 319 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pir44-1-89-87-99-142.dsl.club-internet.fr Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAPFBMVEUAAABIPTwvJSaTgX38 +PQRCAqxnp339/92Z2bLvMAFAAT///8bEBLp5eny8uvd1NNcUFQVABUIAAj///carFalAAAB10lE QVRIie2U25brIAiGUaLxGIx9/3cd0GmnjXTW7sW+G9q1kiAfEPkNwMeWP7I/4Mcq3W9i/ReA7DmJ WCD8Angz01GBGYcdAOXmeBR6ASzYkbixt/A1yFyFRAtmW4HDclzkQgAdypYjXztXoJGgrsBuONDU zUriRNxY4p+vpzybYwWkdYAWp8R8m9dg4N7ZFbhZaQFmABT3IlHUXlpaWm34UtSABiuR0nAZdQ4N FGJ6vD64a3i/P/eqAqi9wWBa1oAqA0hXIAlS1Aqjo977pa+RIijAZpSOoJgxj7KtAAFY34oJLAmU DXPBO2hbjBF/enoC/CjMmbwLQ6lBBD/kG6Erg+M9oryz5XjsMhOfd/GzgyD5FeCQyCFC8N/IdPf9 nkuTRhvbvY8acjbBCS9QLWoFznlyyCZAHVtzzrSVVzQAeQx2+ucZkwkjYpB5OloBmqchBGwnFIwU nuSnqZWV8dCFPXKk+RGYk0cF4J6cY0akQzFAx6MBK6lzmlPVEmvDDTlxX65ETMWMAumdWmU70pSe 8ceRySQnjjQ+Phrwrb/OWvIR0WNxU9yU3wAiHng6pvOF8JbfA/nmx74/EIP0sr4AbAeRx9CaCUT1 dlnUgF/tD/hfwIf2BQZnSFIDGmgZAAAAAElFTkSuQmCC User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:9hYdGhXJOOan//UrSRp1rSh1g5s= X-detected-kernel: by mx20.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102976 Archived-At: --=-=-= Eli Zaretskii wrote: >> From: Ivan Kanis >> 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=fsxwin.patch 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}, -@code{fullwidth} or @code{fullheight}, which correspond to -the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh} +@code{fullheight}, @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 +@code{fullboth} 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 --=-=-=--