File: key-model.c

package info (click to toggle)
caribou 0.4.21-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,232 kB
  • sloc: ansic: 14,664; sh: 4,253; xml: 2,045; python: 1,401; makefile: 463
file content (1511 lines) | stat: -rw-r--r-- 53,914 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
/* key-model.c generated by valac 0.32.0.49-00a57, the Vala compiler
 * generated from key-model.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <gee.h>


#define CARIBOU_TYPE_ISCANNABLE_ITEM (caribou_iscannable_item_get_type ())
#define CARIBOU_ISCANNABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM, CaribouIScannableItem))
#define CARIBOU_IS_ISCANNABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM))
#define CARIBOU_ISCANNABLE_ITEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM, CaribouIScannableItemIface))

typedef struct _CaribouIScannableItem CaribouIScannableItem;
typedef struct _CaribouIScannableItemIface CaribouIScannableItemIface;

#define CARIBOU_TYPE_IKEYBOARD_OBJECT (caribou_ikeyboard_object_get_type ())
#define CARIBOU_IKEYBOARD_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_IKEYBOARD_OBJECT, CaribouIKeyboardObject))
#define CARIBOU_IS_IKEYBOARD_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_IKEYBOARD_OBJECT))
#define CARIBOU_IKEYBOARD_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_IKEYBOARD_OBJECT, CaribouIKeyboardObjectIface))

typedef struct _CaribouIKeyboardObject CaribouIKeyboardObject;
typedef struct _CaribouIKeyboardObjectIface CaribouIKeyboardObjectIface;

#define CARIBOU_TYPE_KEY_MODEL (caribou_key_model_get_type ())
#define CARIBOU_KEY_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_KEY_MODEL, CaribouKeyModel))
#define CARIBOU_KEY_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_KEY_MODEL, CaribouKeyModelClass))
#define CARIBOU_IS_KEY_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_KEY_MODEL))
#define CARIBOU_IS_KEY_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_KEY_MODEL))
#define CARIBOU_KEY_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_KEY_MODEL, CaribouKeyModelClass))

typedef struct _CaribouKeyModel CaribouKeyModel;
typedef struct _CaribouKeyModelClass CaribouKeyModelClass;
typedef struct _CaribouKeyModelPrivate CaribouKeyModelPrivate;

#define CARIBOU_TYPE_MODIFIER_STATE (caribou_modifier_state_get_type ())

#define CARIBOU_TYPE_DISPLAY_ADAPTER (caribou_display_adapter_get_type ())
#define CARIBOU_DISPLAY_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_DISPLAY_ADAPTER, CaribouDisplayAdapter))
#define CARIBOU_DISPLAY_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_DISPLAY_ADAPTER, CaribouDisplayAdapterClass))
#define CARIBOU_IS_DISPLAY_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_DISPLAY_ADAPTER))
#define CARIBOU_IS_DISPLAY_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_DISPLAY_ADAPTER))
#define CARIBOU_DISPLAY_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_DISPLAY_ADAPTER, CaribouDisplayAdapterClass))

typedef struct _CaribouDisplayAdapter CaribouDisplayAdapter;
typedef struct _CaribouDisplayAdapterClass CaribouDisplayAdapterClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define CARIBOU_TYPE_MODIFIER_MAP_ENTRY (caribou_modifier_map_entry_get_type ())
typedef struct _CaribouModifierMapEntry CaribouModifierMapEntry;

#define CARIBOU_TYPE_LABEL_MAP_ENTRY (caribou_label_map_entry_get_type ())
typedef struct _CaribouLabelMapEntry CaribouLabelMapEntry;

struct _CaribouIScannableItemIface {
	GTypeInterface parent_iface;
	gboolean (*get_scan_stepping) (CaribouIScannableItem* self);
	void (*set_scan_stepping) (CaribouIScannableItem* self, gboolean value);
	gboolean (*get_scan_selected) (CaribouIScannableItem* self);
	void (*set_scan_selected) (CaribouIScannableItem* self, gboolean value);
};

struct _CaribouIKeyboardObjectIface {
	GTypeInterface parent_iface;
	CaribouIKeyboardObject** (*get_children) (CaribouIKeyboardObject* self, int* result_length1);
	CaribouKeyModel** (*get_keys) (CaribouIKeyboardObject* self, int* result_length1);
};

typedef enum  {
	CARIBOU_MODIFIER_STATE_NONE,
	CARIBOU_MODIFIER_STATE_LATCHED,
	CARIBOU_MODIFIER_STATE_LOCKED
} CaribouModifierState;

struct _CaribouKeyModel {
	GObject parent_instance;
	CaribouKeyModelPrivate * priv;
	CaribouModifierState modifier_state;
};

struct _CaribouKeyModelClass {
	GObjectClass parent_class;
};

struct _CaribouKeyModelPrivate {
	gchar* _align;
	gdouble _width;
	gchar* _toggle;
	gboolean _repeatable;
	GdkModifierType mod_mask;
	gboolean _show_subkeys;
	gchar* _name;
	guint _keyval;
	gchar* _text;
	guint* _keyvals;
	gint _keyvals_length1;
	gint __keyvals_size_;
	gchar* _label;
	gboolean _scan_stepping;
	gboolean _scan_selected;
	guint hold_tid;
	CaribouDisplayAdapter* xadapter;
	GeeArrayList* extended_keys;
};

struct _CaribouModifierMapEntry {
	gchar* name;
	GdkModifierType mask;
};

struct _CaribouLabelMapEntry {
	gchar* name;
	gchar* label;
};


static gpointer caribou_key_model_parent_class = NULL;
static CaribouIScannableItemIface* caribou_key_model_caribou_iscannable_item_parent_iface = NULL;
static CaribouIKeyboardObjectIface* caribou_key_model_caribou_ikeyboard_object_parent_iface = NULL;

GType caribou_iscannable_item_get_type (void) G_GNUC_CONST;
GType caribou_key_model_get_type (void) G_GNUC_CONST;
GType caribou_ikeyboard_object_get_type (void) G_GNUC_CONST;
GType caribou_modifier_state_get_type (void) G_GNUC_CONST;
GType caribou_display_adapter_get_type (void) G_GNUC_CONST;
#define CARIBOU_KEY_MODEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CARIBOU_TYPE_KEY_MODEL, CaribouKeyModelPrivate))
enum  {
	CARIBOU_KEY_MODEL_DUMMY_PROPERTY,
	CARIBOU_KEY_MODEL_ALIGN,
	CARIBOU_KEY_MODEL_WIDTH,
	CARIBOU_KEY_MODEL_TOGGLE,
	CARIBOU_KEY_MODEL_REPEATABLE,
	CARIBOU_KEY_MODEL_IS_MODIFIER,
	CARIBOU_KEY_MODEL_SHOW_SUBKEYS,
	CARIBOU_KEY_MODEL_NAME,
	CARIBOU_KEY_MODEL_KEYVAL,
	CARIBOU_KEY_MODEL_TEXT,
	CARIBOU_KEY_MODEL_LABEL,
	CARIBOU_KEY_MODEL_SCAN_STEPPING,
	CARIBOU_KEY_MODEL_SCAN_SELECTED
};
GType caribou_modifier_map_entry_get_type (void) G_GNUC_CONST;
CaribouModifierMapEntry* caribou_modifier_map_entry_dup (const CaribouModifierMapEntry* self);
void caribou_modifier_map_entry_free (CaribouModifierMapEntry* self);
void caribou_modifier_map_entry_copy (const CaribouModifierMapEntry* self, CaribouModifierMapEntry* dest);
void caribou_modifier_map_entry_destroy (CaribouModifierMapEntry* self);
GType caribou_label_map_entry_get_type (void) G_GNUC_CONST;
CaribouLabelMapEntry* caribou_label_map_entry_dup (const CaribouLabelMapEntry* self);
void caribou_label_map_entry_free (CaribouLabelMapEntry* self);
void caribou_label_map_entry_copy (const CaribouLabelMapEntry* self, CaribouLabelMapEntry* dest);
void caribou_label_map_entry_destroy (CaribouLabelMapEntry* self);
CaribouKeyModel* caribou_key_model_new (const gchar* name, const gchar* text);
CaribouKeyModel* caribou_key_model_construct (GType object_type, const gchar* name, const gchar* text);
static void caribou_key_model_set_name (CaribouKeyModel* self, const gchar* value);
static void caribou_key_model_set_text (CaribouKeyModel* self, const gchar* value);
static void _vala_array_add3 (guint** array, int* length, int* size, guint value);
static void _vala_array_add4 (guint** array, int* length, int* size, guint value);
static void caribou_key_model_set_keyval (CaribouKeyModel* self, guint value);
void caribou_key_model_set_label (CaribouKeyModel* self, const gchar* value);
const gchar* caribou_key_model_get_label (CaribouKeyModel* self);
CaribouDisplayAdapter* caribou_display_adapter_get_default (void);
void caribou_key_model_add_subkey (CaribouKeyModel* self, CaribouKeyModel* key);
static void caribou_key_model_on_subkey_released (CaribouKeyModel* self, CaribouKeyModel* key);
static void _caribou_key_model_on_subkey_released_caribou_ikeyboard_object_key_released (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self);
static void caribou_key_model_set_show_subkeys (CaribouKeyModel* self, gboolean value);
void caribou_key_model_press (CaribouKeyModel* self);
gboolean caribou_key_model_get_is_modifier (CaribouKeyModel* self);
void caribou_display_adapter_mod_lock (CaribouDisplayAdapter* self, guint mask);
gboolean caribou_key_model_get_repeatable (CaribouKeyModel* self);
void caribou_display_adapter_keyval_press (CaribouDisplayAdapter* self, guint keyval);
guint caribou_key_model_get_keyval (CaribouKeyModel* self);
static gboolean caribou_key_model_on_key_held (CaribouKeyModel* self);
static gboolean _caribou_key_model_on_key_held_gsource_func (gpointer self);
void caribou_key_model_release (CaribouKeyModel* self);
void caribou_display_adapter_mod_unlock (CaribouDisplayAdapter* self, guint mask);
void caribou_display_adapter_keyval_release (CaribouDisplayAdapter* self, guint keyval);
CaribouKeyModel** caribou_key_model_get_extended_keys (CaribouKeyModel* self, int* result_length1);
static CaribouKeyModel** caribou_key_model_real_get_keys (CaribouIKeyboardObject* base, int* result_length1);
static CaribouIKeyboardObject** caribou_key_model_real_get_children (CaribouIKeyboardObject* base, int* result_length1);
void caribou_key_model_activate (CaribouKeyModel* self);
static gboolean __lambda4_ (CaribouKeyModel* self);
static gboolean ___lambda4__gsource_func (gpointer self);
const gchar* caribou_key_model_get_align (CaribouKeyModel* self);
void caribou_key_model_set_align (CaribouKeyModel* self, const gchar* value);
gdouble caribou_key_model_get_width (CaribouKeyModel* self);
void caribou_key_model_set_width (CaribouKeyModel* self, gdouble value);
const gchar* caribou_key_model_get_toggle (CaribouKeyModel* self);
void caribou_key_model_set_toggle (CaribouKeyModel* self, const gchar* value);
void caribou_key_model_set_repeatable (CaribouKeyModel* self, gboolean value);
void caribou_key_model_set_is_modifier (CaribouKeyModel* self, gboolean value);
gboolean caribou_key_model_get_show_subkeys (CaribouKeyModel* self);
const gchar* caribou_key_model_get_name (CaribouKeyModel* self);
const gchar* caribou_key_model_get_text (CaribouKeyModel* self);
static void caribou_key_model_finalize (GObject* obj);
gboolean caribou_iscannable_item_get_scan_stepping (CaribouIScannableItem* self);
gboolean caribou_iscannable_item_get_scan_selected (CaribouIScannableItem* self);
static void _vala_caribou_key_model_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
void caribou_iscannable_item_set_scan_stepping (CaribouIScannableItem* self, gboolean value);
void caribou_iscannable_item_set_scan_selected (CaribouIScannableItem* self, gboolean value);
static void _vala_caribou_key_model_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);

static const CaribouModifierMapEntry CARIBOU_KEY_MODEL_mod_map[3] = {{"Control_L", GDK_CONTROL_MASK}, {"Alt_L", GDK_MOD1_MASK}, {NULL, 0}};
static const CaribouLabelMapEntry CARIBOU_KEY_MODEL_label_map[24] = {{"BackSpace", "\xe2\x8c\xab"}, {"space", " "}, {"Delete", "\xe2\x8c\xa6"}, {"Return", "\xe2\x8f\x8e"}, {"Escape", "Esc"}, {"Tab", "\xe2\x86\xb9"}, {"Control_L", "Ctrl"}, {"Control_R", "Ctrl"}, {"Alt_L", "Alt"}, {"Alt_R", "Alt"}, {"Up", "\xe2\x87\xa1"}, {"Down", "\xe2\x87\xa3"}, {"Left", "\xe2\x87\xa0"}, {"Right", "\xe2\x87\xa2"}, {"Prior", "Page\nUp"}, {"Next", "Page\nDown"}, {"Caribou_Prefs", "\xe2\x8c\xa8"}, {"Caribou_ShiftUp", "\xe2\xac\x86"}, {"Caribou_ShiftDown", "\xe2\xac\x87"}, {"Caribou_Emoticons", "\xe2\x98\xba"}, {"Caribou_Symbols", "123"}, {"Caribou_Symbols_More", "{#*"}, {"Caribou_Alpha", "Abc"}, {"Caribou_Repeat", "\xe2\x99\xbb"}};

static gboolean string_get_next_char (const gchar* self, gint* index, gunichar* c) {
	gunichar _vala_c = 0U;
	gboolean result = FALSE;
	gint _tmp0_ = 0;
	gunichar _tmp1_ = 0U;
	gunichar _tmp2_ = 0U;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = *index;
	_tmp1_ = g_utf8_get_char (((gchar*) self) + _tmp0_);
	_vala_c = _tmp1_;
	_tmp2_ = _vala_c;
	if (_tmp2_ != ((gunichar) 0)) {
		gint _tmp3_ = 0;
		gchar* _tmp4_ = NULL;
		_tmp3_ = *index;
		_tmp4_ = g_utf8_next_char (((gchar*) self) + _tmp3_);
		*index = (gint) (_tmp4_ - ((gchar*) self));
		result = TRUE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	} else {
		result = FALSE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	}
	if (c) {
		*c = _vala_c;
	}
}


static void _vala_array_add3 (guint** array, int* length, int* size, guint value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (guint, *array, *size);
	}
	(*array)[(*length)++] = value;
}


static void _vala_array_add4 (guint** array, int* length, int* size, guint value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (guint, *array, *size);
	}
	(*array)[(*length)++] = value;
}


static gchar* string_slice (const gchar* self, glong start, glong end) {
	gchar* result = NULL;
	glong string_length = 0L;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	glong _tmp2_ = 0L;
	glong _tmp5_ = 0L;
	gboolean _tmp8_ = FALSE;
	glong _tmp9_ = 0L;
	gboolean _tmp12_ = FALSE;
	glong _tmp13_ = 0L;
	glong _tmp16_ = 0L;
	glong _tmp17_ = 0L;
	glong _tmp18_ = 0L;
	glong _tmp19_ = 0L;
	glong _tmp20_ = 0L;
	gchar* _tmp21_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	_tmp2_ = start;
	if (_tmp2_ < ((glong) 0)) {
		glong _tmp3_ = 0L;
		glong _tmp4_ = 0L;
		_tmp3_ = string_length;
		_tmp4_ = start;
		start = _tmp3_ + _tmp4_;
	}
	_tmp5_ = end;
	if (_tmp5_ < ((glong) 0)) {
		glong _tmp6_ = 0L;
		glong _tmp7_ = 0L;
		_tmp6_ = string_length;
		_tmp7_ = end;
		end = _tmp6_ + _tmp7_;
	}
	_tmp9_ = start;
	if (_tmp9_ >= ((glong) 0)) {
		glong _tmp10_ = 0L;
		glong _tmp11_ = 0L;
		_tmp10_ = start;
		_tmp11_ = string_length;
		_tmp8_ = _tmp10_ <= _tmp11_;
	} else {
		_tmp8_ = FALSE;
	}
	g_return_val_if_fail (_tmp8_, NULL);
	_tmp13_ = end;
	if (_tmp13_ >= ((glong) 0)) {
		glong _tmp14_ = 0L;
		glong _tmp15_ = 0L;
		_tmp14_ = end;
		_tmp15_ = string_length;
		_tmp12_ = _tmp14_ <= _tmp15_;
	} else {
		_tmp12_ = FALSE;
	}
	g_return_val_if_fail (_tmp12_, NULL);
	_tmp16_ = start;
	_tmp17_ = end;
	g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
	_tmp18_ = start;
	_tmp19_ = end;
	_tmp20_ = start;
	_tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
	result = _tmp21_;
	return result;
}


static gchar* g_unichar_to_string (gunichar self) {
	gchar* result = NULL;
	gchar* str = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	_tmp1_ = str;
	g_unichar_to_utf8 (self, _tmp1_);
	result = str;
	return result;
}


CaribouKeyModel* caribou_key_model_construct (GType object_type, const gchar* name, const gchar* text) {
	CaribouKeyModel * self = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gint i = 0;
	GdkModifierType _tmp17_ = 0;
	gint _tmp46_ = 0;
	CaribouDisplayAdapter* _tmp97_ = NULL;
	GeeArrayList* _tmp98_ = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	self = (CaribouKeyModel*) g_object_new (object_type, NULL);
	_tmp0_ = name;
	caribou_key_model_set_name (self, _tmp0_);
	_tmp1_ = text;
	caribou_key_model_set_text (self, _tmp1_);
	self->priv->mod_mask = (GdkModifierType) 0;
	i = 0;
	{
		CaribouModifierMapEntry entry = {0};
		gint _tmp2_ = 0;
		CaribouModifierMapEntry _tmp3_ = {0};
		CaribouModifierMapEntry _tmp4_ = {0};
		_tmp2_ = i;
		_tmp3_ = CARIBOU_KEY_MODEL_mod_map[_tmp2_];
		caribou_modifier_map_entry_copy (&_tmp3_, &_tmp4_);
		entry = _tmp4_;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				CaribouModifierMapEntry _tmp10_ = {0};
				const gchar* _tmp11_ = NULL;
				const gchar* _tmp12_ = NULL;
				CaribouModifierMapEntry _tmp13_ = {0};
				const gchar* _tmp14_ = NULL;
				if (!_tmp5_) {
					gint _tmp6_ = 0;
					gint _tmp7_ = 0;
					CaribouModifierMapEntry _tmp8_ = {0};
					CaribouModifierMapEntry _tmp9_ = {0};
					_tmp6_ = i;
					i = _tmp6_ + 1;
					_tmp7_ = i;
					_tmp8_ = CARIBOU_KEY_MODEL_mod_map[_tmp7_];
					caribou_modifier_map_entry_copy (&_tmp8_, &_tmp9_);
					caribou_modifier_map_entry_destroy (&entry);
					entry = _tmp9_;
				}
				_tmp5_ = FALSE;
				_tmp10_ = entry;
				_tmp11_ = _tmp10_.name;
				if (!(_tmp11_ != NULL)) {
					break;
				}
				_tmp12_ = name;
				_tmp13_ = entry;
				_tmp14_ = _tmp13_.name;
				if (g_strcmp0 (_tmp12_, _tmp14_) == 0) {
					CaribouModifierMapEntry _tmp15_ = {0};
					GdkModifierType _tmp16_ = 0;
					_tmp15_ = entry;
					_tmp16_ = _tmp15_.mask;
					self->priv->mod_mask = _tmp16_;
				}
			}
		}
		caribou_modifier_map_entry_destroy (&entry);
	}
	_tmp17_ = self->priv->mod_mask;
	if (_tmp17_ == 0) {
		const gchar* _tmp18_ = NULL;
		_tmp18_ = text;
		if (_tmp18_ != NULL) {
			gint index = 0;
			gunichar uc = 0U;
			index = 0;
			while (TRUE) {
				const gchar* _tmp19_ = NULL;
				gunichar _tmp20_ = 0U;
				gboolean _tmp21_ = FALSE;
				guint keyval = 0U;
				gunichar _tmp22_ = 0U;
				guint _tmp23_ = 0U;
				guint _tmp24_ = 0U;
				gunichar _tmp25_ = 0U;
				_tmp19_ = text;
				_tmp21_ = string_get_next_char (_tmp19_, &index, &_tmp20_);
				uc = _tmp20_;
				if (!_tmp21_) {
					break;
				}
				_tmp22_ = uc;
				_tmp23_ = gdk_unicode_to_keyval ((guint32) _tmp22_);
				keyval = _tmp23_;
				_tmp24_ = keyval;
				_tmp25_ = uc;
				if ((_tmp24_ != ((guint) _tmp25_)) | 0x01000000) {
					guint* _tmp26_ = NULL;
					gint _tmp26__length1 = 0;
					guint _tmp27_ = 0U;
					_tmp26_ = self->priv->_keyvals;
					_tmp26__length1 = self->priv->_keyvals_length1;
					_tmp27_ = keyval;
					_vala_array_add3 (&self->priv->_keyvals, &self->priv->_keyvals_length1, &self->priv->__keyvals_size_, _tmp27_);
				}
			}
		} else {
			guint keyval = 0U;
			const gchar* _tmp28_ = NULL;
			guint _tmp29_ = 0U;
			gboolean _tmp30_ = FALSE;
			guint _tmp31_ = 0U;
			guint _tmp35_ = 0U;
			_tmp28_ = name;
			_tmp29_ = gdk_keyval_from_name (_tmp28_);
			keyval = _tmp29_;
			_tmp31_ = keyval;
			if (_tmp31_ != ((guint) GDK_KEY_VoidSymbol)) {
				guint _tmp32_ = 0U;
				_tmp32_ = keyval;
				_tmp30_ = _tmp32_ != ((guint) 0);
			} else {
				_tmp30_ = FALSE;
			}
			if (_tmp30_) {
				guint* _tmp33_ = NULL;
				gint _tmp33__length1 = 0;
				guint _tmp34_ = 0U;
				_tmp33_ = self->priv->_keyvals;
				_tmp33__length1 = self->priv->_keyvals_length1;
				_tmp34_ = keyval;
				_vala_array_add4 (&self->priv->_keyvals, &self->priv->_keyvals_length1, &self->priv->__keyvals_size_, _tmp34_);
			}
			_tmp35_ = keyval;
			caribou_key_model_set_keyval (self, _tmp35_);
		}
	}
	{
		gboolean _tmp36_ = FALSE;
		i = 0;
		_tmp36_ = TRUE;
		while (TRUE) {
			gint _tmp38_ = 0;
			gint _tmp39_ = 0;
			CaribouLabelMapEntry _tmp40_ = {0};
			const gchar* _tmp41_ = NULL;
			const gchar* _tmp42_ = NULL;
			if (!_tmp36_) {
				gint _tmp37_ = 0;
				_tmp37_ = i;
				i = _tmp37_ + 1;
			}
			_tmp36_ = FALSE;
			_tmp38_ = i;
			if (!(_tmp38_ < G_N_ELEMENTS (CARIBOU_KEY_MODEL_label_map))) {
				break;
			}
			_tmp39_ = i;
			_tmp40_ = CARIBOU_KEY_MODEL_label_map[_tmp39_];
			_tmp41_ = _tmp40_.name;
			_tmp42_ = name;
			if (g_strcmp0 (_tmp41_, _tmp42_) == 0) {
				gint _tmp43_ = 0;
				CaribouLabelMapEntry _tmp44_ = {0};
				const gchar* _tmp45_ = NULL;
				_tmp43_ = i;
				_tmp44_ = CARIBOU_KEY_MODEL_label_map[_tmp43_];
				_tmp45_ = _tmp44_.label;
				caribou_key_model_set_label (self, _tmp45_);
				break;
			}
		}
	}
	_tmp46_ = i;
	if (_tmp46_ == G_N_ELEMENTS (CARIBOU_KEY_MODEL_label_map)) {
		const gchar* _tmp47_ = NULL;
		_tmp47_ = text;
		if (_tmp47_ != NULL) {
			const gchar* _tmp48_ = NULL;
			_tmp48_ = text;
			caribou_key_model_set_label (self, _tmp48_);
		} else {
			const gchar* _tmp49_ = NULL;
			gboolean _tmp50_ = FALSE;
			_tmp49_ = name;
			_tmp50_ = g_str_has_prefix (_tmp49_, "Caribou_");
			if (_tmp50_) {
				const gchar* _tmp51_ = NULL;
				gint _tmp52_ = 0;
				gint _tmp53_ = 0;
				const gchar* _tmp54_ = NULL;
				gint _tmp55_ = 0;
				gint _tmp56_ = 0;
				gchar* _tmp57_ = NULL;
				gchar* _tmp58_ = NULL;
				_tmp51_ = name;
				_tmp52_ = strlen ("Caribou_");
				_tmp53_ = _tmp52_;
				_tmp54_ = name;
				_tmp55_ = strlen (_tmp54_);
				_tmp56_ = _tmp55_;
				_tmp57_ = string_slice (_tmp51_, (glong) _tmp53_, (glong) _tmp56_);
				_tmp58_ = _tmp57_;
				caribou_key_model_set_label (self, _tmp58_);
				_g_free0 (_tmp58_);
			} else {
				guint* _tmp59_ = NULL;
				gint _tmp59__length1 = 0;
				gboolean _tmp70_ = FALSE;
				const gchar* _tmp71_ = NULL;
				gboolean _tmp93_ = FALSE;
				const gchar* _tmp94_ = NULL;
				_tmp59_ = self->priv->_keyvals;
				_tmp59__length1 = self->priv->_keyvals_length1;
				if (_tmp59__length1 > 0) {
					gunichar uc = 0U;
					guint* _tmp60_ = NULL;
					gint _tmp60__length1 = 0;
					guint _tmp61_ = 0U;
					guint32 _tmp62_ = 0U;
					gboolean _tmp63_ = FALSE;
					gunichar _tmp64_ = 0U;
					gboolean _tmp65_ = FALSE;
					_tmp60_ = self->priv->_keyvals;
					_tmp60__length1 = self->priv->_keyvals_length1;
					_tmp61_ = _tmp60_[0];
					_tmp62_ = gdk_keyval_to_unicode (_tmp61_);
					uc = (gunichar) _tmp62_;
					_tmp64_ = uc;
					_tmp65_ = g_unichar_isspace (_tmp64_);
					if (!_tmp65_) {
						gunichar _tmp66_ = 0U;
						_tmp66_ = uc;
						_tmp63_ = _tmp66_ != ((gunichar) 0);
					} else {
						_tmp63_ = FALSE;
					}
					if (_tmp63_) {
						gunichar _tmp67_ = 0U;
						gchar* _tmp68_ = NULL;
						gchar* _tmp69_ = NULL;
						_tmp67_ = uc;
						_tmp68_ = g_unichar_to_string (_tmp67_);
						_tmp69_ = _tmp68_;
						caribou_key_model_set_label (self, _tmp69_);
						_g_free0 (_tmp69_);
					}
				}
				_tmp71_ = self->priv->_label;
				if (g_strcmp0 (_tmp71_, "") == 0) {
					const gchar* _tmp72_ = NULL;
					gboolean _tmp73_ = FALSE;
					_tmp72_ = name;
					_tmp73_ = g_str_has_prefix (_tmp72_, "dead_");
					_tmp70_ = _tmp73_;
				} else {
					_tmp70_ = FALSE;
				}
				if (_tmp70_) {
					guint keyval = 0U;
					const gchar* _tmp74_ = NULL;
					gint _tmp75_ = 0;
					gint _tmp76_ = 0;
					const gchar* _tmp77_ = NULL;
					gint _tmp78_ = 0;
					gint _tmp79_ = 0;
					gchar* _tmp80_ = NULL;
					gchar* _tmp81_ = NULL;
					guint _tmp82_ = 0U;
					guint _tmp83_ = 0U;
					gunichar uc = 0U;
					guint _tmp84_ = 0U;
					guint32 _tmp85_ = 0U;
					gboolean _tmp86_ = FALSE;
					gunichar _tmp87_ = 0U;
					gboolean _tmp88_ = FALSE;
					_tmp74_ = name;
					_tmp75_ = strlen ("dead_");
					_tmp76_ = _tmp75_;
					_tmp77_ = name;
					_tmp78_ = strlen (_tmp77_);
					_tmp79_ = _tmp78_;
					_tmp80_ = string_slice (_tmp74_, (glong) _tmp76_, (glong) _tmp79_);
					_tmp81_ = _tmp80_;
					_tmp82_ = gdk_keyval_from_name (_tmp81_);
					_tmp83_ = _tmp82_;
					_g_free0 (_tmp81_);
					keyval = _tmp83_;
					_tmp84_ = keyval;
					_tmp85_ = gdk_keyval_to_unicode (_tmp84_);
					uc = (gunichar) _tmp85_;
					_tmp87_ = uc;
					_tmp88_ = g_unichar_isspace (_tmp87_);
					if (!_tmp88_) {
						gunichar _tmp89_ = 0U;
						_tmp89_ = uc;
						_tmp86_ = _tmp89_ != ((gunichar) 0);
					} else {
						_tmp86_ = FALSE;
					}
					if (_tmp86_) {
						gunichar _tmp90_ = 0U;
						gchar* _tmp91_ = NULL;
						gchar* _tmp92_ = NULL;
						_tmp90_ = uc;
						_tmp91_ = g_unichar_to_string (_tmp90_);
						_tmp92_ = _tmp91_;
						caribou_key_model_set_label (self, _tmp92_);
						_g_free0 (_tmp92_);
					}
				}
				_tmp94_ = self->priv->_label;
				if (g_strcmp0 (_tmp94_, "") == 0) {
					guint* _tmp95_ = NULL;
					gint _tmp95__length1 = 0;
					_tmp95_ = self->priv->_keyvals;
					_tmp95__length1 = self->priv->_keyvals_length1;
					_tmp93_ = _tmp95__length1 > 0;
				} else {
					_tmp93_ = FALSE;
				}
				if (_tmp93_) {
					const gchar* _tmp96_ = NULL;
					_tmp96_ = name;
					caribou_key_model_set_label (self, _tmp96_);
				}
			}
		}
	}
	_tmp97_ = caribou_display_adapter_get_default ();
	_g_object_unref0 (self->priv->xadapter);
	self->priv->xadapter = _tmp97_;
	_tmp98_ = gee_array_list_new (CARIBOU_TYPE_KEY_MODEL, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->extended_keys);
	self->priv->extended_keys = _tmp98_;
	return self;
}


CaribouKeyModel* caribou_key_model_new (const gchar* name, const gchar* text) {
	return caribou_key_model_construct (CARIBOU_TYPE_KEY_MODEL, name, text);
}


static void _caribou_key_model_on_subkey_released_caribou_ikeyboard_object_key_released (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self) {
	caribou_key_model_on_subkey_released ((CaribouKeyModel*) self, key);
}


void caribou_key_model_add_subkey (CaribouKeyModel* self, CaribouKeyModel* key) {
	CaribouKeyModel* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
	CaribouKeyModel* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = key;
	g_signal_connect_object ((CaribouIKeyboardObject*) _tmp0_, "key-released", (GCallback) _caribou_key_model_on_subkey_released_caribou_ikeyboard_object_key_released, self, 0);
	_tmp1_ = self->priv->extended_keys;
	_tmp2_ = key;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp1_, _tmp2_);
}


static void caribou_key_model_on_subkey_released (CaribouKeyModel* self, CaribouKeyModel* key) {
	CaribouKeyModel* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = key;
	g_signal_emit_by_name ((CaribouIKeyboardObject*) self, "key-released", _tmp0_);
	caribou_key_model_set_show_subkeys (self, FALSE);
}


static gboolean _caribou_key_model_on_key_held_gsource_func (gpointer self) {
	gboolean result;
	result = caribou_key_model_on_key_held ((CaribouKeyModel*) self);
	return result;
}


void caribou_key_model_press (CaribouKeyModel* self) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp5_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = caribou_key_model_get_is_modifier (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		CaribouModifierState _tmp2_ = 0;
		_tmp2_ = self->modifier_state;
		if (_tmp2_ == CARIBOU_MODIFIER_STATE_NONE) {
			CaribouDisplayAdapter* _tmp3_ = NULL;
			GdkModifierType _tmp4_ = 0;
			self->modifier_state = CARIBOU_MODIFIER_STATE_LATCHED;
			_tmp3_ = self->priv->xadapter;
			_tmp4_ = self->priv->mod_mask;
			caribou_display_adapter_mod_lock (_tmp3_, (guint) _tmp4_);
		} else {
			self->modifier_state = CARIBOU_MODIFIER_STATE_NONE;
		}
	}
	_tmp5_ = self->priv->_repeatable;
	if (_tmp5_) {
		CaribouDisplayAdapter* _tmp6_ = NULL;
		guint _tmp7_ = 0U;
		_tmp6_ = self->priv->xadapter;
		_tmp7_ = self->priv->_keyval;
		caribou_display_adapter_keyval_press (_tmp6_, _tmp7_);
	} else {
		guint _tmp8_ = 0U;
		_tmp8_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 1000, _caribou_key_model_on_key_held_gsource_func, g_object_ref (self), g_object_unref);
		self->priv->hold_tid = _tmp8_;
	}
	g_signal_emit_by_name ((CaribouIKeyboardObject*) self, "key-pressed", self);
}


void caribou_key_model_release (CaribouKeyModel* self) {
	guint _tmp0_ = 0U;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp7_ = FALSE;
	guint _tmp15_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->hold_tid;
	if (_tmp0_ != ((guint) 0)) {
		guint _tmp1_ = 0U;
		_tmp1_ = self->priv->hold_tid;
		g_source_remove (_tmp1_);
	}
	_tmp2_ = caribou_key_model_get_is_modifier (self);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		CaribouModifierState _tmp4_ = 0;
		_tmp4_ = self->modifier_state;
		if (_tmp4_ == CARIBOU_MODIFIER_STATE_NONE) {
			CaribouDisplayAdapter* _tmp5_ = NULL;
			GdkModifierType _tmp6_ = 0;
			_tmp5_ = self->priv->xadapter;
			_tmp6_ = self->priv->mod_mask;
			caribou_display_adapter_mod_unlock (_tmp5_, (guint) _tmp6_);
		} else {
			return;
		}
	}
	_tmp7_ = self->priv->_repeatable;
	if (_tmp7_) {
		CaribouDisplayAdapter* _tmp8_ = NULL;
		guint _tmp9_ = 0U;
		_tmp8_ = self->priv->xadapter;
		_tmp9_ = self->priv->_keyval;
		caribou_display_adapter_keyval_release (_tmp8_, _tmp9_);
	} else {
		guint* _tmp10_ = NULL;
		gint _tmp10__length1 = 0;
		_tmp10_ = self->priv->_keyvals;
		_tmp10__length1 = self->priv->_keyvals_length1;
		{
			guint* keyval_collection = NULL;
			gint keyval_collection_length1 = 0;
			gint _keyval_collection_size_ = 0;
			gint keyval_it = 0;
			keyval_collection = _tmp10_;
			keyval_collection_length1 = _tmp10__length1;
			for (keyval_it = 0; keyval_it < _tmp10__length1; keyval_it = keyval_it + 1) {
				guint keyval = 0U;
				keyval = keyval_collection[keyval_it];
				{
					CaribouDisplayAdapter* _tmp11_ = NULL;
					guint _tmp12_ = 0U;
					CaribouDisplayAdapter* _tmp13_ = NULL;
					guint _tmp14_ = 0U;
					_tmp11_ = self->priv->xadapter;
					_tmp12_ = keyval;
					caribou_display_adapter_keyval_press (_tmp11_, _tmp12_);
					_tmp13_ = self->priv->xadapter;
					_tmp14_ = keyval;
					caribou_display_adapter_keyval_release (_tmp13_, _tmp14_);
				}
			}
		}
	}
	g_signal_emit_by_name ((CaribouIKeyboardObject*) self, "key-released", self);
	_tmp15_ = self->priv->hold_tid;
	if (_tmp15_ != ((guint) 0)) {
		g_signal_emit_by_name ((CaribouIKeyboardObject*) self, "key-clicked", self);
		self->priv->hold_tid = (guint) 0;
	} else {
		g_signal_emit_by_name (self, "key-hold-end");
	}
}


static gboolean caribou_key_model_on_key_held (CaribouKeyModel* self) {
	gboolean result = FALSE;
	GeeArrayList* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->hold_tid = (guint) 0;
	_tmp0_ = self->priv->extended_keys;
	_tmp1_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != 0) {
		caribou_key_model_set_show_subkeys (self, TRUE);
	}
	_tmp4_ = caribou_key_model_get_is_modifier (self);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		CaribouModifierState _tmp6_ = 0;
		_tmp6_ = self->modifier_state;
		_tmp3_ = _tmp6_ == CARIBOU_MODIFIER_STATE_LATCHED;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		self->modifier_state = CARIBOU_MODIFIER_STATE_LOCKED;
	}
	g_signal_emit_by_name (self, "key-hold");
	result = FALSE;
	return result;
}


CaribouKeyModel** caribou_key_model_get_extended_keys (CaribouKeyModel* self, int* result_length1) {
	CaribouKeyModel** result = NULL;
	GeeArrayList* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gpointer* _tmp2_ = NULL;
	CaribouKeyModel** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->extended_keys;
	_tmp2_ = gee_collection_to_array ((GeeCollection*) _tmp0_, &_tmp1_);
	_tmp3_ = (CaribouKeyModel**) _tmp2_;
	_tmp3__length1 = (_tmp1_ * sizeof (CaribouKeyModel*)) / sizeof (CaribouKeyModel*);
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}


static CaribouKeyModel** caribou_key_model_real_get_keys (CaribouIKeyboardObject* base, int* result_length1) {
	CaribouKeyModel * self;
	CaribouKeyModel** result = NULL;
	GeeArrayList* all_keys = NULL;
	GeeArrayList* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gpointer* _tmp3_ = NULL;
	CaribouKeyModel** _tmp4_ = NULL;
	gint _tmp4__length1 = 0;
	self = (CaribouKeyModel*) base;
	_tmp0_ = gee_array_list_new (CARIBOU_TYPE_KEY_MODEL, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	all_keys = _tmp0_;
	gee_abstract_collection_add ((GeeAbstractCollection*) all_keys, self);
	_tmp1_ = self->priv->extended_keys;
	gee_array_list_add_all (all_keys, (GeeCollection*) _tmp1_);
	_tmp3_ = gee_collection_to_array ((GeeCollection*) all_keys, &_tmp2_);
	_tmp4_ = (CaribouKeyModel**) _tmp3_;
	_tmp4__length1 = (_tmp2_ * sizeof (CaribouKeyModel*)) / sizeof (CaribouKeyModel*);
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	_g_object_unref0 (all_keys);
	return result;
}


static CaribouIKeyboardObject** caribou_key_model_real_get_children (CaribouIKeyboardObject* base, int* result_length1) {
	CaribouKeyModel * self;
	CaribouIKeyboardObject** result = NULL;
	GeeArrayList* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gpointer* _tmp2_ = NULL;
	CaribouIKeyboardObject** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	self = (CaribouKeyModel*) base;
	_tmp0_ = self->priv->extended_keys;
	_tmp2_ = gee_collection_to_array ((GeeCollection*) _tmp0_, &_tmp1_);
	_tmp3_ = (CaribouIKeyboardObject**) _tmp2_;
	_tmp3__length1 = (_tmp1_ * sizeof (CaribouKeyModel*)) / sizeof (CaribouIKeyboardObject*);
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}


static gboolean __lambda4_ (CaribouKeyModel* self) {
	gboolean result = FALSE;
	caribou_key_model_release (self);
	result = FALSE;
	return result;
}


static gboolean ___lambda4__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda4_ ((CaribouKeyModel*) self);
	return result;
}


void caribou_key_model_activate (CaribouKeyModel* self) {
	g_return_if_fail (self != NULL);
	caribou_key_model_press (self);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, ___lambda4__gsource_func, g_object_ref (self), g_object_unref);
}


const gchar* caribou_key_model_get_align (CaribouKeyModel* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_align;
	result = _tmp0_;
	return result;
}


void caribou_key_model_set_align (CaribouKeyModel* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_align);
	self->priv->_align = _tmp1_;
	g_object_notify ((GObject *) self, "align");
}


gdouble caribou_key_model_get_width (CaribouKeyModel* self) {
	gdouble result;
	gdouble _tmp0_ = 0.0;
	g_return_val_if_fail (self != NULL, 0.0);
	_tmp0_ = self->priv->_width;
	result = _tmp0_;
	return result;
}


void caribou_key_model_set_width (CaribouKeyModel* self, gdouble value) {
	gdouble _tmp0_ = 0.0;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_width = _tmp0_;
	g_object_notify ((GObject *) self, "width");
}


const gchar* caribou_key_model_get_toggle (CaribouKeyModel* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_toggle;
	result = _tmp0_;
	return result;
}


void caribou_key_model_set_toggle (CaribouKeyModel* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_toggle);
	self->priv->_toggle = _tmp1_;
	g_object_notify ((GObject *) self, "toggle");
}


gboolean caribou_key_model_get_repeatable (CaribouKeyModel* self) {
	gboolean result;
	gboolean _tmp0_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_repeatable;
	result = _tmp0_;
	return result;
}


void caribou_key_model_set_repeatable (CaribouKeyModel* self, gboolean value) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_repeatable = _tmp0_;
	g_object_notify ((GObject *) self, "repeatable");
}


gboolean caribou_key_model_get_is_modifier (CaribouKeyModel* self) {
	gboolean result;
	GdkModifierType _tmp0_ = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->mod_mask;
	result = _tmp0_ != 0;
	return result;
}


void caribou_key_model_set_is_modifier (CaribouKeyModel* self, gboolean value) {
	g_return_if_fail (self != NULL);
	g_object_notify ((GObject *) self, "is-modifier");
}


gboolean caribou_key_model_get_show_subkeys (CaribouKeyModel* self) {
	gboolean result;
	gboolean _tmp0_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_show_subkeys;
	result = _tmp0_;
	return result;
}


static void caribou_key_model_set_show_subkeys (CaribouKeyModel* self, gboolean value) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_show_subkeys = _tmp0_;
	g_object_notify ((GObject *) self, "show-subkeys");
}


const gchar* caribou_key_model_get_name (CaribouKeyModel* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}


static void caribou_key_model_set_name (CaribouKeyModel* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_name);
	self->priv->_name = _tmp1_;
	g_object_notify ((GObject *) self, "name");
}


guint caribou_key_model_get_keyval (CaribouKeyModel* self) {
	guint result;
	guint _tmp0_ = 0U;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = self->priv->_keyval;
	result = _tmp0_;
	return result;
}


static void caribou_key_model_set_keyval (CaribouKeyModel* self, guint value) {
	guint _tmp0_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_keyval = _tmp0_;
	g_object_notify ((GObject *) self, "keyval");
}


const gchar* caribou_key_model_get_text (CaribouKeyModel* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_text;
	result = _tmp0_;
	return result;
}


static void caribou_key_model_set_text (CaribouKeyModel* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_text);
	self->priv->_text = _tmp1_;
	g_object_notify ((GObject *) self, "text");
}


const gchar* caribou_key_model_get_label (CaribouKeyModel* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}


void caribou_key_model_set_label (CaribouKeyModel* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_label);
	self->priv->_label = _tmp1_;
	g_object_notify ((GObject *) self, "label");
}


static gboolean caribou_key_model_real_get_scan_stepping (CaribouIScannableItem* base) {
	gboolean result;
	CaribouKeyModel* self;
	gboolean _tmp0_ = FALSE;
	self = (CaribouKeyModel*) base;
	_tmp0_ = self->priv->_scan_stepping;
	result = _tmp0_;
	return result;
}


static void caribou_key_model_real_set_scan_stepping (CaribouIScannableItem* base, gboolean value) {
	CaribouKeyModel* self;
	gboolean _tmp0_ = FALSE;
	self = (CaribouKeyModel*) base;
	_tmp0_ = value;
	self->priv->_scan_stepping = _tmp0_;
	g_object_notify ((GObject *) self, "scan-stepping");
}


static gboolean caribou_key_model_real_get_scan_selected (CaribouIScannableItem* base) {
	gboolean result;
	CaribouKeyModel* self;
	gboolean _tmp0_ = FALSE;
	self = (CaribouKeyModel*) base;
	_tmp0_ = self->priv->_scan_selected;
	result = _tmp0_;
	return result;
}


static void caribou_key_model_real_set_scan_selected (CaribouIScannableItem* base, gboolean value) {
	CaribouKeyModel* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	self = (CaribouKeyModel*) base;
	_tmp0_ = value;
	self->priv->_scan_selected = _tmp0_;
	_tmp1_ = self->priv->_scan_selected;
	if (_tmp1_) {
		caribou_key_model_activate (self);
	}
	g_object_notify ((GObject *) self, "scan-selected");
}


static void caribou_key_model_class_init (CaribouKeyModelClass * klass) {
	caribou_key_model_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (CaribouKeyModelPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_caribou_key_model_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_caribou_key_model_set_property;
	G_OBJECT_CLASS (klass)->finalize = caribou_key_model_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_ALIGN, g_param_spec_string ("align", "align", "align", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_WIDTH, g_param_spec_double ("width", "width", "width", -G_MAXDOUBLE, G_MAXDOUBLE, 1.0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_TOGGLE, g_param_spec_string ("toggle", "toggle", "toggle", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_REPEATABLE, g_param_spec_boolean ("repeatable", "repeatable", "repeatable", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_IS_MODIFIER, g_param_spec_boolean ("is-modifier", "is-modifier", "is-modifier", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_SHOW_SUBKEYS, g_param_spec_boolean ("show-subkeys", "show-subkeys", "show-subkeys", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_KEYVAL, g_param_spec_uint ("keyval", "keyval", "keyval", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_TEXT, g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_LABEL, g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_SCAN_STEPPING, g_param_spec_boolean ("scan-stepping", "scan-stepping", "scan-stepping", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_KEY_MODEL_SCAN_SELECTED, g_param_spec_boolean ("scan-selected", "scan-selected", "scan-selected", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_signal_new ("key_hold_end", CARIBOU_TYPE_KEY_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	g_signal_new ("key_hold", CARIBOU_TYPE_KEY_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void caribou_key_model_caribou_iscannable_item_interface_init (CaribouIScannableItemIface * iface) {
	caribou_key_model_caribou_iscannable_item_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_scan_stepping = caribou_key_model_real_get_scan_stepping;
	iface->set_scan_stepping = caribou_key_model_real_set_scan_stepping;
	iface->get_scan_selected = caribou_key_model_real_get_scan_selected;
	iface->set_scan_selected = caribou_key_model_real_set_scan_selected;
}


static void caribou_key_model_caribou_ikeyboard_object_interface_init (CaribouIKeyboardObjectIface * iface) {
	caribou_key_model_caribou_ikeyboard_object_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_keys = (CaribouKeyModel** (*)(CaribouIKeyboardObject*, int*)) caribou_key_model_real_get_keys;
	iface->get_children = (CaribouIKeyboardObject** (*)(CaribouIKeyboardObject*, int*)) caribou_key_model_real_get_children;
}


static void caribou_key_model_instance_init (CaribouKeyModel * self) {
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	guint* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	self->priv = CARIBOU_KEY_MODEL_GET_PRIVATE (self);
	_tmp0_ = g_strdup ("center");
	self->priv->_align = _tmp0_;
	self->priv->_width = 1.0;
	_tmp1_ = g_strdup ("");
	self->priv->_toggle = _tmp1_;
	self->priv->_repeatable = FALSE;
	self->priv->_show_subkeys = FALSE;
	self->priv->_text = NULL;
	_tmp2_ = g_new0 (guint, 0);
	self->priv->_keyvals = _tmp2_;
	self->priv->_keyvals_length1 = 0;
	self->priv->__keyvals_size_ = self->priv->_keyvals_length1;
	_tmp3_ = g_strdup ("");
	self->priv->_label = _tmp3_;
}


static void caribou_key_model_finalize (GObject* obj) {
	CaribouKeyModel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CARIBOU_TYPE_KEY_MODEL, CaribouKeyModel);
	_g_free0 (self->priv->_align);
	_g_free0 (self->priv->_toggle);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_text);
	self->priv->_keyvals = (g_free (self->priv->_keyvals), NULL);
	_g_free0 (self->priv->_label);
	_g_object_unref0 (self->priv->xadapter);
	_g_object_unref0 (self->priv->extended_keys);
	G_OBJECT_CLASS (caribou_key_model_parent_class)->finalize (obj);
}


/**
     * Object representing a key in a column.
     *
     * This is used for implementing custom keyboard service.
     */
