diff options
author | Mike Gorse <mgorse@alum.wpi.edu> | 2019-08-05 14:31:58 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@alum.wpi.edu> | 2019-08-05 14:31:58 -0500 |
commit | 673340d60a0bf7b97863985f02854b943ee009bb (patch) | |
tree | f949e12e42296b07db963bea4458e8a0ce16f5c6 /atspi/atspi-registry.c | |
parent | 3ab9289a679e7dba0312e3379e187a2487e0a703 (diff) | |
download | at-spi2-core-673340d60a0bf7b97863985f02854b943ee009bb.tar.gz |
Support mutter remote desktop interface for key/mouse events
Mutter now has a remote desktop interface with methods to synthesize keyboard
and mouse events. This functionality has not been available through AT-SPI on
wayland since it uses X-specific functions.
Also add atspi_set_reference_window.
Probably a work in progress; doesn't appear to be behaving as intended.
Also requires that introspection be enabled on gnome-shell. Ie,
gsettings set org.gnome.shell introspect true
https://bugzilla.gnome.org/show_bug.cgi?id=709999
https://gitlab.gnome.org/GNOME/at-spi2-core/issues/14
Diffstat (limited to 'atspi/atspi-registry.c')
-rw-r--r-- | atspi/atspi-registry.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/atspi/atspi-registry.c b/atspi/atspi-registry.c index 76b19264..50cce980 100644 --- a/atspi/atspi-registry.c +++ b/atspi/atspi-registry.c @@ -424,6 +424,12 @@ atspi_deregister_device_event_listener (AtspiDeviceListener *listener, return TRUE; } +static gboolean +using_mutter () +{ + return (g_getenv ("WAYLAND_DISPLAY") != NULL); +} + /** * atspi_generate_keyboard_event: * @keyval: a #gint indicating the keycode or keysym or modifier mask of the @@ -456,6 +462,12 @@ atspi_generate_keyboard_event (glong keyval, dbus_int32_t d_keyval = keyval; DBusError d_error; + if (using_mutter ()) + { + if (_atspi_mutter_generate_keyboard_event (keyval, keystring, synth_type, error)) + return TRUE; + } + dbus_error_init (&d_error); if (!keystring) keystring = ""; @@ -492,6 +504,14 @@ atspi_generate_mouse_event (glong x, glong y, const gchar *name, GError **error) dbus_int32_t d_x = x, d_y = y; DBusError d_error; + g_return_val_if_fail (name != NULL, FALSE); + + if (using_mutter ()) + { + if (_atspi_mutter_generate_mouse_event (x, y, name, error)) + return TRUE; + } + dbus_error_init (&d_error); dbind_method_call_reentrant (_atspi_bus(), atspi_bus_registry, atspi_path_dec, atspi_interface_dec, @@ -506,6 +526,27 @@ atspi_generate_mouse_event (glong x, glong y, const gchar *name, GError **error) return TRUE; } +/** + * atspi_set_reference_window: + * + * @accessible: the #AtspiAccessible corresponding to the window to select. + * should be a top-level window with a role of + * ATSPI_ROLE_APPLICATION. + * + * Sets the reference window that will be used when atspi_generate_mouse_event + * is called. Coordinates will be assumed to be relative to this window. This + * is needed because, due to Wayland's security model, it is not currently + * possible to retrieve global coordinates. + * If NULL is passed, then AT-SPI will use the window that has focus at the + * time that atspi_generate_mouse_event is called. + */ +void +atspi_set_reference_window (AtspiAccessible *accessible) +{ + if (using_mutter ()) + _atspi_mutter_set_reference_window (accessible); +} + AtspiKeyDefinition * atspi_key_definition_copy (AtspiKeyDefinition *src) { |