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: Full screen mode on windows Date: Wed, 04 Jun 2008 19:57:06 +0200 Message-ID: <87r6bdt765.fsf@kanis.fr> References: <871w3ik9js.fsf@kanis.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212602436 11640 80.91.229.12 (4 Jun 2008 18:00:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Jun 2008 18:00:36 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 04 20:01:18 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 1K3xID-0004NG-Jk for ged-emacs-devel@m.gmane.org; Wed, 04 Jun 2008 20:01:02 +0200 Original-Received: from localhost ([127.0.0.1]:56893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3xHR-0007eB-9x for ged-emacs-devel@m.gmane.org; Wed, 04 Jun 2008 14:00:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K3xHL-0007ah-4z for emacs-devel@gnu.org; Wed, 04 Jun 2008 14:00:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K3xHJ-0007YF-NL for emacs-devel@gnu.org; Wed, 04 Jun 2008 14:00:06 -0400 Original-Received: from [199.232.76.173] (port=56887 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3xHJ-0007Y2-He for emacs-devel@gnu.org; Wed, 04 Jun 2008 14:00:05 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:57900 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K3xHI-0003LI-S9 for emacs-devel@gnu.org; Wed, 04 Jun 2008 14:00:05 -0400 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1K3xHG-0005qb-Lq for emacs-devel@gnu.org; Wed, 04 Jun 2008 18:00:02 +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 ; Wed, 04 Jun 2008 18:00:02 +0000 Original-Received: from expire-by-2008-06-10 by pir44-1-89-87-99-142.dsl.club-internet.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 04 Jun 2008 18:00:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 156 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:GacE1VhMrEhal0BGggJqMsRxfQw= 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:98411 Archived-At: joakim@verona.se writes: > I would suggest looking at the existing fullscreen option for X: > > (set-frame-parameter nil 'fullscreen 'fullboth) Hello, The following patch agains 22.2 makes it work. As a bonus I have added full width and full height so that it works properly. It's a rough start I need to work on startup options -fs -fh and -fw. diff -U5 -pr emacs-22.2/src/frame.c emacs-ivan/src/frame.c --- emacs-22.2/src/frame.c 2008-01-10 13:16:14.000000000 +0100 +++ emacs-ivan/src/frame.c 2008-06-04 19:47:38.000000000 +0200 @@ -2608,10 +2608,11 @@ x_fullscreen_adjust (f, width, height, t int newheight = FRAME_LINES (f); *top_pos = f->top_pos; *left_pos = f->left_pos; +#ifdef ivan if (f->want_fullscreen & FULLSCREEN_HEIGHT) { int ph; ph = FRAME_X_DISPLAY_INFO (f)->height; @@ -2629,10 +2630,11 @@ x_fullscreen_adjust (f, width, height, t newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw); pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, newwidth) - f->x_pixels_diff; newwidth = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pw); *left_pos = 0; } +#endif *width = newwidth; *height = newheight; } diff -U5 -pr emacs-22.2/src/w32fns.c emacs-ivan/src/w32fns.c --- emacs-22.2/src/w32fns.c 2008-03-01 20:28:20.000000000 +0100 +++ emacs-ivan/src/w32fns.c 2008-06-04 19:47:37.000000000 +0200 @@ -3664,10 +3664,14 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) wmsg.dwModifiers = w32_get_modifiers (); my_post_msg (&wmsg, hwnd, msg, wParam, lParam); return 0; case WM_WINDOWPOSCHANGING: + /* Don't restrict fullscreen 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; { WINDOWPLACEMENT wp; diff -U5 -pr emacs-22.2/src/w32term.c emacs-ivan/src/w32term.c --- emacs-22.2/src/w32term.c 2008-02-23 14:49:09.000000000 +0100 +++ emacs-ivan/src/w32term.c 2008-06-04 19:47:37.000000000 +0200 @@ -255,10 +255,11 @@ static void w32_clip_to_row P_ ((struct static BOOL my_show_window P_ ((struct frame *, HWND, int)); static void my_set_window_pos P_ ((HWND, HWND, int, int, int, int, UINT)); 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 Lisp_Object Qvendor_specific_keysyms; /*********************************************************************** @@ -5559,10 +5560,71 @@ x_set_offset (f, xoff, yoff, change_grav 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); UNBLOCK_INPUT; } +static void +w32_fullscreen_hook(f) + FRAME_PTR f; +{ + DWORD style; + RECT workarea_rect, window_rect; + HWND hwnd; + + 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); + break; + case FULLSCREEN_WIDTH: + SystemParametersInfo( SPI_GETWORKAREA, 0, &workarea_rect, 0 ); + GetWindowRect(FRAME_W32_WINDOW(f), &window_rect); + SetWindowPos(hwnd, + NULL, + workarea_rect.left, + window_rect.top, + workarea_rect.right, + window_rect.bottom, 0); + break; + case FULLSCREEN_HEIGHT: + SystemParametersInfo( SPI_GETWORKAREA, 0, &workarea_rect, 0 ); + GetWindowRect(FRAME_W32_WINDOW(f), &window_rect); + SetWindowPos(hwnd, + NULL, + window_rect.left, + workarea_rect.top, + window_rect.right, + workarea_rect.bottom, 0); + 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); + break; + } +} /* Check if we need to resize the frame due to a fullscreen request. If so needed, resize the frame. */ static void x_check_fullscreen (f) @@ -6502,10 +6564,11 @@ w32_initialize () frame_raise_lower_hook = w32_frame_raise_lower; set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar; condemn_scroll_bars_hook = w32_condemn_scroll_bars; redeem_scroll_bar_hook = w32_redeem_scroll_bar; judge_scroll_bars_hook = w32_judge_scroll_bars; + fullscreen_hook = w32_fullscreen_hook; scroll_region_ok = 1; /* we'll scroll partial frames */ char_ins_del_ok = 1; line_ins_del_ok = 1; /* we'll just blt 'em */ fast_clear_end_of_line = 1; /* X does this well */