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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use bitflags::bitflags;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;
use std::fmt;

bitflags! {
    /// Positioning hints for aligning a window relative to a rectangle.
    ///
    /// These hints determine how the window should be positioned in the case that
    /// the window would fall off-screen if placed in its ideal position.
    ///
    /// For example, [`FLIP_X`][Self::FLIP_X] will replace [`Gravity::NorthWest`][crate::Gravity::NorthWest] with
    /// [`Gravity::NorthEast`][crate::Gravity::NorthEast] and vice versa if the window extends beyond the left
    /// or right edges of the monitor.
    ///
    /// If [`SLIDE_X`][Self::SLIDE_X] is set, the window can be shifted horizontally to fit
    /// on-screen. If [`RESIZE_X`][Self::RESIZE_X] is set, the window can be shrunken
    /// horizontally to fit.
    ///
    /// In general, when multiple flags are set, flipping should take precedence over
    /// sliding, which should take precedence over resizing.
    #[doc(alias = "GdkAnchorHints")]
    pub struct AnchorHints: u32 {
        /// allow flipping anchors horizontally
        #[doc(alias = "GDK_ANCHOR_FLIP_X")]
        const FLIP_X = ffi::GDK_ANCHOR_FLIP_X as u32;
        /// allow flipping anchors vertically
        #[doc(alias = "GDK_ANCHOR_FLIP_Y")]
        const FLIP_Y = ffi::GDK_ANCHOR_FLIP_Y as u32;
        /// allow sliding window horizontally
        #[doc(alias = "GDK_ANCHOR_SLIDE_X")]
        const SLIDE_X = ffi::GDK_ANCHOR_SLIDE_X as u32;
        /// allow sliding window vertically
        #[doc(alias = "GDK_ANCHOR_SLIDE_Y")]
        const SLIDE_Y = ffi::GDK_ANCHOR_SLIDE_Y as u32;
        /// allow resizing window horizontally
        #[doc(alias = "GDK_ANCHOR_RESIZE_X")]
        const RESIZE_X = ffi::GDK_ANCHOR_RESIZE_X as u32;
        /// allow resizing window vertically
        #[doc(alias = "GDK_ANCHOR_RESIZE_Y")]
        const RESIZE_Y = ffi::GDK_ANCHOR_RESIZE_Y as u32;
        /// allow flipping anchors on both axes
        #[doc(alias = "GDK_ANCHOR_FLIP")]
        const FLIP = ffi::GDK_ANCHOR_FLIP as u32;
        /// allow sliding window on both axes
        #[doc(alias = "GDK_ANCHOR_SLIDE")]
        const SLIDE = ffi::GDK_ANCHOR_SLIDE as u32;
        /// allow resizing window on both axes
        #[doc(alias = "GDK_ANCHOR_RESIZE")]
        const RESIZE = ffi::GDK_ANCHOR_RESIZE as u32;
    }
}

impl fmt::Display for AnchorHints {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for AnchorHints {
    type GlibType = ffi::GdkAnchorHints;

    fn into_glib(self) -> ffi::GdkAnchorHints {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkAnchorHints> for AnchorHints {
    unsafe fn from_glib(value: ffi::GdkAnchorHints) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for AnchorHints {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_anchor_hints_get_type()) }
    }
}

impl glib::value::ValueType for AnchorHints {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for AnchorHints {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for AnchorHints {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags describing the current capabilities of a device/tool.
    #[doc(alias = "GdkAxisFlags")]
    pub struct AxisFlags: u32 {
        /// X axis is present
        #[doc(alias = "GDK_AXIS_FLAG_X")]
        const X = ffi::GDK_AXIS_FLAG_X as u32;
        /// Y axis is present
        #[doc(alias = "GDK_AXIS_FLAG_Y")]
        const Y = ffi::GDK_AXIS_FLAG_Y as u32;
        /// Pressure axis is present
        #[doc(alias = "GDK_AXIS_FLAG_PRESSURE")]
        const PRESSURE = ffi::GDK_AXIS_FLAG_PRESSURE as u32;
        /// X tilt axis is present
        #[doc(alias = "GDK_AXIS_FLAG_XTILT")]
        const XTILT = ffi::GDK_AXIS_FLAG_XTILT as u32;
        /// Y tilt axis is present
        #[doc(alias = "GDK_AXIS_FLAG_YTILT")]
        const YTILT = ffi::GDK_AXIS_FLAG_YTILT as u32;
        /// Wheel axis is present
        #[doc(alias = "GDK_AXIS_FLAG_WHEEL")]
        const WHEEL = ffi::GDK_AXIS_FLAG_WHEEL as u32;
        /// Distance axis is present
        #[doc(alias = "GDK_AXIS_FLAG_DISTANCE")]
        const DISTANCE = ffi::GDK_AXIS_FLAG_DISTANCE as u32;
        /// Z-axis rotation is present
        #[doc(alias = "GDK_AXIS_FLAG_ROTATION")]
        const ROTATION = ffi::GDK_AXIS_FLAG_ROTATION as u32;
        /// Slider axis is present
        #[doc(alias = "GDK_AXIS_FLAG_SLIDER")]
        const SLIDER = ffi::GDK_AXIS_FLAG_SLIDER as u32;
    }
}

impl fmt::Display for AxisFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for AxisFlags {
    type GlibType = ffi::GdkAxisFlags;

