patch 9.1.1784: Wayland code can be improved

Problem:  Wayland code can be improved
Solution: Refactor Wayland Clipboard code (Foxe Chen).

This the second attempt to refactor the Wayland code base:
- Move clipboard code from wayland.c to clipboard.c
- Use C99 bool type
- Properly poll the Wayland display file descriptor
- Instead of checking if the data source is not NULL in order to
  determine if a selection event comes from us, use a special mime type
  to identify selection events coming from ourselves. The problem with
  the previous approach is that race conditions may occur.
- Put the focus stealing code under a new feature "wayland_focus_steal"
- Use ELAPSED_* macros instead of gettimeofday()
- Pass tests
- Reimplement commented out code
- Update docs
- Make Wayland clipboard behaviour more in line with X11 when connection
  is lost
- add missing malloc checks and possible memory leaks + refactored some
  tests.

closes: #18324

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-09-22 19:06:58 +00:00
committed by Christian Brabandt
parent 70d745a61b
commit 368710abcf
34 changed files with 2685 additions and 2709 deletions

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 9.1. Last change: 2025 Sep 20
*options.txt* For Vim version 9.1. Last change: 2025 Sep 22
VIM REFERENCE MANUAL by Bram Moolenaar
@ -10204,7 +10204,8 @@ A jump table for the options with a short description can be found at |Q_op|.
*'wlsteal'* *'wst'* *'nowlsteal'* *'nowst'*
'wlsteal' 'wst' boolean (default off)
global
{only when the |+wayland_clipboard| feature is included}
{only when the |+wayland_focus_steal| feature is
included}
When enabled, then allow Vim to steal focus by creating a temporary
surface, in order to access the clipboard. For more information see
|wayland-focus-steal|.