2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2020 SUSE LLC.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #ifndef _ATSPI_DEVICE_H_
25 #define _ATSPI_DEVICE_H_
27 #include "glib-object.h"
29 #include "atspi-types.h"
33 #define ATSPI_TYPE_DEVICE (atspi_device_get_type ())
34 #define ATSPI_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DEVICE, AtspiDevice))
35 #define ATSPI_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_DEVICE, AtspiDeviceClass))
36 #define ATSPI_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DEVICE))
37 #define ATSPI_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_DEVICE))
38 #define ATSPI_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_DEVICE, AtspiDeviceClass))
40 typedef struct _AtspiDevice AtspiDevice;
46 typedef struct _AtspiDeviceClass AtspiDeviceClass;
47 struct _AtspiDeviceClass
49 GObjectClass parent_class;
51 void (*add_key_grab) (AtspiDevice *device, AtspiKeyDefinition *kd);
52 void (*remove_key_grab) (AtspiDevice *device, guint id);
53 guint (*map_modifier) (AtspiDevice *device, gint keycode);
54 void (*unmap_modifier) (AtspiDevice *device, gint keycode);
55 guint (*get_modifier) (AtspiDevice *device, gint keycode);
56 gboolean (*grab_keyboard) (AtspiDevice *device);
57 void (*ungrab_keyboard) (AtspiDevice *device);
58 guint (*get_locked_modifiers) (AtspiDevice *device);
61 GType atspi_device_get_type (void);
65 * @device: the device.
66 * @pressed: TRUE if the key is being pressed, FALSE if being released.
67 * @keycode: the hardware code for the key.
68 * @keysym: the keysym for the key.
69 * @modifiers: a bitflag indicating which key modifiers are active.
70 * @keystring: the text corresponding to the keypress.
71 * @user_data: (closure): user-supplied data
73 * A callback that will be invoked when a key is pressed.
75 typedef void (*AtspiKeyCallback) (AtspiDevice *device, gboolean pressed, guint keycode, guint keysym, guint modifiers, const gchar *keystring, void *user_data);
77 AtspiDevice *atspi_device_new ();
79 gboolean atspi_device_notify_key (AtspiDevice *device, gboolean pressed, int keycode, int keysym, gint state, gchar *text);
81 guint atspi_device_add_key_grab (AtspiDevice *device, AtspiKeyDefinition *kd, AtspiKeyCallback callback, void *user_data, GDestroyNotify callback_destroyed);
83 void atspi_device_remove_key_grab (AtspiDevice *device, guint id);
85 void atspi_device_add_key_watcher (AtspiDevice *device, AtspiKeyCallback callback, void *user_data, GDestroyNotify callback_destroyed);
87 AtspiKeyDefinition *atspi_device_get_grab_by_id (AtspiDevice *device, guint id);
89 guint atspi_device_map_modifier (AtspiDevice *device, gint keycode);
91 void atspi_device_unmap_modifier (AtspiDevice *device, gint keycode);
93 guint atspi_device_get_modifier (AtspiDevice *device, gint keycode);
95 guint atspi_device_get_locked_modifiers (AtspiDevice *device);
97 gboolean atspi_device_grab_keyboard (AtspiDevice *device);
99 void atspi_device_ungrab_keyboard (AtspiDevice *device);
103 #endif /* _ATSPI_DEVICE_H_ */