]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0534: GTK UI does not support fullscreen mode v9.2.0534
authorMuraoka Taro <koron.kaoriya@gmail.com>
Mon, 25 May 2026 15:48:43 +0000 (15:48 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 25 May 2026 15:54:20 +0000 (15:54 +0000)
Problem:  GTK UI does not support fullscreen mode
Solution: Add support for fullscreen (guioptions+=s) mode
          (Muraoka Taro).

closes: #20303

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
12 files changed:
runtime/doc/gui.txt
runtime/doc/gui_w32.txt
runtime/doc/options.txt
runtime/doc/tags
runtime/doc/version9.txt
src/gui.c
src/gui_gtk.c
src/gui_gtk4.c
src/gui_gtk_x11.c
src/proto/gui_gtk.pro
src/proto/gui_gtk4.pro
src/version.c

index 9965e3dd402fed78f1ac4a9364b94023c9671656..3a9feac715c0f6198f31b105a6cd38d77a315d46 100644 (file)
@@ -1,4 +1,4 @@
-*gui.txt*      For Vim version 9.2.  Last change: 2026 Apr 07
+*gui.txt*      For Vim version 9.2.  Last change: 2026 May 25
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1254,6 +1254,32 @@ A recommended Japanese font is MS Mincho.  You can find info here:
 https://learn.microsoft.com/en-us/typography/font-list/ms-mincho
 It should be distributed with Windows.
 
+
+Full Screen                                            *gui-fullscreen*
+
+Fullscreen mode is currently only supported in the Windows and GTK GUI
+versions of Vim.
+
+To enable fullscreen mode in the 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.
+
+
 ==============================================================================
 8. Shell Commands                                      *gui-shell*
 
index 2e2e2601d00dd10a9e19c64d03d24b8aa0505055..26c516d895b2e8d008b4dcbf1bfa0f222d749d5d 100644 (file)
@@ -1,4 +1,4 @@
-*gui_w32.txt*  For Vim version 9.2.  Last change: 2026 Feb 14
+*gui_w32.txt*  For Vim version 9.2.  Last change: 2026 May 25
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -505,25 +505,4 @@ To use the system's default title bar colors, set highlighting groups to
        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:
index bfab0a87b411f7c5a0430a26e00800cc45b22862..6dc518cc758aa152a79057ce850fc285d60c682d 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.2.  Last change: 2026 May 22
+*options.txt*  For Vim version 9.2.  Last change: 2026 May 25
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -4613,10 +4613,10 @@ A jump table for the options with a short description can be found at |Q_op|.
                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|.
+               MS-Windows and GTK 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-fullscreen|.
                                                                *'go-r'*
          'r'   Right-hand scrollbar is always present.
                                                                *'go-R'*
index 7cd0074a6a9ec3d7d96ad89ce83e0feb4791b853..878f0f520a358d3d4ea1e1786b1db6b92ee983a5 100644 (file)
@@ -8257,6 +8257,7 @@ gui-font  gui.txt /*gui-font*
 gui-fontwide   gui.txt /*gui-fontwide*
 gui-footer     debugger.txt    /*gui-footer*
 gui-fork       gui_x11.txt     /*gui-fork*
+gui-fullscreen gui.txt /*gui-fullscreen*
 gui-functions  usr_41.txt      /*gui-functions*
 gui-gnome      gui_x11.txt     /*gui-gnome*
 gui-gnome-session      gui_x11.txt     /*gui-gnome-session*
@@ -8286,7 +8287,6 @@ gui-vert-scroll   gui.txt /*gui-vert-scroll*
 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*
index 4f7b9b62da6b1877fe98bc92bac7ba473a0e167a..2bea93a32330d03da363596a340166e542ff2311 100644 (file)
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.2.  Last change: 2026 May 22
+*version9.txt* For Vim version 9.2.  Last change: 2026 May 25
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -52589,6 +52589,7 @@ GUI ~
 -----
 - Added support for the GTK 4 GUI (via patch 9.2.0501).  Enable with
   `--enable-gui=gtk4` configure switch at build time.
+- Add support for fullscreen mode in the GTK UI |'go-s'|.
 
 Popups ~
 ------
index b04f132163f353a25b4bb6ff640d7443d98b33cb..8cf4c8fa48378e92e32353a6171a673772466a78 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -158,7 +158,7 @@ gui_start(char_u *arg UNUSED)
        choose_clipmethod();
 #endif
 
-#ifdef FEAT_GUI_MSWIN
+#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)
     // Enable fullscreen mode
     if (vim_strchr(p_go, GO_FULLSCREEN) != NULL)
        gui_mch_set_fullscreen(TRUE);
@@ -3512,7 +3512,9 @@ gui_init_which_components(char_u *oldval UNUSED)
 #ifdef FEAT_GUI_MSWIN
     static int prev_titlebar = FALSE;
     int                using_titlebar = FALSE;
+#endif
 
+#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)
     static int prev_fullscreen = FALSE;
     int                using_fullscreen = FALSE;
 #endif
@@ -3589,6 +3591,8 @@ gui_init_which_components(char_u *oldval UNUSED)
            case GO_TITLEBAR:
                using_titlebar = TRUE;
                break;
+#endif
+#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)
            case GO_FULLSCREEN:
                using_fullscreen = TRUE;
                break;
@@ -3620,7 +3624,9 @@ gui_init_which_components(char_u *oldval UNUSED)
        gui_mch_set_titlebar_colors();
        prev_titlebar = using_titlebar;
     }
+#endif
 
+#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK)
     if (using_fullscreen != prev_fullscreen)
     {
        gui_mch_set_fullscreen(using_fullscreen);
index 77f96179e19ade02959a969e13ef147fd6a4f17f..84eae6d41b86e99bd65ec0c6a670300a385a054e 100644 (file)
@@ -2611,3 +2611,12 @@ recent_func_log_func(const gchar *log_domain UNUSED,
     // http://bugzilla.gnome.org/show_bug.cgi?id=664587
 }
 #endif
+
+    void
+gui_mch_set_fullscreen(int flag)
+{
+    if (flag)
+       gtk_window_fullscreen(GTK_WINDOW(gui.mainwin));
+    else
+       gtk_window_unfullscreen(GTK_WINDOW(gui.mainwin));
+}
index c12256790e8cd3a45e9a55a8434c3ba6abb09fd5..9cbffb3c9e2af380e3138ad97fe1e80711db794a 100644 (file)
@@ -280,6 +280,7 @@ static gboolean drop_cb(GtkDropTarget *target, const GValue *value, double x, do
 #endif
 static void mainwin_destroy_cb(GObject *object, gpointer data);
 static gboolean delete_event_cb(GtkWindow *window, gpointer data);
+static void mainwin_fullscreened_cb(GObject *obj, GParamSpec *pspec, gpointer user_data);
 static void drawarea_realize_cb(GtkWidget *widget, gpointer data);
 static void drawarea_unrealize_cb(GtkWidget *widget, gpointer data);
 static void drawarea_resize_cb(GtkDrawingArea *area, int width, int height, gpointer data);
@@ -449,6 +450,8 @@ gui_mch_init(void)
 
     g_signal_connect(G_OBJECT(gui.mainwin), "close-request",
                     G_CALLBACK(delete_event_cb), NULL);
+    g_signal_connect(G_OBJECT(gui.mainwin), "notify::fullscreened",
+                    G_CALLBACK(mainwin_fullscreened_cb), NULL);
 
     // A vertical box holds the menubar, toolbar and main text window.
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
@@ -747,6 +750,26 @@ gui_mch_unmaximize(void)
        gtk_window_unmaximize(GTK_WINDOW(gui.mainwin));
 }
 
+    void
+gui_mch_set_fullscreen(int flag)
+{
+    if (gui.mainwin == NULL)
+       return;
+    if (flag)
+       gtk_window_fullscreen(GTK_WINDOW(gui.mainwin));
+    else
+       gtk_window_unfullscreen(GTK_WINDOW(gui.mainwin));
+}
+
+    static void
+mainwin_fullscreened_cb(GObject *obj,
+       GParamSpec *pspec UNUSED, gpointer user_data UNUSED)
+{
+    // Force a redraw of the drawing area when entering fullscreen mode.
+    if (gtk_window_is_fullscreen(GTK_WINDOW(obj)))
+       gui_focus_change(TRUE);
+}
+
 /*
  * Called when the font changed while the window is maximized or GO_KEEPWINSIZE
  * is set.  Recalculate Rows and Columns based on the current window size.
index b47941acba597f415c8f249093bd19a5f3da893c..44b95345fe74c40af12c850528f533c90e835bbb 100644 (file)
@@ -2850,6 +2850,18 @@ mainwin_screen_changed_cb(GtkWidget  *widget,
     }
 }
 
+    static gboolean
+mainwin_state_event_cb(GtkWidget *widget UNUSED,
+                      GdkEventWindowState *event,
+                      gpointer user_data UNUSED)
+{
+    if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
+       // To redraw the text area when switching to fullscreen mode, we will
+       // reuse the `gui_focus_change` method.
+       gui_focus_change(TRUE);
+    return FALSE;
+}
+
 /*
  * After the drawing area comes up, we calculate all colors and create the
  * dummy blank cursor.
@@ -3826,6 +3838,9 @@ gui_mch_init(void)
     g_signal_connect(G_OBJECT(gui.mainwin), "screen-changed",
                     G_CALLBACK(&mainwin_screen_changed_cb), NULL);
 
+    g_signal_connect(G_OBJECT(gui.mainwin), "window-state-event",
+                    G_CALLBACK(&mainwin_state_event_cb), NULL);
+
     gui.accel_group = gtk_accel_group_new();
     gtk_window_add_accel_group(GTK_WINDOW(gui.mainwin), gui.accel_group);
 
index 7b87ba00bdb79a896ec5a8d4ce676055fb081a51..9b69c69418a111068764d237fdae0c6b253c5f2a 100644 (file)
@@ -21,4 +21,5 @@ void gui_make_popup(char_u *path_name, int mouse_pos);
 void gui_mch_find_dialog(exarg_T *eap);
 void gui_mch_replace_dialog(exarg_T *eap);
 void ex_helpfind(exarg_T *eap);
+void gui_mch_set_fullscreen(int flag);
 /* vim: set ft=c : */
index 7359c750c79790c5c1684ebbf8957fb3ed3fd5ef..10f3ccc20286b8e2930f9894ac4ac0618562aa41 100644 (file)
@@ -16,6 +16,7 @@ int gui_mch_get_winpos(int *x, int *y);
 void gui_mch_set_winpos(int x, int y);
 int gui_mch_maximized(void);
 void gui_mch_unmaximize(void);
+void gui_mch_set_fullscreen(int flag);
 void gui_mch_newfont(void);
 void gui_mch_settitle(char_u *title, char_u *icon);
 void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction);
index 2056d71108e89611cadb3420eff35baf357a0eaa..14ae41df75cb9d6dd95cea0622f5ef7ccdc0921a 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    534,
 /**/
     533,
 /**/