[vim/vim] Add --enable-gui=gtk4 support (PR #19815)

83 views
Skip to first unread message

mattn

unread,
Mar 25, 2026, 3:50:24 AMMar 25
to vim/vim, Subscribed

Add GTK4 GUI backend using separate source files instead of adding conditional branches to the existing GTK2/GTK3 code. GTK4's API changes are too fundamental for #if branching to be maintainable.

This PR was developed with the assistance of Claude Code (Anthropic).

Build

./configure --enable-gui=gtk4
make

Requires GTK 4.10+ (for GtkFontDialog).

New files

  • gui_gtk4_f.c/h — GtkForm widget (extends GtkWidget, uses GskTransform)
  • gui_gtk4_x11.c — Main GUI implementation (events, drawing, fonts, colors)
  • gui_gtk4.c — Scrollbars, dialogs, menu stubs

What works

  • Window display and resizing
  • Text rendering (Pango glyph string based)
  • Key input via GtkEventController
  • Mouse events (click, motion, scroll, focus)
  • Background/foreground colors and colorschemes
  • Font selection dialog (:set guifont=*) via GtkFontDialog
  • Scrollbar show/hide
  • :q! exit
  • Plugin compatibility (vim-lsp, vim-lsp-settings)

What's not implemented yet

  • Menu system (GTK4 uses GMenu/GtkPopoverMenuBar)
  • Toolbar
  • File chooser dialog (:browse)
  • Message dialog (gui_mch_dialog)
  • Find/Replace dialog
  • Clipboard (GTK4 uses GdkClipboard)
  • Cursor blinking
  • Screen scrolling (gui_mch_delete_lines / gui_mch_insert_lines)
  • Drag and drop
  • XIM input method support
  • Sign icons
  • Balloon eval (tooltips)

This is a work in progress.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19815

Commit Summary

  • f58481f Add 'pumopacity' option for popup menu transparency
  • c072e40 pumopacity: move blend processing into screen_puts_len/screen_fill
  • 31efdf1 pumopacity: add hl_pum_blend_attr() for correct fg/bg blending
  • 97c745e pumopacity: remove dead code and fix duplicate condition
  • 5311443 pumopacity: add tests for 'pumopacity' option
  • f7cf5cb pumopacity: remove stray blank line in popupmenu.c
  • 1abdde6 pumopacity: fix build error when FEAT_PROP_POPUP is not defined
  • 26ba5c6 pumopacity: mark blend param UNUSED in hl_pum_blend_attr()
  • 79ef5cd pumopacity: fix did_set_pumopacity() order in proto file
  • 5aedbfe Fix pum opacity background mismatch after window resize
  • c563743 pumopacity: fix option sort order in optiondefs.h
  • 1667043 Add 'pumopt' option to consolidate pum settings
  • 6f50ba8 Remove 'pumopacity' option, use 'pumopt' opacity: instead
  • b584731 Add 'pumopt' tag to doc/tags
  • f3f49e6 Add --enable-gui=gtk4 support with separate GTK4 implementation

File Changes

(36 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815@github.com>

mattn

unread,
Mar 25, 2026, 3:52:34 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 311b6cf Add --enable-gui=gtk4 support with separate GTK4 implementation


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/f3f49e6bf44e9bc46b14da835c156d125a92be46/after/311b6cf711abd65e5f85c04da375ed84716e1ad1@github.com>

mattn

unread,
Mar 25, 2026, 9:50:19 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 7328942 GTK4: implement cursor, scrolling, mouse, dialogs


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/311b6cf711abd65e5f85c04da375ed84716e1ad1/after/7328942e9f8cb070a3d3e9c977eb65bd6bd87fee@github.com>

mattn

unread,
Mar 25, 2026, 10:11:32 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 0a8b2b7 GTK4: implement clipboard, signs, tabline, mouse shape, and more


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/7328942e9f8cb070a3d3e9c977eb65bd6bd87fee/after/0a8b2b75f470ed98bce0fddf74aa557383517ef2@github.com>

mattn

unread,
Mar 25, 2026, 10:18:28 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 3965ef6 GTK4: default window size to 80x24


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/0a8b2b75f470ed98bce0fddf74aa557383517ef2/after/3965ef63426365712adf3c0aefd6ebc256b4c00a@github.com>

mattn

unread,
Mar 25, 2026, 10:22:41 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 9d95aae GTK4: implement drag-and-drop, geometry, cleanup


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/3965ef63426365712adf3c0aefd6ebc256b4c00a/after/9d95aaee9e8162cc38ffac54962dfe98d6f24094@github.com>

mattn

unread,
Mar 25, 2026, 11:01:51 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 7f9cead GTK4: add GtkIMContext input method support


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/9d95aaee9e8162cc38ffac54962dfe98d6f24094/after/7f9cead4895cadea16bb2b7e800e9a9973e7d737@github.com>

mattn

unread,
Mar 25, 2026, 11:09:12 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 2c5b2f2 GTK4: implement Find/Replace dialog


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/7f9cead4895cadea16bb2b7e800e9a9973e7d737/after/2c5b2f28c0c1b790023a6fdbddc1b6bee5233d3c@github.com>

mattn

unread,
Mar 25, 2026, 11:13:52 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/2c5b2f28c0c1b790023a6fdbddc1b6bee5233d3c/after/8f930602896e12971f2908865c6dbb69debe4217@github.com>

mattn

unread,
Mar 25, 2026, 11:18:39 AMMar 25
to vim/vim, Push

@mattn pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/8f930602896e12971f2908865c6dbb69debe4217/after/2a841df6e91a95dd20cd42b46be4cdd49c074c83@github.com>

mattn

unread,
Mar 25, 2026, 12:01:52 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 006fedf GTK4: fix white screen and resize loop


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/565b3198d51c34c79ab8387f936b2ec83923b399/after/006fedfa8dbafe2c7b5f2fe04f9c2fe83cda1992@github.com>

mattn

unread,
Mar 25, 2026, 12:11:08 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 84765e0 GTK4: implement menu system with GMenu/GtkPopoverMenuBar


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/006fedfa8dbafe2c7b5f2fe04f9c2fe83cda1992/after/84765e05d40a02c38e6f1b60b74930f6886b1c88@github.com>

mattn

unread,
Mar 25, 2026, 12:55:04 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 6d5eb11 GTK4: fix resize handling and scrollbar layout


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/84765e05d40a02c38e6f1b60b74930f6886b1c88/after/6d5eb1115eab11c9c2a0209a20e922d5ca738513@github.com>

mattn

unread,
Mar 25, 2026, 1:18:46 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 94732fa GTK4: fix vertical resize shrink


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/6d5eb1115eab11c9c2a0209a20e922d5ca738513/after/94732fa4255a8a7e0de5a13e0e3272aa77d4c273@github.com>

Christian Brabandt

unread,
Mar 25, 2026, 3:46:54 PMMar 25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19815)

wow, very nice. Can you share a screenshot of vim --clean -g ?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4129319385@github.com>

Foxe Chen

unread,
Mar 25, 2026, 7:07:00 PMMar 25
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#19815)

I think the GTK4 port of GVim should focus more on Wayland instead of X11, which is already deprecated and will be removed in GTK5. I suppose there are issues with keyboard layout detection, but there a much more users that have it working fine. Having a 2800 line file called "gui_gtk4_x11.c" does not feel right...


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4130395354@github.com>

mattn

unread,
Mar 25, 2026, 8:27:29 PMMar 25
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

@chrisbra

Default GDK backend is x11

image.png (view on web) image.png (view on web) image.png (view on web) image.png (view on web)
$ GDK_BACKEND=wayland GSK_RENDERER=cairo ./vim -gf
image.png (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4130712103@github.com>

mattn

unread,
Mar 25, 2026, 8:28:11 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • cd26f51 GTK4: use GtkOverlay for drawarea auto-resize


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/94732fa4255a8a7e0de5a13e0e3272aa77d4c273/after/cd26f519ae83fa838b57c47e999181c1276fbcd1@github.com>

mattn

unread,
Mar 25, 2026, 8:31:12 PMMar 25
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

Currently the only X11 dependency in the GTK4 backend is XParseGeometry from <X11/Xutil.h>. By implementing our own geometry parser, we can remove the X11 dependency entirely and switch the default GDK_BACKEND to Wayland.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4130724398@github.com>

mattn

unread,
Mar 25, 2026, 8:32:11 PMMar 25
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

This also means we could rename gui_gtk4_x11.c to gui_gtk4.c since it would no longer have any X11 dependency.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4130727588@github.com>

mattn

unread,
Mar 25, 2026, 9:12:15 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 3c70ced GTK4: add new files to Filelist for CI packaging check


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/cd26f519ae83fa838b57c47e999181c1276fbcd1/after/3c70cedc32f08c19673a8d092a33c4bca8f9bed8@github.com>

mattn

unread,
Mar 25, 2026, 10:44:52 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 42c3d16 GTK4: merge gui_gtk4_x11.c into gui_gtk4.c


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/3c70cedc32f08c19673a8d092a33c4bca8f9bed8/after/42c3d1697f0659d90c966426e8e08f36fd1eb6b7@github.com>

mattn

unread,
Mar 25, 2026, 11:01:42 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 13343a1 GTK4: fix preprocessor indent in gui_xim.c


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/42c3d1697f0659d90c966426e8e08f36fd1eb6b7/after/13343a1106d36791c86b18ec587c3f9db9c97548@github.com>

mattn

unread,
Mar 25, 2026, 11:06:41 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • ab3601d GTK4: suppress EGL warnings when GL is unavailable


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/13343a1106d36791c86b18ec587c3f9db9c97548/after/ab3601d18477100a1a0cc53e7e531a03929fd3af@github.com>

mattn

unread,
Mar 25, 2026, 11:28:03 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 37cfce5 GTK4: fix scrollbar CRITICAL warnings


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/ab3601d18477100a1a0cc53e7e531a03929fd3af/after/37cfce59dd787747547f0576a5a4f102d61169ee@github.com>

mattn

unread,
Mar 25, 2026, 11:43:21 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 4d8ff9f GTK4: remove direct X11 dependency


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/37cfce59dd787747547f0576a5a4f102d61169ee/after/4d8ff9f59a36e290753e5d8a828d6604ddbc04d6@github.com>

mattn

unread,
Mar 25, 2026, 11:46:14 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • 3c84d69 GTK4: remove direct X11 dependency


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/4d8ff9f59a36e290753e5d8a828d6604ddbc04d6/after/3c84d69946c1a4f78ca78ee804c99d30c68efc06@github.com>

mattn

unread,
Mar 25, 2026, 11:47:43 PMMar 25
to vim/vim, Push

@mattn pushed 1 commit.

  • cb39dfa GTK4: remove direct X11 dependency


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/3c84d69946c1a4f78ca78ee804c99d30c68efc06/after/cb39dfa10795a9743bd4c8a9734d90a598e9304a@github.com>

mattn

unread,
Mar 25, 2026, 11:53:22 PMMar 25
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)
The GTK4 port now has zero direct X11 dependency 💪

$ nm -u ./vim | grep -i '^.\+U.*X[A-Z]' | grep -v 'gdk\|gtk\|glib\|pango\|cairo\|GLIBC\|g_\|getx'
(no output)

The X11 libraries shown by ldd are all indirect dependencies pulled in by libgtk-4.so itself, not by Vim's code.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4131448529@github.com>

mattn

unread,
Mar 26, 2026, 12:33:41 AMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • 3faccb8 GTK4: fix text rendering, wide chars, and cursor focus


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/cb39dfa10795a9743bd4c8a9734d90a598e9304a/after/3faccb889a0856d6d5a8e3c7c670b4f2ebafd241@github.com>

mattn

unread,
Mar 26, 2026, 12:35:49 AMMar 26
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

Multi-byte characters are now rendering correctly. Getting close to completion.

image.png (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4131597573@github.com>

Foxe Chen

unread,
Mar 26, 2026, 5:03:37 AMMar 26
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#19815)

I am getting build errors when trying to compile this PR. It seems that multiple functions in gui_gtk4.c are not exposed in the .pro file


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4132849630@github.com>

mattn

unread,
Mar 26, 2026, 6:24:30 AMMar 26
to vim/vim, Push

@mattn pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/3faccb889a0856d6d5a8e3c7c670b4f2ebafd241/after/7db1c98d1dba503ad00312cab3603ff94732264a@github.com>

mattn

unread,
Mar 26, 2026, 6:25:01 AMMar 26
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

Sorry, the proto file was broken when gui_gtk4_x11.c was merged into gui_gtk4.c. It should be fixed now.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4133397059@github.com>

mattn

unread,
Mar 26, 2026, 7:17:59 AMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • 8881f7e GTK4: fix GTK_MENU_SHELL stub to accept an argument


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/7db1c98d1dba503ad00312cab3603ff94732264a/after/8881f7e4573af1c2e75740e1bc2964372d681c60@github.com>

Foxe Chen

unread,
Mar 26, 2026, 7:29:19 AMMar 26
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#19815)

Here are some compilation errors I am getting on Linux:

getchar.c: In function ‘vgetc’:
getchar.c:2023:44: error: passing argument 1 of ‘gtk_menu_shell_select_first’ makes pointer from integer without a cast [-Wint-conversion]
 2023 |                                            GTK_MENU_SHELL(gui.menubar), FALSE);
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                            |
      |                                            GType {aka long unsigned int}
In file included from proto.h:306,
                 from vim.h:2525,
                 from getchar.c:15:
proto/gui_gtk4.pro:90:40: note: expected ‘void *’ but argument is of type ‘GType’ {aka ‘long unsigned int’}
   90 | void gtk_menu_shell_select_first(void *shell, gboolean sr);
      |                                  ~~~~~~^~~~~
optionstr.c: In function ‘expand_set_guifont’:
optionstr.c:2680:19: error: passing argument 2 of ‘expand_set_opt_callback’ from incompatible pointer type [-Wincompatible-pointer-types]
 2680 |             args, gui_mch_expand_font, &wide, numMatches, matches);
      |                   ^~~~~~~~~~~~~~~~~~~
      |                   |
      |                   int (*)(optexpand_T *, int *, char_u ***) {aka int (*)(optexpand_T *, int *, unsigned char ***)}
