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

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit 26876d6da09ed134972b2b3eea203c6155e248c1
Author: Carsten Haitzler <[email protected]>
AuthorDate: Mon Jan 5 19:11:41 2026 +0000

    clipboard - delay fetch of sel a bit to allow rapid changes to settle
---
 src/modules/clipboard/common.h     |  1 +
 src/modules/clipboard/e_mod_main.c | 44 +++++++++++++++++++++++++++++---------
 2 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/src/modules/clipboard/common.h b/src/modules/clipboard/common.h
index 9606ed4f9..e42b9a214 100644
--- a/src/modules/clipboard/common.h
+++ b/src/modules/clipboard/common.h
@@ -54,6 +54,7 @@ struct _Mod_Inst
   Evas_Object *ewin; // window to send clipboard events to
   Eina_List *handle; // for handling clipboard events
   Eina_List *items; // clipboard history
+  Elm_Sel_Type sel_type; // type of sel we last saw change
 };
 
 void       cb_mod_log(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args);
diff --git a/src/modules/clipboard/e_mod_main.c b/src/modules/clipboard/e_mod_main.c
index 4dab859fa..a28cb3af6 100644
--- a/src/modules/clipboard/e_mod_main.c
+++ b/src/modules/clipboard/e_mod_main.c
@@ -42,6 +42,7 @@ static E_Config_DD *conf_edd = NULL;
 static E_Config_DD *conf_item_edd = NULL;
 Mod_Inst *clip_inst = NULL; /* Need by e_mod_config.c */
 static E_Action *act = NULL;
+static Ecore_Timer *delay_sel_timer = NULL;
 
 /*   First some call backs   */
 static void       _clipboard_cb_paste_item(void *d1, void *d2);
@@ -528,6 +529,9 @@ _cliboard_cb_paste(void *data,
 
   if (!paste) return EINA_TRUE;
 
+  // some debug here for now
+  printf("CP: [%6.3f] [%s]\n", ecore_time_get(), paste);
+
   if (!!strcmp(last, paste))
     {
       if (strlen(paste) == 0) return ECORE_CALLBACK_DONE;
@@ -570,23 +574,41 @@ _clipboard_cb_elm_selection_lost(void *data, Elm_Sel_Type selection)
 }
 
 static Eina_Bool
-_clipboard_cb_event_selection(void *data,
-                              Evas_Object *obj EINA_UNUSED,
-                              void *event EINA_UNUSED)
+_cb_sel_change_delay(void *data)
 {
   Mod_Inst *mod_inst = data;
+  Eina_Bool fetch = EINA_FALSE;
 
-  elm_cnp_selection_get(mod_inst->ewin,
-                        ELM_SEL_TYPE_CLIPBOARD,
-                        ELM_SEL_FORMAT_TARGETS,
-                        _cliboard_cb_paste,
-                        mod_inst);
-  if (clip_cfg->clip_select)
+  delay_sel_timer = NULL;
+  if ((mod_inst->sel_type == ELM_SEL_TYPE_PRIMARY) &&
+      (clip_cfg->clip_select))
+    fetch = EINA_TRUE;
+  else if (mod_inst->sel_type == ELM_SEL_TYPE_CLIPBOARD)
+    fetch = EINA_TRUE;
+  if (fetch)
     elm_cnp_selection_get(e_comp->evas,
-                          ELM_SEL_TYPE_PRIMARY,
+                          mod_inst->sel_type,
                           ELM_SEL_FORMAT_TARGETS,
                           _cliboard_cb_paste,
                           mod_inst);
+  return EINA_FALSE;
+}
+
+static Eina_Bool
+_clipboard_cb_event_selection(void *data,
+                              Evas_Object *obj EINA_UNUSED,
+                              void *event)
+{
+  Mod_Inst *mod_inst = data;
+  Elm_Cnp_Event_Selection_Changed *ev = event;
+
+  if (delay_sel_timer)
+    {
+      ecore_timer_del(delay_sel_timer);
+      delay_sel_timer = NULL;
+    }
+  delay_sel_timer = ecore_timer_add(0.25, _cb_sel_change_delay, data);
+  mod_inst->sel_type = ev->type;
   return EINA_TRUE;
 }
 
@@ -736,6 +758,8 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
 {
   Config_Item *ci;
 
+  if (delay_sel_timer) ecore_timer_del(delay_sel_timer);
+  delay_sel_timer = NULL;
   // the 2 following EINA SAFETY checks should never happen
   // and i usually avoid gotos but here I feel their use is harmless */
   EINA_SAFETY_ON_NULL_GOTO(clip_inst, noclip);

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

Reply via email to