patch 9.1.1485: missing Wayland clipboard support

Problem:  missing Wayland clipboard support
Solution: make it work (Foxe Chen)

fixes: #5157
closes: #17097

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2025-06-27 21:10:35 +02:00
committed by Christian Brabandt
parent 03125277e9
commit b90c2395b2
68 changed files with 7520 additions and 226 deletions

View File

@ -449,7 +449,7 @@ main
#endif // NO_VIM_MAIN
#endif // PROTO
#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(FEAT_CLIPBOARD)
/*
* Restore the state after a fatal X error.
*/
@ -475,6 +475,7 @@ x_restore_state(void)
starttermcap();
scroll_start();
redraw_later_clear();
choose_clipmethod();
}
#endif
@ -667,7 +668,7 @@ vim_main2(void)
# endif
{
setup_term_clip();
TIME_MSG("setup clipboard");
TIME_MSG("setup x11 clipboard");
}
#endif
@ -676,6 +677,27 @@ vim_main2(void)
prepare_server(&params);
#endif
#ifdef FEAT_WAYLAND
# ifdef FEAT_GUI
if (!gui.in_use)
# endif
{
if (wayland_init_client(wayland_display_name) == OK)
{
TIME_MSG("connected to wayland display");
# ifdef FEAT_WAYLAND_CLIPBOARD
if (wayland_cb_init((char*)p_wse) == OK)
TIME_MSG("setup wayland clipboard");
}
# endif
}
#endif
#ifdef FEAT_CLIPBOARD
choose_clipmethod();
#endif
/*
* If "-" argument given: Read file from stdin.
* Do this before starting Raw mode, because it may change things that the
@ -2458,6 +2480,11 @@ command_line_scan(mparm_T *parmp)
case 'X': // "-X" don't connect to X server
#if (defined(UNIX) || defined(VMS)) && defined(FEAT_X11)
x_no_connect = TRUE;
#endif
break;
case 'Y': // "-Y" don't connect to wayland compositor
#if defined(FEAT_WAYLAND)
wayland_no_connect = TRUE;
#endif
break;
@ -3665,6 +3692,9 @@ usage(void)
# endif
main_msg(_("-X\t\t\tDo not connect to X server"));
#endif
#if defined(FEAT_WAYLAND)
main_msg(_("-Y\t\t\tDo not connect to wayland compositor"));
#endif
#ifdef FEAT_CLIENTSERVER
main_msg(_("--remote <files>\tEdit <files> in a Vim server if possible"));
main_msg(_("--remote-silent <files> Same, don't complain if there is no server"));