    fn into_glib(self) -> ffi::GdkAxisFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkAxisFlags> for AxisFlags {
    unsafe fn from_glib(value: ffi::GdkAxisFlags) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for AxisFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_axis_flags_get_type()) }
    }
}

impl glib::value::ValueType for AxisFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for AxisFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for AxisFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Used in [`DragContext`][crate::DragContext] to indicate what the destination
    /// should do with the dropped data.
    #[doc(alias = "GdkDragAction")]
    pub struct DragAction: u32 {
        /// Means nothing, and should not be used.
        #[doc(alias = "GDK_ACTION_DEFAULT")]
        const DEFAULT = ffi::GDK_ACTION_DEFAULT as u32;
        /// Copy the data.
        #[doc(alias = "GDK_ACTION_COPY")]
        const COPY = ffi::GDK_ACTION_COPY as u32;
        /// Move the data, i.e. first copy it, then delete
        ///  it from the source using the DELETE target of the X selection protocol.
        #[doc(alias = "GDK_ACTION_MOVE")]
        const MOVE = ffi::GDK_ACTION_MOVE as u32;
        /// Add a link to the data. Note that this is only
        ///  useful if source and destination agree on what it means.
        #[doc(alias = "GDK_ACTION_LINK")]
        const LINK = ffi::GDK_ACTION_LINK as u32;
        /// Special action which tells the source that the
        ///  destination will do something that the source doesn’t understand.
        #[doc(alias = "GDK_ACTION_PRIVATE")]
        const PRIVATE = ffi::GDK_ACTION_PRIVATE as u32;
        /// Ask the user what to do with the data.
        #[doc(alias = "GDK_ACTION_ASK")]
        const ASK = ffi::GDK_ACTION_ASK as u32;
    }
}

impl fmt::Display for DragAction {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DragAction {
    type GlibType = ffi::GdkDragAction;

