Bläddra i källkod

wayland: Use the implicit grab serial when clearing the clipboard

Some compositors won't clear the selection without a valid serial.

(cherry picked from commit 9094395b13cc20b6f2d80ad10717bd74410aa9a5)
Frank Praznik 2 månader sedan
förälder
incheckning
bfe3abdc26
1 ändrade filer med 4 tillägg och 2 borttagningar
  1. 4 2
      src/video/wayland/SDL_waylanddatamanager.c

+ 4 - 2
src/video/wayland/SDL_waylanddatamanager.c

@@ -34,6 +34,8 @@
 
 #include "SDL_waylandvideo.h"
 #include "SDL_waylanddatamanager.h"
+
+#include "SDL_waylandevents_c.h"
 #include "primary-selection-unstable-v1-client-protocol.h"
 
 /* FIXME: This is arbitrary, but we want this to be less than a frame because
@@ -524,7 +526,7 @@ bool Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device)
     if (!data_device || !data_device->data_device) {
         result = SDL_SetError("Invalid Data Device");
     } else if (data_device->selection_source) {
-        wl_data_device_set_selection(data_device->data_device, NULL, 0);
+        wl_data_device_set_selection(data_device->data_device, NULL, data_device->video_data->input->last_implicit_grab_serial);
         Wayland_data_source_destroy(data_device->selection_source);
         data_device->selection_source = NULL;
     }
@@ -539,7 +541,7 @@ bool Wayland_primary_selection_device_clear_selection(SDL_WaylandPrimarySelectio
         result = SDL_SetError("Invalid Primary Selection Device");
     } else if (primary_selection_device->selection_source) {
         zwp_primary_selection_device_v1_set_selection(primary_selection_device->primary_selection_device,
-                                                      NULL, 0);
+                                                      NULL, primary_selection_device->video_data->input->last_implicit_grab_serial);
         Wayland_primary_selection_source_destroy(primary_selection_device->selection_source);
         primary_selection_device->selection_source = NULL;
     }