GType caribou_key_model_get_type (void) {
	static volatile gsize caribou_key_model_type_id__volatile = 0;
	if (g_once_init_enter (&caribou_key_model_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (CaribouKeyModelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) caribou_key_model_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CaribouKeyModel), 0, (GInstanceInitFunc) caribou_key_model_instance_init, NULL };
		static const GInterfaceInfo caribou_iscannable_item_info = { (GInterfaceInitFunc) caribou_key_model_caribou_iscannable_item_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo caribou_ikeyboard_object_info = { (GInterfaceInitFunc) caribou_key_model_caribou_ikeyboard_object_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType caribou_key_model_type_id;
		caribou_key_model_type_id = g_type_register_static (G_TYPE_OBJECT, "CaribouKeyModel", &g_define_type_info, 0);
		g_type_add_interface_static (caribou_key_model_type_id, CARIBOU_TYPE_ISCANNABLE_ITEM, &caribou_iscannable_item_info);
		g_type_add_interface_static (caribou_key_model_type_id, CARIBOU_TYPE_IKEYBOARD_OBJECT, &caribou_ikeyboard_object_info);
		g_once_init_leave (&caribou_key_model_type_id__volatile, caribou_key_model_type_id);
	}
	return caribou_key_model_type_id__volatile;
}


static void _vala_caribou_key_model_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	CaribouKeyModel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CARIBOU_TYPE_KEY_MODEL, CaribouKeyModel);
	switch (property_id) {
		case CARIBOU_KEY_MODEL_ALIGN:
		g_value_set_string (value, caribou_key_model_get_align (self));
		break;
		case CARIBOU_KEY_MODEL_WIDTH:
		g_value_set_double (value, caribou_key_model_get_width (self));
		break;
		case CARIBOU_KEY_MODEL_TOGGLE:
		g_value_set_string (value, caribou_key_model_get_toggle (self));
		break;
		case CARIBOU_KEY_MODEL_REPEATABLE:
		g_value_set_boolean (value, caribou_key_model_get_repeatable (self));
		break;
		case CARIBOU_KEY_MODEL_IS_MODIFIER:
		g_value_set_boolean (value, caribou_key_model_get_is_modifier (self));
		break;
		case CARIBOU_KEY_MODEL_SHOW_SUBKEYS:
		g_value_set_boolean (value, caribou_key_model_get_show_subkeys (self));
		break;
		case CARIBOU_KEY_MODEL_NAME:
		g_value_set_string (value, caribou_key_model_get_name (self));
		break;
		case CARIBOU_KEY_MODEL_KEYVAL:
		g_value_set_uint (value, caribou_key_model_get_keyval (self));
		break;
		case CARIBOU_KEY_MODEL_TEXT:
		g_value_set_string (value, caribou_key_model_get_text (self));
		break;
		case CARIBOU_KEY_MODEL_LABEL:
		g_value_set_string (value, caribou_key_model_get_label (self));
		break;
		case CARIBOU_KEY_MODEL_SCAN_STEPPING:
		g_value_set_boolean (value, caribou_iscannable_item_get_scan_stepping ((CaribouIScannableItem*) self));
		break;
		case CARIBOU_KEY_MODEL_SCAN_SELECTED:
		g_value_set_boolean (value, caribou_iscannable_item_get_scan_selected ((CaribouIScannableItem*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_caribou_key_model_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	CaribouKeyModel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CARIBOU_TYPE_KEY_MODEL, CaribouKeyModel);
	switch (property_id) {
		case CARIBOU_KEY_MODEL_ALIGN:
		caribou_key_model_set_align (self, g_value_get_string (value));
		break;
		case CARIBOU_KEY_MODEL_WIDTH:
		caribou_key_model_set_width (self, g_value_get_double (value));
		break;
		case CARIBOU_KEY_MODEL_TOGGLE:
		caribou_key_model_set_toggle (self, g_value_get_string (value));
		break;
		case CARIBOU_KEY_MODEL_REPEATABLE:
		caribou_key_model_set_repeatable (self, g_value_get_boolean (value));
		break;
		case CARIBOU_KEY_MODEL_IS_MODIFIER:
		caribou_key_model_set_is_modifier (self, g_value_get_boolean (value));
		break;
		case CARIBOU_KEY_MODEL_SHOW_SUBKEYS:
		caribou_key_model_set_show_subkeys (self, g_value_get_boolean (value));
		break;
		case CARIBOU_KEY_MODEL_NAME:
		caribou_key_model_set_name (self, g_value_get_string (value));
		break;
		case CARIBOU_KEY_MODEL_KEYVAL:
		caribou_key_model_set_keyval (self, g_value_get_uint (value));
		break;
		case CARIBOU_KEY_MODEL_TEXT:
		caribou_key_model_set_text (self, g_value_get_string (value));
		break;
		case CARIBOU_KEY_MODEL_LABEL:
		caribou_key_model_set_label (self, g_value_get_string (value));
		break;
		case CARIBOU_KEY_MODEL_SCAN_STEPPING:
		caribou_iscannable_item_set_scan_stepping ((CaribouIScannableItem*) self, g_value_get_boolean (value));
		break;
		case CARIBOU_KEY_MODEL_SCAN_SELECTED:
		caribou_iscannable_item_set_scan_selected ((CaribouIScannableItem*) self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


GType caribou_modifier_state_get_type (void) {
	static volatile gsize caribou_modifier_state_type_id__volatile = 0;
	if (g_once_init_enter (&caribou_modifier_state_type_id__volatile)) {
		static const GEnumValue values[] = {{CARIBOU_MODIFIER_STATE_NONE, "CARIBOU_MODIFIER_STATE_NONE", "none"}, {CARIBOU_MODIFIER_STATE_LATCHED, "CARIBOU_MODIFIER_STATE_LATCHED", "latched"}, {CARIBOU_MODIFIER_STATE_LOCKED, "CARIBOU_MODIFIER_STATE_LOCKED", "locked"}, {0, NULL, NULL}};
		GType caribou_modifier_state_type_id;
		caribou_modifier_state_type_id = g_enum_register_static ("CaribouModifierState", values);
		g_once_init_leave (&caribou_modifier_state_type_id__volatile, caribou_modifier_state_type_id);
	}
	return caribou_modifier_state_type_id__volatile;
}


void caribou_modifier_map_entry_copy (const CaribouModifierMapEntry* self, CaribouModifierMapEntry* dest) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	GdkModifierType _tmp2_ = 0;
	_tmp0_ = (*self).name;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).name);
	(*dest).name = _tmp1_;
	_tmp2_ = (*self).mask;
	(*dest).mask = _tmp2_;
}


void caribou_modifier_map_entry_destroy (CaribouModifierMapEntry* self) {
	_g_free0 ((*self).name);
}


CaribouModifierMapEntry* caribou_modifier_map_entry_dup (const CaribouModifierMapEntry* self) {
	CaribouModifierMapEntry* dup;
	dup = g_new0 (CaribouModifierMapEntry, 1);
	caribou_modifier_map_entry_copy (self, dup);
	return dup;
}


void caribou_modifier_map_entry_free (CaribouModifierMapEntry* self) {
	caribou_modifier_map_entry_destroy (self);
	g_free (self);
}


GType caribou_modifier_map_entry_get_type (void) {
	static volatile gsize caribou_modifier_map_entry_type_id__volatile = 0;
	if (g_once_init_enter (&caribou_modifier_map_entry_type_id__volatile)) {
		GType caribou_modifier_map_entry_type_id;
		caribou_modifier_map_entry_type_id = g_boxed_type_register_static ("CaribouModifierMapEntry", (GBoxedCopyFunc) caribou_modifier_map_entry_dup, (GBoxedFreeFunc) caribou_modifier_map_entry_free);
		g_once_init_leave (&caribou_modifier_map_entry_type_id__volatile, caribou_modifier_map_entry_type_id);
	}
	return caribou_modifier_map_entry_type_id__volatile;
}


void caribou_label_map_entry_copy (const CaribouLabelMapEntry* self, CaribouLabelMapEntry* dest) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	_tmp0_ = (*self).name;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).name);
	(*dest).name = _tmp1_;
	_tmp2_ = (*self).label;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).label);
	(*dest).label = _tmp3_;
}


