mirror of
https://github.com/vim/vim.git
synced 2025-10-24 08:54:47 -04:00
patch 9.1.1725: Wayland code can be improved
Problem: Wayland code can be improved Solution: Refactor Wayland Clipboard code (Foxe Chen) This refactor makes the Wayland codebase less convoluted: - Move clipboard code in 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: #18139 Signed-off-by: Foxe Chen <chen.foxe@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
6a2d0496a1
commit
f50504a87b
@@ -5237,20 +5237,26 @@ struct cellsize {
|
||||
|
||||
#ifdef FEAT_WAYLAND
|
||||
|
||||
typedef struct vwl_connection_S vwl_connection_T;
|
||||
typedef struct vwl_seat_S vwl_seat_T;
|
||||
|
||||
# ifdef FEAT_WAYLAND_CLIPBOARD
|
||||
|
||||
typedef struct vwl_data_offer_S vwl_data_offer_T;
|
||||
typedef struct vwl_data_source_S vwl_data_source_T;
|
||||
typedef struct vwl_data_device_S vwl_data_device_T;
|
||||
typedef struct vwl_data_device_manager_S vwl_data_device_manager_T;
|
||||
|
||||
typedef struct vwl_data_device_listener_S vwl_data_device_listener_T;
|
||||
typedef struct vwl_data_source_listener_S vwl_data_source_listener_T;
|
||||
typedef struct vwl_data_offer_listener_S vwl_data_offer_listener_T;
|
||||
|
||||
// Wayland selections
|
||||
typedef enum {
|
||||
WAYLAND_SELECTION_NONE = 0x0,
|
||||
WAYLAND_SELECTION_REGULAR = 0x1,
|
||||
WAYLAND_SELECTION_PRIMARY = 0x2,
|
||||
WAYLAND_SELECTION_NONE = 0,
|
||||
WAYLAND_SELECTION_REGULAR = 1 << 0,
|
||||
WAYLAND_SELECTION_PRIMARY = 1 << 1,
|
||||
} wayland_selection_T;
|
||||
|
||||
// Callback when another client wants us to send data to them
|
||||
typedef void (*wayland_cb_send_data_func_T)(
|
||||
const char *mime_type,
|
||||
int fd,
|
||||
wayland_selection_T type);
|
||||
|
||||
// Callback when the selection is lost (data source object overwritten)
|
||||
typedef void (*wayland_cb_selection_cancelled_func_T)(wayland_selection_T type);
|
||||
|
||||
#endif // FEAT_WAYLAND
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user