optionstr.c:960:16: note: expected ‘void (*)(optexpand_T *, void *, int (*)(char_u *))’ {aka ‘void (*)(optexpand_T *, void *, int (*)(unsigned char *))’} but argument is of type ‘int (*)(optexpand_T *, int *, char_u ***)’ {aka ‘int (*)(optexpand_T *, int *, unsigned char ***)’}
  960 |         void (*func)(optexpand_T *, void* params, int (*cb)(char_u *val)),
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from proto.h:306,
                 from vim.h:2525,
                 from optionstr.c:14:
proto/gui_gtk4.pro:32:5: note: ‘gui_mch_expand_font’ declared here
   32 | int gui_mch_expand_font(optexpand_T *args, int *numMatches, char_u ***matches);
      |     ^~~~~~~~~~~~~~~~~~~


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4133830578@github.com>

mattn

unread,
Mar 26, 2026, 7:32:14 AMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • ed14f69 GTK4: fix gui_get_x11_windis() return type


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/8881f7e4573af1c2e75740e1bc2964372d681c60/after/ed14f6958bc3c7e355ada2c8f506b15eb46f335a@github.com>

mattn

unread,
Mar 26, 2026, 7:41:35 AMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • 958364e GTK4: exclude GtkMenuShell code instead of using stubs


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/ed14f6958bc3c7e355ada2c8f506b15eb46f335a/after/958364eaf9f299f7d37bac5fe3bba49f03dbb65d@github.com>

