[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Full screen mode on windows
From: |
Ivan Kanis |
Subject: |
Re: Full screen mode on windows |
Date: |
Wed, 04 Jun 2008 19:57:06 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
address@hidden 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 */