unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Kanis <expire-by-2008-06-10@kanis.fr>
To: emacs-devel@gnu.org
Subject: Re: Full screen mode on windows
Date: Wed, 04 Jun 2008 19:57:06 +0200	[thread overview]
Message-ID: <87r6bdt765.fsf@kanis.fr> (raw)
In-Reply-To: m363sur5w9.fsf@verona.se

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;
 
 \f
 /***********************************************************************
@@ -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 */





      parent reply	other threads:[~2008-06-04 17:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-31 11:16 Full screen mode on windows Ivan Kanis
2008-05-31 12:53 ` joakim
2008-05-31 13:13   ` Eli Zaretskii
2008-05-31 13:25     ` Lennart Borgman (gmail)
2008-05-31 13:52       ` Lennart Borgman (gmail)
2008-05-31 15:28         ` Eli Zaretskii
2008-05-31 15:50           ` Lennart Borgman (gmail)
2008-06-01  2:02     ` Jason Rumney
2008-05-31 18:25   ` Ivan Kanis
2008-05-31 21:11     ` Eli Zaretskii
2008-05-31 21:16       ` Tom Tromey
2008-06-01  1:30       ` Miles Bader
2008-06-01 10:05       ` Ivan Kanis
2008-06-03  6:53         ` Evans Winner
2008-06-03  7:01           ` dhruva
2008-06-03 20:56             ` Evans Winner
2008-06-03  7:23           ` Thien-Thi Nguyen
2008-06-04 17:57   ` Ivan Kanis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r6bdt765.fsf@kanis.fr \
    --to=expire-by-2008-06-10@kanis.fr \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).