mattn

unread,
Mar 26, 2026, 1:17:15 PMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • 525e91b GTK4: replace deprecated gtk_widget_show() with gtk_widget_set_visible()


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/958364eaf9f299f7d37bac5fe3bba49f03dbb65d/after/525e91b7f6b28fcdff16c1732ab2e7f7ee6562e1@github.com>

mattn

unread,
Mar 26, 2026, 1:18:59 PMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • 9bbf6eb GTK4: fix deprecated GTK API calls in gui_xim.c


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/525e91b7f6b28fcdff16c1732ab2e7f7ee6562e1/after/9bbf6ebc3dff9782cd79007f965e326459fd198f@github.com>

mattn

unread,
Mar 26, 2026, 1:23:14 PMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • 760f609 GTK4: use modern GDK key symbols in gui_beval.c


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/9bbf6ebc3dff9782cd79007f965e326459fd198f/after/760f609c183775c8d761f6269a1e76ca4a8b42d0@github.com>

mattn

unread,
Mar 26, 2026, 1:25:47 PMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • b6c0237 GTK4: reject non-empty 'imactivatekey' values


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/760f609c183775c8d761f6269a1e76ca4a8b42d0/after/b6c0237f5b7657ccbef3878af45e11bbdee8d90b@github.com>

Philip H.

