1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2019 Red Hat Inc.
7  *
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 of the License, or (at your option) any later version.
12  *
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.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * Author: Carlos Garnacho <carlosg@gnome.org>
22  */
23 #ifndef CLUTTER_SEAT_H
24 #define CLUTTER_SEAT_H
25 
26 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
27 #error "Only <clutter/clutter.h> can be included directly."
28 #endif
29 
30 #include "clutter/clutter-types.h"
31 #include "clutter/clutter-keymap.h"
32 #include "clutter/clutter-virtual-input-device.h"
33 
34 #define CLUTTER_TYPE_SEAT (clutter_seat_get_type ())
35 
36 CLUTTER_EXPORT
37 G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
38 			  CLUTTER, SEAT, GObject)
39 
40 /**
41  * ClutterPointerA11ySettings:
42  *
43  * The #ClutterPointerA11ySettings structure contains pointer accessibility
44  * settings
45  *
46  */
47 typedef struct _ClutterPointerA11ySettings
48 {
49   ClutterPointerA11yFlags controls;
50   ClutterPointerA11yDwellClickType dwell_click_type;
51   ClutterPointerA11yDwellMode dwell_mode;
52   ClutterPointerA11yDwellDirection dwell_gesture_single;
53   ClutterPointerA11yDwellDirection dwell_gesture_double;
54   ClutterPointerA11yDwellDirection dwell_gesture_drag;
55   ClutterPointerA11yDwellDirection dwell_gesture_secondary;
56   gint secondary_click_delay;
57   gint dwell_delay;
58   gint dwell_threshold;
59 } ClutterPointerA11ySettings;
60 
61 /**
62  * ClutterVirtualDeviceType:
63  */
64 typedef enum
65 {
66   CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
67   CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
68   CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
69   CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
70 } ClutterVirtualDeviceType;
71 
72 typedef struct _ClutterSeatClass ClutterSeatClass;
73 
74 struct _ClutterSeatClass
75 {
76   GObjectClass parent_class;
77 
78   ClutterInputDevice * (* get_pointer)  (ClutterSeat *seat);
79   ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat);
80 
81   const GList * (* peek_devices) (ClutterSeat *seat);
82 
83   void (* bell_notify) (ClutterSeat *seat);
84 
85   ClutterKeymap * (* get_keymap) (ClutterSeat *seat);
86 
87   gboolean (* handle_event_post) (ClutterSeat        *seat,
88                                   const ClutterEvent *event);
89 
90   void (* warp_pointer) (ClutterSeat *seat,
91                          int          x,
92                          int          y);
93 
94   gboolean (* query_state) (ClutterSeat          *seat,
95                             ClutterInputDevice   *device,
96                             ClutterEventSequence *sequence,
97                             graphene_point_t     *coords,
98                             ClutterModifierType  *modifiers);
99 
100   /* Virtual devices */
101   ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat            *seat,
102                                                          ClutterInputDeviceType  device_type);
103   ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterSeat *seat);
104 };
105 
106 CLUTTER_EXPORT
107 ClutterInputDevice * clutter_seat_get_pointer  (ClutterSeat *seat);
108 CLUTTER_EXPORT
109 ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
110 CLUTTER_EXPORT
111 GList * clutter_seat_list_devices (ClutterSeat *seat);
112 const GList * clutter_seat_peek_devices (ClutterSeat *seat);
113 CLUTTER_EXPORT
114 void clutter_seat_bell_notify (ClutterSeat *seat);
115 
116 CLUTTER_EXPORT
117 ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
118 
119 CLUTTER_EXPORT
120 void clutter_seat_ensure_a11y_state     (ClutterSeat            *seat);
121 
122 CLUTTER_EXPORT
123 void clutter_seat_set_pointer_a11y_settings (ClutterSeat                *seat,
124                                              ClutterPointerA11ySettings *settings);
125 
126 CLUTTER_EXPORT
127 void clutter_seat_get_pointer_a11y_settings (ClutterSeat                *seat,
128                                              ClutterPointerA11ySettings *settings);
129 
130 CLUTTER_EXPORT
131 void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat                      *seat,
132                                                      ClutterPointerA11yDwellClickType  click_type);
133 
134 CLUTTER_EXPORT
135 void clutter_seat_inhibit_unfocus (ClutterSeat *seat);
136 
137 CLUTTER_EXPORT
138 void clutter_seat_uninhibit_unfocus (ClutterSeat *seat);
139 
140 CLUTTER_EXPORT
141 gboolean clutter_seat_is_unfocus_inhibited (ClutterSeat *seat);
142 
143 CLUTTER_EXPORT
144 ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat            *seat,
145                                                                ClutterInputDeviceType  device_type);
146 
147 CLUTTER_EXPORT
148 ClutterVirtualDeviceType clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat);
149 
150 CLUTTER_EXPORT
151 void clutter_seat_warp_pointer (ClutterSeat *seat,
152                                 int          x,
153                                 int          y);
154 CLUTTER_EXPORT
155 gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
156 
157 CLUTTER_EXPORT
158 gboolean clutter_seat_has_touchscreen (ClutterSeat *seat);
159 
160 CLUTTER_EXPORT
161 gboolean clutter_seat_query_state (ClutterSeat          *seat,
162                                    ClutterInputDevice   *device,
163                                    ClutterEventSequence *sequence,
164                                    graphene_point_t     *coords,
165                                    ClutterModifierType  *modifiers);
166 
167 #endif /* CLUTTER_SEAT_H */
168