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

git pushed a commit to reference refs/pull/94/head
in repository efl.

View the commit online.

commit 18220e130c79d9198dde9ad3f3266f32c1c1d8a5
Author: Swagtoy <m...@ow.swag.toys>
AuthorDate: Thu Jun 26 03:03:11 2025 -0400

    Ecore_X: Add basic keyboard repeat methods
    
    These are stubbed into a struct as there are other options that may be useful one day.
---
 src/lib/ecore_x/Ecore_X.h | 10 ++++++++++
 src/lib/ecore_x/ecore_x.c | 40 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index 6f99d88007..555a79c0c1 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -1054,6 +1054,13 @@ struct _Ecore_X_Event_Generic
    void        *data;
 };
 
+struct _Ecore_X_Keyboard_Repeat
+{
+   int delay;
+   int rate;
+};
+typedef struct _Ecore_X_Keyboard_Repeat Ecore_X_Keyboard_Repeat;
+
 typedef enum Ecore_X_Present_Event_Mask
 {
     ECORE_X_PRESENT_EVENT_MASK_NO_EVENT = 0,
@@ -2059,6 +2066,9 @@ EAPI void             ecore_x_window_button_ungrab(Ecore_X_Window win, int butto
 EAPI void             ecore_x_window_key_grab(Ecore_X_Window win, const char *key, int mod, int any_mod);
 EAPI void             ecore_x_window_key_ungrab(Ecore_X_Window win, const char *key, int mod, int any_mod);
 
+EAPI Eina_Bool        ecore_x_keyboard_repeat_set(Ecore_X_Display *display, Ecore_X_Keyboard_Repeat *repeat);
+EAPI Eina_Bool        ecore_x_keyboard_repeat_get(Ecore_X_Display *display, Ecore_X_Keyboard_Repeat *repeat);
+
 EAPI void             ecore_x_focus_reset(void);
 EAPI void             ecore_x_events_allow_all(void);
 EAPI void             ecore_x_pointer_last_xy_get(int *x, int *y);
diff --git a/src/lib/ecore_x/ecore_x.c b/src/lib/ecore_x/ecore_x.c
index c78e6adbb1..8f9d758d86 100644
--- a/src/lib/ecore_x/ecore_x.c
+++ b/src/lib/ecore_x/ecore_x.c
@@ -1,3 +1,5 @@
+#include <X11/XKBlib.h>
+#include <X11/extensions/XKB.h>
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif /* ifdef HAVE_CONFIG_H */
@@ -2115,12 +2117,40 @@ _ecore_x_key_grab_resume(void)
      }
 }
 
+EAPI Eina_Bool
+ecore_x_keyboard_repeat_set(Ecore_X_Display *display, Ecore_X_Keyboard_Repeat *repeat)
+{
+   XkbDescPtr xkb = XkbAllocKeyboard();
+   if (!xkb || XkbGetControls(display, XkbRepeatKeysMask, xkb) != Success)
+     {
+	    if (xkb)
+		  XkbFreeKeyboard(xkb, 0, True);
+        return EINA_FALSE;
+     }
+   
+   xkb->ctrls->repeat_delay = repeat->delay;
+   xkb->ctrls->repeat_interval = repeat->rate;
+   XkbSetControls(display, XkbRepeatKeysMask, xkb);
+   XkbFreeKeyboard(xkb, 0, True);
+   return EINA_TRUE;
+}
 
-
-
-
-
-
+EAPI Eina_Bool
+ecore_x_keyboard_repeat_get(Ecore_X_Display *display, Ecore_X_Keyboard_Repeat *repeat)
+{
+	XkbDescPtr xkb = XkbAllocKeyboard();
+	if (!xkb || XkbGetControls(display, XkbRepeatKeysMask, xkb) != Success)
+	  {
+	     if (xkb)
+		   XkbFreeKeyboard(xkb, 0, True);
+	     return EINA_FALSE;
+      }
+	
+	repeat->delay = xkb->ctrls->repeat_delay;
+	repeat->rate  = xkb->ctrls->repeat_interval;
+	XkbFreeKeyboard(xkb, 0, True);
+	return EINA_TRUE;
+}
 
 /**
  * Send client message with given type and format 32.

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

Reply via email to