    fn into_glib(self) -> ffi::GdkDragAction {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkDragAction> for DragAction {
    unsafe fn from_glib(value: ffi::GdkDragAction) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DragAction {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_drag_action_get_type()) }
    }
}

impl glib::value::ValueType for DragAction {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DragAction {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DragAction {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// A set of bit-flags to indicate which events a window is to receive.
    /// Most of these masks map onto one or more of the [`EventType`][crate::EventType] event types
    /// above.
    ///
    /// See the [input handling overview][chap-input-handling] for details of
    /// [event masks][event-masks] and [event propagation][event-propagation].
    ///
    /// [`POINTER_MOTION_HINT_MASK`][Self::POINTER_MOTION_HINT_MASK] is deprecated. It is a special mask
    /// to reduce the number of [`EventType::MotionNotify`][crate::EventType::MotionNotify] events received. When using
    /// [`POINTER_MOTION_HINT_MASK`][Self::POINTER_MOTION_HINT_MASK], fewer [`EventType::MotionNotify`][crate::EventType::MotionNotify] events will
    /// be sent, some of which are marked as a hint (the is_hint member is
    /// [`true`]). To receive more motion events after a motion hint event,
    /// the application needs to asks for more, by calling
    /// `gdk_event_request_motions()`.
    ///
    /// Since GTK 3.8, motion events are already compressed by default, independent
    /// of this mechanism. This compression can be disabled with
    /// [`Window::set_event_compression()`][crate::Window::set_event_compression()]. See the documentation of that function
    /// for details.
    ///
    /// If [`TOUCH_MASK`][Self::TOUCH_MASK] is enabled, the window will receive touch events
    /// from touch-enabled devices. Those will come as sequences of [`EventTouch`][crate::EventTouch]
    /// with type [`EventType::TouchUpdate`][crate::EventType::TouchUpdate], enclosed by two events with
    /// type [`EventType::TouchBegin`][crate::EventType::TouchBegin] and [`EventType::TouchEnd`][crate::EventType::TouchEnd] (or [`EventType::TouchCancel`][crate::EventType::TouchCancel]).
    /// `gdk_event_get_event_sequence()` returns the event sequence for these
    /// events, so different sequences may be distinguished.
    #[doc(alias = "GdkEventMask")]
    pub struct EventMask: u32 {
        /// receive expose events
        #[doc(alias = "GDK_EXPOSURE_MASK")]
        const EXPOSURE_MASK = ffi::GDK_EXPOSURE_MASK as u32;
        /// receive all pointer motion events
        #[doc(alias = "GDK_POINTER_MOTION_MASK")]
        const POINTER_MOTION_MASK = ffi::GDK_POINTER_MOTION_MASK as u32;
        /// deprecated. see the explanation above
        #[doc(alias = "GDK_POINTER_MOTION_HINT_MASK")]
        const POINTER_MOTION_HINT_MASK = ffi::GDK_POINTER_MOTION_HINT_MASK as u32;
        /// receive pointer motion events while any button is pressed
        #[doc(alias = "GDK_BUTTON_MOTION_MASK")]
        const BUTTON_MOTION_MASK = ffi::GDK_BUTTON_MOTION_MASK as u32;
        /// receive pointer motion events while 1 button is pressed
        #[doc(alias = "GDK_BUTTON1_MOTION_MASK")]
        const BUTTON1_MOTION_MASK = ffi::GDK_BUTTON1_MOTION_MASK as u32;
        /// receive pointer motion events while 2 button is pressed
        #[doc(alias = "GDK_BUTTON2_MOTION_MASK")]
        const BUTTON2_MOTION_MASK = ffi::GDK_BUTTON2_MOTION_MASK as u32;
        /// receive pointer motion events while 3 button is pressed
        #[doc(alias = "GDK_BUTTON3_MOTION_MASK")]
        const BUTTON3_MOTION_MASK = ffi::GDK_BUTTON3_MOTION_MASK as u32;
        /// receive button press events
        #[doc(alias = "GDK_BUTTON_PRESS_MASK")]
        const BUTTON_PRESS_MASK = ffi::GDK_BUTTON_PRESS_MASK as u32;
        /// receive button release events
        #[doc(alias = "GDK_BUTTON_RELEASE_MASK")]
        const BUTTON_RELEASE_MASK = ffi::GDK_BUTTON_RELEASE_MASK as u32;
        /// receive key press events
        #[doc(alias = "GDK_KEY_PRESS_MASK")]
        const KEY_PRESS_MASK = ffi::GDK_KEY_PRESS_MASK as u32;
        /// receive key release events
        #[doc(alias = "GDK_KEY_RELEASE_MASK")]
        const KEY_RELEASE_MASK = ffi::GDK_KEY_RELEASE_MASK as u32;
        /// receive window enter events
        #[doc(alias = "GDK_ENTER_NOTIFY_MASK")]
        const ENTER_NOTIFY_MASK = ffi::GDK_ENTER_NOTIFY_MASK as u32;
        /// receive window leave events
        #[doc(alias = "GDK_LEAVE_NOTIFY_MASK")]
        const LEAVE_NOTIFY_MASK = ffi::GDK_LEAVE_NOTIFY_MASK as u32;
        /// receive focus change events
        #[doc(alias = "GDK_FOCUS_CHANGE_MASK")]
        const FOCUS_CHANGE_MASK = ffi::GDK_FOCUS_CHANGE_MASK as u32;
        /// receive events about window configuration change
        #[doc(alias = "GDK_STRUCTURE_MASK")]
        const STRUCTURE_MASK = ffi::GDK_STRUCTURE_MASK as u32;
        /// receive property change events
        #[doc(alias = "GDK_PROPERTY_CHANGE_MASK")]
        const PROPERTY_CHANGE_MASK = ffi::GDK_PROPERTY_CHANGE_MASK as u32;
        /// receive visibility change events
        #[doc(alias = "GDK_VISIBILITY_NOTIFY_MASK")]
        const VISIBILITY_NOTIFY_MASK = ffi::GDK_VISIBILITY_NOTIFY_MASK as u32;
        /// receive proximity in events
        #[doc(alias = "GDK_PROXIMITY_IN_MASK")]
        const PROXIMITY_IN_MASK = ffi::GDK_PROXIMITY_IN_MASK as u32;
        /// receive proximity out events
        #[doc(alias = "GDK_PROXIMITY_OUT_MASK")]
        const PROXIMITY_OUT_MASK = ffi::GDK_PROXIMITY_OUT_MASK as u32;
        /// receive events about window configuration changes of
        ///  child windows
        #[doc(alias = "GDK_SUBSTRUCTURE_MASK")]
        const SUBSTRUCTURE_MASK = ffi::GDK_SUBSTRUCTURE_MASK as u32;
        /// receive scroll events
        #[doc(alias = "GDK_SCROLL_MASK")]
        const SCROLL_MASK = ffi::GDK_SCROLL_MASK as u32;
        /// receive touch events. Since 3.4
        #[doc(alias = "GDK_TOUCH_MASK")]
        const TOUCH_MASK = ffi::GDK_TOUCH_MASK as u32;
        /// receive smooth scrolling events. Since 3.4
        #[doc(alias = "GDK_SMOOTH_SCROLL_MASK")]
        const SMOOTH_SCROLL_MASK = ffi::GDK_SMOOTH_SCROLL_MASK as u32;
        /// receive touchpad gesture events. Since 3.18
        #[doc(alias = "GDK_TOUCHPAD_GESTURE_MASK")]
        const TOUCHPAD_GESTURE_MASK = ffi::GDK_TOUCHPAD_GESTURE_MASK as u32;
        /// receive tablet pad events. Since 3.22
        #[doc(alias = "GDK_TABLET_PAD_MASK")]
        const TABLET_PAD_MASK = ffi::GDK_TABLET_PAD_MASK as u32;
        /// the combination of all the above event masks.
        #[doc(alias = "GDK_ALL_EVENTS_MASK")]
        const ALL_EVENTS_MASK = ffi::GDK_ALL_EVENTS_MASK as u32;
    }
}

impl fmt::Display for EventMask {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for EventMask {
    type GlibType = ffi::GdkEventMask;

