This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch wl/browser-all
in repository enlightenment.

View the commit online.

commit 059a6288e834a1ff5c842264b604e99cff9dab71
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Aug 16 16:13:42 2026 -0600

    e_comp_wl - do not announce an empty primary selection on focus
    
    Telling a client newly in focus that there is no primary selection says
    nothing it did not already know: a client begins knowing of none. What it
    does do is put a zwp_primary_selection_device_v1.selection(NULL) on the
    wire at a moment nobody asked for one, and a client watching for a
    selection event in sequence reads it as the answer to a different
    question.
    
    wlcs PrimarySelection.sink_can_listen is such a client, and caught it -
    intermittently, because whether the empty announcement lands between the
    listener going on and the real selection arriving is a matter of when
    focus settles. It failed 5 runs in 6 and passed the rest, which is why
    the single full-suite run that cleared this branch did not see it.
    
    An empty selection is still announced when the selection really has gone
    away - a client that was told about the old one has to hear that it is
    stale - so the two callers that mean it say so.
---
 src/bin/e_comp_wl_data.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/bin/e_comp_wl_data.c b/src/bin/e_comp_wl_data.c
index cb3c8ac74..fe64ed09f 100644
--- a/src/bin/e_comp_wl_data.c
+++ b/src/bin/e_comp_wl_data.c
@@ -1240,10 +1240,16 @@ _e_comp_wl_primary_selection_offer_create(E_Comp_Wl_Data_Source *source, struct
    return offer->resource;
 }
 
-/* Announce whatever the primary selection currently is to the client holding
- * keyboard focus, or announce that there is none. */
+/* Announce the primary selection to the client holding keyboard focus.
+ *
+ * announce_empty says whether "there is no selection" is worth saying out
+ * loud. It is when a selection has just gone away, because a client that was
+ * told about the old one has to hear that it is stale. It is not on a focus
+ * change: a client begins knowing of no selection, so telling it so carries
+ * nothing, and a client waiting on a selection event in sequence reads the
+ * empty one as the answer to a question nobody asked. */
 static void
-_e_comp_wl_primary_selection_send(void)
+_e_comp_wl_primary_selection_send(Eina_Bool announce_empty)
 {
    struct wl_resource *device, *offer_res = NULL, *focus;
    E_Comp_Wl_Data_Source *source;
@@ -1251,10 +1257,12 @@ _e_comp_wl_primary_selection_send(void)
    if (!e_comp_wl->kbd.enabled) return;
    if (!(focus = e_comp_wl->kbd.focus)) return;
 
+   source = e_comp_wl->primary_selection.source;
+   if ((!source) && (!announce_empty)) return;
+
    device = _e_comp_wl_primary_selection_device_find(wl_resource_get_client(focus));
    if (!device) return;
 
-   source = e_comp_wl->primary_selection.source;
    if (source)
      offer_res = _e_comp_wl_primary_selection_offer_create(source, device);
 
@@ -1272,7 +1280,9 @@ _e_comp_wl_primary_selection_cb_source_destroy(struct wl_listener *listener EINA
     * exactly when there is a source to be listening to. */
    wl_list_remove(&e_comp_wl->primary_selection.source_destroy_listener.link);
    e_comp_wl->primary_selection.source = NULL;
-   _e_comp_wl_primary_selection_send();
+   /* The selection really has gone: whoever holds focus was told about it and
+    * needs to know it is stale. */
+   _e_comp_wl_primary_selection_send(EINA_TRUE);
 }
 
 static void
@@ -1298,7 +1308,9 @@ _e_comp_wl_primary_selection_set(E_Comp_Wl_Data_Source *source)
                       &e_comp_wl->primary_selection.source_destroy_listener);
      }
 
-   _e_comp_wl_primary_selection_send();
+   /* A set to nothing is a client clearing the selection, which is a change
+    * worth announcing in its own right. */
+   _e_comp_wl_primary_selection_send(EINA_TRUE);
 }
 
 /* The serial names the input event the user selected with. E has no way to
@@ -1395,7 +1407,7 @@ _e_comp_wl_primary_selection_manager_cb_device_get(struct wl_client *client, str
     * announcement that went out when the selection was set. */
    if ((e_comp_wl->kbd.enabled) && (e_comp_wl->kbd.focus) &&
        (wl_resource_get_client(e_comp_wl->kbd.focus) == client))
-     _e_comp_wl_primary_selection_send();
+     _e_comp_wl_primary_selection_send(EINA_FALSE);
 }
 
 static void
@@ -1438,8 +1450,9 @@ e_comp_wl_data_device_keyboard_focus_set(void)
 
    /* The primary selection follows keyboard focus on its own terms - it has
     * no XWayland half to negotiate, so it must not be caught by the early
-    * returns below. */
-   _e_comp_wl_primary_selection_send();
+    * returns below. Nothing to say to a client newly in focus when there is
+    * no selection: it already knows of none. */
+   _e_comp_wl_primary_selection_send(EINA_FALSE);
 
    if (!e_comp_wl->kbd.enabled)
      {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to