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
// 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 gdk_sys;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;

#[cfg(any(feature = "v3_22", feature = "dox"))]
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, `AnchorHints::FlipX` will replace `Gravity::NorthWest` with
    /// `Gravity::NorthEast` and vice versa if the window extends beyond the left
    /// or right edges of the monitor.
    ///
    /// If `AnchorHints::SlideX` is set, the window can be shifted horizontally to fit
    /// on-screen. If `AnchorHints::ResizeX` 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.
    pub struct AnchorHints: u32 {
        /// allow flipping anchors horizontally
        const FLIP_X = 1;
        /// allow flipping anchors vertically
        const FLIP_Y = 2;
        /// allow sliding window horizontally
        const SLIDE_X = 4;
        /// allow sliding window vertically
        const SLIDE_Y = 8;
        /// allow resizing window horizontally
        const RESIZE_X = 16;
        /// allow resizing window vertically
        const RESIZE_Y = 32;
        /// allow flipping anchors on both axes
        const FLIP = 3;
        /// allow sliding window on both axes
        const SLIDE = 12;
        /// allow resizing window on both axes
        ///
        /// Feature: `v3_22`
        ///
        const RESIZE = 48;
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for AnchorHints {
    type GlibType = gdk_sys::GdkAnchorHints;

    fn to_glib(&self) -> gdk_sys::GdkAnchorHints {
        self.bits()
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkAnchorHints> for AnchorHints {
    fn from_glib(value: gdk_sys::GdkAnchorHints) -> AnchorHints {
        skip_assert_initialized!();
        AnchorHints::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl StaticType for AnchorHints {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_anchor_hints_get_type()) }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValueOptional<'a> for AnchorHints {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValue<'a> for AnchorHints {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl SetValue for AnchorHints {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
bitflags! {
    /// Flags describing the current capabilities of a device/tool.
    pub struct AxisFlags: u32 {
        /// X axis is present
        const X = 2;
        /// Y axis is present
        const Y = 4;
        /// Pressure axis is present
        const PRESSURE = 8;
        /// X tilt axis is present
        const XTILT = 16;
        /// Y tilt axis is present
        const YTILT = 32;
        /// Wheel axis is present
        const WHEEL = 64;
        /// Distance axis is present
        const DISTANCE = 128;
        /// Z-axis rotation is present
        const ROTATION = 256;
        /// Slider axis is present
        ///
        /// Feature: `v3_22`
        ///
        const SLIDER = 512;
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for AxisFlags {
    type GlibType = gdk_sys::GdkAxisFlags;

    fn to_glib(&self) -> gdk_sys::GdkAxisFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkAxisFlags> for AxisFlags {
    fn from_glib(value: gdk_sys::GdkAxisFlags) -> AxisFlags {
        skip_assert_initialized!();
        AxisFlags::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl StaticType for AxisFlags {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_axis_flags_get_type()) }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValueOptional<'a> for AxisFlags {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValue<'a> for AxisFlags {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl SetValue for AxisFlags {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Used in `DragContext` to indicate what the destination
    /// should do with the dropped data.
    pub struct DragAction: u32 {
        /// Means nothing, and should not be used.
        const DEFAULT = 1;
        /// Copy the data.
        const COPY = 2;
        /// Move the data, i.e. first copy it, then delete
        ///  it from the source using the DELETE target of the X selection protocol.
        const MOVE = 4;
        /// Add a link to the data. Note that this is only
        ///  useful if source and destination agree on what it means.
        const LINK = 8;
        /// Special action which tells the source that the
        ///  destination will do something that the source doesn’t understand.
        const PRIVATE = 16;
        /// Ask the user what to do with the data.
        const ASK = 32;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkDragAction {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for DragAction {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for DragAction {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for DragAction {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

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` event types
    /// above.
    ///
    /// See the [input handling overview][chap-input-handling] for details of
    /// [event masks][event-masks] and [event propagation][event-propagation].
    ///
    /// `EventMask::PointerMotionHintMask` is deprecated. It is a special mask
    /// to reduce the number of `EventType::MotionNotify` events received. When using
    /// `EventMask::PointerMotionHintMask`, fewer `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
    /// `WindowExt::set_event_compression`. See the documentation of that function
    /// for details.
    ///
    /// If `EventMask::TouchMask` is enabled, the window will receive touch events
    /// from touch-enabled devices. Those will come as sequences of `EventTouch`
    /// with type `EventType::TouchUpdate`, enclosed by two events with
    /// type `EventType::TouchBegin` and `EventType::TouchEnd` (or `EventType::TouchCancel`).
    /// `gdk_event_get_event_sequence` returns the event sequence for these
    /// events, so different sequences may be distinguished.
    pub struct EventMask: u32 {
        /// receive expose events
        const EXPOSURE_MASK = 2;
        /// receive all pointer motion events
        const POINTER_MOTION_MASK = 4;
        /// deprecated. see the explanation above
        const POINTER_MOTION_HINT_MASK = 8;
        /// receive pointer motion events while any button is pressed
        const BUTTON_MOTION_MASK = 16;
        /// receive pointer motion events while 1 button is pressed
        const BUTTON1_MOTION_MASK = 32;
        /// receive pointer motion events while 2 button is pressed
        const BUTTON2_MOTION_MASK = 64;
        /// receive pointer motion events while 3 button is pressed
        const BUTTON3_MOTION_MASK = 128;
        /// receive button press events
        const BUTTON_PRESS_MASK = 256;
        /// receive button release events
        const BUTTON_RELEASE_MASK = 512;
        /// receive key press events
        const KEY_PRESS_MASK = 1024;
        /// receive key release events
        const KEY_RELEASE_MASK = 2048;
        /// receive window enter events
        const ENTER_NOTIFY_MASK = 4096;
        /// receive window leave events
        const LEAVE_NOTIFY_MASK = 8192;
        /// receive focus change events
        const FOCUS_CHANGE_MASK = 16384;
        /// receive events about window configuration change
        const STRUCTURE_MASK = 32768;
        /// receive property change events
        const PROPERTY_CHANGE_MASK = 65536;
        /// receive visibility change events
        const VISIBILITY_NOTIFY_MASK = 131072;
        /// receive proximity in events
        const PROXIMITY_IN_MASK = 262144;
        /// receive proximity out events
        const PROXIMITY_OUT_MASK = 524288;
        /// receive events about window configuration changes of
        ///  child windows
        const SUBSTRUCTURE_MASK = 1048576;
        /// receive scroll events
        const SCROLL_MASK = 2097152;
        /// receive touch events. Since 3.4
        const TOUCH_MASK = 4194304;
        /// receive smooth scrolling events. Since 3.4
        const SMOOTH_SCROLL_MASK = 8388608;
        /// receive touchpad gesture events. Since 3.18
        const TOUCHPAD_GESTURE_MASK = 16777216;
        /// receive tablet pad events. Since 3.22
        const TABLET_PAD_MASK = 33554432;
        /// the combination of all the above event masks.
        const ALL_EVENTS_MASK = 67108862;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkEventMask {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for EventMask {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for EventMask {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for EventMask {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// `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`.
    pub struct FrameClockPhase: u32 {
        /// no phase
        const NONE = 0;
        /// corresponds to `FrameClock`::flush-events. Should not be handled by applications.
        const FLUSH_EVENTS = 1;
        /// corresponds to `FrameClock`::before-paint. Should not be handled by applications.
        const BEFORE_PAINT = 2;
        /// corresponds to `FrameClock`::update.
        const UPDATE = 4;
        /// corresponds to `FrameClock`::layout.
        const LAYOUT = 8;
        /// corresponds to `FrameClock`::paint.
        const PAINT = 16;
        /// corresponds to `FrameClock`::resume-events. Should not be handled by applications.
        const RESUME_EVENTS = 32;
        /// corresponds to `FrameClock`::after-paint. Should not be handled by applications.
        const AFTER_PAINT = 64;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkFrameClockPhase {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for FrameClockPhase {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for FrameClockPhase {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for FrameClockPhase {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

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 `ModifierType::SuperMask`,
    /// `ModifierType::HyperMask` or `ModifierType::MetaMask` in the state field of key events.
    ///
    /// Note that GDK may add internal values to events which include
    /// reserved values such as `ModifierType::ModifierReserved13Mask`. Your code
    /// should preserve and ignore them. You can use `ModifierType::ModifierMask` to
    /// remove all reserved values.
    ///
    /// Also note that the GDK X backend interprets button press events for button
    /// 4-7 as scroll events, so `ModifierType::Button4Mask` and `ModifierType::Button5Mask` will never
    /// be set.
    pub struct ModifierType: u32 {
        /// the Shift key.
        const SHIFT_MASK = 1;
        /// a Lock key (depending on the modifier mapping of the
        ///  X server this may either be CapsLock or ShiftLock).
        const LOCK_MASK = 2;
        /// the Control key.
        const CONTROL_MASK = 4;
        /// 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).
        const MOD1_MASK = 8;
        /// the fifth modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        const MOD2_MASK = 16;
        /// the sixth modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        const MOD3_MASK = 32;
        /// the seventh modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        const MOD4_MASK = 64;
        /// the eighth modifier key (it depends on the modifier
        ///  mapping of the X server which key is interpreted as this modifier).
        const MOD5_MASK = 128;
        /// the first mouse button.
        const BUTTON1_MASK = 256;
        /// the second mouse button.
        const BUTTON2_MASK = 512;
        /// the third mouse button.
        const BUTTON3_MASK = 1024;
        /// the fourth mouse button.
        const BUTTON4_MASK = 2048;
        /// the fifth mouse button.
        const BUTTON5_MASK = 4096;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_13_MASK = 8192;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_14_MASK = 16384;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_15_MASK = 32768;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_16_MASK = 65536;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_17_MASK = 131072;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_18_MASK = 262144;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_19_MASK = 524288;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_20_MASK = 1048576;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_21_MASK = 2097152;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_22_MASK = 4194304;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_23_MASK = 8388608;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_24_MASK = 16777216;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_25_MASK = 33554432;
        /// the Super modifier. Since 2.10
        const SUPER_MASK = 67108864;
        /// the Hyper modifier. Since 2.10
        const HYPER_MASK = 134217728;
        /// the Meta modifier. Since 2.10
        const META_MASK = 268435456;
        /// A reserved bit flag; do not use in your own code
        const MODIFIER_RESERVED_29_MASK = 536870912;
        /// not used in GDK itself. GTK+ uses it to differentiate
        ///  between (keyval, modifiers) pairs from key press and release events.
        const RELEASE_MASK = 1073741824;
        /// a mask covering all modifier types.
        const MODIFIER_MASK = 1543512063;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkModifierType {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for ModifierType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for ModifierType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for ModifierType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
bitflags! {
    /// Flags describing the seat capabilities.
    pub struct SeatCapabilities: u32 {
        /// No input capabilities
        const NONE = 0;
        /// The seat has a pointer (e.g. mouse)
        const POINTER = 1;
        /// The seat has touchscreen(s) attached
        const TOUCH = 2;
        /// The seat has drawing tablet(s) attached
        const TABLET_STYLUS = 4;
        /// The seat has keyboard(s) attached
        const KEYBOARD = 8;
        /// The union of all pointing capabilities
        const ALL_POINTING = 7;
        /// The union of all capabilities
        ///
        /// Feature: `v3_20`
        ///
        const ALL = 15;
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for SeatCapabilities {
    type GlibType = gdk_sys::GdkSeatCapabilities;

    fn to_glib(&self) -> gdk_sys::GdkSeatCapabilities {
        self.bits()
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkSeatCapabilities> for SeatCapabilities {
    fn from_glib(value: gdk_sys::GdkSeatCapabilities) -> SeatCapabilities {
        skip_assert_initialized!();
        SeatCapabilities::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl StaticType for SeatCapabilities {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_seat_capabilities_get_type()) }
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl<'a> FromValueOptional<'a> for SeatCapabilities {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl<'a> FromValue<'a> for SeatCapabilities {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl SetValue for SeatCapabilities {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

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.
    pub struct WMDecoration: u32 {
        /// all decorations should be applied.
        const ALL = 1;
        /// a frame should be drawn around the window.
        const BORDER = 2;
        /// the frame should have resize handles.
        const RESIZEH = 4;
        /// a titlebar should be placed above the window.
        const TITLE = 8;
        /// a button for opening a menu should be included.
        const MENU = 16;
        /// a minimize button should be included.
        const MINIMIZE = 32;
        /// a maximize button should be included.
        const MAXIMIZE = 64;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkWMDecoration {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for WMDecoration {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WMDecoration {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for WMDecoration {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

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.
    pub struct WMFunction: u32 {
        /// all functions should be offered.
        const ALL = 1;
        /// the window should be resizable.
        const RESIZE = 2;
        /// the window should be movable.
        const MOVE = 4;
        /// the window should be minimizable.
        const MINIMIZE = 8;
        /// the window should be maximizable.
        const MAXIMIZE = 16;
        /// the window should be closable.
        const CLOSE = 32;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkWMFunction {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for WMFunction {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WMFunction {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for WMFunction {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Used to indicate which fields of a `Geometry` struct should be paid
    /// attention to. Also, the presence/absence of `WindowHints::Pos`,
    /// `WindowHints::UserPos`, and `WindowHints::UserSize` is significant, though they don't
    /// directly refer to `Geometry` fields. `WindowHints::UserPos` will be set
    /// automatically by ``GtkWindow`` if you call `gtk_window_move`.
    /// `WindowHints::UserPos` and `WindowHints::UserSize` should be set if the user
    /// specified a size/position using a --geometry command-line argument;
    /// `gtk_window_parse_geometry` automatically sets these flags.
    pub struct WindowHints: u32 {
        /// indicates that the program has positioned the window
        const POS = 1;
        /// min size fields are set
        const MIN_SIZE = 2;
        /// max size fields are set
        const MAX_SIZE = 4;
        /// base size fields are set
        const BASE_SIZE = 8;
        /// aspect ratio fields are set
        const ASPECT = 16;
        /// resize increment fields are set
        const RESIZE_INC = 32;
        /// window gravity field is set
        const WIN_GRAVITY = 64;
        /// indicates that the window’s position was explicitly set
        ///  by the user
        const USER_POS = 128;
        /// indicates that the window’s size was explicitly set by
        ///  the user
        const USER_SIZE = 256;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkWindowHints {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for WindowHints {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WindowHints {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for WindowHints {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}

bitflags! {
    /// Specifies the state of a toplevel window.
    pub struct WindowState: u32 {
        /// the window is not shown.
        const WITHDRAWN = 1;
        /// the window is minimized.
        const ICONIFIED = 2;
        /// the window is maximized.
        const MAXIMIZED = 4;
        /// the window is sticky.
        const STICKY = 8;
        /// the window is maximized without
        ///  decorations.
        const FULLSCREEN = 16;
        /// the window is kept above other windows.
        const ABOVE = 32;
        /// the window is kept below other windows.
        const BELOW = 64;
        /// the window is presented as focused (with active decorations).
        const FOCUSED = 128;
        /// the window is in a tiled state, Since 3.10. Since 3.22.23, this
        ///  is deprecated in favor of per-edge information.
        const TILED = 256;
        /// whether the top edge is tiled, Since 3.22.23
        const TOP_TILED = 512;
        /// whether the top edge is resizable, Since 3.22.23
        const TOP_RESIZABLE = 1024;
        /// whether the right edge is tiled, Since 3.22.23
        const RIGHT_TILED = 2048;
        /// whether the right edge is resizable, Since 3.22.23
        const RIGHT_RESIZABLE = 4096;
        /// whether the bottom edge is tiled, Since 3.22.23
        const BOTTOM_TILED = 8192;
        /// whether the bottom edge is resizable, Since 3.22.23
        const BOTTOM_RESIZABLE = 16384;
        /// whether the left edge is tiled, Since 3.22.23
        const LEFT_TILED = 32768;
        /// whether the left edge is resizable, Since 3.22.23
        const LEFT_RESIZABLE = 65536;
    }
}

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

    fn to_glib(&self) -> gdk_sys::GdkWindowState {
        self.bits()
    }
}

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

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

impl<'a> FromValueOptional<'a> for WindowState {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WindowState {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
    }
}

impl SetValue for WindowState {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib())
    }
}