    fn into_glib(self) -> ffi::GdkEventMask {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkEventMask> for EventMask {
    unsafe fn from_glib(value: ffi::GdkEventMask) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for EventMask {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_event_mask_get_type()) }
    }
}

impl glib::value::ValueType for EventMask {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for EventMask {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for EventMask {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// [`FrameClockPhase`][crate::FrameClockPhase] is used to represent the different paint clock
    /// phases that can be requested. The elements of the enumeration
    /// correspond to the signals of [`FrameClock`][crate::FrameClock].
    #[doc(alias = "GdkFrameClockPhase")]
    pub struct FrameClockPhase: u32 {
        /// no phase
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_NONE")]
        const NONE = ffi::GDK_FRAME_CLOCK_PHASE_NONE as u32;
        /// corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS")]
        const FLUSH_EVENTS = ffi::GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS as u32;
        /// corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT")]
        const BEFORE_PAINT = ffi::GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT as u32;
        /// corresponds to GdkFrameClock::update.
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_UPDATE")]
        const UPDATE = ffi::GDK_FRAME_CLOCK_PHASE_UPDATE as u32;
        /// corresponds to GdkFrameClock::layout.
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_LAYOUT")]
        const LAYOUT = ffi::GDK_FRAME_CLOCK_PHASE_LAYOUT as u32;
        /// corresponds to GdkFrameClock::paint.
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_PAINT")]
        const PAINT = ffi::GDK_FRAME_CLOCK_PHASE_PAINT as u32;
        /// corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS")]
        const RESUME_EVENTS = ffi::GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS as u32;
        /// corresponds to GdkFrameClock::after-paint. Should not be handled by applications.
        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_AFTER_PAINT")]
        const AFTER_PAINT = ffi::GDK_FRAME_CLOCK_PHASE_AFTER_PAINT as u32;
    }
}

impl fmt::Display for FrameClockPhase {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FrameClockPhase {
    type GlibType = ffi::GdkFrameClockPhase;