unread,
Mar 26, 2026, 1:27:04 PMMar 26
to vim/vim, Subscribed
pheiduck left a comment (vim/vim#19815)

I build w/ gtk4 overtime, but may it makes no sense until this gets merge. Thx for your work @mattn


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4136814449@github.com>

Ruben Gonzalez

unread,
Mar 26, 2026, 3:40:22 PMMar 26
to vim/vim, Subscribed
gonzaru left a comment (vim/vim#19815)

Thank @mattn this looks very interesting! :)

(GNU/Linux dwm x11)

This is a screenshot with the black version with set guioptions+=d

vim-gtk4.png (view on web)

I understand that this still in beta fase, For now I was able to build it without problems, but I can only start it using gvim --nofork (without --nofork, does not start).

Thanks again and I hope that this will be merged when ready!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4137720895@github.com>

mattn

unread,
Mar 26, 2026, 8:11:15 PMMar 26
to vim/vim, Push

@mattn pushed 1 commit.

  • 0b69825 GTK4: move gtk_init() from gui_mch_prepare() to gui_mch_init_check()


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/b6c0237f5b7657ccbef3878af45e11bbdee8d90b/after/0b69825dc9f2ee93b0489d35de153361099c9691@github.com>

mattn

unread,
Mar 26, 2026, 10:36:01 PMMar 26
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

Since I'm developing this on WSL2, I haven't been able to test the Broadway backend yet. If you have a native Linux environment, you should be able to run gvim in a browser:

  1. Start broadwayd :5
  2. Run GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 ./vim -gf
  3. Open http://localhost:8085 in your browser

You should see gvim running inside the browser. I'd appreciate it if someone could give it a try!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4139706863@github.com>

mattn

unread,
Mar 27, 2026, 5:41:29 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • e39b4c5 GTK4: fix deprecated gtk_image_new_from_pixbuf and gui_mch_expand_font signature


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/0b69825dc9f2ee93b0489d35de153361099c9691/after/e39b4c568518318b723b6433fb1d16454fe31dca@github.com>

Ruben Gonzalez

unread,
Mar 27, 2026, 5:46:23 AMMar 27
to vim/vim, Subscribed
gonzaru left a comment (vim/vim#19815)

Hello,

I can't really test it properly, but following the recent GTK4 updates, the --nofork issue is now resolved and it's not needed anymore, starts well by default now.

Small things that I quickly detect when use it:

  1. Empty WM_CLASS (X11)

When running in an X11 environment, the WM_CLASS attribute is empty. This prevents window managers (I use dwm) from correctly identifying the application, applying window rules, or displaying the correct icon.

Command: xprop

Output: WM_CLASS(STRING) = "", ""

(gtk2, gtk3) already has this by default.
Expected: WM_CLASS(STRING) = "gvim", "Gvim" 
  1. Crash when setting guioptions=k

Setting the k flag (Keep window size) in guioptions causes an immediate crash.

Steps to reproduce:

    Start gvim: gvim --clean

    Run: :set guioptions=k

Result: Segmented fault / Crash.
  1. Ligatures are not rendering

Even with a supported font and the guiligatures option set, symbols are not displayed as expected.

Steps to reproduce:

    :set guiligatures==!><

    Input text: != <= >=

Result: Characters are rendered individually rather than as a single ligature glyph.
  1. X11 Feature missing in :version

The :version output shows -X11. While this is a GTK4 build, it is unclear if certain X11-specific integrations (like clipboard or session management) are intentionally disabled or if this is a configuration error in the build as you said before.

Thank you, this looks promising!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4141418468@github.com>

mattn

unread,
Mar 27, 2026, 5:50:58 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • 65917b3 GTK4: fix deprecated gtk_image_new_from_pixbuf and gui_mch_expand_font signature


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/e39b4c568518318b723b6433fb1d16454fe31dca/after/65917b34a7ebf2376910a5224283380998d70131@github.com>

mattn

unread,
Mar 27, 2026, 6:06:21 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • 2dcc011 GTK4: fix crash when setting guioptions=k


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/65917b34a7ebf2376910a5224283380998d70131/after/2dcc011fc2be863ffcedb42c1780cd5b6ec36c63@github.com>

mattn

unread,
Mar 27, 2026, 6:09:45 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • 931846e GTK4: set WM_CLASS by calling g_set_prgname("gvim")


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/2dcc011fc2be863ffcedb42c1780cd5b6ec36c63/after/931846e718d699d9aba42ef324c57b47098845be@github.com>

mattn

unread,
Mar 27, 2026, 6:20:17 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • 7a9ca32 GTK4: add ligature support for 'guiligatures' option


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/931846e718d699d9aba42ef324c57b47098845be/after/7a9ca32ba159ec3361b10c7c1981365e98772667@github.com>

mattn

unread,
Mar 27, 2026, 6:25:03 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • a592f36 GTK4: use flat style for toolbar buttons


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/7a9ca32ba159ec3361b10c7c1981365e98772667/after/a592f36fe09f8a4800e9a82cdfde346d9a630689@github.com>

mattn

unread,
Mar 27, 2026, 6:37:34 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • 3836369 GTK4: fix mouse click, selection, and drag not working


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/a592f36fe09f8a4800e9a82cdfde346d9a630689/after/3836369157307177b9f460ae478bb0cde52b9a56@github.com>

mattn

unread,
Mar 27, 2026, 6:42:49 AMMar 27
to vim/vim, Push

@mattn pushed 1 commit.

  • fa1a92b GTK4: fix popup ghosting by requesting widget redraw on flush


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/3836369157307177b9f460ae478bb0cde52b9a56/after/fa1a92bab5c5fa7241042cdc3cdf9a203aed9535@github.com>

mattn

unread,
Mar 27, 2026, 6:43:20 AMMar 27
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

Improved the toolbar appearance by using flat style buttons, which removes the raised/bordered look.

image.png (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4141714759@github.com>

mattn

unread,
Mar 27, 2026, 6:47:16 AMMar 27
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

@gonzaru Thank you for the detailed report! The three issues you reported have been fixed:

  1. Crash on set guioptions=k — Fixed infinite recursion in gui_mch_newfont().
  2. Ligatures not rendering — Ported the ligature rendering logic from GTK3 to GTK4.
  3. Mouse click/selection/drag not working — Fixed event targeting (overlay was intercepting events) and drag detection.

Regarding -X11 in :version: this is intentional. This GTK4 port removes direct X11 dependencies. gvim no longer depends on X11 directly. It still works on X11 servers, but only through GTK4's GDK backend abstraction, not via direct X11 API calls.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4141734347@github.com>

mattn

unread,
Mar 27, 2026, 6:49:01 AMMar 27
to vim/vim, Subscribed
mattn left a comment (vim/vim#19815)

@gonzaru Thank you for the detailed report! The three issues you reported have been fixed:

  1. WM_CLASS empty — Added g_set_prgname("gvim") so WM_CLASS is set correctly on X11.
  1. Crash on set guioptions=k — Fixed infinite recursion in gui_mch_newfont().
  2. Ligatures not rendering — Ported the ligature rendering logic from GTK3 to GTK4.

    Regarding -X11 in :version: this is intentional. This GTK4 port removes direct X11 dependencies. gvim no longer depends on X11 directly. It still works on X11 servers, but only through GTK4's GDK backend abstraction, not via direct X11 API calls.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4141743702@github.com>

    mattn

    unread,
    Mar 27, 2026, 6:58:55 AMMar 27
    to vim/vim, Push

    @mattn pushed 1 commit.

    • 3e56574 GTK4: grab focus on mouse enter to fix hollow cursor


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/fa1a92bab5c5fa7241042cdc3cdf9a203aed9535/after/3e56574dce02537b565e21e0ead8a4c30a25c471@github.com>

    mattn

    unread,
    Mar 27, 2026, 7:03:46 AMMar 27
    to vim/vim, Push

    @mattn pushed 1 commit.

    • e73d1dc GTK4: fix ghost artifacts after :vsp by not copying stale surface


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/3e56574dce02537b565e21e0ead8a4c30a25c471/after/e73d1dcab3a732ec1cee207fc06a11c9c6b551ce@github.com>

    Ruben Gonzalez

    unread,
    Mar 27, 2026, 7:21:02 AMMar 27
    to vim/vim, Subscribed
    gonzaru left a comment (vim/vim#19815)

    @gonzaru Thank you for the detailed report! The three issues you reported have been fixed:

    1. **WM_CLASS empty** — Added `g_set_prgname("gvim")` so WM_CLASS is set correctly on X11.
    
    2. **Crash on `set guioptions=k`** — Fixed infinite recursion in `gui_mch_newfont()`.
    
    3. **Ligatures not rendering** — Ported the ligature rendering logic from GTK3 to GTK4.
    

    Regarding -X11 in :version: this is intentional. This GTK4 port removes direct X11 dependencies. gvim no longer depends on X11 directly. It still works on X11 servers, but only through GTK4's GDK backend abstraction, not via direct X11 API calls.

    I can confirm that 2. and 3 ara resolved. The crash is fixed and ligatures works!

    About 1. the WM_CLASS reports:

    WM_CLASS(STRING) = "gvim", "gvim"

    Needs to be:

    WM_CLASS(STRING) = "gvim", "Gvim"

    This is how gtk2 and gkt3 also report its, as the class name the standard is to capitalize it.

    The spec states that WM_CLASS must contain two consecutive null-terminated strings:

    Instance Name: Identifies the specific instance (used for specific resource lookups).
    
    Class Name: Identifies the general class of the application (used for grouping and general rules).
    

    (4.1.2.5. WM_CLASS Property)
    https://tronche.com/gui/x/icccm/sec-4.html

    I will try to check more things this weekend and report it if necessary.

    Regards


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4141903523@github.com>

    mattn

    unread,
    Mar 27, 2026, 8:22:09 AMMar 27
    to vim/vim, Push

    @mattn pushed 1 commit.

    • 7f7bfb1 GTK4: add StartupWMClass=Gvim to gvim.desktop


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/e73d1dcab3a732ec1cee207fc06a11c9c6b551ce/after/7f7bfb1a96bf714dd4f18fb385cceeee8f42cbdc@github.com>

    mattn

    unread,
    Mar 27, 2026, 8:22:57 AMMar 27
    to vim/vim, Subscribed
    mattn left a comment (vim/vim#19815)

    @gonzaru Thanks for the clarification on WM_CLASS.

    WM_CLASS is an X11-specific property that GTK4 no longer sets directly. The correct way to handle this in GTK4 is through the StartupWMClass field in the desktop entry file. Added StartupWMClass=Gvim to runtime/gvim.desktop.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4142212749@github.com>

    Ruben Gonzalez

    unread,
    Mar 27, 2026, 9:50:02 AMMar 27
    to vim/vim, Subscribed
    gonzaru left a comment (vim/vim#19815)

    @mattn Yes I understand to do not focus on x11 specific for now. As you said, the .desktop way can helps to this then, as it will add the correct class name on the fly.

    Just in case, another small bug:

    (crash on console dialogs)

    1. gvim --clean
    2. :set guioptions+=c
    3. :set confirm
    4. write anything in the buffer
    5. :q

    It will show a console dialog, but the gvim freeze an does not respond anymore.

    With the gui dialog: (with :set guioptions-=c)

    1. gvim --clean
    2. :set confirm
    3. write anyting in the buffer
    4. :q

    Works, nut the text of the dialog are not labeled correctly and can confusing.

    p1.png (view on web)


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4142732354@github.com>

    mattn

    unread,
    Mar 27, 2026, 11:52:08 AMMar 27
    to vim/vim, Push

    @mattn pushed 2 commits.

    • 22a7c00 GTK4: fix hang on console dialog with :q and 'confirm'
    • 3fc5cc7 GTK4: fix dialog button labels showing corrupted text


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/7f7bfb1a96bf714dd4f18fb385cceeee8f42cbdc/after/3fc5cc7fa742c9ae147866c3ffa85789deae71e6@github.com>

    mattn

    unread,
    Mar 27, 2026, 12:01:40 PMMar 27
    to vim/vim, Subscribed
    mattn left a comment (vim/vim#19815)

    @gonzaru Thank you for the detailed reports! The following two issues have been fixed and pushed:

    1. Console dialog freeze (guioptions+=c + confirm + :q) — The GTK4-specific exiting check in gui_mch_wait_for_chars() caused it to bail out immediately without waiting for key input. Removed to match GTK3 behavior.

    2. GUI dialog button labels corrupted ("on" / "no" instead of "Yes" / "No") — The button label strings were used after the backing buffer was freed (use-after-free). Fixed the lifetime management.

    Regarding the ligature issue at cursor position (#12901): this is a pre-existing bug that affects GTK2/GTK3 as well, not specific to GTK4. The cursor is drawn with gui_screenchar() which renders only a single character, breaking the ligature context that Pango needs. This will be addressed separately.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4143616852@github.com>

    Ruben Gonzalez

    unread,
    Mar 27, 2026, 3:17:17 PMMar 27
    to vim/vim, Subscribed
    gonzaru left a comment (vim/vim#19815)

    @mattn Confirmed both (gui and non-gui dialogs) fixed. thxs!

    I agree to focus more in gtk4 now in this PR than fix old gtk2/gtk3 know bugs.

    A few more small ones I've just found:

    ***** Font completion (:set guifont=)

    1. gvim --clean
    2. :set guifont= (does nothing), in other gtks shows a popup to select the gui font.

    --

    This is more cosmetic than a bug.

    ***** Menu greying (disabled items)
    The gtk4 version treats all menu items as active, so even if there is no copy/cut/paste, it does not show the menu as "empty/grey".

    (gtk3)
    1000028920.jpg (view on web)

    (gtk4)
    1000028921.jpg (view on web)

    --

    ***** :winpos always retuns 0

    winpos can be useful for sessions with :set sessionoptions+=winpos and in the previous gtk's returns the correct window position.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4144715109@github.com>

    mattn

    unread,
    Mar 28, 2026, 6:57:47 AMMar 28
    to vim/vim, Push

    @mattn pushed 1 commit.

    • a9d5064 GTK4: implement menu greying and fix popover not closing


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/3fc5cc7fa742c9ae147866c3ffa85789deae71e6/after/a9d5064a3f8caf4c3d7c8c120cdd86a797f24887@github.com>

    mattn

    unread,
    Mar 28, 2026, 7:01:42 AMMar 28
    to vim/vim, Push

    @mattn pushed 1 commit.

    • b54db6f GTK4: return FAIL from gui_mch_get_winpos()


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/a9d5064a3f8caf4c3d7c8c120cdd86a797f24887/after/b54db6fcf0cd3aa43873a6b0ad8dc287f004354c@github.com>

    mattn

    unread,
    Mar 28, 2026, 7:05:55 AMMar 28
    to vim/vim, Push

    @mattn pushed 1 commit.

    • 47f362e GTK4: implement guifont completion


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/b54db6fcf0cd3aa43873a6b0ad8dc287f004354c/after/47f362e9a60101009e68ff88a5dfc3fafe6c2f3e@github.com>

    mattn

    unread,
    Mar 28, 2026, 7:06:52 AMMar 28
    to vim/vim, Subscribed
    mattn left a comment (vim/vim#19815)

    @gonzaru The remaining three items from your latest report have been fixed and pushed:

    1. Font completion:set guifont=\<TAB> now lists monospace font families from Pango, matching GTK3 behavior.

    2. Menu greying — Disabled menu items (Copy/Paste etc.) are now greyed out using g_simple_action_set_enabled(). Also fixed the popover menu not closing after selecting an item.

    3. :winpos — Unfortunately, GTK4 does not provide a window position API (removed by design for Wayland compatibility). gui_mch_get_winpos() now returns FAIL instead of reporting a misleading 0,0.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4147864562@github.com>

    mattn

    unread,
    Mar 28, 2026, 8:05:12 AMMar 28
    to vim/vim, Push

    @mattn pushed 1 commit.

    • ab73036 GTK4: update proto file for gui_gtk_draw_string_ext()


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/47f362e9a60101009e68ff88a5dfc3fafe6c2f3e/after/ab73036b27f1a8a9f415c7f6168bd98305631884@github.com>

    mattn

    unread,
    Mar 28, 2026, 8:52:32 AMMar 28
    to vim/vim, Push

    @mattn pushed 1 commit.

    • d4e1b9f GTK4: add native print dialog for :hardcopy


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/ab73036b27f1a8a9f415c7f6168bd98305631884/after/d4e1b9f1119a618aa1e550e00a7bfb560b8077d1@github.com>

    mattn

    unread,
    Mar 28, 2026, 8:53:11 AMMar 28
    to vim/vim, Subscribed
    mattn left a comment (vim/vim#19815)

    I added a native print dialog for :hardcopy on GTK4 GUI, similar to how
    Windows GUI shows a print dialog. When the GUI is not running, the existing
    PostScript path is used as before. If this is not desired, I can drop the
    implementation — for now it can be disabled via #ifdef FEAT_GUI_GTK_PRINT.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4148027466@github.com>

    mattn

    unread,
    Mar 28, 2026, 9:31:27 AMMar 28
    to vim/vim, Push

    @mattn pushed 1 commit.

    • ea5354d fix preprocessor indent in gui_xim.c


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/d4e1b9f1119a618aa1e550e00a7bfb560b8077d1/after/ea5354d4dc79f3b8e3a303b4bbf39adb0300d13b@github.com>

    Reilly Brogan

    unread,
    Mar 30, 2026, 2:24:05 PMMar 30
    to vim/vim, Subscribed
    ReillyBrogan left a comment (vim/vim#19815)

    WM_CLASS is an X11-specific property that GTK4 no longer sets directly. The correct way to handle this in GTK4 is through the StartupWMClass field in the desktop entry file. Added StartupWMClass=Gvim to runtime/gvim.desktop.

    That's not correct. The intended use of StartupWMClass is for integration of a launcher that may have a different WM-CLASS than the application (think of a splash-screen style window). While it is frequently abused for cases where application developers cannot or will not make the WM-Class / Wayland App-id match the name of the .desktop file in this particular case it isn't actually going to do anything since vim doesn't use the capitalized Gvim and so that match would never happen anyway.

    WM_CLASS(STRING) = "gvim", "gvim"

    Needs to be:

    WM_CLASS(STRING) = "gvim", "Gvim"

    This is irrelevant in practice. All that ultimately matters is whether or not the DE/WM can associate a given window to the correct .desktop file, and I'm not aware of a single DE/WM that will fail to match a window against gvim.desktop just because the WM_CLASS is "gvim", "gvim" and not "gvim", "Gvim".

    g_set_prgname("gvim")

    According to this it sounds like using the GtkApplication constructor with the app_id as an argument should be preferred over g_set_prgname().

    Honestly this would be a good time to unify app-id with the flatpak and just use org.vim.Vim for both WM_CLASS and app-id and also rename the .desktop file and icons to org.vim.Gvim.desktop. Users are already going to be in for a fairly noticeable change with the update to GTK4 so having to re-pin their launcher is probably not more disruptive.

    Defaults to GSK_RENDERER=cairo because GL/Vulkan renderers may not be available in all environments. Can be overridden via environment variable.

    I don't think you should do this globally. The default renderer should be preferred as it is hardware-accelerated, and if there are problematic platforms (like WSL2) then it would be better to check for those platforms at startup and only use cairo if they are detected.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4157176636@github.com>

    Ruben Gonzalez

    unread,
    Mar 30, 2026, 3:10:16 PMMar 30
    to vim/vim, Subscribed
    gonzaru left a comment (vim/vim#19815)

    My window manager doesn’t handle this properly (yes you can duplicate rules, but usually lots of the programas are capitalized), so I had to catch it in a different way. Since GTK, GTK2, and GTK3 use “Gvim” instead of “gvim” as the class name, it creates inconsistency.

    Yes, you can technically set it however you want, but why not follow the same conventions as before?

    https://git.suckless.org/dwm/file/config.def.h.html#l29


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4157485489@github.com>

    mattn

    unread,
    Mar 31, 2026, 7:29:16 AMMar 31
    to vim/vim, Push

    @mattn pushed 1 commit.

    • b64ffe9 GTK4: do not force GSK_RENDERER=cairo globally


    View it on GitHub.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/ea5354d4dc79f3b8e3a303b4bbf39adb0300d13b/after/b64ffe97aae32d2e4d5e7719f66c868d8b128333@github.com>

    mattn

    unread,
    Mar 31, 2026, 7:31:12 AMMar 31
    to vim/vim, Subscribed
    mattn left a comment (vim/vim#19815)

    GTK4 does not provide a direct API to set WM_CLASS separately (unlike GTK2/GTK3 which had gtk_window_set_wmclass()). We use g_set_prgname("gvim") which sets both instance and class to "gvim". The StartupWMClass=Gvim in the desktop file handles the association for desktop environments. Using GtkApplication with a proper app_id would be ideal, but Vim's architecture doesn't currently use GtkApplication.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4161956945@github.com>

    Reilly Brogan

    unread,
    Mar 31, 2026, 12:03:34 PMMar 31
    to vim/vim, Subscribed
    ReillyBrogan left a comment (vim/vim#19815)

    The StartupWMClass=Gvim in the desktop file handles the association for desktop environments

    It does not, you are completely mistaken on that. The name of the .desktop file handles the association for desktop environments. $NAME.desktop is used to match X11 windows that have a WM_CLASS of $NAME or Wayland windows that have an app-id of $NAME. This PR sets the GTK4 X11 WM_CLASS and wayland app-id both to gvim, which matches the existing .desktop file, and so no further action is needed to ensure that windows are associated correctly.

    Consider that if that were not true then window associations would be broken with the existing GTK3 UI and they are not.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4163725934@github.com>

    KiYugadgeter

    unread,
    Apr 4, 2026, 1:36:35 AMApr 4
    to vim/vim, Subscribed
    KiYugadgeter left a comment (vim/vim#19815)

    Is it affect to xterm-clipboard on CUI if X11 deps is removed by support of GTK4?
    Mutter (Wayland Compositor on GNOME) doesn't support both of wlr-data-control-unstable-v1 and ext-data-control-v1, also developers say they never support it due to security concern (I am not familiar what is it).

    Way to use system clipboard without steal of window focus will gone on GNOME if X11 deps is removed?


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4186441976@github.com>

    mattn

    unread,
    Apr 4, 2026, 1:41:13 PMApr 4
    to vim/vim, Subscribed
    mattn left a comment (vim/vim#19815)

    @KiYugadgeter

    You raise a valid concern. With --enable-gui=gtk4, the hybrid binary (same binary runs as both gvim and terminal vim) loses FEAT_XCLIPBOARD in terminal mode because the GTK4 build disables X11 dependencies entirely.

    On GNOME/Wayland where Mutter doesn't support wlr-data-control-unstable-v1 or ext-data-control-v1, this means CUI clipboard access is limited to clipboard providers (e.g., OSC 52 via clipboardmethod=provider).

    Keeping X11 linking in GTK4 builds could be a short-term workaround, but GTK5 will remove the X11 backend entirely, so it would only be temporary.

    The long-term solution for terminal clipboard on Wayland is clipboardmethod=provider (e.g., OSC 52), which works independently of both X11 and Wayland compositor protocols. This is ultimately a GNOME ecosystem limitation (their decision not to implement wlr-data-control) rather than a Vim-specific issue, but it's worth documenting clearly.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4187471277@github.com>

    mattn

    unread,
    Apr 4, 2026, 2:05:39 PMApr 4
    to vim/vim, Subscribed
    mattn left a comment (vim/vim#19815)

    @KiYugadgeter

    To add more context: the GTK4 build actually does enable FEAT_WAYLAND_CLIPBOARD (the WANT_WAYLAND definition in feature.h has no !defined(USE_GTK4) guard, unlike WANT_X11). Vim's Wayland clipboard implementation uses the wlr-data-control / ext-data-control protocols, so it works in terminal mode on compositors that support them.

    Compositor CUI clipboard in GTK4 build
    Sway, Hyprland (wlroots-based) Works (wlr-data-control / ext-data-control)
    KDE Plasma Wayland Works (ext-data-control-v1)
    GNOME/Mutter Does not work (neither protocol supported)

    So on GNOME/Wayland with a GTK4 build, CUI Vim cannot use Wayland clipboard directly. However, this is a limitation on GNOME's side — Mutter has refused to implement ext-data-control-v1 even after it was standardized in wayland-protocols v1.39.

    For workarounds in terminal Vim on GNOME/Wayland, you can use clipboardmethod=provider (e.g., OSC 52), or plugins like vim-fakeclip to integrate with xclip/xsel (which access clipboard via XWayland, and Mutter syncs it with Wayland clipboard).


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/c4187507860@github.com>

    mattn

    unread,
    Apr 7, 2026, 5:39:21 AMApr 7
    to vim/vim, Push

    @mattn pushed 1 commit.

    • edc99a7 Merge branch 'master' into gtk4-gui


    View it on GitHub or unsubscribe.
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/b64ffe97aae32d2e4d5e7719f66c868d8b128333/after/edc99a74edb2b1c4488e792b1d7fa0a4086479bb@github.com>

    mattn

    unread,
    Apr 23, 2026, 7:28:47 PM (19 hours ago) Apr 23
    to vim/vim, Push

    @mattn pushed 48 commits.

    • 3126d9c Add --enable-gui=gtk4 support with separate GTK4 implementation
    • c22383a GTK4: implement cursor, scrolling, mouse, dialogs
    • 7b844da GTK4: implement clipboard, signs, tabline, mouse shape, and more
    • ca3b9bc GTK4: default window size to 80x24
    • cf80609 GTK4: implement drag-and-drop, geometry, cleanup
    • 998116b GTK4: add GtkIMContext input method support
    • 2029b5f GTK4: implement Find/Replace dialog
    • 25adc67 GTK4: implement toolbar
    • 117b5d9 GTK4: fix white screen and resize loop
    • d9548cd GTK4: implement menu system with GMenu/GtkPopoverMenuBar
    • c53b0f5 GTK4: fix resize handling and scrollbar layout
    • 7b9c2bb GTK4: fix vertical resize shrink
    • 08e04a2 GTK4: use GtkOverlay for drawarea auto-resize
    • 2ae657a GTK4: add new files to Filelist for CI packaging check
    • e81b8ab GTK4: merge gui_gtk4_x11.c into gui_gtk4.c
    • 9ebdfa0 GTK4: fix preprocessor indent in gui_xim.c
    • d736890 GTK4: suppress EGL warnings when GL is unavailable
    • a2bbc18 GTK4: fix scrollbar CRITICAL warnings
    • 63e2d51 GTK4: remove direct X11 dependency
    • 4ae804c GTK4: fix text rendering, wide chars, and cursor focus
    • e36b122 GTK4: fix missing prototypes in gui_gtk4.pro
    • 0aa2c1e GTK4: fix GTK_MENU_SHELL stub to accept an argument
    • 09be106 GTK4: fix gui_get_x11_windis() return type
    • f7c6dcc GTK4: exclude GtkMenuShell code instead of using stubs
    • c349355 GTK4: replace deprecated gtk_widget_show() with gtk_widget_set_visible()
    • 646cc00 GTK4: fix deprecated GTK API calls in gui_xim.c
    • 0cb907c GTK4: use modern GDK key symbols in gui_beval.c
    • 6757c99 GTK4: reject non-empty 'imactivatekey' values
    • decd5b3 GTK4: move gtk_init() from gui_mch_prepare() to gui_mch_init_check()
    • 0f3fbf4 GTK4: fix deprecated gtk_image_new_from_pixbuf and gui_mch_expand_font signature
    • 8588162 GTK4: fix crash when setting guioptions=k
    • 1bb72b2 GTK4: set WM_CLASS by calling g_set_prgname("gvim")
    • e52dad4 GTK4: add ligature support for 'guiligatures' option
    • 47dda0e GTK4: use flat style for toolbar buttons
    • 8dce55c GTK4: fix mouse click, selection, and drag not working
    • 8cf470f GTK4: fix popup ghosting by requesting widget redraw on flush
    • f5cd3d8 GTK4: grab focus on mouse enter to fix hollow cursor
    • 771c8af GTK4: fix ghost artifacts after :vsp by not copying stale surface
    • 0e967fe GTK4: add StartupWMClass=Gvim to gvim.desktop
    • c0dee61 GTK4: fix hang on console dialog with :q and 'confirm'
    • 47d9dfe GTK4: fix dialog button labels showing corrupted text
    • 52d917a GTK4: implement menu greying and fix popover not closing
    • 5b529c2 GTK4: return FAIL from gui_mch_get_winpos()
    • 6ee0522 GTK4: implement guifont completion
    • 3725532 GTK4: update proto file for gui_gtk_draw_string_ext()
    • 0e791a3 GTK4: add native print dialog for :hardcopy
    • d641f58 fix preprocessor indent in gui_xim.c
    • f100866 GTK4: do not force GSK_RENDERER=cairo globally

    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19815/before/edc99a74edb2b1c4488e792b1d7fa0a4086479bb/after/f100866697547651d7edcb8be7d05c3b660db526@github.com>

    Reply all
    Reply to author
    Forward
    0 new messages