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>
diff --git a/src/main.c b/src/main.c
index 31494e3..98a17bc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -449,7 +449,7 @@
#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 @@
starttermcap();
scroll_start();
redraw_later_clear();
+ choose_clipmethod();
}
#endif
@@ -667,7 +668,7 @@
# endif
{
setup_term_clip();
- TIME_MSG("setup clipboard");
+ TIME_MSG("setup x11 clipboard");
}
#endif
@@ -676,6 +677,27 @@
prepare_server(¶ms);
#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
@@ -2460,6 +2482,11 @@
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;
case 'Z': // "-Z" restricted mode
restricted = TRUE;
@@ -3665,6 +3692,9 @@
# 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"));