    fn into_glib(self) -> ffi::GdkFrameClockPhase {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkFrameClockPhase> for FrameClockPhase {
    unsafe fn from_glib(value: ffi::GdkFrameClockPhase) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FrameClockPhase {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_frame_clock_phase_get_type()) }
    }
}

impl glib::value::ValueType for FrameClockPhase {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FrameClockPhase {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FrameClockPhase {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// A set of bit-flags to indicate the state of modifier keys and mouse buttons
    /// in various event types. Typical modifier keys are Shift, Control, Meta,
    /// Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
    ///
    /// Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
    ///
    /// Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
    /// to Mod2 - Mod5, and indicates this by setting [`SUPER_MASK`][Self::SUPER_MASK],
    /// [`HYPER_MASK`][Self::HYPER_MASK] or [`META_MASK`][Self::META_MASK] in the state field of key events.
    ///
    /// Note that GDK may add internal values to events which include
    /// reserved values such as [`MODIFIER_RESERVED_13_MASK`][Self::MODIFIER_RESERVED_13_MASK]. Your code
    /// should preserve and ignore them. You can use [`MODIFIER_MASK`][Self::MODIFIER_MASK] to
    /// remove all reserved values.
    ///
    /// Also note that the GDK X backend interprets button press events for button
    /// 4-7 as scroll events, so [`BUTTON4_MASK`][Self::BUTTON4_MASK] and [`BUTTON5_MASK`][Self::BUTTON5_MASK] will never
    /// be set.
    #[doc(alias = "GdkModifierType")]
    pub struct ModifierType: u32 {
        /// the Shift key.
        #[doc(alias = "GDK_SHIFT_MASK")]
        const SHIFT_MASK = ffi::GDK_SHIFT_MASK as u32;
        /// a Lock key (depending on the modifier mapping of the
        ///  X server this may either be CapsLock or ShiftLock).
        #[doc(alias = "GDK_LOCK_MASK")]
        const LOCK_MASK = ffi::GDK_LOCK_MASK as u32;
        /// the Control key.
        #[doc(alias = "GDK_CONTROL_MASK")]
        const CONTROL_MASK = ffi::GDK_CONTROL_MASK as u32;
        /// the fourth modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier, but
        ///  normally it is the Alt key).
        #[doc(alias = "GDK_MOD1_MASK")]
        const MOD1_MASK = ffi::GDK_MOD1_MASK as u32;
        /// the fifth modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        #[doc(alias = "GDK_MOD2_MASK")]
        const MOD2_MASK = ffi::GDK_MOD2_MASK as u32;
        /// the sixth modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        #[doc(alias = "GDK_MOD3_MASK")]
        const MOD3_MASK = ffi::GDK_MOD3_MASK as u32;
        /// the seventh modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        #[doc(alias = "GDK_MOD4_MASK")]
        const MOD4_MASK = ffi::GDK_MOD4_MASK as u32;
        /// the eighth modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        #[doc(alias = "GDK_MOD5_MASK")]
        const MOD5_MASK = ffi::GDK_MOD5_MASK as u32;
        /// the first mouse button.
        #[doc(alias = "GDK_BUTTON1_MASK")]
        const BUTTON1_MASK = ffi::GDK_BUTTON1_MASK as u32;
        /// the second mouse button.
        #[doc(alias = "GDK_BUTTON2_MASK")]
        const BUTTON2_MASK = ffi::GDK_BUTTON2_MASK as u32;
        /// the third mouse button.
        #[doc(alias = "GDK_BUTTON3_MASK")]
        const BUTTON3_MASK = ffi::GDK_BUTTON3_MASK as u32;
        /// the fourth mouse button.
        #[doc(alias = "GDK_BUTTON4_MASK")]
        const BUTTON4_MASK = ffi::GDK_BUTTON4_MASK as u32;
        /// the fifth mouse button.
        #[doc(alias = "GDK_BUTTON5_MASK")]
        const BUTTON5_MASK = ffi::GDK_BUTTON5_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_13_MASK")]
        const MODIFIER_RESERVED_13_MASK = ffi::GDK_MODIFIER_RESERVED_13_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_14_MASK")]
        const MODIFIER_RESERVED_14_MASK = ffi::GDK_MODIFIER_RESERVED_14_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_15_MASK")]
        const MODIFIER_RESERVED_15_MASK = ffi::GDK_MODIFIER_RESERVED_15_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_16_MASK")]
        const MODIFIER_RESERVED_16_MASK = ffi::GDK_MODIFIER_RESERVED_16_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_17_MASK")]
        const MODIFIER_RESERVED_17_MASK = ffi::GDK_MODIFIER_RESERVED_17_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_18_MASK")]
        const MODIFIER_RESERVED_18_MASK = ffi::GDK_MODIFIER_RESERVED_18_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_19_MASK")]
        const MODIFIER_RESERVED_19_MASK = ffi::GDK_MODIFIER_RESERVED_19_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_20_MASK")]
        const MODIFIER_RESERVED_20_MASK = ffi::GDK_MODIFIER_RESERVED_20_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_21_MASK")]
        const MODIFIER_RESERVED_21_MASK = ffi::GDK_MODIFIER_RESERVED_21_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_22_MASK")]
        const MODIFIER_RESERVED_22_MASK = ffi::GDK_MODIFIER_RESERVED_22_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_23_MASK")]
        const MODIFIER_RESERVED_23_MASK = ffi::GDK_MODIFIER_RESERVED_23_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_24_MASK")]
        const MODIFIER_RESERVED_24_MASK = ffi::GDK_MODIFIER_RESERVED_24_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_25_MASK")]
        const MODIFIER_RESERVED_25_MASK = ffi::GDK_MODIFIER_RESERVED_25_MASK as u32;
        /// the Super modifier. Since 2.10
        #[doc(alias = "GDK_SUPER_MASK")]
        const SUPER_MASK = ffi::GDK_SUPER_MASK as u32;
        /// the Hyper modifier. Since 2.10
        #[doc(alias = "GDK_HYPER_MASK")]
        const HYPER_MASK = ffi::GDK_HYPER_MASK as u32;
        /// the Meta modifier. Since 2.10
        #[doc(alias = "GDK_META_MASK")]
        const META_MASK = ffi::GDK_META_MASK as u32;
        /// A reserved bit flag; do not use in your own code
        #[doc(alias = "GDK_MODIFIER_RESERVED_29_MASK")]
        const MODIFIER_RESERVED_29_MASK = ffi::GDK_MODIFIER_RESERVED_29_MASK as u32;
        /// not used in GDK itself. GTK+ uses it to differentiate
        ///  between (keyval, modifiers) pairs from key press and release events.
        #[doc(alias = "GDK_RELEASE_MASK")]
        const RELEASE_MASK = ffi::GDK_RELEASE_MASK as u32;
        /// a mask covering all modifier types.
        #[doc(alias = "GDK_MODIFIER_MASK")]
        const MODIFIER_MASK = ffi::GDK_MODIFIER_MASK as u32;
    }
}

impl fmt::Display for ModifierType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for ModifierType {
    type GlibType = ffi::GdkModifierType;

