Should fix #5157. There are still some things that I want to mention:
Overall, since Wayland uses the same model as X11 when dealing with selections/clipboard, the new code fit pretty smoothly. Unfortunately, this PR doesn't work for GNOME, since they don't provide a way for external clients to access the selection/clipboard. This is my first time developing with Wayland, so I hope my code is good enough :P
Thanks,
https://github.com/vim/vim/pull/17097
(52 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
No worries, the CI test errors were unrelated and should have been fixed in master. Can you please rebase on top of master?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 2 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
I think just starting a new Wayland compositor process within the Vim test instance would be the best way for the tests. So Niri will be the best fit since it supports both data control protocols.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra Would it be possible for the CI tests to have a Wayland compositor installed? Current tests use Niri, but requires a really new version (v25.02), not sure if that is in the repos yet.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Should be fine to add, but probably depends on how much effort it is to install Niri (v25.02).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 17 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 0 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 7 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman commented on this pull request.
In src/os_unix.c:
> +#endif
+}
+
+
+/*
+ * Redirect libwayland logging to use ch_log instead.
+ */
+static void vwl_log_handler(const char *fmt, va_list args) {
+ size_t len = STRLEN(fmt) + STRLEN("LIBWAYLAND: ") + 1;
+ char *format = alloc(len);
+
+ if (format == NULL)
+ return;
+ // Subtract one to remove newline that libwayland puts
+ vim_snprintf(format, len - 1, "LIBWAYLAND: %s", fmt);
+ ch_vlog(NULL, format, args);
Looks fine to me.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Would the CI test changes have to be included in a separate commit so it can be put to use for this PR?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Should be fine to add, but probably depends on how much effort it is to install Niri (v25.02).
Would the CI test changes have to be included in a separate commit so it can be put to use for this PR?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Would the CI test changes have to be included in a separate PR so it can be put to use for this PR?
We don't necessarily have to include it as part of this PR. A separate PR could be used for the tests. As long as we try to add tests of course :) Thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra What would be your opinion on this?
Thing is with GNOME is that it needs something like a focused window to work, which terminal vim obviously doesn't work. wl-clipboard gets around this by focus-stealing (creating an invisible window and doing all the stuff it needs to before closing it). This introduces weird quirks though: bugaevc/wl-clipboard#90, bugaevc/wl-clipboard#91, bugaevc/wl-clipboard#31, bugaevc/wl-clipboard#12. Unless these are only specific to wl-clipboard, which I think is highly unlikely, this is a pretty hacky way, not sure if it belongs in Vim.
I wouldn't mind implementing the focus stealing hack that wl-clipboard does. Thanks.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Well, it sounds like a big hack, but if this is what users expect and you wouldn't mind implementing it, than that is probably what we need to do. Thanks for working on that!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 10 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I wouldn't mind implementing the focus stealing hack that wl-clipboard does. Thanks.
Would it be the same hack for gui vim?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I wouldn't mind implementing the focus stealing hack that wl-clipboard does. Thanks.
Would it be the same hack for gui vim?
With gui vim it has an actual window that the compositor can know if its focused or not, so it doesn't need any focus stealing hacks. This PR is only relevant for terminal vim
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
With gui vim it has an actual window that the compositor can know if its focused or not, so it doesn't need any focus stealing hacks. This PR is only relevant for terminal vim, right now I'm rewriting the wayland code since the current design is clunky.
Well, yes. Sorry, my actual question should have been, would gui vim support clipboard in Wayland? And it looks like no as this PR is only for terminal vim.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I was hoping that wlr and ext data control protocols would also "fix" gui vim clipboard in Wayland (KDE, sway).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I was hoping that wlr and ext data control protocols would also "fix" gui vim clipboard in Wayland (KDE, sway).
Shouldn't the gtk library handle the clipboard and stuff?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I was hoping that wlr and ext data control protocols would also "fix" gui vim clipboard in Wayland (KDE, sway).
Shouldn't the gtk library handle the clipboard and stuff?
It probably should, but vim with GVIM_ENABLE_WAYLAND doesn't work with clipbord in pure wayland environment as far as I remember.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Indeed, https://github.com/vim/vim/blob/31b78cce6e6412cada49ca994f6665ef4acec792/src/gui_gtk_x11.c#L1736
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thats unfortunate. I don't think it's a good idea to handle the wayland selection directly when using gui vim, the gui library should handle that. Vim does this (only uses the x11 library for setting the selection when not in gui mode)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 0 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 0 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 9 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 0 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 9 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 10 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman commented on this pull request.
In src/wayland.c:
> +}
+
+/*
+ * Redirect libwayland logging to use ch_log + semsg instead.
+ */
+ static void
+vwl_log_handler(const char *fmt, va_list args)
+{
+ size_t len = STRLEN(fmt) + STRLEN("LIBWAYLAND: ") + 1;
+ char *format = alloc(len);
+
+ if (format == NULL)
+ return;
+ // Subtract one to remove newline that libwayland puts
+ vim_snprintf(format, len - 1, "libwayland internal error: %s", fmt);
+ ch_vlog(NULL, format, args);
irrelevant unless libwayland is malicious
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
> +
+/*
+ * Redirect libwayland logging to use ch_log + semsg instead.
+ */
+ static void
+vwl_log_handler(const char *fmt, va_list args)
+{
+ size_t len = STRLEN(fmt) + STRLEN("LIBWAYLAND: ") + 1;
+ char *format = alloc(len);
+
+ if (format == NULL)
+ return;
+ // Subtract one to remove newline that libwayland puts
+ vim_snprintf(format, len - 1, "libwayland internal error: %s", fmt);
+ ch_vlog(NULL, format, args);
+ semsg(format, args);
Irrelevant unless libwayland is malicious
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 10 commits.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()