-*gui_w32.txt* For Vim version 9.1. Last change: 2025 Nov 09
+*gui_w32.txt* For Vim version 9.1. Last change: 2025 Dec 21
VIM REFERENCE MANUAL by Bram Moolenaar
hi TitleBar guibg=NONE guifg=NONE
hi TitleBarNC guibg=NONE guifg=NONE
<
+
+Full Screen *gui-w32-fullscreen*
+
+To enable fullscreen mode in the Windows GUI version of Vim, add the 's' flag
+to the 'guioptions' setting.
+
+For convenience, you can define a command or mapping to toggle fullscreen mode:
+>
+ command! ToggleFullscreen {
+ if &guioptions =~# 's'
+ set guioptions-=s
+ else
+ set guioptions+=s
+ endif
+ }
+
+ map <expr> <F11> &go =~# 's' ? ":se go-=s<CR>" : ":se go+=s<CR>"
+
+The fullscreen mode will occupy the entire screen area while hiding window
+decorations such as the title bar and borders.
+
vim:tw=78:sw=4:ts=8:noet:ft=help:norl:
-*options.txt* For Vim version 9.1. Last change: 2025 Dec 18
+*options.txt* For Vim version 9.1. Last change: 2025 Dec 21
VIM REFERENCE MANUAL by Bram Moolenaar
*'go-T'*
'T' Include Toolbar. Currently only in Win32, GTK+, Motif and
Photon GUIs.
+ *'go-s'*
+ 's' Enable fullscreen mode. Currently only supported in the
+ MS-Windows GUI version. When set, the window will occupy the
+ entire screen and remove window decorations. Define custom
+ mappings to toggle this mode conveniently. For detailed usage
+ instructions, see |gui-w32-fullscreen|.
*'go-r'*
'r' Right-hand scrollbar is always present.
*'go-R'*
'go-m' options.txt /*'go-m'*
'go-p' options.txt /*'go-p'*
'go-r' options.txt /*'go-r'*
+'go-s' options.txt /*'go-s'*
'go-t' options.txt /*'go-t'*
'go-v' options.txt /*'go-v'*
'gp' options.txt /*'gp'*
gui-w32 gui_w32.txt /*gui-w32*
gui-w32-cmdargs gui_w32.txt /*gui-w32-cmdargs*
gui-w32-dialogs gui_w32.txt /*gui-w32-dialogs*
+gui-w32-fullscreen gui_w32.txt /*gui-w32-fullscreen*
gui-w32-printing gui_w32.txt /*gui-w32-printing*
gui-w32-start gui_w32.txt /*gui-w32-start*
gui-w32-title-bar gui_w32.txt /*gui-w32-title-bar*
-*version9.txt* For Vim version 9.1. Last change: 2025 Dec 15
+*version9.txt* For Vim version 9.1. Last change: 2025 Dec 21
VIM REFERENCE MANUAL by Bram Moolenaar
(see also the below platform specific change).
- 'guioptions': Support darkmode on MS-Windows for menu and title bar using
|'go-d'| (see also the below platform specific change).
+- 'guioptions': New value |'go-s'| to support fullscreen on MS-Windows GUI
+ (see also the below platform specific change).
- 'completepopup': Add more values to style popup windows.
Ex commands: ~
- MS-Windows: Vim no longer searches the current directory for
executables when running external commands; prefix a relative or absolute
path if you want the old behavior |$NoDefaultCurrentDirectoryInExePath|.
+- MS-Windows: New value |'go-s'| to support fullscreen on MS-Windows GUI
- macOS: increase default scheduler priority to TASK_DEFAULT_APPLICATION.
gui_gtk_init_socket_server();
#endif
+#ifdef FEAT_GUI_MSWIN
+ // Enable fullscreen mode
+ if (vim_strchr(p_go, GO_FULLSCREEN) != NULL)
+ gui_mch_set_fullscreen(TRUE);
+#endif
+
vim_free(old_term);
// If the GUI started successfully, trigger the GUIEnter event, otherwise
#ifdef FEAT_GUI_MSWIN
static int prev_titlebar = FALSE;
int using_titlebar = FALSE;
+
+ static int prev_fullscreen = FALSE;
+ int using_fullscreen = FALSE;
#endif
#if defined(FEAT_MENU)
static int prev_tearoff = -1;
case GO_TITLEBAR:
using_titlebar = TRUE;
break;
+ case GO_FULLSCREEN:
+ using_fullscreen = TRUE;
+ break;
#endif
#ifdef FEAT_TOOLBAR
case GO_TOOLBAR:
gui_mch_set_titlebar_colors();
prev_titlebar = using_titlebar;
}
+
+ if (using_fullscreen != prev_fullscreen)
+ {
+ gui_mch_set_fullscreen(using_fullscreen);
+ prev_fullscreen = using_fullscreen;
+ }
#endif
#ifdef FEAT_GUI_DARKTHEME
static HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND, DWORD, LPCVOID, DWORD);
static void dyn_dwm_load(void);
+static int fullscreen_on = FALSE;
+
#ifdef FEAT_GUI_DARKTHEME
static HINSTANCE hUxThemeLib = NULL;
#endif // FEAT_GUI_DARKTHEME
+/*
+ * When flag is true, set fullscreen on.
+ * When flag is false, set fullscreen off.
+ */
+ void
+gui_mch_set_fullscreen(int flag)
+{
+ static RECT normal_rect;
+ static LONG_PTR normal_style, normal_exstyle;
+ HMONITOR mon;
+ MONITORINFO moninfo;
+ RECT rc;
+
+ if (!full_screen) // Windows not set yet.
+ return;
+
+ if (flag)
+ {
+ if (fullscreen_on)
+ return;
+
+ // Enter fullscreen mode
+ GetWindowRect(s_hwnd, &rc);
+
+ moninfo.cbSize = sizeof(MONITORINFO);
+ mon = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST);
+ if (mon == NULL || !GetMonitorInfo(mon, &moninfo))
+ return;
+
+ // Save current window state
+ GetWindowRect(s_hwnd, &normal_rect);
+ normal_style = GetWindowLongPtr(s_hwnd, GWL_STYLE);
+ normal_exstyle = GetWindowLongPtr(s_hwnd, GWL_EXSTYLE);
+
+ // Set fullscreen styles
+ SetWindowLongPtr(s_hwnd, GWL_STYLE,
+ normal_style & ~(WS_CAPTION | WS_THICKFRAME));
+ SetWindowLongPtr(s_hwnd, GWL_EXSTYLE,
+ normal_exstyle & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE |
+ WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
+ SetWindowPos(s_hwnd, NULL,
+ moninfo.rcMonitor.left,
+ moninfo.rcMonitor.top,
+ moninfo.rcMonitor.right - moninfo.rcMonitor.left,
+ moninfo.rcMonitor.bottom - moninfo.rcMonitor.top,
+ SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+
+ fullscreen_on = TRUE;
+ }
+ else
+ {
+ if (!fullscreen_on)
+ return;
+
+ // Exit fullscreen mode
+ SetWindowLongPtr(s_hwnd, GWL_STYLE, normal_style);
+ SetWindowLongPtr(s_hwnd, GWL_EXSTYLE, normal_exstyle);
+
+ // Restore original window position and size
+ SetWindowPos(s_hwnd, NULL,
+ normal_rect.left,
+ normal_rect.top,
+ normal_rect.right - normal_rect.left,
+ normal_rect.bottom - normal_rect.top,
+ SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
+
+ fullscreen_on = FALSE;
+ }
+}
+
/*
* ":simalt" command.
*/
#define GO_ASELPLUS 'P' // autoselectPlus
#define GO_RIGHT 'r' // use right scrollbar
#define GO_VRIGHT 'R' // right scrollbar with vert split
+#define GO_FULLSCREEN 's' // enter fullscreen
#define GO_TEAROFF 't' // add tear-off menu items
#define GO_TOOLBAR 'T' // add toolbar
#define GO_FOOTER 'F' // add footer
#define GO_VERTICAL 'v' // arrange dialog buttons vertically
#define GO_KEEPWINSIZE 'k' // keep GUI window size
// all possible flags for 'go'
-#define GO_ALL "!aAbcCdefFghilLmMpPrRtTvk"
+#define GO_ALL "!aAbcCdefFghilLmMpPrRstTvk"
// flags for 'comments' option
#define COM_NEST 'n' // comments strings nest
void gui_mch_update_tabline(void);
void gui_mch_set_curtab(int nr);
void gui_mch_set_dark_theme(int dark);
+void gui_mch_set_fullscreen(int flag);
void ex_simalt(exarg_T *eap);
void gui_mch_find_dialog(exarg_T *eap);
void gui_mch_replace_dialog(exarg_T *eap);
set guioptions&
call assert_equal('egmrLtT', &guioptions)
- set guioptions+=C
+ set guioptions+=s
exec 'sleep' . duration
- call assert_equal('egmrLtTC', &guioptions)
- set guioptions-=C
+ call assert_equal('egmrLtTs', &guioptions)
+ set guioptions-=s
exec 'sleep' . duration
call assert_equal('egmrLtT', &guioptions)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2005,
/**/
2004,
/**/