    fn into_glib(self) -> ffi::GdkModifierType {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkModifierType> for ModifierType {
    unsafe fn from_glib(value: ffi::GdkModifierType) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for ModifierType {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_modifier_type_get_type()) }
    }
}

impl glib::value::ValueType for ModifierType {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for ModifierType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for ModifierType {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags describing the seat capabilities.
    #[doc(alias = "GdkSeatCapabilities")]
    pub struct SeatCapabilities: u32 {
        /// No input capabilities
        #[doc(alias = "GDK_SEAT_CAPABILITY_NONE")]
        const NONE = ffi::GDK_SEAT_CAPABILITY_NONE as u32;
        /// The seat has a pointer (e.g. mouse)
        #[doc(alias = "GDK_SEAT_CAPABILITY_POINTER")]
        const POINTER = ffi::GDK_SEAT_CAPABILITY_POINTER as u32;
        /// The seat has touchscreen(s) attached
        #[doc(alias = "GDK_SEAT_CAPABILITY_TOUCH")]
        const TOUCH = ffi::GDK_SEAT_CAPABILITY_TOUCH as u32;
        /// The seat has drawing tablet(s) attached
        #[doc(alias = "GDK_SEAT_CAPABILITY_TABLET_STYLUS")]
        const TABLET_STYLUS = ffi::GDK_SEAT_CAPABILITY_TABLET_STYLUS as u32;
        /// The seat has keyboard(s) attached
        #[doc(alias = "GDK_SEAT_CAPABILITY_KEYBOARD")]
        const KEYBOARD = ffi::GDK_SEAT_CAPABILITY_KEYBOARD as u32;
        /// The union of all pointing capabilities
        #[doc(alias = "GDK_SEAT_CAPABILITY_ALL_POINTING")]
        const ALL_POINTING = ffi::GDK_SEAT_CAPABILITY_ALL_POINTING as u32;
        /// The union of all capabilities
        #[doc(alias = "GDK_SEAT_CAPABILITY_ALL")]
        const ALL = ffi::GDK_SEAT_CAPABILITY_ALL as u32;
    }
}

impl fmt::Display for SeatCapabilities {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for SeatCapabilities {
    type GlibType = ffi::GdkSeatCapabilities;

    fn into_glib(self) -> ffi::GdkSeatCapabilities {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkSeatCapabilities> for SeatCapabilities {
    unsafe fn from_glib(value: ffi::GdkSeatCapabilities) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for SeatCapabilities {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_seat_capabilities_get_type()) }
    }
}

impl glib::value::ValueType for SeatCapabilities {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for SeatCapabilities {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for SeatCapabilities {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// These are hints originally defined by the Motif toolkit.
    /// The window manager can use them when determining how to decorate
    /// the window. The hint must be set before mapping the window.
    #[doc(alias = "GdkWMDecoration")]
    pub struct WMDecoration: u32 {
        /// all decorations should be applied.
        #[doc(alias = "GDK_DECOR_ALL")]
        const ALL = ffi::GDK_DECOR_ALL as u32;
        /// a frame should be drawn around the window.
        #[doc(alias = "GDK_DECOR_BORDER")]
        const BORDER = ffi::GDK_DECOR_BORDER as u32;
        /// the frame should have resize handles.
        #[doc(alias = "GDK_DECOR_RESIZEH")]
        const RESIZEH = ffi::GDK_DECOR_RESIZEH as u32;
        /// a titlebar should be placed above the window.
        #[doc(alias = "GDK_DECOR_TITLE")]
        const TITLE = ffi::GDK_DECOR_TITLE as u32;
        /// a button for opening a menu should be included.
        #[doc(alias = "GDK_DECOR_MENU")]
        const MENU = ffi::GDK_DECOR_MENU as u32;
        /// a minimize button should be included.
        #[doc(alias = "GDK_DECOR_MINIMIZE")]
        const MINIMIZE = ffi::GDK_DECOR_MINIMIZE as u32;
        /// a maximize button should be included.
        #[doc(alias = "GDK_DECOR_MAXIMIZE")]
        const MAXIMIZE = ffi::GDK_DECOR_MAXIMIZE as u32;
    }
}

impl fmt::Display for WMDecoration {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for WMDecoration {
    type GlibType = ffi::GdkWMDecoration;

