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

git pushed a commit to branch master
in repository efl.

View the commit online.

commit d2cd3883450ea1a9a6fca60345851f93b2f108e0
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Nov 19 18:50:00 2026 -0600

    ecore-x - add api to fake pointer moves and button presses with xtest
    
    ecore_x_test_fake_key_down/up/press() fake keys only. A test driving a
    window manager also needs the pointer: a drag is a press, motion and a
    release that the server delivers to whoever holds the grab, which neither
    ecore_x_pointer_warp() nor ecore_x_mouse_*_send() can give. Without this,
    Enlightenment's X11 tests have to link libXtst and use Xlib themselves.
    
    ecore_x_test_fake_mouse_move(), ecore_x_test_fake_mouse_down() and
    ecore_x_test_fake_mouse_up() follow the key ones: XTest when ecore_x has
    it, EINA_FALSE when it does not.
    
    @feat
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/ecore_x/Ecore_X.h      | 25 ++++++++++++++++++++++
 src/lib/ecore_x/ecore_x_test.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index f45aa2b1b1..3f311c24f8 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -2645,6 +2645,31 @@ EAPI void           ecore_x_dpms_force(Eina_Bool on);
 EAPI Eina_Bool      ecore_x_test_fake_key_down(const char *key);
 EAPI Eina_Bool      ecore_x_test_fake_key_up(const char *key);
 EAPI Eina_Bool      ecore_x_test_fake_key_press(const char *key);
+/**
+ * Moves the pointer to x,y on the root window, as input from a device:
+ * the motion goes to whoever has the pointer grabbed.
+ * @param x The x coordinate on the root window.
+ * @param y The y coordinate on the root window.
+ * @return @c EINA_TRUE if the event was sent, @c EINA_FALSE otherwise, as
+ * when the XTest extension is not available.
+ * @since 1.30
+ */
+EAPI Eina_Bool      ecore_x_test_fake_mouse_move(int x, int y);
+/**
+ * Presses a pointer button where the pointer is, as a real device would:
+ * the server delivers it, and takes the implicit grab, as for a real press.
+ * @param button The button, from 1.
+ * @return @c EINA_TRUE if the event was sent, @c EINA_FALSE otherwise.
+ * @since 1.30
+ */
+EAPI Eina_Bool      ecore_x_test_fake_mouse_down(int button);
+/**
+ * Releases a pointer button pressed with ecore_x_test_fake_mouse_down().
+ * @param button The button, from 1.
+ * @return @c EINA_TRUE if the event was sent, @c EINA_FALSE otherwise.
+ * @since 1.30
+ */
+EAPI Eina_Bool      ecore_x_test_fake_mouse_up(int button);
 EAPI const char    *ecore_x_keysym_string_get(int keysym);
 
 /**
diff --git a/src/lib/ecore_x/ecore_x_test.c b/src/lib/ecore_x/ecore_x_test.c
index 51ead5a136..318df749a3 100644
--- a/src/lib/ecore_x/ecore_x_test.c
+++ b/src/lib/ecore_x/ecore_x_test.c
@@ -147,6 +147,54 @@ ecore_x_test_fake_key_press(const char *key EINA_UNUSED)
 #endif /* ifdef ECORE_XTEST */
 }
 
+EAPI Eina_Bool
+#ifdef ECORE_XTEST
+ecore_x_test_fake_mouse_move(int x, int y)
+#else
+ecore_x_test_fake_mouse_move(int x EINA_UNUSED, int y EINA_UNUSED)
+#endif
+{
+#ifdef ECORE_XTEST
+   LOGFN;
+   /* -1: the screen the pointer is on */
+   return XTestFakeMotionEvent(_ecore_x_disp, -1, x, y, 0) ? EINA_TRUE : EINA_FALSE;
+#else /* ifdef ECORE_XTEST */
+   return EINA_FALSE;
+#endif /* ifdef ECORE_XTEST */
+}
+
+EAPI Eina_Bool
+#ifdef ECORE_XTEST
+ecore_x_test_fake_mouse_down(int button)
+#else
+ecore_x_test_fake_mouse_down(int button EINA_UNUSED)
+#endif
+{
+#ifdef ECORE_XTEST
+   LOGFN;
+   if (button < 1) return EINA_FALSE;
+   return XTestFakeButtonEvent(_ecore_x_disp, button, 1, 0) ? EINA_TRUE : EINA_FALSE;
+#else /* ifdef ECORE_XTEST */
+   return EINA_FALSE;
+#endif /* ifdef ECORE_XTEST */
+}
+
+EAPI Eina_Bool
+#ifdef ECORE_XTEST
+ecore_x_test_fake_mouse_up(int button)
+#else
+ecore_x_test_fake_mouse_up(int button EINA_UNUSED)
+#endif
+{
+#ifdef ECORE_XTEST
+   LOGFN;
+   if (button < 1) return EINA_FALSE;
+   return XTestFakeButtonEvent(_ecore_x_disp, button, 0, 0) ? EINA_TRUE : EINA_FALSE;
+#else /* ifdef ECORE_XTEST */
+   return EINA_FALSE;
+#endif /* ifdef ECORE_XTEST */
+}
+
 EAPI const char *
 ecore_x_keysym_string_get(int keysym)
 {

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

Reply via email to