File: | testsuite/ctk/gestures.c |
Warning: | line 157, column 26 Using a fixed address is not portable because that address will probably not be valid in all environments or platforms |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <ctk/ctk.h> | |||
2 | ||||
3 | typedef struct { | |||
4 | CtkWidget *widget; | |||
5 | gint x; | |||
6 | gint y; | |||
7 | guint state; | |||
8 | guint pressed : 1; | |||
9 | } PointState; | |||
10 | ||||
11 | static PointState mouse_state; | |||
12 | static PointState touch_state[10]; /* touchpoint 0 gets pointer emulation, | |||
13 | * use it first in tests for consistency. | |||
14 | */ | |||
15 | ||||
16 | #define EVENT_SEQUENCE(point)(CdkEventSequence*) ((point) - touch_state + 1) (CdkEventSequence*) ((point) - touch_state + 1) | |||
17 | ||||
18 | static void | |||
19 | point_press (PointState *point, | |||
20 | CtkWidget *widget, | |||
21 | guint button) | |||
22 | { | |||
23 | CdkDisplay *display; | |||
24 | CdkDevice *device; | |||
25 | CdkSeat *seat; | |||
26 | CdkEvent *ev; | |||
27 | ||||
28 | display = ctk_widget_get_display (widget); | |||
29 | seat = cdk_display_get_default_seat (display); | |||
30 | device = cdk_seat_get_pointer (seat); | |||
31 | ||||
32 | if (point == &mouse_state) | |||
33 | { | |||
34 | ev = cdk_event_new (CDK_BUTTON_PRESS); | |||
35 | ev->any.window = g_object_ref (ctk_widget_get_window (widget))((__typeof__ (ctk_widget_get_window (widget))) (g_object_ref) (ctk_widget_get_window (widget))); | |||
36 | ev->button.time = CDK_CURRENT_TIME0L; | |||
37 | ev->button.x = point->x; | |||
38 | ev->button.y = point->y; | |||
39 | ev->button.button = button; | |||
40 | ev->button.state = point->state; | |||
41 | ||||
42 | point->state |= CDK_BUTTON1_MASK << (button - 1); | |||
43 | } | |||
44 | else | |||
45 | { | |||
46 | ev = cdk_event_new (CDK_TOUCH_BEGIN); | |||
47 | ev->any.window = g_object_ref (ctk_widget_get_window (widget))((__typeof__ (ctk_widget_get_window (widget))) (g_object_ref) (ctk_widget_get_window (widget))); | |||
48 | ev->touch.time = CDK_CURRENT_TIME0L; | |||
49 | ev->touch.x = point->x; | |||
50 | ev->touch.y = point->y; | |||
51 | ev->touch.sequence = EVENT_SEQUENCE (point)(CdkEventSequence*) ((point) - touch_state + 1); | |||
52 | ||||
53 | if (point == &touch_state[0]) | |||
54 | ev->touch.emulating_pointer = TRUE(!(0)); | |||
55 | } | |||
56 | ||||
57 | cdk_event_set_device (ev, device); | |||
58 | ||||
59 | ctk_main_do_event (ev); | |||
60 | ||||
61 | cdk_event_free (ev); | |||
62 | ||||
63 | point->widget = widget; | |||
64 | } | |||
65 | ||||
66 | static void | |||
67 | point_update (PointState *point, | |||
68 | CtkWidget *widget, | |||
69 | gdouble x, | |||
70 | gdouble y) | |||
71 | { | |||
72 | CdkDisplay *display; | |||
73 | CdkDevice *device; | |||
74 | CdkSeat *seat; | |||
75 | CdkEvent *ev; | |||
76 | ||||
77 | display = ctk_widget_get_display (widget); | |||
78 | seat = cdk_display_get_default_seat (display); | |||
79 | device = cdk_seat_get_pointer (seat); | |||
80 | ||||
81 | point->x = x; | |||
82 | point->y = y; | |||
83 | ||||
84 | if (point == &mouse_state) | |||
85 | { | |||
86 | ev = cdk_event_new (CDK_MOTION_NOTIFY); | |||
87 | ev->any.window = g_object_ref (ctk_widget_get_window (widget))((__typeof__ (ctk_widget_get_window (widget))) (g_object_ref) (ctk_widget_get_window (widget))); | |||
88 | ev->button.time = CDK_CURRENT_TIME0L; | |||
89 | ev->motion.x = x; | |||
90 | ev->motion.y = y; | |||
91 | ev->motion.state = point->state; | |||
92 | } | |||
93 | else | |||
94 | { | |||
95 | if (!point->widget || widget != point->widget) | |||
96 | return; | |||
97 | ||||
98 | ev = cdk_event_new (CDK_TOUCH_UPDATE); | |||
99 | ev->any.window = g_object_ref (ctk_widget_get_window (widget))((__typeof__ (ctk_widget_get_window (widget))) (g_object_ref) (ctk_widget_get_window (widget))); | |||
100 | ev->touch.time = CDK_CURRENT_TIME0L; | |||
101 | ev->touch.x = x; | |||
102 | ev->touch.y = y; | |||
103 | ev->touch.sequence = EVENT_SEQUENCE (point)(CdkEventSequence*) ((point) - touch_state + 1); | |||
104 | ev->touch.state = 0; | |||
105 | ||||
106 | if (point == &touch_state[0]) | |||
107 | ev->touch.emulating_pointer = TRUE(!(0)); | |||
108 | } | |||
109 | ||||
110 | cdk_event_set_device (ev, device); | |||
111 | ||||
112 | ctk_main_do_event (ev); | |||
113 | ||||
114 | cdk_event_free (ev); | |||
115 | } | |||
116 | ||||
117 | static void | |||
118 | point_release (PointState *point, | |||
119 | guint button) | |||
120 | { | |||
121 | CdkDisplay *display; | |||
122 | CdkDevice *device; | |||
123 | CdkSeat *seat; | |||
124 | CdkEvent *ev; | |||
125 | ||||
126 | if (point->widget == NULL((void*)0)) | |||
127 | return; | |||
128 | ||||
129 | display = ctk_widget_get_display (point->widget); | |||
130 | seat = cdk_display_get_default_seat (display); | |||
131 | device = cdk_seat_get_pointer (seat); | |||
132 | ||||
133 | if (!point->widget) | |||
134 | return; | |||
135 | ||||
136 | if (point == &mouse_state) | |||
137 | { | |||
138 | if ((point->state & (CDK_BUTTON1_MASK << (button - 1))) == 0) | |||
139 | return; | |||
140 | ||||
141 | ev = cdk_event_new (CDK_BUTTON_RELEASE); | |||
142 | ev->any.window = g_object_ref (ctk_widget_get_window (point->widget))((__typeof__ (ctk_widget_get_window (point->widget))) (g_object_ref ) (ctk_widget_get_window (point->widget))); | |||
143 | ev->button.time = CDK_CURRENT_TIME0L; | |||
144 | ev->button.x = point->x; | |||
145 | ev->button.y = point->y; | |||
146 | ev->button.state = point->state; | |||
147 | ||||
148 | point->state &= ~(CDK_BUTTON1_MASK << (button - 1)); | |||
149 | } | |||
150 | else | |||
151 | { | |||
152 | ev = cdk_event_new (CDK_TOUCH_END); | |||
153 | ev->any.window = g_object_ref (ctk_widget_get_window (point->widget))((__typeof__ (ctk_widget_get_window (point->widget))) (g_object_ref ) (ctk_widget_get_window (point->widget))); | |||
154 | ev->touch.time = CDK_CURRENT_TIME0L; | |||
155 | ev->touch.x = point->x; | |||
156 | ev->touch.y = point->y; | |||
157 | ev->touch.sequence = EVENT_SEQUENCE (point)(CdkEventSequence*) ((point) - touch_state + 1); | |||
| ||||
158 | ev->touch.state = point->state; | |||
159 | ||||
160 | if (point == &touch_state[0]) | |||
161 | ev->touch.emulating_pointer = TRUE(!(0)); | |||
162 | } | |||
163 | ||||
164 | cdk_event_set_device (ev, device); | |||
165 | ||||
166 | ctk_main_do_event (ev); | |||
167 | ||||
168 | cdk_event_free (ev); | |||
169 | } | |||
170 | ||||
171 | static const gchar * | |||
172 | phase_nick (CtkPropagationPhase phase) | |||
173 | { | |||
174 | GTypeClass *class; | |||
175 | GEnumValue *value; | |||
176 | ||||
177 | class = g_type_class_ref (CTK_TYPE_PROPAGATION_PHASE(ctk_propagation_phase_get_type ())); | |||
178 | value = g_enum_get_value ((GEnumClass*)class, phase); | |||
179 | g_type_class_unref (class); | |||
180 | ||||
181 | return value->value_nick; | |||
182 | } | |||
183 | ||||
184 | static const gchar * | |||
185 | state_nick (CtkEventSequenceState state) | |||
186 | { | |||
187 | GTypeClass *class; | |||
188 | GEnumValue *value; | |||
189 | ||||
190 | class = g_type_class_ref (CTK_TYPE_EVENT_SEQUENCE_STATE(ctk_event_sequence_state_get_type ())); | |||
191 | value = g_enum_get_value ((GEnumClass*)class, state); | |||
192 | g_type_class_unref (class); | |||
193 | ||||
194 | return value->value_nick; | |||
195 | } | |||
196 | ||||
197 | typedef struct { | |||
198 | GString *str; | |||
199 | gboolean exit; | |||
200 | } LegacyData; | |||
201 | ||||
202 | static gboolean | |||
203 | legacy_cb (CtkWidget *w, | |||
204 | CdkEventButton *button G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
205 | gpointer data) | |||
206 | { | |||
207 | LegacyData *ld = data; | |||
208 | ||||
209 | if (ld->str->len > 0) | |||
210 | g_string_append (ld->str, ", ")(__builtin_constant_p (", ") ? __extension__ ({ const char * const __val = (", "); g_string_append_len_inline (ld->str, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (ld->str , ", ", (gssize) -1)); | |||
211 | g_string_append_printf (ld->str, "legacy %s", ctk_widget_get_name (w)); | |||
212 | ||||
213 | return ld->exit; | |||
214 | } | |||
215 | ||||
216 | typedef struct { | |||
217 | GString *str; | |||
218 | CtkEventSequenceState state; | |||
219 | } GestureData; | |||
220 | ||||
221 | static void | |||
222 | press_cb (CtkGesture *g, | |||
223 | gint n_press G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
224 | gdouble x G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
225 | gdouble y G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
226 | gpointer data) | |||
227 | { | |||
228 | CtkEventController *c = CTK_EVENT_CONTROLLER (g)((((CtkEventController*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((g)), ((ctk_event_controller_get_type ()))) ))); | |||
229 | CdkEventSequence *sequence; | |||
230 | CtkPropagationPhase phase; | |||
231 | GestureData *gd = data; | |||
232 | const gchar *name; | |||
233 | ||||
234 | name = g_object_get_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name"); | |||
235 | phase = ctk_event_controller_get_propagation_phase (c); | |||
236 | ||||
237 | if (gd->str->len > 0) | |||
238 | g_string_append (gd->str, ", ")(__builtin_constant_p (", ") ? __extension__ ({ const char * const __val = (", "); g_string_append_len_inline (gd->str, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (gd->str , ", ", (gssize) -1)); | |||
239 | g_string_append_printf (gd->str, "%s %s", phase_nick (phase), name); | |||
240 | ||||
241 | sequence = ctk_gesture_get_last_updated_sequence (g); | |||
242 | ||||
243 | if (sequence) | |||
244 | g_string_append_printf (gd->str, " (%x)", GPOINTER_TO_UINT (sequence)((guint) (gulong) (sequence))); | |||
245 | ||||
246 | if (gd->state != CTK_EVENT_SEQUENCE_NONE) | |||
247 | ctk_gesture_set_state (g, gd->state); | |||
248 | } | |||
249 | ||||
250 | static void | |||
251 | cancel_cb (CtkGesture *g, | |||
252 | CdkEventSequence *sequence G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
253 | gpointer data) | |||
254 | { | |||
255 | GestureData *gd = data; | |||
256 | const gchar *name; | |||
257 | ||||
258 | name = g_object_get_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name"); | |||
259 | ||||
260 | if (gd->str->len > 0) | |||
261 | g_string_append (gd->str, ", ")(__builtin_constant_p (", ") ? __extension__ ({ const char * const __val = (", "); g_string_append_len_inline (gd->str, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (gd->str , ", ", (gssize) -1)); | |||
262 | g_string_append_printf (gd->str, "%s cancelled", name); | |||
263 | } | |||
264 | ||||
265 | static void | |||
266 | begin_cb (CtkGesture *g, | |||
267 | CdkEventSequence *sequence G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
268 | gpointer data) | |||
269 | { | |||
270 | GestureData *gd = data; | |||
271 | const gchar *name; | |||
272 | ||||
273 | name = g_object_get_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name"); | |||
274 | ||||
275 | if (gd->str->len > 0) | |||
276 | g_string_append (gd->str, ", ")(__builtin_constant_p (", ") ? __extension__ ({ const char * const __val = (", "); g_string_append_len_inline (gd->str, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (gd->str , ", ", (gssize) -1)); | |||
277 | g_string_append_printf (gd->str, "%s began", name); | |||
278 | ||||
279 | if (gd->state != CTK_EVENT_SEQUENCE_NONE) | |||
280 | ctk_gesture_set_state (g, gd->state); | |||
281 | } | |||
282 | ||||
283 | static void | |||
284 | end_cb (CtkGesture *g, | |||
285 | CdkEventSequence *sequence G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
286 | gpointer data) | |||
287 | { | |||
288 | GestureData *gd = data; | |||
289 | const gchar *name; | |||
290 | ||||
291 | name = g_object_get_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name"); | |||
292 | ||||
293 | if (gd->str->len > 0) | |||
294 | g_string_append (gd->str, ", ")(__builtin_constant_p (", ") ? __extension__ ({ const char * const __val = (", "); g_string_append_len_inline (gd->str, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (gd->str , ", ", (gssize) -1)); | |||
295 | g_string_append_printf (gd->str, "%s ended", name); | |||
296 | } | |||
297 | ||||
298 | static void | |||
299 | update_cb (CtkGesture *g, | |||
300 | CdkEventSequence *sequence G_GNUC_UNUSED__attribute__ ((__unused__)), | |||
301 | gpointer data) | |||
302 | { | |||
303 | GestureData *gd = data; | |||
304 | const gchar *name; | |||
305 | ||||
306 | name = g_object_get_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name"); | |||
307 | ||||
308 | if (gd->str->len > 0) | |||
309 | g_string_append (gd->str, ", ")(__builtin_constant_p (", ") ? __extension__ ({ const char * const __val = (", "); g_string_append_len_inline (gd->str, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (gd->str , ", ", (gssize) -1)); | |||
310 | g_string_append_printf (gd->str, "%s updated", name); | |||
311 | } | |||
312 | ||||
313 | static void | |||
314 | state_changed_cb (CtkGesture *g, CdkEventSequence *sequence, CtkEventSequenceState state, gpointer data) | |||
315 | { | |||
316 | GestureData *gd = data; | |||
317 | const gchar *name; | |||
318 | ||||
319 | name = g_object_get_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name"); | |||
320 | ||||
321 | if (gd->str->len > 0) | |||
322 | g_string_append (gd->str, ", ")(__builtin_constant_p (", ") ? __extension__ ({ const char * const __val = (", "); g_string_append_len_inline (gd->str, __val , (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val ))) : (gssize) -1); }) : g_string_append_len_inline (gd->str , ", ", (gssize) -1)); | |||
323 | g_string_append_printf (gd->str, "%s state %s", name, state_nick (state)); | |||
324 | ||||
325 | if (sequence != NULL((void*)0)) | |||
326 | g_string_append_printf (gd->str, " (%x)", GPOINTER_TO_UINT (sequence)((guint) (gulong) (sequence))); | |||
327 | } | |||
328 | ||||
329 | ||||
330 | static CtkGesture * | |||
331 | add_gesture (CtkWidget *w, const gchar *name, CtkPropagationPhase phase, GString *str, CtkEventSequenceState state) | |||
332 | { | |||
333 | CtkGesture *g; | |||
334 | GestureData *data; | |||
335 | ||||
336 | data = g_new (GestureData, 1)((GestureData *) g_malloc_n ((1), sizeof (GestureData))); | |||
337 | data->str = str; | |||
338 | data->state = state; | |||
339 | ||||
340 | g = ctk_gesture_multi_press_new (w); | |||
341 | ctk_gesture_single_set_touch_only (CTK_GESTURE_SINGLE (g)((((CtkGestureSingle*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((g)), ((ctk_gesture_single_get_type ())))))), FALSE(0)); | |||
342 | ctk_gesture_single_set_button (CTK_GESTURE_SINGLE (g)((((CtkGestureSingle*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((g)), ((ctk_gesture_single_get_type ())))))), 1); | |||
343 | ctk_event_controller_set_propagation_phase (CTK_EVENT_CONTROLLER (g)((((CtkEventController*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((g)), ((ctk_event_controller_get_type ()))) ))), phase); | |||
344 | ||||
345 | g_object_set_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name", (gpointer)name); | |||
346 | ||||
347 | g_signal_connect (g, "pressed", G_CALLBACK (press_cb), data)g_signal_connect_data ((g), ("pressed"), (((GCallback) (press_cb ))), (data), ((void*)0), (GConnectFlags) 0); | |||
348 | g_signal_connect (g, "cancel", G_CALLBACK (cancel_cb), data)g_signal_connect_data ((g), ("cancel"), (((GCallback) (cancel_cb ))), (data), ((void*)0), (GConnectFlags) 0); | |||
349 | g_signal_connect (g, "update", G_CALLBACK (update_cb), data)g_signal_connect_data ((g), ("update"), (((GCallback) (update_cb ))), (data), ((void*)0), (GConnectFlags) 0); | |||
350 | g_signal_connect (g, "sequence-state-changed", G_CALLBACK (state_changed_cb), data)g_signal_connect_data ((g), ("sequence-state-changed"), (((GCallback ) (state_changed_cb))), (data), ((void*)0), (GConnectFlags) 0 ); | |||
351 | ||||
352 | return g; | |||
353 | } | |||
354 | ||||
355 | static CtkGesture * | |||
356 | add_mt_gesture (CtkWidget *w, const gchar *name, CtkPropagationPhase phase, GString *str, CtkEventSequenceState state) | |||
357 | { | |||
358 | CtkGesture *g; | |||
359 | GestureData *data; | |||
360 | ||||
361 | data = g_new (GestureData, 1)((GestureData *) g_malloc_n ((1), sizeof (GestureData))); | |||
362 | data->str = str; | |||
363 | data->state = state; | |||
364 | ||||
365 | g = ctk_gesture_rotate_new (w); | |||
366 | ctk_event_controller_set_propagation_phase (CTK_EVENT_CONTROLLER (g)((((CtkEventController*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((g)), ((ctk_event_controller_get_type ()))) ))), phase); | |||
367 | ||||
368 | g_object_set_data (G_OBJECT (g)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((g)), (((GType) ((20) << (2)))))))), "name", (gpointer)name); | |||
369 | ||||
370 | g_signal_connect (g, "begin", G_CALLBACK (begin_cb), data)g_signal_connect_data ((g), ("begin"), (((GCallback) (begin_cb ))), (data), ((void*)0), (GConnectFlags) 0); | |||
371 | g_signal_connect (g, "update", G_CALLBACK (update_cb), data)g_signal_connect_data ((g), ("update"), (((GCallback) (update_cb ))), (data), ((void*)0), (GConnectFlags) 0); | |||
372 | g_signal_connect (g, "end", G_CALLBACK (end_cb), data)g_signal_connect_data ((g), ("end"), (((GCallback) (end_cb))) , (data), ((void*)0), (GConnectFlags) 0); | |||
373 | g_signal_connect (g, "sequence-state-changed", G_CALLBACK (state_changed_cb), data)g_signal_connect_data ((g), ("sequence-state-changed"), (((GCallback ) (state_changed_cb))), (data), ((void*)0), (GConnectFlags) 0 ); | |||
374 | ||||
375 | return g; | |||
376 | } | |||
377 | ||||
378 | static void | |||
379 | add_legacy (CtkWidget *w, GString *str, gboolean exit) | |||
380 | { | |||
381 | LegacyData *data; | |||
382 | ||||
383 | data = g_new (LegacyData, 1)((LegacyData *) g_malloc_n ((1), sizeof (LegacyData))); | |||
384 | data->str = str; | |||
385 | data->exit = exit; | |||
386 | g_signal_connect (w, "button-press-event", G_CALLBACK (legacy_cb), data)g_signal_connect_data ((w), ("button-press-event"), (((GCallback ) (legacy_cb))), (data), ((void*)0), (GConnectFlags) 0); | |||
387 | } | |||
388 | ||||
389 | static void | |||
390 | test_phases (void) | |||
391 | { | |||
392 | CtkWidget *A, *B, *C; | |||
393 | GString *str; | |||
394 | ||||
395 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
396 | ctk_widget_set_name (A, "A"); | |||
397 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
398 | ctk_widget_set_name (B, "B"); | |||
399 | C = ctk_event_box_new (); | |||
400 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
401 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
402 | ctk_widget_set_name (C, "C"); | |||
403 | ||||
404 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
405 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
406 | ||||
407 | ctk_widget_show_all (A); | |||
408 | ||||
409 | str = g_string_new (""); | |||
410 | ||||
411 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
412 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
413 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
414 | add_gesture (A, "a2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
415 | add_gesture (B, "b2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
416 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
417 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
418 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
419 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
420 | ||||
421 | point_update (&mouse_state, C, 10, 10); | |||
422 | point_press (&mouse_state, C, 1); | |||
423 | ||||
424 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
425 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
426 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
427 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
428 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
429 | "bubble c3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
430 | "bubble b3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
431 | "bubble a3")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 431, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"bubble a3\"" , __s1, "==", __s2); } while (0); | |||
432 | ||||
433 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
434 | ||||
435 | ctk_widget_destroy (A); | |||
436 | } | |||
437 | ||||
438 | static void | |||
439 | test_mixed (void) | |||
440 | { | |||
441 | CtkWidget *A, *B, *C; | |||
442 | GString *str; | |||
443 | ||||
444 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
445 | ctk_widget_set_name (A, "A"); | |||
446 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
447 | ctk_widget_set_name (B, "B"); | |||
448 | C = ctk_event_box_new (); | |||
449 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
450 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
451 | ctk_widget_set_name (C, "C"); | |||
452 | ||||
453 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
454 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
455 | ||||
456 | ctk_widget_show_all (A); | |||
457 | ||||
458 | str = g_string_new (""); | |||
459 | ||||
460 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
461 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
462 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
463 | add_gesture (A, "a2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
464 | add_gesture (B, "b2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
465 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
466 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
467 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
468 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
469 | ||||
470 | add_legacy (A, str, CDK_EVENT_PROPAGATE((0))); | |||
471 | add_legacy (B, str, CDK_EVENT_PROPAGATE((0))); | |||
472 | add_legacy (C, str, CDK_EVENT_PROPAGATE((0))); | |||
473 | ||||
474 | point_update (&mouse_state, C, 10, 10); | |||
475 | point_press (&mouse_state, C, 1); | |||
476 | ||||
477 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
478 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
479 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
480 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
481 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
482 | "legacy C, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
483 | "bubble c3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
484 | "legacy B, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
485 | "bubble b3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
486 | "legacy A, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0) | |||
487 | "bubble a3")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B, " "bubble b3, " "legacy A, " "bubble a3"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 487, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B, \" \"bubble b3, \" \"legacy A, \" \"bubble a3\"" , __s1, "==", __s2); } while (0); | |||
488 | ||||
489 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
490 | ||||
491 | ctk_widget_destroy (A); | |||
492 | } | |||
493 | ||||
494 | static void | |||
495 | test_early_exit (void) | |||
496 | { | |||
497 | CtkWidget *A, *B, *C; | |||
498 | GString *str; | |||
499 | ||||
500 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
501 | ctk_widget_set_name (A, "A"); | |||
502 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
503 | ctk_widget_set_name (B, "B"); | |||
504 | C = ctk_event_box_new (); | |||
505 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
506 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
507 | ctk_widget_set_name (C, "C"); | |||
508 | ||||
509 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
510 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
511 | ||||
512 | ctk_widget_show_all (A); | |||
513 | ||||
514 | str = g_string_new (""); | |||
515 | ||||
516 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
517 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
518 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
519 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
520 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
521 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
522 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
523 | ||||
524 | add_legacy (A, str, CDK_EVENT_PROPAGATE((0))); | |||
525 | add_legacy (B, str, CDK_EVENT_STOP((!(0)))); | |||
526 | add_legacy (C, str, CDK_EVENT_PROPAGATE((0))); | |||
527 | ||||
528 | point_update (&mouse_state, C, 10, 10); | |||
529 | point_press (&mouse_state, C, 1); | |||
530 | ||||
531 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0) | |||
532 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0) | |||
533 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0) | |||
534 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0) | |||
535 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0) | |||
536 | "legacy C, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0) | |||
537 | "bubble c3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0) | |||
538 | "legacy B")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "legacy C, " "bubble c3, " "legacy B"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 538, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"legacy C, \" \"bubble c3, \" \"legacy B\"" , __s1, "==", __s2); } while (0); | |||
539 | ||||
540 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
541 | ||||
542 | ctk_widget_destroy (A); | |||
543 | } | |||
544 | ||||
545 | static void | |||
546 | test_claim_capture (void) | |||
547 | { | |||
548 | CtkWidget *A, *B, *C; | |||
549 | GString *str; | |||
550 | ||||
551 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
552 | ctk_widget_set_name (A, "A"); | |||
553 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
554 | ctk_widget_set_name (B, "B"); | |||
555 | C = ctk_event_box_new (); | |||
556 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
557 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
558 | ctk_widget_set_name (C, "C"); | |||
559 | ||||
560 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
561 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
562 | ||||
563 | ctk_widget_show_all (A); | |||
564 | ||||
565 | str = g_string_new (""); | |||
566 | ||||
567 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
568 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
569 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
570 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
571 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
572 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
573 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
574 | ||||
575 | point_update (&mouse_state, C, 10, 10); | |||
576 | point_press (&mouse_state, C, 1); | |||
577 | ||||
578 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 582, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
579 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 582, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
580 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 582, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
581 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 582, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
582 | "c1 state claimed")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 582, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0); | |||
583 | ||||
584 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
585 | ||||
586 | ctk_widget_destroy (A); | |||
587 | } | |||
588 | ||||
589 | static void | |||
590 | test_claim_target (void) | |||
591 | { | |||
592 | CtkWidget *A, *B, *C; | |||
593 | GString *str; | |||
594 | ||||
595 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
596 | ctk_widget_set_name (A, "A"); | |||
597 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
598 | ctk_widget_set_name (B, "B"); | |||
599 | C = ctk_event_box_new (); | |||
600 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
601 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
602 | ctk_widget_set_name (C, "C"); | |||
603 | ||||
604 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
605 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
606 | ||||
607 | ctk_widget_show_all (A); | |||
608 | ||||
609 | str = g_string_new (""); | |||
610 | ||||
611 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
612 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
613 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
614 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
615 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
616 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
617 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
618 | ||||
619 | point_update (&mouse_state, C, 10, 10); | |||
620 | point_press (&mouse_state, C, 1); | |||
621 | ||||
622 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 627, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
623 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 627, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
624 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 627, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
625 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 627, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
626 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 627, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
627 | "c2 state claimed")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 627, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0); | |||
628 | ||||
629 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
630 | ||||
631 | ctk_widget_destroy (A); | |||
632 | } | |||
633 | ||||
634 | static void | |||
635 | test_claim_bubble (void) | |||
636 | { | |||
637 | CtkWidget *A, *B, *C; | |||
638 | GString *str; | |||
639 | ||||
640 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
641 | ctk_widget_set_name (A, "A"); | |||
642 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
643 | ctk_widget_set_name (B, "B"); | |||
644 | C = ctk_event_box_new (); | |||
645 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
646 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
647 | ctk_widget_set_name (C, "C"); | |||
648 | ||||
649 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
650 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
651 | ||||
652 | ctk_widget_show_all (A); | |||
653 | ||||
654 | str = g_string_new (""); | |||
655 | ||||
656 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
657 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
658 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
659 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
660 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
661 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
662 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
663 | ||||
664 | point_update (&mouse_state, C, 10, 10); | |||
665 | point_press (&mouse_state, C, 1); | |||
666 | ||||
667 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
668 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
669 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
670 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
671 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
672 | "bubble c3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
673 | "bubble b3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
674 | "c3 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
675 | "c2 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
676 | "c1 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
677 | "b3 state claimed"do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0) | |||
678 | )do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "bubble c3, " "bubble b3, " "c3 cancelled, " "c2 cancelled, " "c1 cancelled, " "b3 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 678, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"bubble c3, \" \"bubble b3, \" \"c3 cancelled, \" \"c2 cancelled, \" \"c1 cancelled, \" \"b3 state claimed\"" , __s1, "==", __s2); } while (0); | |||
679 | ||||
680 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
681 | ||||
682 | ctk_widget_destroy (A); | |||
683 | } | |||
684 | ||||
685 | static void | |||
686 | test_early_claim_capture (void) | |||
687 | { | |||
688 | CtkWidget *A, *B, *C; | |||
689 | CtkGesture *g; | |||
690 | GString *str; | |||
691 | ||||
692 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
693 | ctk_widget_set_name (A, "A"); | |||
694 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
695 | ctk_widget_set_name (B, "B"); | |||
696 | C = ctk_event_box_new (); | |||
697 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
698 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
699 | ctk_widget_set_name (C, "C"); | |||
700 | ||||
701 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
702 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
703 | ||||
704 | ctk_widget_show_all (A); | |||
705 | ||||
706 | str = g_string_new (""); | |||
707 | ||||
708 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
709 | g = add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
710 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
711 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
712 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
713 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
714 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
715 | ||||
716 | point_update (&mouse_state, C, 10, 10); | |||
717 | point_press (&mouse_state, C, 1); | |||
718 | ||||
719 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 722, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"b1 state claimed\"", __s1 , "==", __s2); } while (0) | |||
720 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 722, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"b1 state claimed\"", __s1 , "==", __s2); } while (0) | |||
721 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 722, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"b1 state claimed\"", __s1 , "==", __s2); } while (0) | |||
722 | "b1 state claimed")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 722, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"b1 state claimed\"", __s1 , "==", __s2); } while (0); | |||
723 | ||||
724 | /* Reset the string */ | |||
725 | g_string_erase (str, 0, str->len); | |||
726 | ||||
727 | ctk_gesture_set_state (g, CTK_EVENT_SEQUENCE_DENIED); | |||
728 | ||||
729 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture c1, " "c1 state claimed, " "b1 state denied"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 732, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture c1, \" \"c1 state claimed, \" \"b1 state denied\"" , __s1, "==", __s2); } while (0) | |||
730 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture c1, " "c1 state claimed, " "b1 state denied"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 732, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture c1, \" \"c1 state claimed, \" \"b1 state denied\"" , __s1, "==", __s2); } while (0) | |||
731 | "c1 state claimed, "do { const char *__s1 = (str->str), *__s2 = ("capture c1, " "c1 state claimed, " "b1 state denied"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 732, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture c1, \" \"c1 state claimed, \" \"b1 state denied\"" , __s1, "==", __s2); } while (0) | |||
732 | "b1 state denied")do { const char *__s1 = (str->str), *__s2 = ("capture c1, " "c1 state claimed, " "b1 state denied"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 732, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture c1, \" \"c1 state claimed, \" \"b1 state denied\"" , __s1, "==", __s2); } while (0); | |||
733 | ||||
734 | point_release (&mouse_state, 1); | |||
735 | ||||
736 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
737 | ctk_widget_destroy (A); | |||
738 | } | |||
739 | ||||
740 | static void | |||
741 | test_late_claim_capture (void) | |||
742 | { | |||
743 | CtkWidget *A, *B, *C; | |||
744 | CtkGesture *g; | |||
745 | GString *str; | |||
746 | ||||
747 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
748 | ctk_widget_set_name (A, "A"); | |||
749 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
750 | ctk_widget_set_name (B, "B"); | |||
751 | C = ctk_event_box_new (); | |||
752 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
753 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
754 | ctk_widget_set_name (C, "C"); | |||
755 | ||||
756 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
757 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
758 | ||||
759 | ctk_widget_show_all (A); | |||
760 | ||||
761 | str = g_string_new (""); | |||
762 | ||||
763 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
764 | g = add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
765 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
766 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
767 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
768 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
769 | add_gesture (C, "c3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
770 | ||||
771 | point_update (&mouse_state, C, 10, 10); | |||
772 | point_press (&mouse_state, C, 1); | |||
773 | ||||
774 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 779, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
775 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 779, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
776 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 779, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
777 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 779, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
778 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 779, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
779 | "c2 state claimed")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 779, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0); | |||
780 | ||||
781 | /* Reset the string */ | |||
782 | g_string_erase (str, 0, str->len); | |||
783 | ||||
784 | ctk_gesture_set_state (g, CTK_EVENT_SEQUENCE_CLAIMED); | |||
785 | ||||
786 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c2 cancelled, " "c1 cancelled, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 789, ((const char*) (__func__)), "str->str" " " "==" " " "\"c2 cancelled, \" \"c1 cancelled, \" \"b1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
787 | "c2 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("c2 cancelled, " "c1 cancelled, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 789, ((const char*) (__func__)), "str->str" " " "==" " " "\"c2 cancelled, \" \"c1 cancelled, \" \"b1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
788 | "c1 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("c2 cancelled, " "c1 cancelled, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 789, ((const char*) (__func__)), "str->str" " " "==" " " "\"c2 cancelled, \" \"c1 cancelled, \" \"b1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
789 | "b1 state claimed")do { const char *__s1 = (str->str), *__s2 = ("c2 cancelled, " "c1 cancelled, " "b1 state claimed"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 789, ((const char*) (__func__)), "str->str" " " "==" " " "\"c2 cancelled, \" \"c1 cancelled, \" \"b1 state claimed\"" , __s1, "==", __s2); } while (0); | |||
790 | ||||
791 | point_release (&mouse_state, 1); | |||
792 | ||||
793 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
794 | ctk_widget_destroy (A); | |||
795 | } | |||
796 | ||||
797 | static void | |||
798 | test_group (void) | |||
799 | { | |||
800 | CtkWidget *A, *B, *C; | |||
801 | GString *str; | |||
802 | CtkGesture *g1, *g2; | |||
803 | ||||
804 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
805 | ctk_widget_set_name (A, "A"); | |||
806 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
807 | ctk_widget_set_name (B, "B"); | |||
808 | C = ctk_event_box_new (); | |||
809 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
810 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
811 | ctk_widget_set_name (C, "C"); | |||
812 | ||||
813 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
814 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
815 | ||||
816 | ctk_widget_show_all (A); | |||
817 | ||||
818 | str = g_string_new (""); | |||
819 | ||||
820 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
821 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
822 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
823 | g1 = add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_NONE); | |||
824 | g2 = add_gesture (C, "c3", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
825 | ctk_gesture_group (g1, g2); | |||
826 | add_gesture (A, "a3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
827 | add_gesture (B, "b3", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
828 | add_gesture (C, "c4", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
829 | ||||
830 | point_update (&mouse_state, C, 10, 10); | |||
831 | point_press (&mouse_state, C, 1); | |||
832 | ||||
833 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0) | |||
834 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0) | |||
835 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0) | |||
836 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0) | |||
837 | "target c3, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0) | |||
838 | "c3 state claimed, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0) | |||
839 | "c2 state claimed, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0) | |||
840 | "target c2")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c3, " "c3 state claimed, " "c2 state claimed, " "target c2"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 840, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c3, \" \"c3 state claimed, \" \"c2 state claimed, \" \"target c2\"" , __s1, "==", __s2); } while (0); | |||
841 | ||||
842 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
843 | ||||
844 | ctk_widget_destroy (A); | |||
845 | } | |||
846 | ||||
847 | static void | |||
848 | test_gestures_outside_grab (void) | |||
849 | { | |||
850 | CtkWidget *A, *B, *C, *D; | |||
851 | GString *str; | |||
852 | ||||
853 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
854 | ctk_widget_set_name (A, "A"); | |||
855 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
856 | ctk_widget_set_name (B, "B"); | |||
857 | C = ctk_event_box_new (); | |||
858 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
859 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
860 | ctk_widget_set_name (C, "C"); | |||
861 | ||||
862 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
863 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
864 | ||||
865 | ctk_widget_show_all (A); | |||
866 | ||||
867 | D = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
868 | ctk_widget_show (D); | |||
869 | ||||
870 | str = g_string_new (""); | |||
871 | ||||
872 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
873 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
874 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
875 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
876 | add_gesture (B, "b2", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
877 | add_gesture (A, "a2", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
878 | ||||
879 | point_update (&mouse_state, C, 10, 10); | |||
880 | point_press (&mouse_state, C, 1); | |||
881 | ||||
882 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 887, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
883 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 887, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
884 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 887, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
885 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 887, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
886 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 887, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
887 | "c2 state claimed")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 887, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0); | |||
888 | ||||
889 | /* Set a grab on another window */ | |||
890 | g_string_erase (str, 0, str->len); | |||
891 | ctk_grab_add (D); | |||
892 | ||||
893 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 cancelled, " "c2 cancelled, " "b1 cancelled, " "a1 cancelled"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 897, ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 cancelled, \" \"c2 cancelled, \" \"b1 cancelled, \" \"a1 cancelled\"" , __s1, "==", __s2); } while (0) | |||
894 | "c1 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("c1 cancelled, " "c2 cancelled, " "b1 cancelled, " "a1 cancelled"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 897, ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 cancelled, \" \"c2 cancelled, \" \"b1 cancelled, \" \"a1 cancelled\"" , __s1, "==", __s2); } while (0) | |||
895 | "c2 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("c1 cancelled, " "c2 cancelled, " "b1 cancelled, " "a1 cancelled"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 897, ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 cancelled, \" \"c2 cancelled, \" \"b1 cancelled, \" \"a1 cancelled\"" , __s1, "==", __s2); } while (0) | |||
896 | "b1 cancelled, "do { const char *__s1 = (str->str), *__s2 = ("c1 cancelled, " "c2 cancelled, " "b1 cancelled, " "a1 cancelled"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 897, ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 cancelled, \" \"c2 cancelled, \" \"b1 cancelled, \" \"a1 cancelled\"" , __s1, "==", __s2); } while (0) | |||
897 | "a1 cancelled")do { const char *__s1 = (str->str), *__s2 = ("c1 cancelled, " "c2 cancelled, " "b1 cancelled, " "a1 cancelled"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 897, ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 cancelled, \" \"c2 cancelled, \" \"b1 cancelled, \" \"a1 cancelled\"" , __s1, "==", __s2); } while (0); | |||
898 | ||||
899 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
900 | ||||
901 | ctk_widget_destroy (A); | |||
902 | ctk_widget_destroy (D); | |||
903 | } | |||
904 | ||||
905 | static void | |||
906 | test_gestures_inside_grab (void) | |||
907 | { | |||
908 | CtkWidget *A, *B, *C; | |||
909 | GString *str; | |||
910 | ||||
911 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
912 | ctk_widget_set_name (A, "A"); | |||
913 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
914 | ctk_widget_set_name (B, "B"); | |||
915 | C = ctk_event_box_new (); | |||
916 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
917 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
918 | ctk_widget_set_name (C, "C"); | |||
919 | ||||
920 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
921 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
922 | ||||
923 | ctk_widget_show_all (A); | |||
924 | ||||
925 | str = g_string_new (""); | |||
926 | ||||
927 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
928 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
929 | add_gesture (C, "c1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
930 | add_gesture (C, "c2", CTK_PHASE_TARGET, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
931 | add_gesture (B, "b2", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
932 | add_gesture (A, "a2", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_NONE); | |||
933 | ||||
934 | point_update (&mouse_state, C, 10, 10); | |||
935 | point_press (&mouse_state, C, 1); | |||
936 | ||||
937 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 942, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
938 | "capture a1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 942, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
939 | "capture b1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 942, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
940 | "capture c1, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 942, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
941 | "target c2, "do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 942, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0) | |||
942 | "c2 state claimed")do { const char *__s1 = (str->str), *__s2 = ("capture a1, " "capture b1, " "capture c1, " "target c2, " "c2 state claimed" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 942, ((const char*) (__func__)) , "str->str" " " "==" " " "\"capture a1, \" \"capture b1, \" \"capture c1, \" \"target c2, \" \"c2 state claimed\"" , __s1, "==", __s2); } while (0); | |||
943 | ||||
944 | /* Set a grab on B */ | |||
945 | g_string_erase (str, 0, str->len); | |||
946 | ctk_grab_add (B); | |||
947 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("a1 cancelled" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 948, ((const char*) (__func__)) , "str->str" " " "==" " " "\"a1 cancelled\"", __s1, "==", __s2 ); } while (0) | |||
948 | "a1 cancelled")do { const char *__s1 = (str->str), *__s2 = ("a1 cancelled" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 948, ((const char*) (__func__)) , "str->str" " " "==" " " "\"a1 cancelled\"", __s1, "==", __s2 ); } while (0); | |||
949 | ||||
950 | /* Update with the grab under effect */ | |||
951 | g_string_erase (str, 0, str->len); | |||
952 | point_update (&mouse_state, C, 20, 20); | |||
953 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("b1 updated, " "c1 updated, " "c2 updated"); if (g_strcmp0 (__s1, __s2) == 0 ) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 956, ((const char*) (__func__)), "str->str" " " "==" " " "\"b1 updated, \" \"c1 updated, \" \"c2 updated\"", __s1, "==" , __s2); } while (0) | |||
954 | "b1 updated, "do { const char *__s1 = (str->str), *__s2 = ("b1 updated, " "c1 updated, " "c2 updated"); if (g_strcmp0 (__s1, __s2) == 0 ) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 956, ((const char*) (__func__)), "str->str" " " "==" " " "\"b1 updated, \" \"c1 updated, \" \"c2 updated\"", __s1, "==" , __s2); } while (0) | |||
955 | "c1 updated, "do { const char *__s1 = (str->str), *__s2 = ("b1 updated, " "c1 updated, " "c2 updated"); if (g_strcmp0 (__s1, __s2) == 0 ) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 956, ((const char*) (__func__)), "str->str" " " "==" " " "\"b1 updated, \" \"c1 updated, \" \"c2 updated\"", __s1, "==" , __s2); } while (0) | |||
956 | "c2 updated")do { const char *__s1 = (str->str), *__s2 = ("b1 updated, " "c1 updated, " "c2 updated"); if (g_strcmp0 (__s1, __s2) == 0 ) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 956, ((const char*) (__func__)), "str->str" " " "==" " " "\"b1 updated, \" \"c1 updated, \" \"c2 updated\"", __s1, "==" , __s2); } while (0); | |||
957 | ||||
958 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
959 | ||||
960 | ctk_widget_destroy (A); | |||
961 | } | |||
962 | ||||
963 | static void | |||
964 | test_multitouch_on_single (void) | |||
965 | { | |||
966 | CtkWidget *A, *B, *C; | |||
967 | GString *str; | |||
968 | ||||
969 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
970 | ctk_widget_set_name (A, "A"); | |||
971 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
972 | ctk_widget_set_name (B, "B"); | |||
973 | C = ctk_event_box_new (); | |||
974 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
975 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
976 | ctk_widget_set_name (C, "C"); | |||
977 | ||||
978 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
979 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
980 | ||||
981 | ctk_widget_show_all (A); | |||
982 | ||||
983 | str = g_string_new (""); | |||
984 | ||||
985 | add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_NONE); | |||
986 | add_gesture (B, "b1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
987 | ||||
988 | /* First touch down */ | |||
989 | point_update (&touch_state[0], C, 10, 10); | |||
990 | point_press (&touch_state[0], C, 1); | |||
991 | ||||
992 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1 (1), " "capture b1 (1), " "b1 state claimed (1)"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 995, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1 (1), \" \"capture b1 (1), \" \"b1 state claimed (1)\"" , __s1, "==", __s2); } while (0) | |||
993 | "capture a1 (1), "do { const char *__s1 = (str->str), *__s2 = ("capture a1 (1), " "capture b1 (1), " "b1 state claimed (1)"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 995, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1 (1), \" \"capture b1 (1), \" \"b1 state claimed (1)\"" , __s1, "==", __s2); } while (0) | |||
994 | "capture b1 (1), "do { const char *__s1 = (str->str), *__s2 = ("capture a1 (1), " "capture b1 (1), " "b1 state claimed (1)"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 995, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1 (1), \" \"capture b1 (1), \" \"b1 state claimed (1)\"" , __s1, "==", __s2); } while (0) | |||
995 | "b1 state claimed (1)")do { const char *__s1 = (str->str), *__s2 = ("capture a1 (1), " "capture b1 (1), " "b1 state claimed (1)"); if (g_strcmp0 (__s1 , __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0) , "gestures.c", 995, ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1 (1), \" \"capture b1 (1), \" \"b1 state claimed (1)\"" , __s1, "==", __s2); } while (0); | |||
996 | ||||
997 | /* Second touch down */ | |||
998 | g_string_erase (str, 0, str->len); | |||
999 | point_update (&touch_state[1], C, 20, 20); | |||
1000 | point_press (&touch_state[1], C, 1); | |||
1001 | ||||
1002 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "b1 state denied (2)"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1004 , ((const char*) (__func__)), "str->str" " " "==" " " "\"a1 state denied (2), \" \"b1 state denied (2)\"" , __s1, "==", __s2); } while (0) | |||
1003 | "a1 state denied (2), "do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "b1 state denied (2)"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1004 , ((const char*) (__func__)), "str->str" " " "==" " " "\"a1 state denied (2), \" \"b1 state denied (2)\"" , __s1, "==", __s2); } while (0) | |||
1004 | "b1 state denied (2)")do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "b1 state denied (2)"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1004 , ((const char*) (__func__)), "str->str" " " "==" " " "\"a1 state denied (2), \" \"b1 state denied (2)\"" , __s1, "==", __s2); } while (0); | |||
1005 | ||||
1006 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
1007 | ||||
1008 | ctk_widget_destroy (A); | |||
1009 | } | |||
1010 | ||||
1011 | static void | |||
1012 | test_multitouch_activation (void) | |||
1013 | { | |||
1014 | CtkWidget *A, *B, *C; | |||
1015 | GString *str; | |||
1016 | ||||
1017 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
1018 | ctk_widget_set_name (A, "A"); | |||
1019 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
1020 | ctk_widget_set_name (B, "B"); | |||
1021 | C = ctk_event_box_new (); | |||
1022 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
1023 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
1024 | ctk_widget_set_name (C, "C"); | |||
1025 | ||||
1026 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
1027 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
1028 | ||||
1029 | ctk_widget_show_all (A); | |||
1030 | ||||
1031 | str = g_string_new (""); | |||
1032 | ||||
1033 | add_mt_gesture (C, "c1", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
1034 | ||||
1035 | /* First touch down */ | |||
1036 | point_update (&touch_state[0], C, 10, 10); | |||
1037 | point_press (&touch_state[0], C, 1); | |||
1038 | ||||
1039 | g_assert_cmpstr (str->str, ==, "")do { const char *__s1 = (str->str), *__s2 = (""); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 1039, ((const char*) (__func__)), "str->str" " " "==" " " "\"\"", __s1, "==", __s2); } while (0); | |||
| ||||
1040 | ||||
1041 | /* Second touch down */ | |||
1042 | point_update (&touch_state[1], C, 20, 20); | |||
1043 | point_press (&touch_state[1], C, 1); | |||
1044 | ||||
1045 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 began, " "c1 state claimed (2), " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1048 , ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 began, \" \"c1 state claimed (2), \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
1046 | "c1 began, "do { const char *__s1 = (str->str), *__s2 = ("c1 began, " "c1 state claimed (2), " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1048 , ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 began, \" \"c1 state claimed (2), \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
1047 | "c1 state claimed (2), "do { const char *__s1 = (str->str), *__s2 = ("c1 began, " "c1 state claimed (2), " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1048 , ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 began, \" \"c1 state claimed (2), \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0) | |||
1048 | "c1 state claimed")do { const char *__s1 = (str->str), *__s2 = ("c1 began, " "c1 state claimed (2), " "c1 state claimed"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1048 , ((const char*) (__func__)), "str->str" " " "==" " " "\"c1 began, \" \"c1 state claimed (2), \" \"c1 state claimed\"" , __s1, "==", __s2); } while (0); | |||
1049 | ||||
1050 | /* First touch up */ | |||
1051 | g_string_erase (str, 0, str->len); | |||
1052 | point_release (&touch_state[0], 1); | |||
1053 | ||||
1054 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1055, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0) | |||
1055 | "c1 ended")do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1055, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0); | |||
1056 | ||||
1057 | /* A third touch down triggering again action */ | |||
1058 | g_string_erase (str, 0, str->len); | |||
1059 | point_update (&touch_state[2], C, 20, 20); | |||
1060 | point_press (&touch_state[2], C, 1); | |||
1061 | ||||
1062 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 began, " "c1 state claimed (3)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1064, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 began, \" \"c1 state claimed (3)\"" , __s1, "==", __s2); } while (0) | |||
1063 | "c1 began, "do { const char *__s1 = (str->str), *__s2 = ("c1 began, " "c1 state claimed (3)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1064, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 began, \" \"c1 state claimed (3)\"" , __s1, "==", __s2); } while (0) | |||
1064 | "c1 state claimed (3)")do { const char *__s1 = (str->str), *__s2 = ("c1 began, " "c1 state claimed (3)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1064, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 began, \" \"c1 state claimed (3)\"" , __s1, "==", __s2); } while (0); | |||
1065 | ||||
1066 | /* One touch up, gesture is finished again */ | |||
1067 | g_string_erase (str, 0, str->len); | |||
1068 | point_release (&touch_state[2], 1); | |||
1069 | ||||
1070 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1071, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0) | |||
1071 | "c1 ended")do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1071, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0); | |||
1072 | ||||
1073 | /* Another touch up, gesture remains inactive */ | |||
1074 | g_string_erase (str, 0, str->len); | |||
1075 | point_release (&touch_state[1], 1); | |||
1076 | ||||
1077 | g_assert_cmpstr (str->str, ==, "")do { const char *__s1 = (str->str), *__s2 = (""); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 1077, ((const char*) (__func__)), "str->str" " " "==" " " "\"\"", __s1, "==", __s2); } while (0); | |||
1078 | ||||
1079 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
1080 | ||||
1081 | ctk_widget_destroy (A); | |||
1082 | } | |||
1083 | ||||
1084 | static void | |||
1085 | test_multitouch_interaction (void) | |||
1086 | { | |||
1087 | CtkWidget *A, *B, *C; | |||
1088 | CtkGesture *g; | |||
1089 | GString *str; | |||
1090 | ||||
1091 | A = ctk_window_new (CTK_WINDOW_TOPLEVEL); | |||
1092 | ctk_widget_set_name (A, "A"); | |||
1093 | B = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 0); | |||
1094 | ctk_widget_set_name (B, "B"); | |||
1095 | C = ctk_event_box_new (); | |||
1096 | ctk_widget_set_hexpand (C, TRUE(!(0))); | |||
1097 | ctk_widget_set_vexpand (C, TRUE(!(0))); | |||
1098 | ctk_widget_set_name (C, "C"); | |||
1099 | ||||
1100 | ctk_container_add (CTK_CONTAINER (A)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((A)), ((ctk_container_get_type ())))))), B); | |||
1101 | ctk_container_add (CTK_CONTAINER (B)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((B)), ((ctk_container_get_type ())))))), C); | |||
1102 | ||||
1103 | ctk_widget_show_all (A); | |||
1104 | ||||
1105 | str = g_string_new (""); | |||
1106 | ||||
1107 | g = add_gesture (A, "a1", CTK_PHASE_CAPTURE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
1108 | add_mt_gesture (C, "c1", CTK_PHASE_BUBBLE, str, CTK_EVENT_SEQUENCE_CLAIMED); | |||
1109 | ||||
1110 | /* First touch down, a1 claims the sequence */ | |||
1111 | point_update (&touch_state[0], C, 10, 10); | |||
1112 | point_press (&touch_state[0], C, 1); | |||
1113 | ||||
1114 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("capture a1 (1), " "a1 state claimed (1)"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1116 , ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1 (1), \" \"a1 state claimed (1)\"" , __s1, "==", __s2); } while (0) | |||
1115 | "capture a1 (1), "do { const char *__s1 = (str->str), *__s2 = ("capture a1 (1), " "a1 state claimed (1)"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1116 , ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1 (1), \" \"a1 state claimed (1)\"" , __s1, "==", __s2); } while (0) | |||
1116 | "a1 state claimed (1)")do { const char *__s1 = (str->str), *__s2 = ("capture a1 (1), " "a1 state claimed (1)"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1116 , ((const char*) (__func__)), "str->str" " " "==" " " "\"capture a1 (1), \" \"a1 state claimed (1)\"" , __s1, "==", __s2); } while (0); | |||
1117 | ||||
1118 | /* Second touch down, a1 denies and c1 takes over */ | |||
1119 | g_string_erase (str, 0, str->len); | |||
1120 | point_update (&touch_state[1], C, 20, 20); | |||
1121 | point_press (&touch_state[1], C, 1); | |||
1122 | ||||
1123 | /* Denying sequences in touch-excess situation is a responsibility of the caller */ | |||
1124 | ctk_gesture_set_state (g, CTK_EVENT_SEQUENCE_DENIED); | |||
1125 | ||||
1126 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "c1 began, " "c1 state claimed, " "c1 state claimed (2), " "a1 state denied (1)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1131, ((const char*) (__func__) ), "str->str" " " "==" " " "\"a1 state denied (2), \" \"c1 began, \" \"c1 state claimed, \" \"c1 state claimed (2), \" \"a1 state denied (1)\"" , __s1, "==", __s2); } while (0) | |||
1127 | "a1 state denied (2), "do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "c1 began, " "c1 state claimed, " "c1 state claimed (2), " "a1 state denied (1)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1131, ((const char*) (__func__) ), "str->str" " " "==" " " "\"a1 state denied (2), \" \"c1 began, \" \"c1 state claimed, \" \"c1 state claimed (2), \" \"a1 state denied (1)\"" , __s1, "==", __s2); } while (0) | |||
1128 | "c1 began, "do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "c1 began, " "c1 state claimed, " "c1 state claimed (2), " "a1 state denied (1)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1131, ((const char*) (__func__) ), "str->str" " " "==" " " "\"a1 state denied (2), \" \"c1 began, \" \"c1 state claimed, \" \"c1 state claimed (2), \" \"a1 state denied (1)\"" , __s1, "==", __s2); } while (0) | |||
1129 | "c1 state claimed, "do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "c1 began, " "c1 state claimed, " "c1 state claimed (2), " "a1 state denied (1)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1131, ((const char*) (__func__) ), "str->str" " " "==" " " "\"a1 state denied (2), \" \"c1 began, \" \"c1 state claimed, \" \"c1 state claimed (2), \" \"a1 state denied (1)\"" , __s1, "==", __s2); } while (0) | |||
1130 | "c1 state claimed (2), "do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "c1 began, " "c1 state claimed, " "c1 state claimed (2), " "a1 state denied (1)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1131, ((const char*) (__func__) ), "str->str" " " "==" " " "\"a1 state denied (2), \" \"c1 began, \" \"c1 state claimed, \" \"c1 state claimed (2), \" \"a1 state denied (1)\"" , __s1, "==", __s2); } while (0) | |||
1131 | "a1 state denied (1)")do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (2), " "c1 began, " "c1 state claimed, " "c1 state claimed (2), " "a1 state denied (1)" ); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1131, ((const char*) (__func__) ), "str->str" " " "==" " " "\"a1 state denied (2), \" \"c1 began, \" \"c1 state claimed, \" \"c1 state claimed (2), \" \"a1 state denied (1)\"" , __s1, "==", __s2); } while (0); | |||
1132 | ||||
1133 | /* Move first point, only c1 should update */ | |||
1134 | g_string_erase (str, 0, str->len); | |||
1135 | point_update (&touch_state[0], C, 30, 30); | |||
1136 | ||||
1137 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 updated") ; if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1138, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 updated\"", __s1, "==", __s2 ); } while (0) | |||
1138 | "c1 updated")do { const char *__s1 = (str->str), *__s2 = ("c1 updated") ; if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1138, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 updated\"", __s1, "==", __s2 ); } while (0); | |||
1139 | ||||
1140 | /* First touch up */ | |||
1141 | g_string_erase (str, 0, str->len); | |||
1142 | point_release (&touch_state[0], 1); | |||
1143 | ||||
1144 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1145, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0) | |||
1145 | "c1 ended")do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1145, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0); | |||
1146 | ||||
1147 | /* A third touch down triggering again action on c1 */ | |||
1148 | g_string_erase (str, 0, str->len); | |||
1149 | point_update (&touch_state[2], C, 20, 20); | |||
1150 | point_press (&touch_state[2], C, 1); | |||
1151 | ||||
1152 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (3), " "c1 began, " "c1 state claimed (3)"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 1155, ((const char*) (__func__)), "str->str" " " "==" " " "\"a1 state denied (3), \" \"c1 began, \" \"c1 state claimed (3)\"" , __s1, "==", __s2); } while (0) | |||
1153 | "a1 state denied (3), "do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (3), " "c1 began, " "c1 state claimed (3)"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 1155, ((const char*) (__func__)), "str->str" " " "==" " " "\"a1 state denied (3), \" \"c1 began, \" \"c1 state claimed (3)\"" , __s1, "==", __s2); } while (0) | |||
1154 | "c1 began, "do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (3), " "c1 began, " "c1 state claimed (3)"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 1155, ((const char*) (__func__)), "str->str" " " "==" " " "\"a1 state denied (3), \" \"c1 began, \" \"c1 state claimed (3)\"" , __s1, "==", __s2); } while (0) | |||
1155 | "c1 state claimed (3)")do { const char *__s1 = (str->str), *__s2 = ("a1 state denied (3), " "c1 began, " "c1 state claimed (3)"); if (g_strcmp0 (__s1, __s2 ) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c" , 1155, ((const char*) (__func__)), "str->str" " " "==" " " "\"a1 state denied (3), \" \"c1 began, \" \"c1 state claimed (3)\"" , __s1, "==", __s2); } while (0); | |||
1156 | ||||
1157 | /* One touch up, gesture is finished again */ | |||
1158 | g_string_erase (str, 0, str->len); | |||
1159 | point_release (&touch_state[2], 1); | |||
1160 | ||||
1161 | g_assert_cmpstr (str->str, ==,do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1162, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0) | |||
1162 | "c1 ended")do { const char *__s1 = (str->str), *__s2 = ("c1 ended"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "gestures.c", 1162, ((const char*) (__func__) ), "str->str" " " "==" " " "\"c1 ended\"", __s1, "==", __s2 ); } while (0); | |||
1163 | ||||
1164 | /* Another touch up, gesture remains inactive */ | |||
1165 | g_string_erase (str, 0, str->len); | |||
1166 | point_release (&touch_state[1], 1); | |||
1167 | ||||
1168 | g_assert_cmpstr (str->str, ==, "")do { const char *__s1 = (str->str), *__s2 = (""); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar *) 0), "gestures.c", 1168, ((const char*) (__func__)), "str->str" " " "==" " " "\"\"", __s1, "==", __s2); } while (0); | |||
1169 | ||||
1170 | g_string_free (str, TRUE)(__builtin_constant_p ((!(0))) ? (((!(0))) ? (g_string_free) ( (str), ((!(0)))) : g_string_free_and_steal (str)) : (g_string_free ) ((str), ((!(0))))); | |||
1171 | ||||
1172 | ctk_widget_destroy (A); | |||
1173 | } | |||
1174 | ||||
1175 | int | |||
1176 | main (int argc, char *argv[]) | |||
1177 | { | |||
1178 | ctk_test_init (&argc, &argv); | |||
1179 | ||||
1180 | g_test_add_func ("/gestures/propagation/phases", test_phases); | |||
1181 | g_test_add_func ("/gestures/propagation/mixed", test_mixed); | |||
1182 | g_test_add_func ("/gestures/propagation/early-exit", test_early_exit); | |||
1183 | g_test_add_func ("/gestures/claim/capture", test_claim_capture); | |||
1184 | g_test_add_func ("/gestures/claim/target", test_claim_target); | |||
1185 | g_test_add_func ("/gestures/claim/bubble", test_claim_bubble); | |||
1186 | g_test_add_func ("/gestures/claim/early-capture", test_early_claim_capture); | |||
1187 | g_test_add_func ("/gestures/claim/late-capture", test_late_claim_capture); | |||
1188 | g_test_add_func ("/gestures/group", test_group); | |||
1189 | g_test_add_func ("/gestures/grabs/gestures-outside-grab", test_gestures_outside_grab); | |||
1190 | g_test_add_func ("/gestures/grabs/gestures-inside-grab", test_gestures_inside_grab); | |||
1191 | g_test_add_func ("/gestures/multitouch/gesture-single", test_multitouch_on_single); | |||
1192 | g_test_add_func ("/gestures/multitouch/multitouch-activation", test_multitouch_activation); | |||
1193 | g_test_add_func ("/gestures/multitouch/interaction", test_multitouch_interaction); | |||
1194 | ||||
1195 | return g_test_run (); | |||
1196 | } |