    fn into_glib(self) -> ffi::GdkWMDecoration {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkWMDecoration> for WMDecoration {
    unsafe fn from_glib(value: ffi::GdkWMDecoration) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for WMDecoration {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_wm_decoration_get_type()) }
    }
}

impl glib::value::ValueType for WMDecoration {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for WMDecoration {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for WMDecoration {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// These are hints originally defined by the Motif toolkit. The window manager
    /// can use them when determining the functions to offer for the window. The
    /// hint must be set before mapping the window.
    #[doc(alias = "GdkWMFunction")]
    pub struct WMFunction: u32 {
        /// all functions should be offered.
        #[doc(alias = "GDK_FUNC_ALL")]
        const ALL = ffi::GDK_FUNC_ALL as u32;
        /// the window should be resizable.
        #[doc(alias = "GDK_FUNC_RESIZE")]
        const RESIZE = ffi::GDK_FUNC_RESIZE as u32;
        /// the window should be movable.
        #[doc(alias = "GDK_FUNC_MOVE")]
        const MOVE = ffi::GDK_FUNC_MOVE as u32;
        /// the window should be minimizable.
        #[doc(alias = "GDK_FUNC_MINIMIZE")]
        const MINIMIZE = ffi::GDK_FUNC_MINIMIZE as u32;
        /// the window should be maximizable.
        #[doc(alias = "GDK_FUNC_MAXIMIZE")]
        const MAXIMIZE = ffi::GDK_FUNC_MAXIMIZE as u32;
        /// the window should be closable.
        #[doc(alias = "GDK_FUNC_CLOSE")]
        const CLOSE = ffi::GDK_FUNC_CLOSE as u32;
    }
}

impl fmt::Display for WMFunction {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for WMFunction {
    type GlibType = ffi::GdkWMFunction;

    fn into_glib(self) -> ffi::GdkWMFunction {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkWMFunction> for WMFunction {
    unsafe fn from_glib(value: ffi::GdkWMFunction) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for WMFunction {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_wm_function_get_type()) }
    }
}

impl glib::value::ValueType for WMFunction {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for WMFunction {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for WMFunction {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Used to indicate which fields of a [`Geometry`][crate::Geometry] struct should be paid
    /// attention to. Also, the presence/absence of [`POS`][Self::POS],
    /// [`USER_POS`][Self::USER_POS], and [`USER_SIZE`][Self::USER_SIZE] is significant, though they don't
    /// directly refer to [`Geometry`][crate::Geometry] fields. [`USER_POS`][Self::USER_POS] will be set
    /// automatically by `GtkWindow` if you call `gtk_window_move()`.
    /// [`USER_POS`][Self::USER_POS] and [`USER_SIZE`][Self::USER_SIZE] should be set if the user
    /// specified a size/position using a --geometry command-line argument;
    /// `gtk_window_parse_geometry()` automatically sets these flags.
    #[doc(alias = "GdkWindowHints")]
    pub struct WindowHints: u32 {
        /// indicates that the program has positioned the window
        #[doc(alias = "GDK_HINT_POS")]
        const POS = ffi::GDK_HINT_POS as u32;
        /// min size fields are set
        #[doc(alias = "GDK_HINT_MIN_SIZE")]
        const MIN_SIZE = ffi::GDK_HINT_MIN_SIZE as u32;
        /// max size fields are set
        #[doc(alias = "GDK_HINT_MAX_SIZE")]
        const MAX_SIZE = ffi::GDK_HINT_MAX_SIZE as u32;
        /// base size fields are set
        #[doc(alias = "GDK_HINT_BASE_SIZE")]
        const BASE_SIZE = ffi::GDK_HINT_BASE_SIZE as u32;
        /// aspect ratio fields are set
        #[doc(alias = "GDK_HINT_ASPECT")]
        const ASPECT = ffi::GDK_HINT_ASPECT as u32;
        /// resize increment fields are set
        #[doc(alias = "GDK_HINT_RESIZE_INC")]
        const RESIZE_INC = ffi::GDK_HINT_RESIZE_INC as u32;
        /// window gravity field is set
        #[doc(alias = "GDK_HINT_WIN_GRAVITY")]
        const WIN_GRAVITY = ffi::GDK_HINT_WIN_GRAVITY as u32;
        /// indicates that the window’s position was explicitly set
        ///  by the user
        #[doc(alias = "GDK_HINT_USER_POS")]
        const USER_POS = ffi::GDK_HINT_USER_POS as u32;
        /// indicates that the window’s size was explicitly set by
        ///  the user
        #[doc(alias = "GDK_HINT_USER_SIZE")]
        const USER_SIZE = ffi::GDK_HINT_USER_SIZE as u32;
    }
}

impl fmt::Display for WindowHints {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for WindowHints {
    type GlibType = ffi::GdkWindowHints;