void caribou_label_map_entry_destroy (CaribouLabelMapEntry* self) {
	_g_free0 ((*self).name);
	_g_free0 ((*self).label);
}


CaribouLabelMapEntry* caribou_label_map_entry_dup (const CaribouLabelMapEntry* self) {
	CaribouLabelMapEntry* dup;
	dup = g_new0 (CaribouLabelMapEntry, 1);
	caribou_label_map_entry_copy (self, dup);
	return dup;
}


void caribou_label_map_entry_free (CaribouLabelMapEntry* self) {
	caribou_label_map_entry_destroy (self);
	g_free (self);
}


GType caribou_label_map_entry_get_type (void) {
	static volatile gsize caribou_label_map_entry_type_id__volatile = 0;
	if (g_once_init_enter (&caribou_label_map_entry_type_id__volatile)) {
		GType caribou_label_map_entry_type_id;
		caribou_label_map_entry_type_id = g_boxed_type_register_static ("CaribouLabelMapEntry", (GBoxedCopyFunc) caribou_label_map_entry_dup, (GBoxedFreeFunc) caribou_label_map_entry_free);
		g_once_init_leave (&caribou_label_map_entry_type_id__volatile, caribou_label_map_entry_type_id);
	}
	return caribou_label_map_entry_type_id__volatile;
}