0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

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

49
src/auto/configure vendored
View File

@@ -862,6 +862,7 @@ enable_farsi
enable_xim
enable_fontset
with_wayland
enable_wayland_focus_steal
with_x
enable_gui
enable_gtk2_check
@@ -1542,6 +1543,9 @@ Optional Features:
--disable-farsi Deprecated.
--enable-xim Include XIM input support.
--enable-fontset Include X fontset output support.
--enable-wayland-focus-steal
Include focus stealing support for Wayland
clipboard.
--enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/haiku/photon/carbon
--enable-gtk2-check If auto-select GUI, check for GTK+ 2 default=yes
--enable-gnome-check If GTK GUI, check for GNOME default=no
@@ -9271,13 +9275,39 @@ fi
if test "$with_wayland" = yes; then
cppflags_save=$CPPFLAGS
cflags_save=$CFLAGS
cppflags_save=$CPPFLAGS
cflags_save=$CFLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wayland" >&5
printf %s "checking for wayland... " >&6; }
if "$PKG_CONFIG" --exists 'wayland-client'; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking --enable-wayland-focus-steal argument" >&5
printf %s "checking --enable-wayland-focus-steal argument... " >&6; }
# Check whether --enable-wayland-focus-steal was given.
if test ${enable_wayland_focus_steal+y}
then :
enableval=$enable_wayland_focus_steal; enable_wayland_fs=$enableval
else case e in #(
e) enable_wayland_fs="yes" ;;
esac
fi
if test "$enable_wayland_fs" = "yes"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
printf "%s\n" "#define FEAT_WAYLAND_CLIPBOARD_FS 1" >>confdefs.h
else case e in #(
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; } ;;
esac
fi
printf "%s\n" "#define HAVE_WAYLAND 1" >>confdefs.h
WAYLAND_CPPFLAGS=`$PKG_CONFIG --cflags-only-I wayland-client`
@@ -9288,16 +9318,23 @@ printf "%s\n" "yes" >&6; }
WAYLAND_SRC=" \
auto/wayland/wlr-data-control-unstable-v1.c \
auto/wayland/ext-data-control-v1.c \
auto/wayland/xdg-shell.c \
auto/wayland/primary-selection-unstable-v1.c \
wayland.c"
WAYLAND_OBJ=" \
objects/wlr-data-control-unstable-v1.o \
objects/ext-data-control-v1.o \
objects/xdg-shell.o \
objects/primary-selection-unstable-v1.o \
objects/wayland.o"
if test "$enable_wayland_fs" = "yes"
then :
as_fn_append WAYLAND_SRC " \
auto/wayland/xdg-shell.c \
auto/wayland/primary-selection-unstable-v1.c"
as_fn_append WAYLAND_OBJ " \
objects/xdg-shell.o \
objects/primary-selection-unstable-v1.o"
fi