    fn into_glib(self) -> ffi::GdkWindowHints {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkWindowHints> for WindowHints {
    unsafe fn from_glib(value: ffi::GdkWindowHints) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for WindowHints {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_window_hints_get_type()) }
    }
}

impl glib::value::ValueType for WindowHints {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for WindowHints {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for WindowHints {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Specifies the state of a toplevel window.
    #[doc(alias = "GdkWindowState")]
    pub struct WindowState: u32 {
        /// the window is not shown.
        #[doc(alias = "GDK_WINDOW_STATE_WITHDRAWN")]
        const WITHDRAWN = ffi::GDK_WINDOW_STATE_WITHDRAWN as u32;
        /// the window is minimized.
        #[doc(alias = "GDK_WINDOW_STATE_ICONIFIED")]
        const ICONIFIED = ffi::GDK_WINDOW_STATE_ICONIFIED as u32;
        /// the window is maximized.
        #[doc(alias = "GDK_WINDOW_STATE_MAXIMIZED")]
        const MAXIMIZED = ffi::GDK_WINDOW_STATE_MAXIMIZED as u32;
        /// the window is sticky.
        #[doc(alias = "GDK_WINDOW_STATE_STICKY")]
        const STICKY = ffi::GDK_WINDOW_STATE_STICKY as u32;
        /// the window is maximized without
        ///  decorations.
        #[doc(alias = "GDK_WINDOW_STATE_FULLSCREEN")]
        const FULLSCREEN = ffi::GDK_WINDOW_STATE_FULLSCREEN as u32;
        /// the window is kept above other windows.
        #[doc(alias = "GDK_WINDOW_STATE_ABOVE")]
        const ABOVE = ffi::GDK_WINDOW_STATE_ABOVE as u32;
        /// the window is kept below other windows.
        #[doc(alias = "GDK_WINDOW_STATE_BELOW")]
        const BELOW = ffi::GDK_WINDOW_STATE_BELOW as u32;
        /// the window is presented as focused (with active decorations).
        #[doc(alias = "GDK_WINDOW_STATE_FOCUSED")]
        const FOCUSED = ffi::GDK_WINDOW_STATE_FOCUSED as u32;
        /// the window is in a tiled state, Since 3.10. Since 3.22.23, this
        ///  is deprecated in favor of per-edge information.
        #[doc(alias = "GDK_WINDOW_STATE_TILED")]
        const TILED = ffi::GDK_WINDOW_STATE_TILED as u32;
        /// whether the top edge is tiled, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_TOP_TILED")]
        const TOP_TILED = ffi::GDK_WINDOW_STATE_TOP_TILED as u32;
        /// whether the top edge is resizable, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_TOP_RESIZABLE")]
        const TOP_RESIZABLE = ffi::GDK_WINDOW_STATE_TOP_RESIZABLE as u32;
        /// whether the right edge is tiled, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_RIGHT_TILED")]
        const RIGHT_TILED = ffi::GDK_WINDOW_STATE_RIGHT_TILED as u32;
        /// whether the right edge is resizable, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_RIGHT_RESIZABLE")]
        const RIGHT_RESIZABLE = ffi::GDK_WINDOW_STATE_RIGHT_RESIZABLE as u32;
        /// whether the bottom edge is tiled, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_BOTTOM_TILED")]
        const BOTTOM_TILED = ffi::GDK_WINDOW_STATE_BOTTOM_TILED as u32;
        /// whether the bottom edge is resizable, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_BOTTOM_RESIZABLE")]
        const BOTTOM_RESIZABLE = ffi::GDK_WINDOW_STATE_BOTTOM_RESIZABLE as u32;
        /// whether the left edge is tiled, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_LEFT_TILED")]
        const LEFT_TILED = ffi::GDK_WINDOW_STATE_LEFT_TILED as u32;
        /// whether the left edge is resizable, Since 3.22.23
        #[doc(alias = "GDK_WINDOW_STATE_LEFT_RESIZABLE")]
        const LEFT_RESIZABLE = ffi::GDK_WINDOW_STATE_LEFT_RESIZABLE as u32;
    }
}

impl fmt::Display for WindowState {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for WindowState {
    type GlibType = ffi::GdkWindowState;

    fn into_glib(self) -> ffi::GdkWindowState {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GdkWindowState> for WindowState {
    unsafe fn from_glib(value: ffi::GdkWindowState) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for WindowState {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::gdk_window_state_get_type()) }
    }
}

impl glib::value::ValueType for WindowState {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for WindowState {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for WindowState {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}