Wayland: Improve handling of pending data offers

The code assumed that all data offers were selections that supported
plaintext UTF-8.

The initial data offer events are now handled almost tolerably.  Only
selection data offers are used for clipboard string and only if they
provide plaintext UTF-8.  Drag and drop data offers are now rejected as
soon as they enter a surface.

Related to #2040
This commit is contained in:
Camilla Löwy
2022-03-23 19:58:33 +01:00
parent 89d3ea8d69
commit 8d87be1268
4 changed files with 93 additions and 25 deletions
+12 -2
View File
@@ -219,6 +219,12 @@ typedef struct _GLFWdecorationWayland
struct wp_viewport* viewport;
} _GLFWdecorationWayland;
typedef struct _GLFWofferWayland
{
struct wl_data_offer* offer;
GLFWbool text_plain_utf8;
} _GLFWofferWayland;
// Wayland-specific per-window data
//
typedef struct _GLFWwindowWayland
@@ -281,8 +287,6 @@ typedef struct _GLFWlibraryWayland
struct wl_keyboard* keyboard;
struct wl_data_device_manager* dataDeviceManager;
struct wl_data_device* dataDevice;
struct wl_data_offer* dataOffer;
struct wl_data_source* dataSource;
struct xdg_wm_base* wmBase;
struct zxdg_decoration_manager_v1* decorationManager;
struct wp_viewporter* viewporter;
@@ -290,6 +294,12 @@ typedef struct _GLFWlibraryWayland
struct zwp_pointer_constraints_v1* pointerConstraints;
struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
_GLFWofferWayland* offers;
unsigned int offerCount;
struct wl_data_offer* selectionOffer;
struct wl_data_source* selectionSource;
int compositorVersion;
int seatVersion;