e_comp_wl_data: Change secondary send_selection event condition 46/298646/2
authorJunkyeong Kim <jk0430.kim@samsung.com>
Tue, 12 Sep 2023 03:28:22 +0000 (12:28 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Tue, 12 Sep 2023 05:32:31 +0000 (05:32 +0000)
Because secondary send_selection event sequence changed,
the event sending condition also must be changed.
Use secondary_selection_sent flag to prevent send_selection event to secondary.

Change-Id: I54ad377b91ee4a20f927272a3b8dfe65cbfe42fe

src/bin/e_comp_wl.h
src/bin/e_comp_wl_data.c
src/bin/e_compositor.c

index 51c2b9b1a72f9872ce6277b0232a15abc74843f1..9a727f42bdfcfa2901378edaf0b8c95d96e90ef0 100644 (file)
@@ -309,6 +309,7 @@ struct _E_Comp_Wl_Data
         struct wl_resource *cbhm;
         struct wl_resource *secondary;
         Eina_List *data_only_list;
+        Eina_Bool secondary_selection_sent;
      } selection;
 
    struct
index ce3b210174b949708e7c05e681b808d8c86cbbdf..0330df259ddecec72507dd9a314f9415236635cc 100644 (file)
@@ -580,10 +580,11 @@ _e_comp_wl_data_device_selection_set(void *data EINA_UNUSED, E_Comp_Wl_Data_Sour
         data_device_res = e_comp_wl_data_find_for_client(cbhm_client);
         if ((data_device_res) && (source))
           {
-             offer_res =
-                _e_comp_wl_data_device_data_offer_create(source,
-                                                         data_device_res);
+             offer_res = _e_comp_wl_data_device_data_offer_create(source, data_device_res);
              wl_data_device_send_selection(data_device_res, offer_res);
+
+             if ((secondary_selection_client) && (secondary_selection_client == source_client))
+               e_comp_wl->selection.secondary_selection_sent = EINA_TRUE;
           }
      }
    else
@@ -591,7 +592,8 @@ _e_comp_wl_data_device_selection_set(void *data EINA_UNUSED, E_Comp_Wl_Data_Sour
         /* send wl_data_device@selection to secondary selection client */
         if (secondary_selection_client)
           {
-             if (secondary_selection_client != source_client)
+             if ((e_comp_wl->selection.secondary_selection_sent != EINA_TRUE) &&
+                 (secondary_selection_client != source_client))
                {
                   data_device_res = e_comp_wl_data_find_for_client(secondary_selection_client);
                   if ((data_device_res) && (source))
@@ -603,6 +605,10 @@ _e_comp_wl_data_device_selection_set(void *data EINA_UNUSED, E_Comp_Wl_Data_Sour
                   else if (data_device_res)
                     wl_data_device_send_selection(data_device_res, NULL);
                }
+             else
+               {
+                  e_comp_wl->selection.secondary_selection_sent = EINA_FALSE;
+               }
           }
 
         /* send wl_data_device@selection to focused client */
index 1d0a38f5b83a5ad3ec692ea3051db2a8da594166..df9c9f81a1cf2b653ec52a407847d60b7560727d 100644 (file)
@@ -536,7 +536,10 @@ _e_surface_destroy(E_Surface *surface)
      e_comp_wl->selection.cbhm = NULL;
 
    if (e_comp_wl->selection.secondary == surface->base.surface)
-     e_comp_wl->selection.secondary = NULL;
+     {
+        e_comp_wl->selection.secondary = NULL;
+        e_comp_wl->selection.secondary_selection_sent = EINA_FALSE;
+     }
 
    if (surface->base.viewport_transform)
      {