Skip to main content

gdk4/auto/
enums.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8/// Defines how device axes are interpreted by GTK.
9///
10/// Note that the X and Y axes are not really needed; pointer devices
11/// report their location via the x/y members of events regardless. Whether
12/// X and Y are present as axes depends on the GDK backend.
13#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
14#[non_exhaustive]
15#[doc(alias = "GdkAxisUse")]
16pub enum AxisUse {
17    /// the axis is ignored.
18    #[doc(alias = "GDK_AXIS_IGNORE")]
19    Ignore,
20    /// the axis is used as the x axis.
21    #[doc(alias = "GDK_AXIS_X")]
22    X,
23    /// the axis is used as the y axis.
24    #[doc(alias = "GDK_AXIS_Y")]
25    Y,
26    /// the axis is used as the scroll x delta
27    #[doc(alias = "GDK_AXIS_DELTA_X")]
28    DeltaX,
29    /// the axis is used as the scroll y delta
30    #[doc(alias = "GDK_AXIS_DELTA_Y")]
31    DeltaY,
32    /// the axis is used for pressure information.
33    #[doc(alias = "GDK_AXIS_PRESSURE")]
34    Pressure,
35    /// the axis is used for x tilt information.
36    #[doc(alias = "GDK_AXIS_XTILT")]
37    Xtilt,
38    /// the axis is used for y tilt information.
39    #[doc(alias = "GDK_AXIS_YTILT")]
40    Ytilt,
41    /// the axis is used for wheel information.
42    #[doc(alias = "GDK_AXIS_WHEEL")]
43    Wheel,
44    /// the axis is used for pen/tablet distance information
45    #[doc(alias = "GDK_AXIS_DISTANCE")]
46    Distance,
47    /// the axis is used for pen rotation information
48    #[doc(alias = "GDK_AXIS_ROTATION")]
49    Rotation,
50    /// the axis is used for pen slider information
51    #[doc(alias = "GDK_AXIS_SLIDER")]
52    Slider,
53    #[doc(hidden)]
54    __Unknown(i32),
55}
56
57#[doc(hidden)]
58impl IntoGlib for AxisUse {
59    type GlibType = ffi::GdkAxisUse;
60
61    #[inline]
62    fn into_glib(self) -> ffi::GdkAxisUse {
63        match self {
64            Self::Ignore => ffi::GDK_AXIS_IGNORE,
65            Self::X => ffi::GDK_AXIS_X,
66            Self::Y => ffi::GDK_AXIS_Y,
67            Self::DeltaX => ffi::GDK_AXIS_DELTA_X,
68            Self::DeltaY => ffi::GDK_AXIS_DELTA_Y,
69            Self::Pressure => ffi::GDK_AXIS_PRESSURE,
70            Self::Xtilt => ffi::GDK_AXIS_XTILT,
71            Self::Ytilt => ffi::GDK_AXIS_YTILT,
72            Self::Wheel => ffi::GDK_AXIS_WHEEL,
73            Self::Distance => ffi::GDK_AXIS_DISTANCE,
74            Self::Rotation => ffi::GDK_AXIS_ROTATION,
75            Self::Slider => ffi::GDK_AXIS_SLIDER,
76            Self::__Unknown(value) => value,
77        }
78    }
79}
80
81#[doc(hidden)]
82impl FromGlib<ffi::GdkAxisUse> for AxisUse {
83    #[inline]
84    unsafe fn from_glib(value: ffi::GdkAxisUse) -> Self {
85        skip_assert_initialized!();
86
87        match value {
88            ffi::GDK_AXIS_IGNORE => Self::Ignore,
89            ffi::GDK_AXIS_X => Self::X,
90            ffi::GDK_AXIS_Y => Self::Y,
91            ffi::GDK_AXIS_DELTA_X => Self::DeltaX,
92            ffi::GDK_AXIS_DELTA_Y => Self::DeltaY,
93            ffi::GDK_AXIS_PRESSURE => Self::Pressure,
94            ffi::GDK_AXIS_XTILT => Self::Xtilt,
95            ffi::GDK_AXIS_YTILT => Self::Ytilt,
96            ffi::GDK_AXIS_WHEEL => Self::Wheel,
97            ffi::GDK_AXIS_DISTANCE => Self::Distance,
98            ffi::GDK_AXIS_ROTATION => Self::Rotation,
99            ffi::GDK_AXIS_SLIDER => Self::Slider,
100            value => Self::__Unknown(value),
101        }
102    }
103}
104
105impl StaticType for AxisUse {
106    #[inline]
107    #[doc(alias = "gdk_axis_use_get_type")]
108    fn static_type() -> glib::Type {
109        unsafe { from_glib(ffi::gdk_axis_use_get_type()) }
110    }
111}
112
113impl glib::HasParamSpec for AxisUse {
114    type ParamSpec = glib::ParamSpecEnum;
115    type SetValue = Self;
116    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
117
118    fn param_spec_builder() -> Self::BuilderFn {
119        Self::ParamSpec::builder_with_default
120    }
121}
122
123impl glib::value::ValueType for AxisUse {
124    type Type = Self;
125}
126
127unsafe impl<'a> glib::value::FromValue<'a> for AxisUse {
128    type Checker = glib::value::GenericValueTypeChecker<Self>;
129
130    #[inline]
131    unsafe fn from_value(value: &'a glib::Value) -> Self {
132        skip_assert_initialized!();
133        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
134    }
135}
136
137impl ToValue for AxisUse {
138    #[inline]
139    fn to_value(&self) -> glib::Value {
140        let mut value = glib::Value::for_value_type::<Self>();
141        unsafe {
142            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
143        }
144        value
145    }
146
147    #[inline]
148    fn value_type(&self) -> glib::Type {
149        Self::static_type()
150    }
151}
152
153impl From<AxisUse> for glib::Value {
154    #[inline]
155    fn from(v: AxisUse) -> Self {
156        skip_assert_initialized!();
157        ToValue::to_value(&v)
158    }
159}
160
161/// The values of this enumeration describe whether image data uses
162/// the full range of 8-bit values.
163///
164/// In digital broadcasting, it is common to reserve the lowest and
165/// highest values. Typically the allowed values for the narrow range
166/// are 16-235 for Y and 16-240 for u,v (when dealing with YUV data).
167#[cfg(feature = "v4_16")]
168#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
169#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
170#[non_exhaustive]
171#[doc(alias = "GdkCicpRange")]
172pub enum CicpRange {
173    /// The values use the range of 16-235 (for Y) and 16-240 for u and v.
174    #[doc(alias = "GDK_CICP_RANGE_NARROW")]
175    Narrow,
176    /// The values use the full range.
177    #[doc(alias = "GDK_CICP_RANGE_FULL")]
178    Full,
179    #[doc(hidden)]
180    __Unknown(i32),
181}
182
183#[cfg(feature = "v4_16")]
184#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
185#[doc(hidden)]
186impl IntoGlib for CicpRange {
187    type GlibType = ffi::GdkCicpRange;
188
189    #[inline]
190    fn into_glib(self) -> ffi::GdkCicpRange {
191        match self {
192            Self::Narrow => ffi::GDK_CICP_RANGE_NARROW,
193            Self::Full => ffi::GDK_CICP_RANGE_FULL,
194            Self::__Unknown(value) => value,
195        }
196    }
197}
198
199#[cfg(feature = "v4_16")]
200#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
201#[doc(hidden)]
202impl FromGlib<ffi::GdkCicpRange> for CicpRange {
203    #[inline]
204    unsafe fn from_glib(value: ffi::GdkCicpRange) -> Self {
205        skip_assert_initialized!();
206
207        match value {
208            ffi::GDK_CICP_RANGE_NARROW => Self::Narrow,
209            ffi::GDK_CICP_RANGE_FULL => Self::Full,
210            value => Self::__Unknown(value),
211        }
212    }
213}
214
215#[cfg(feature = "v4_16")]
216#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
217impl StaticType for CicpRange {
218    #[inline]
219    #[doc(alias = "gdk_cicp_range_get_type")]
220    fn static_type() -> glib::Type {
221        unsafe { from_glib(ffi::gdk_cicp_range_get_type()) }
222    }
223}
224
225#[cfg(feature = "v4_16")]
226#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
227impl glib::HasParamSpec for CicpRange {
228    type ParamSpec = glib::ParamSpecEnum;
229    type SetValue = Self;
230    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
231
232    fn param_spec_builder() -> Self::BuilderFn {
233        Self::ParamSpec::builder_with_default
234    }
235}
236
237#[cfg(feature = "v4_16")]
238#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
239impl glib::value::ValueType for CicpRange {
240    type Type = Self;
241}
242
243#[cfg(feature = "v4_16")]
244#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
245unsafe impl<'a> glib::value::FromValue<'a> for CicpRange {
246    type Checker = glib::value::GenericValueTypeChecker<Self>;
247
248    #[inline]
249    unsafe fn from_value(value: &'a glib::Value) -> Self {
250        skip_assert_initialized!();
251        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
252    }
253}
254
255#[cfg(feature = "v4_16")]
256#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
257impl ToValue for CicpRange {
258    #[inline]
259    fn to_value(&self) -> glib::Value {
260        let mut value = glib::Value::for_value_type::<Self>();
261        unsafe {
262            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
263        }
264        value
265    }
266
267    #[inline]
268    fn value_type(&self) -> glib::Type {
269        Self::static_type()
270    }
271}
272
273#[cfg(feature = "v4_16")]
274#[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))]
275impl From<CicpRange> for glib::Value {
276    #[inline]
277    fn from(v: CicpRange) -> Self {
278        skip_assert_initialized!();
279        ToValue::to_value(&v)
280    }
281}
282
283/// Enumerates the color channels of RGBA values as used in
284/// `GdkColor` and OpenGL/Vulkan shaders.
285///
286/// Note that this is not the order of pixel values in Cairo
287/// and [`MemoryFormat`][crate::MemoryFormat] can have many different orders.
288#[cfg(feature = "v4_22")]
289#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
290#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
291#[non_exhaustive]
292#[doc(alias = "GdkColorChannel")]
293pub enum ColorChannel {
294    /// The red color channel, aka 0
295    #[doc(alias = "GDK_COLOR_CHANNEL_RED")]
296    Red,
297    /// The green color channel, aka 1
298    #[doc(alias = "GDK_COLOR_CHANNEL_GREEN")]
299    Green,
300    /// The blue color channel, aka 2
301    #[doc(alias = "GDK_COLOR_CHANNEL_BLUE")]
302    Blue,
303    /// The alpha color channel, aka 3
304    #[doc(alias = "GDK_COLOR_CHANNEL_ALPHA")]
305    Alpha,
306    #[doc(hidden)]
307    __Unknown(i32),
308}
309
310#[cfg(feature = "v4_22")]
311#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
312#[doc(hidden)]
313impl IntoGlib for ColorChannel {
314    type GlibType = ffi::GdkColorChannel;
315
316    #[inline]
317    fn into_glib(self) -> ffi::GdkColorChannel {
318        match self {
319            Self::Red => ffi::GDK_COLOR_CHANNEL_RED,
320            Self::Green => ffi::GDK_COLOR_CHANNEL_GREEN,
321            Self::Blue => ffi::GDK_COLOR_CHANNEL_BLUE,
322            Self::Alpha => ffi::GDK_COLOR_CHANNEL_ALPHA,
323            Self::__Unknown(value) => value,
324        }
325    }
326}
327
328#[cfg(feature = "v4_22")]
329#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
330#[doc(hidden)]
331impl FromGlib<ffi::GdkColorChannel> for ColorChannel {
332    #[inline]
333    unsafe fn from_glib(value: ffi::GdkColorChannel) -> Self {
334        skip_assert_initialized!();
335
336        match value {
337            ffi::GDK_COLOR_CHANNEL_RED => Self::Red,
338            ffi::GDK_COLOR_CHANNEL_GREEN => Self::Green,
339            ffi::GDK_COLOR_CHANNEL_BLUE => Self::Blue,
340            ffi::GDK_COLOR_CHANNEL_ALPHA => Self::Alpha,
341            value => Self::__Unknown(value),
342        }
343    }
344}
345
346#[cfg(feature = "v4_22")]
347#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
348impl StaticType for ColorChannel {
349    #[inline]
350    #[doc(alias = "gdk_color_channel_get_type")]
351    fn static_type() -> glib::Type {
352        unsafe { from_glib(ffi::gdk_color_channel_get_type()) }
353    }
354}
355
356#[cfg(feature = "v4_22")]
357#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
358impl glib::HasParamSpec for ColorChannel {
359    type ParamSpec = glib::ParamSpecEnum;
360    type SetValue = Self;
361    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
362
363    fn param_spec_builder() -> Self::BuilderFn {
364        Self::ParamSpec::builder_with_default
365    }
366}
367
368#[cfg(feature = "v4_22")]
369#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
370impl glib::value::ValueType for ColorChannel {
371    type Type = Self;
372}
373
374#[cfg(feature = "v4_22")]
375#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
376unsafe impl<'a> glib::value::FromValue<'a> for ColorChannel {
377    type Checker = glib::value::GenericValueTypeChecker<Self>;
378
379    #[inline]
380    unsafe fn from_value(value: &'a glib::Value) -> Self {
381        skip_assert_initialized!();
382        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
383    }
384}
385
386#[cfg(feature = "v4_22")]
387#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
388impl ToValue for ColorChannel {
389    #[inline]
390    fn to_value(&self) -> glib::Value {
391        let mut value = glib::Value::for_value_type::<Self>();
392        unsafe {
393            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
394        }
395        value
396    }
397
398    #[inline]
399    fn value_type(&self) -> glib::Type {
400        Self::static_type()
401    }
402}
403
404#[cfg(feature = "v4_22")]
405#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
406impl From<ColorChannel> for glib::Value {
407    #[inline]
408    fn from(v: ColorChannel) -> Self {
409        skip_assert_initialized!();
410        ToValue::to_value(&v)
411    }
412}
413
414/// Specifies the crossing mode for enter and leave events.
415#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
416#[non_exhaustive]
417#[doc(alias = "GdkCrossingMode")]
418pub enum CrossingMode {
419    /// crossing because of pointer motion.
420    #[doc(alias = "GDK_CROSSING_NORMAL")]
421    Normal,
422    /// crossing because a grab is activated.
423    #[doc(alias = "GDK_CROSSING_GRAB")]
424    Grab,
425    /// crossing because a grab is deactivated.
426    #[doc(alias = "GDK_CROSSING_UNGRAB")]
427    Ungrab,
428    /// crossing because a GTK grab is activated.
429    #[doc(alias = "GDK_CROSSING_GTK_GRAB")]
430    GtkGrab,
431    /// crossing because a GTK grab is deactivated.
432    #[doc(alias = "GDK_CROSSING_GTK_UNGRAB")]
433    GtkUngrab,
434    /// crossing because a GTK widget changed
435    ///   state (e.g. sensitivity).
436    #[doc(alias = "GDK_CROSSING_STATE_CHANGED")]
437    StateChanged,
438    /// crossing because a touch sequence has begun,
439    ///   this event is synthetic as the pointer might have not left the surface.
440    #[doc(alias = "GDK_CROSSING_TOUCH_BEGIN")]
441    TouchBegin,
442    /// crossing because a touch sequence has ended,
443    ///   this event is synthetic as the pointer might have not left the surface.
444    #[doc(alias = "GDK_CROSSING_TOUCH_END")]
445    TouchEnd,
446    /// crossing because of a device switch (i.e.
447    ///   a mouse taking control of the pointer after a touch device), this event
448    ///   is synthetic as the pointer didn’t leave the surface.
449    #[doc(alias = "GDK_CROSSING_DEVICE_SWITCH")]
450    DeviceSwitch,
451    #[doc(hidden)]
452    __Unknown(i32),
453}
454
455#[doc(hidden)]
456impl IntoGlib for CrossingMode {
457    type GlibType = ffi::GdkCrossingMode;
458
459    #[inline]
460    fn into_glib(self) -> ffi::GdkCrossingMode {
461        match self {
462            Self::Normal => ffi::GDK_CROSSING_NORMAL,
463            Self::Grab => ffi::GDK_CROSSING_GRAB,
464            Self::Ungrab => ffi::GDK_CROSSING_UNGRAB,
465            Self::GtkGrab => ffi::GDK_CROSSING_GTK_GRAB,
466            Self::GtkUngrab => ffi::GDK_CROSSING_GTK_UNGRAB,
467            Self::StateChanged => ffi::GDK_CROSSING_STATE_CHANGED,
468            Self::TouchBegin => ffi::GDK_CROSSING_TOUCH_BEGIN,
469            Self::TouchEnd => ffi::GDK_CROSSING_TOUCH_END,
470            Self::DeviceSwitch => ffi::GDK_CROSSING_DEVICE_SWITCH,
471            Self::__Unknown(value) => value,
472        }
473    }
474}
475
476#[doc(hidden)]
477impl FromGlib<ffi::GdkCrossingMode> for CrossingMode {
478    #[inline]
479    unsafe fn from_glib(value: ffi::GdkCrossingMode) -> Self {
480        skip_assert_initialized!();
481
482        match value {
483            ffi::GDK_CROSSING_NORMAL => Self::Normal,
484            ffi::GDK_CROSSING_GRAB => Self::Grab,
485            ffi::GDK_CROSSING_UNGRAB => Self::Ungrab,
486            ffi::GDK_CROSSING_GTK_GRAB => Self::GtkGrab,
487            ffi::GDK_CROSSING_GTK_UNGRAB => Self::GtkUngrab,
488            ffi::GDK_CROSSING_STATE_CHANGED => Self::StateChanged,
489            ffi::GDK_CROSSING_TOUCH_BEGIN => Self::TouchBegin,
490            ffi::GDK_CROSSING_TOUCH_END => Self::TouchEnd,
491            ffi::GDK_CROSSING_DEVICE_SWITCH => Self::DeviceSwitch,
492            value => Self::__Unknown(value),
493        }
494    }
495}
496
497impl StaticType for CrossingMode {
498    #[inline]
499    #[doc(alias = "gdk_crossing_mode_get_type")]
500    fn static_type() -> glib::Type {
501        unsafe { from_glib(ffi::gdk_crossing_mode_get_type()) }
502    }
503}
504
505impl glib::HasParamSpec for CrossingMode {
506    type ParamSpec = glib::ParamSpecEnum;
507    type SetValue = Self;
508    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
509
510    fn param_spec_builder() -> Self::BuilderFn {
511        Self::ParamSpec::builder_with_default
512    }
513}
514
515impl glib::value::ValueType for CrossingMode {
516    type Type = Self;
517}
518
519unsafe impl<'a> glib::value::FromValue<'a> for CrossingMode {
520    type Checker = glib::value::GenericValueTypeChecker<Self>;
521
522    #[inline]
523    unsafe fn from_value(value: &'a glib::Value) -> Self {
524        skip_assert_initialized!();
525        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
526    }
527}
528
529impl ToValue for CrossingMode {
530    #[inline]
531    fn to_value(&self) -> glib::Value {
532        let mut value = glib::Value::for_value_type::<Self>();
533        unsafe {
534            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
535        }
536        value
537    }
538
539    #[inline]
540    fn value_type(&self) -> glib::Type {
541        Self::static_type()
542    }
543}
544
545impl From<CrossingMode> for glib::Value {
546    #[inline]
547    fn from(v: CrossingMode) -> Self {
548        skip_assert_initialized!();
549        ToValue::to_value(&v)
550    }
551}
552
553/// A pad feature.
554#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
555#[non_exhaustive]
556#[doc(alias = "GdkDevicePadFeature")]
557pub enum DevicePadFeature {
558    /// a button
559    #[doc(alias = "GDK_DEVICE_PAD_FEATURE_BUTTON")]
560    Button,
561    /// a ring-shaped interactive area
562    #[doc(alias = "GDK_DEVICE_PAD_FEATURE_RING")]
563    Ring,
564    /// a straight interactive area
565    #[doc(alias = "GDK_DEVICE_PAD_FEATURE_STRIP")]
566    Strip,
567    #[doc(hidden)]
568    __Unknown(i32),
569}
570
571#[doc(hidden)]
572impl IntoGlib for DevicePadFeature {
573    type GlibType = ffi::GdkDevicePadFeature;
574
575    #[inline]
576    fn into_glib(self) -> ffi::GdkDevicePadFeature {
577        match self {
578            Self::Button => ffi::GDK_DEVICE_PAD_FEATURE_BUTTON,
579            Self::Ring => ffi::GDK_DEVICE_PAD_FEATURE_RING,
580            Self::Strip => ffi::GDK_DEVICE_PAD_FEATURE_STRIP,
581            Self::__Unknown(value) => value,
582        }
583    }
584}
585
586#[doc(hidden)]
587impl FromGlib<ffi::GdkDevicePadFeature> for DevicePadFeature {
588    #[inline]
589    unsafe fn from_glib(value: ffi::GdkDevicePadFeature) -> Self {
590        skip_assert_initialized!();
591
592        match value {
593            ffi::GDK_DEVICE_PAD_FEATURE_BUTTON => Self::Button,
594            ffi::GDK_DEVICE_PAD_FEATURE_RING => Self::Ring,
595            ffi::GDK_DEVICE_PAD_FEATURE_STRIP => Self::Strip,
596            value => Self::__Unknown(value),
597        }
598    }
599}
600
601impl StaticType for DevicePadFeature {
602    #[inline]
603    #[doc(alias = "gdk_device_pad_feature_get_type")]
604    fn static_type() -> glib::Type {
605        unsafe { from_glib(ffi::gdk_device_pad_feature_get_type()) }
606    }
607}
608
609impl glib::HasParamSpec for DevicePadFeature {
610    type ParamSpec = glib::ParamSpecEnum;
611    type SetValue = Self;
612    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
613
614    fn param_spec_builder() -> Self::BuilderFn {
615        Self::ParamSpec::builder_with_default
616    }
617}
618
619impl glib::value::ValueType for DevicePadFeature {
620    type Type = Self;
621}
622
623unsafe impl<'a> glib::value::FromValue<'a> for DevicePadFeature {
624    type Checker = glib::value::GenericValueTypeChecker<Self>;
625
626    #[inline]
627    unsafe fn from_value(value: &'a glib::Value) -> Self {
628        skip_assert_initialized!();
629        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
630    }
631}
632
633impl ToValue for DevicePadFeature {
634    #[inline]
635    fn to_value(&self) -> glib::Value {
636        let mut value = glib::Value::for_value_type::<Self>();
637        unsafe {
638            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
639        }
640        value
641    }
642
643    #[inline]
644    fn value_type(&self) -> glib::Type {
645        Self::static_type()
646    }
647}
648
649impl From<DevicePadFeature> for glib::Value {
650    #[inline]
651    fn from(v: DevicePadFeature) -> Self {
652        skip_assert_initialized!();
653        ToValue::to_value(&v)
654    }
655}
656
657/// Indicates the specific type of tool being used being a tablet. Such as an
658/// airbrush, pencil, etc.
659#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
660#[non_exhaustive]
661#[doc(alias = "GdkDeviceToolType")]
662pub enum DeviceToolType {
663    /// Tool is of an unknown type.
664    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_UNKNOWN")]
665    Unknown,
666    /// Tool is a standard tablet stylus.
667    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_PEN")]
668    Pen,
669    /// Tool is standard tablet eraser.
670    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_ERASER")]
671    Eraser,
672    /// Tool is a brush stylus.
673    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_BRUSH")]
674    Brush,
675    /// Tool is a pencil stylus.
676    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_PENCIL")]
677    Pencil,
678    /// Tool is an airbrush stylus.
679    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_AIRBRUSH")]
680    Airbrush,
681    /// Tool is a mouse.
682    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_MOUSE")]
683    Mouse,
684    /// Tool is a lens cursor.
685    #[doc(alias = "GDK_DEVICE_TOOL_TYPE_LENS")]
686    Lens,
687    #[doc(hidden)]
688    __Unknown(i32),
689}
690
691#[doc(hidden)]
692impl IntoGlib for DeviceToolType {
693    type GlibType = ffi::GdkDeviceToolType;
694
695    #[inline]
696    fn into_glib(self) -> ffi::GdkDeviceToolType {
697        match self {
698            Self::Unknown => ffi::GDK_DEVICE_TOOL_TYPE_UNKNOWN,
699            Self::Pen => ffi::GDK_DEVICE_TOOL_TYPE_PEN,
700            Self::Eraser => ffi::GDK_DEVICE_TOOL_TYPE_ERASER,
701            Self::Brush => ffi::GDK_DEVICE_TOOL_TYPE_BRUSH,
702            Self::Pencil => ffi::GDK_DEVICE_TOOL_TYPE_PENCIL,
703            Self::Airbrush => ffi::GDK_DEVICE_TOOL_TYPE_AIRBRUSH,
704            Self::Mouse => ffi::GDK_DEVICE_TOOL_TYPE_MOUSE,
705            Self::Lens => ffi::GDK_DEVICE_TOOL_TYPE_LENS,
706            Self::__Unknown(value) => value,
707        }
708    }
709}
710
711#[doc(hidden)]
712impl FromGlib<ffi::GdkDeviceToolType> for DeviceToolType {
713    #[inline]
714    unsafe fn from_glib(value: ffi::GdkDeviceToolType) -> Self {
715        skip_assert_initialized!();
716
717        match value {
718            ffi::GDK_DEVICE_TOOL_TYPE_UNKNOWN => Self::Unknown,
719            ffi::GDK_DEVICE_TOOL_TYPE_PEN => Self::Pen,
720            ffi::GDK_DEVICE_TOOL_TYPE_ERASER => Self::Eraser,
721            ffi::GDK_DEVICE_TOOL_TYPE_BRUSH => Self::Brush,
722            ffi::GDK_DEVICE_TOOL_TYPE_PENCIL => Self::Pencil,
723            ffi::GDK_DEVICE_TOOL_TYPE_AIRBRUSH => Self::Airbrush,
724            ffi::GDK_DEVICE_TOOL_TYPE_MOUSE => Self::Mouse,
725            ffi::GDK_DEVICE_TOOL_TYPE_LENS => Self::Lens,
726            value => Self::__Unknown(value),
727        }
728    }
729}
730
731impl StaticType for DeviceToolType {
732    #[inline]
733    #[doc(alias = "gdk_device_tool_type_get_type")]
734    fn static_type() -> glib::Type {
735        unsafe { from_glib(ffi::gdk_device_tool_type_get_type()) }
736    }
737}
738
739impl glib::HasParamSpec for DeviceToolType {
740    type ParamSpec = glib::ParamSpecEnum;
741    type SetValue = Self;
742    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
743
744    fn param_spec_builder() -> Self::BuilderFn {
745        Self::ParamSpec::builder_with_default
746    }
747}
748
749impl glib::value::ValueType for DeviceToolType {
750    type Type = Self;
751}
752
753unsafe impl<'a> glib::value::FromValue<'a> for DeviceToolType {
754    type Checker = glib::value::GenericValueTypeChecker<Self>;
755
756    #[inline]
757    unsafe fn from_value(value: &'a glib::Value) -> Self {
758        skip_assert_initialized!();
759        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
760    }
761}
762
763impl ToValue for DeviceToolType {
764    #[inline]
765    fn to_value(&self) -> glib::Value {
766        let mut value = glib::Value::for_value_type::<Self>();
767        unsafe {
768            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
769        }
770        value
771    }
772
773    #[inline]
774    fn value_type(&self) -> glib::Type {
775        Self::static_type()
776    }
777}
778
779impl From<DeviceToolType> for glib::Value {
780    #[inline]
781    fn from(v: DeviceToolType) -> Self {
782        skip_assert_initialized!();
783        ToValue::to_value(&v)
784    }
785}
786
787/// Error enumeration for [`DmabufTexture`][crate::DmabufTexture].
788#[cfg(feature = "v4_14")]
789#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
790#[cfg(target_os = "linux")]
791#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
792#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
793#[non_exhaustive]
794#[doc(alias = "GdkDmabufError")]
795pub enum DmabufError {
796    /// Dmabuf support is not available, because the OS
797    ///   is not Linux, or it was explicitly disabled at compile- or runtime
798    #[doc(alias = "GDK_DMABUF_ERROR_NOT_AVAILABLE")]
799    NotAvailable,
800    /// The requested format is not supported
801    #[doc(alias = "GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT")]
802    UnsupportedFormat,
803    /// GTK failed to create the resource for other
804    ///   reasons
805    #[doc(alias = "GDK_DMABUF_ERROR_CREATION_FAILED")]
806    CreationFailed,
807    #[doc(hidden)]
808    __Unknown(i32),
809}
810
811#[cfg(feature = "v4_14")]
812#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
813#[cfg(target_os = "linux")]
814#[doc(hidden)]
815impl IntoGlib for DmabufError {
816    type GlibType = ffi::GdkDmabufError;
817
818    #[inline]
819    fn into_glib(self) -> ffi::GdkDmabufError {
820        match self {
821            Self::NotAvailable => ffi::GDK_DMABUF_ERROR_NOT_AVAILABLE,
822            Self::UnsupportedFormat => ffi::GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT,
823            Self::CreationFailed => ffi::GDK_DMABUF_ERROR_CREATION_FAILED,
824            Self::__Unknown(value) => value,
825        }
826    }
827}
828
829#[cfg(feature = "v4_14")]
830#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
831#[cfg(target_os = "linux")]
832#[doc(hidden)]
833impl FromGlib<ffi::GdkDmabufError> for DmabufError {
834    #[inline]
835    unsafe fn from_glib(value: ffi::GdkDmabufError) -> Self {
836        skip_assert_initialized!();
837
838        match value {
839            ffi::GDK_DMABUF_ERROR_NOT_AVAILABLE => Self::NotAvailable,
840            ffi::GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT => Self::UnsupportedFormat,
841            ffi::GDK_DMABUF_ERROR_CREATION_FAILED => Self::CreationFailed,
842            value => Self::__Unknown(value),
843        }
844    }
845}
846
847#[cfg(feature = "v4_14")]
848#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
849#[cfg(target_os = "linux")]
850impl glib::error::ErrorDomain for DmabufError {
851    #[inline]
852    fn domain() -> glib::Quark {
853        skip_assert_initialized!();
854
855        unsafe { from_glib(ffi::gdk_dmabuf_error_quark()) }
856    }
857
858    #[inline]
859    fn code(self) -> i32 {
860        self.into_glib()
861    }
862
863    #[inline]
864    #[allow(clippy::match_single_binding)]
865    fn from(code: i32) -> Option<Self> {
866        skip_assert_initialized!();
867        match unsafe { from_glib(code) } {
868            value => Some(value),
869        }
870    }
871}
872
873#[cfg(feature = "v4_14")]
874#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
875#[cfg(target_os = "linux")]
876impl StaticType for DmabufError {
877    #[inline]
878    #[doc(alias = "gdk_dmabuf_error_get_type")]
879    fn static_type() -> glib::Type {
880        unsafe { from_glib(ffi::gdk_dmabuf_error_get_type()) }
881    }
882}
883
884#[cfg(feature = "v4_14")]
885#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
886#[cfg(target_os = "linux")]
887impl glib::HasParamSpec for DmabufError {
888    type ParamSpec = glib::ParamSpecEnum;
889    type SetValue = Self;
890    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
891
892    fn param_spec_builder() -> Self::BuilderFn {
893        Self::ParamSpec::builder_with_default
894    }
895}
896
897#[cfg(feature = "v4_14")]
898#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
899#[cfg(target_os = "linux")]
900impl glib::value::ValueType for DmabufError {
901    type Type = Self;
902}
903
904#[cfg(feature = "v4_14")]
905#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
906#[cfg(target_os = "linux")]
907unsafe impl<'a> glib::value::FromValue<'a> for DmabufError {
908    type Checker = glib::value::GenericValueTypeChecker<Self>;
909
910    #[inline]
911    unsafe fn from_value(value: &'a glib::Value) -> Self {
912        skip_assert_initialized!();
913        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
914    }
915}
916
917#[cfg(feature = "v4_14")]
918#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
919#[cfg(target_os = "linux")]
920impl ToValue for DmabufError {
921    #[inline]
922    fn to_value(&self) -> glib::Value {
923        let mut value = glib::Value::for_value_type::<Self>();
924        unsafe {
925            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
926        }
927        value
928    }
929
930    #[inline]
931    fn value_type(&self) -> glib::Type {
932        Self::static_type()
933    }
934}
935
936#[cfg(feature = "v4_14")]
937#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
938#[cfg(target_os = "linux")]
939impl From<DmabufError> for glib::Value {
940    #[inline]
941    fn from(v: DmabufError) -> Self {
942        skip_assert_initialized!();
943        ToValue::to_value(&v)
944    }
945}
946
947/// Used in [`Drag`][crate::Drag] to the reason of a cancelled DND operation.
948#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
949#[non_exhaustive]
950#[doc(alias = "GdkDragCancelReason")]
951pub enum DragCancelReason {
952    /// There is no suitable drop target.
953    #[doc(alias = "GDK_DRAG_CANCEL_NO_TARGET")]
954    NoTarget,
955    /// Drag cancelled by the user
956    #[doc(alias = "GDK_DRAG_CANCEL_USER_CANCELLED")]
957    UserCancelled,
958    /// Unspecified error.
959    #[doc(alias = "GDK_DRAG_CANCEL_ERROR")]
960    Error,
961    #[doc(hidden)]
962    __Unknown(i32),
963}
964
965#[doc(hidden)]
966impl IntoGlib for DragCancelReason {
967    type GlibType = ffi::GdkDragCancelReason;
968
969    #[inline]
970    fn into_glib(self) -> ffi::GdkDragCancelReason {
971        match self {
972            Self::NoTarget => ffi::GDK_DRAG_CANCEL_NO_TARGET,
973            Self::UserCancelled => ffi::GDK_DRAG_CANCEL_USER_CANCELLED,
974            Self::Error => ffi::GDK_DRAG_CANCEL_ERROR,
975            Self::__Unknown(value) => value,
976        }
977    }
978}
979
980#[doc(hidden)]
981impl FromGlib<ffi::GdkDragCancelReason> for DragCancelReason {
982    #[inline]
983    unsafe fn from_glib(value: ffi::GdkDragCancelReason) -> Self {
984        skip_assert_initialized!();
985
986        match value {
987            ffi::GDK_DRAG_CANCEL_NO_TARGET => Self::NoTarget,
988            ffi::GDK_DRAG_CANCEL_USER_CANCELLED => Self::UserCancelled,
989            ffi::GDK_DRAG_CANCEL_ERROR => Self::Error,
990            value => Self::__Unknown(value),
991        }
992    }
993}
994
995impl StaticType for DragCancelReason {
996    #[inline]
997    #[doc(alias = "gdk_drag_cancel_reason_get_type")]
998    fn static_type() -> glib::Type {
999        unsafe { from_glib(ffi::gdk_drag_cancel_reason_get_type()) }
1000    }
1001}
1002
1003impl glib::HasParamSpec for DragCancelReason {
1004    type ParamSpec = glib::ParamSpecEnum;
1005    type SetValue = Self;
1006    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1007
1008    fn param_spec_builder() -> Self::BuilderFn {
1009        Self::ParamSpec::builder_with_default
1010    }
1011}
1012
1013impl glib::value::ValueType for DragCancelReason {
1014    type Type = Self;
1015}
1016
1017unsafe impl<'a> glib::value::FromValue<'a> for DragCancelReason {
1018    type Checker = glib::value::GenericValueTypeChecker<Self>;
1019
1020    #[inline]
1021    unsafe fn from_value(value: &'a glib::Value) -> Self {
1022        skip_assert_initialized!();
1023        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
1024    }
1025}
1026
1027impl ToValue for DragCancelReason {
1028    #[inline]
1029    fn to_value(&self) -> glib::Value {
1030        let mut value = glib::Value::for_value_type::<Self>();
1031        unsafe {
1032            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1033        }
1034        value
1035    }
1036
1037    #[inline]
1038    fn value_type(&self) -> glib::Type {
1039        Self::static_type()
1040    }
1041}
1042
1043impl From<DragCancelReason> for glib::Value {
1044    #[inline]
1045    fn from(v: DragCancelReason) -> Self {
1046        skip_assert_initialized!();
1047        ToValue::to_value(&v)
1048    }
1049}
1050
1051/// Specifies the type of the event.
1052#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1053#[non_exhaustive]
1054#[doc(alias = "GdkEventType")]
1055pub enum EventType {
1056    /// the window manager has requested that the toplevel surface be
1057    ///   hidden or destroyed, usually when the user clicks on a special icon in the
1058    ///   title bar.
1059    #[doc(alias = "GDK_DELETE")]
1060    Delete,
1061    /// the pointer (usually a mouse) has moved.
1062    #[doc(alias = "GDK_MOTION_NOTIFY")]
1063    MotionNotify,
1064    /// a mouse button has been pressed.
1065    #[doc(alias = "GDK_BUTTON_PRESS")]
1066    ButtonPress,
1067    /// a mouse button has been released.
1068    #[doc(alias = "GDK_BUTTON_RELEASE")]
1069    ButtonRelease,
1070    /// a key has been pressed.
1071    #[doc(alias = "GDK_KEY_PRESS")]
1072    KeyPress,
1073    /// a key has been released.
1074    #[doc(alias = "GDK_KEY_RELEASE")]
1075    KeyRelease,
1076    /// the pointer has entered the surface.
1077    #[doc(alias = "GDK_ENTER_NOTIFY")]
1078    EnterNotify,
1079    /// the pointer has left the surface.
1080    #[doc(alias = "GDK_LEAVE_NOTIFY")]
1081    LeaveNotify,
1082    /// the keyboard focus has entered or left the surface.
1083    #[doc(alias = "GDK_FOCUS_CHANGE")]
1084    FocusChange,
1085    /// an input device has moved into contact with a sensing
1086    ///   surface (e.g. a touchscreen or graphics tablet).
1087    #[doc(alias = "GDK_PROXIMITY_IN")]
1088    ProximityIn,
1089    /// an input device has moved out of contact with a sensing
1090    ///   surface.
1091    #[doc(alias = "GDK_PROXIMITY_OUT")]
1092    ProximityOut,
1093    /// the mouse has entered the surface while a drag is in progress.
1094    #[doc(alias = "GDK_DRAG_ENTER")]
1095    DragEnter,
1096    /// the mouse has left the surface while a drag is in progress.
1097    #[doc(alias = "GDK_DRAG_LEAVE")]
1098    DragLeave,
1099    /// the mouse has moved in the surface while a drag is in
1100    ///   progress.
1101    #[doc(alias = "GDK_DRAG_MOTION")]
1102    DragMotion,
1103    /// a drop operation onto the surface has started.
1104    #[doc(alias = "GDK_DROP_START")]
1105    DropStart,
1106    /// the scroll wheel was turned
1107    #[doc(alias = "GDK_SCROLL")]
1108    Scroll,
1109    /// a pointer or keyboard grab was broken.
1110    #[doc(alias = "GDK_GRAB_BROKEN")]
1111    GrabBroken,
1112    /// A new touch event sequence has just started.
1113    #[doc(alias = "GDK_TOUCH_BEGIN")]
1114    TouchBegin,
1115    /// A touch event sequence has been updated.
1116    #[doc(alias = "GDK_TOUCH_UPDATE")]
1117    TouchUpdate,
1118    /// A touch event sequence has finished.
1119    #[doc(alias = "GDK_TOUCH_END")]
1120    TouchEnd,
1121    /// A touch event sequence has been canceled.
1122    #[doc(alias = "GDK_TOUCH_CANCEL")]
1123    TouchCancel,
1124    /// A touchpad swipe gesture event, the current state
1125    ///   is determined by its phase field.
1126    #[doc(alias = "GDK_TOUCHPAD_SWIPE")]
1127    TouchpadSwipe,
1128    /// A touchpad pinch gesture event, the current state
1129    ///   is determined by its phase field.
1130    #[doc(alias = "GDK_TOUCHPAD_PINCH")]
1131    TouchpadPinch,
1132    /// A tablet pad button press event.
1133    #[doc(alias = "GDK_PAD_BUTTON_PRESS")]
1134    PadButtonPress,
1135    /// A tablet pad button release event.
1136    #[doc(alias = "GDK_PAD_BUTTON_RELEASE")]
1137    PadButtonRelease,
1138    /// A tablet pad axis event from a "ring".
1139    #[doc(alias = "GDK_PAD_RING")]
1140    PadRing,
1141    /// A tablet pad axis event from a "strip".
1142    #[doc(alias = "GDK_PAD_STRIP")]
1143    PadStrip,
1144    /// A tablet pad group mode change.
1145    #[doc(alias = "GDK_PAD_GROUP_MODE")]
1146    PadGroupMode,
1147    /// A touchpad hold gesture event, the current state is determined by its phase
1148    /// field.
1149    #[cfg(feature = "v4_8")]
1150    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1151    #[doc(alias = "GDK_TOUCHPAD_HOLD")]
1152    TouchpadHold,
1153    /// A tablet pad axis event from a "dial".
1154    #[cfg(feature = "v4_20")]
1155    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1156    #[doc(alias = "GDK_PAD_DIAL")]
1157    PadDial,
1158    #[doc(hidden)]
1159    __Unknown(i32),
1160}
1161
1162#[doc(hidden)]
1163impl IntoGlib for EventType {
1164    type GlibType = ffi::GdkEventType;
1165
1166    fn into_glib(self) -> ffi::GdkEventType {
1167        match self {
1168            Self::Delete => ffi::GDK_DELETE,
1169            Self::MotionNotify => ffi::GDK_MOTION_NOTIFY,
1170            Self::ButtonPress => ffi::GDK_BUTTON_PRESS,
1171            Self::ButtonRelease => ffi::GDK_BUTTON_RELEASE,
1172            Self::KeyPress => ffi::GDK_KEY_PRESS,
1173            Self::KeyRelease => ffi::GDK_KEY_RELEASE,
1174            Self::EnterNotify => ffi::GDK_ENTER_NOTIFY,
1175            Self::LeaveNotify => ffi::GDK_LEAVE_NOTIFY,
1176            Self::FocusChange => ffi::GDK_FOCUS_CHANGE,
1177            Self::ProximityIn => ffi::GDK_PROXIMITY_IN,
1178            Self::ProximityOut => ffi::GDK_PROXIMITY_OUT,
1179            Self::DragEnter => ffi::GDK_DRAG_ENTER,
1180            Self::DragLeave => ffi::GDK_DRAG_LEAVE,
1181            Self::DragMotion => ffi::GDK_DRAG_MOTION,
1182            Self::DropStart => ffi::GDK_DROP_START,
1183            Self::Scroll => ffi::GDK_SCROLL,
1184            Self::GrabBroken => ffi::GDK_GRAB_BROKEN,
1185            Self::TouchBegin => ffi::GDK_TOUCH_BEGIN,
1186            Self::TouchUpdate => ffi::GDK_TOUCH_UPDATE,
1187            Self::TouchEnd => ffi::GDK_TOUCH_END,
1188            Self::TouchCancel => ffi::GDK_TOUCH_CANCEL,
1189            Self::TouchpadSwipe => ffi::GDK_TOUCHPAD_SWIPE,
1190            Self::TouchpadPinch => ffi::GDK_TOUCHPAD_PINCH,
1191            Self::PadButtonPress => ffi::GDK_PAD_BUTTON_PRESS,
1192            Self::PadButtonRelease => ffi::GDK_PAD_BUTTON_RELEASE,
1193            Self::PadRing => ffi::GDK_PAD_RING,
1194            Self::PadStrip => ffi::GDK_PAD_STRIP,
1195            Self::PadGroupMode => ffi::GDK_PAD_GROUP_MODE,
1196            #[cfg(feature = "v4_8")]
1197            Self::TouchpadHold => ffi::GDK_TOUCHPAD_HOLD,
1198            #[cfg(feature = "v4_20")]
1199            Self::PadDial => ffi::GDK_PAD_DIAL,
1200            Self::__Unknown(value) => value,
1201        }
1202    }
1203}
1204
1205#[doc(hidden)]
1206impl FromGlib<ffi::GdkEventType> for EventType {
1207    unsafe fn from_glib(value: ffi::GdkEventType) -> Self {
1208        skip_assert_initialized!();
1209
1210        match value {
1211            ffi::GDK_DELETE => Self::Delete,
1212            ffi::GDK_MOTION_NOTIFY => Self::MotionNotify,
1213            ffi::GDK_BUTTON_PRESS => Self::ButtonPress,
1214            ffi::GDK_BUTTON_RELEASE => Self::ButtonRelease,
1215            ffi::GDK_KEY_PRESS => Self::KeyPress,
1216            ffi::GDK_KEY_RELEASE => Self::KeyRelease,
1217            ffi::GDK_ENTER_NOTIFY => Self::EnterNotify,
1218            ffi::GDK_LEAVE_NOTIFY => Self::LeaveNotify,
1219            ffi::GDK_FOCUS_CHANGE => Self::FocusChange,
1220            ffi::GDK_PROXIMITY_IN => Self::ProximityIn,
1221            ffi::GDK_PROXIMITY_OUT => Self::ProximityOut,
1222            ffi::GDK_DRAG_ENTER => Self::DragEnter,
1223            ffi::GDK_DRAG_LEAVE => Self::DragLeave,
1224            ffi::GDK_DRAG_MOTION => Self::DragMotion,
1225            ffi::GDK_DROP_START => Self::DropStart,
1226            ffi::GDK_SCROLL => Self::Scroll,
1227            ffi::GDK_GRAB_BROKEN => Self::GrabBroken,
1228            ffi::GDK_TOUCH_BEGIN => Self::TouchBegin,
1229            ffi::GDK_TOUCH_UPDATE => Self::TouchUpdate,
1230            ffi::GDK_TOUCH_END => Self::TouchEnd,
1231            ffi::GDK_TOUCH_CANCEL => Self::TouchCancel,
1232            ffi::GDK_TOUCHPAD_SWIPE => Self::TouchpadSwipe,
1233            ffi::GDK_TOUCHPAD_PINCH => Self::TouchpadPinch,
1234            ffi::GDK_PAD_BUTTON_PRESS => Self::PadButtonPress,
1235            ffi::GDK_PAD_BUTTON_RELEASE => Self::PadButtonRelease,
1236            ffi::GDK_PAD_RING => Self::PadRing,
1237            ffi::GDK_PAD_STRIP => Self::PadStrip,
1238            ffi::GDK_PAD_GROUP_MODE => Self::PadGroupMode,
1239            #[cfg(feature = "v4_8")]
1240            ffi::GDK_TOUCHPAD_HOLD => Self::TouchpadHold,
1241            #[cfg(feature = "v4_20")]
1242            ffi::GDK_PAD_DIAL => Self::PadDial,
1243            value => Self::__Unknown(value),
1244        }
1245    }
1246}
1247
1248impl StaticType for EventType {
1249    #[inline]
1250    #[doc(alias = "gdk_event_type_get_type")]
1251    fn static_type() -> glib::Type {
1252        unsafe { from_glib(ffi::gdk_event_type_get_type()) }
1253    }
1254}
1255
1256impl glib::HasParamSpec for EventType {
1257    type ParamSpec = glib::ParamSpecEnum;
1258    type SetValue = Self;
1259    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1260
1261    fn param_spec_builder() -> Self::BuilderFn {
1262        Self::ParamSpec::builder_with_default
1263    }
1264}
1265
1266impl glib::value::ValueType for EventType {
1267    type Type = Self;
1268}
1269
1270unsafe impl<'a> glib::value::FromValue<'a> for EventType {
1271    type Checker = glib::value::GenericValueTypeChecker<Self>;
1272
1273    #[inline]
1274    unsafe fn from_value(value: &'a glib::Value) -> Self {
1275        skip_assert_initialized!();
1276        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
1277    }
1278}
1279
1280impl ToValue for EventType {
1281    #[inline]
1282    fn to_value(&self) -> glib::Value {
1283        let mut value = glib::Value::for_value_type::<Self>();
1284        unsafe {
1285            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1286        }
1287        value
1288    }
1289
1290    #[inline]
1291    fn value_type(&self) -> glib::Type {
1292        Self::static_type()
1293    }
1294}
1295
1296impl From<EventType> for glib::Value {
1297    #[inline]
1298    fn from(v: EventType) -> Self {
1299        skip_assert_initialized!();
1300        ToValue::to_value(&v)
1301    }
1302}
1303
1304/// An enumeration describing the process of rendering a frame.
1305/// Rendering a frame starts with the frame clock cycle and then follows
1306/// the rendered frame (if there was one) through the display server
1307/// until it appears on screen.
1308///
1309/// It is relevant in particular for [`FrameTimings`][crate::FrameTimings] which
1310/// may still be waiting for values to be filled in.
1311#[cfg(feature = "v4_24")]
1312#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1313#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1314#[non_exhaustive]
1315#[doc(alias = "GdkFrameResult")]
1316pub enum FrameResult {
1317    /// The frame is currently being prepared and rendered by GTK.
1318    /// This is the initial state.
1319    #[cfg(feature = "v4_24")]
1320    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1321    #[doc(alias = "GDK_FRAME_PREPARING")]
1322    Preparing,
1323    /// GTK has determined that nothing needs to be rendered because
1324    /// there are no visual changes. No rendering will be submitted to
1325    /// the display server and because of that no information will
1326    /// be forthcoming from the display server.
1327    ///
1328    /// The frame is complete.
1329    #[cfg(feature = "v4_24")]
1330    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1331    #[doc(alias = "GDK_FRAME_SKIPPED")]
1332    Skipped,
1333    /// GTK has determined that nothing needs to be rendered because
1334    /// there are no visual changes. This information has been submitted
1335    /// to the display server. The presentation time has been updated to
1336    /// reflect when this frame would have been displayed.
1337    ///
1338    /// The frame is complete.
1339    #[cfg(feature = "v4_24")]
1340    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1341    #[doc(alias = "GDK_FRAME_EMPTY")]
1342    Empty,
1343    /// A frame has been drawn and submitted to the display server, but
1344    /// the display server will not provide any further feedback about when
1345    /// or how the frame is going to be displayed.
1346    ///
1347    /// The frame is complete.
1348    #[cfg(feature = "v4_24")]
1349    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1350    #[doc(alias = "GDK_FRAME_SUBMITTED")]
1351    Submitted,
1352    /// The frame has been drawn and submitted to the display server, but the
1353    /// display server has not yet replied what is going to happen with the
1354    /// rendered image.
1355    #[cfg(feature = "v4_24")]
1356    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1357    #[doc(alias = "GDK_FRAME_OUTSTANDING")]
1358    Outstanding,
1359    /// The frame has been drawn and submitted to the display server, but the
1360    /// display server has not displayed it. No presentation time will be available.
1361    ///
1362    /// The frame is complete.
1363    #[cfg(feature = "v4_24")]
1364    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1365    #[doc(alias = "GDK_FRAME_DISCARDED")]
1366    Discarded,
1367    /// The frame has been drawn and submitted to the display server, and the
1368    /// display server has rendered it and displayed the result. The presentation
1369    /// time is accurately reflecting when that happened.
1370    ///
1371    /// The frame is complete.
1372    #[cfg(feature = "v4_24")]
1373    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1374    #[doc(alias = "GDK_FRAME_PRESENTED")]
1375    Presented,
1376    #[doc(hidden)]
1377    __Unknown(i32),
1378}
1379
1380#[cfg(feature = "v4_24")]
1381#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1382#[doc(hidden)]
1383impl IntoGlib for FrameResult {
1384    type GlibType = ffi::GdkFrameResult;
1385
1386    #[inline]
1387    fn into_glib(self) -> ffi::GdkFrameResult {
1388        match self {
1389            #[cfg(feature = "v4_24")]
1390            Self::Preparing => ffi::GDK_FRAME_PREPARING,
1391            #[cfg(feature = "v4_24")]
1392            Self::Skipped => ffi::GDK_FRAME_SKIPPED,
1393            #[cfg(feature = "v4_24")]
1394            Self::Empty => ffi::GDK_FRAME_EMPTY,
1395            #[cfg(feature = "v4_24")]
1396            Self::Submitted => ffi::GDK_FRAME_SUBMITTED,
1397            #[cfg(feature = "v4_24")]
1398            Self::Outstanding => ffi::GDK_FRAME_OUTSTANDING,
1399            #[cfg(feature = "v4_24")]
1400            Self::Discarded => ffi::GDK_FRAME_DISCARDED,
1401            #[cfg(feature = "v4_24")]
1402            Self::Presented => ffi::GDK_FRAME_PRESENTED,
1403            Self::__Unknown(value) => value,
1404        }
1405    }
1406}
1407
1408#[cfg(feature = "v4_24")]
1409#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1410#[doc(hidden)]
1411impl FromGlib<ffi::GdkFrameResult> for FrameResult {
1412    #[inline]
1413    unsafe fn from_glib(value: ffi::GdkFrameResult) -> Self {
1414        skip_assert_initialized!();
1415
1416        match value {
1417            #[cfg(feature = "v4_24")]
1418            ffi::GDK_FRAME_PREPARING => Self::Preparing,
1419            #[cfg(feature = "v4_24")]
1420            ffi::GDK_FRAME_SKIPPED => Self::Skipped,
1421            #[cfg(feature = "v4_24")]
1422            ffi::GDK_FRAME_EMPTY => Self::Empty,
1423            #[cfg(feature = "v4_24")]
1424            ffi::GDK_FRAME_SUBMITTED => Self::Submitted,
1425            #[cfg(feature = "v4_24")]
1426            ffi::GDK_FRAME_OUTSTANDING => Self::Outstanding,
1427            #[cfg(feature = "v4_24")]
1428            ffi::GDK_FRAME_DISCARDED => Self::Discarded,
1429            #[cfg(feature = "v4_24")]
1430            ffi::GDK_FRAME_PRESENTED => Self::Presented,
1431            value => Self::__Unknown(value),
1432        }
1433    }
1434}
1435
1436#[cfg(feature = "v4_24")]
1437#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1438impl StaticType for FrameResult {
1439    #[inline]
1440    #[doc(alias = "gdk_frame_result_get_type")]
1441    fn static_type() -> glib::Type {
1442        unsafe { from_glib(ffi::gdk_frame_result_get_type()) }
1443    }
1444}
1445
1446#[cfg(feature = "v4_24")]
1447#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1448impl glib::HasParamSpec for FrameResult {
1449    type ParamSpec = glib::ParamSpecEnum;
1450    type SetValue = Self;
1451    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1452
1453    fn param_spec_builder() -> Self::BuilderFn {
1454        Self::ParamSpec::builder_with_default
1455    }
1456}
1457
1458#[cfg(feature = "v4_24")]
1459#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1460impl glib::value::ValueType for FrameResult {
1461    type Type = Self;
1462}
1463
1464#[cfg(feature = "v4_24")]
1465#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1466unsafe impl<'a> glib::value::FromValue<'a> for FrameResult {
1467    type Checker = glib::value::GenericValueTypeChecker<Self>;
1468
1469    #[inline]
1470    unsafe fn from_value(value: &'a glib::Value) -> Self {
1471        skip_assert_initialized!();
1472        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
1473    }
1474}
1475
1476#[cfg(feature = "v4_24")]
1477#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1478impl ToValue for FrameResult {
1479    #[inline]
1480    fn to_value(&self) -> glib::Value {
1481        let mut value = glib::Value::for_value_type::<Self>();
1482        unsafe {
1483            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1484        }
1485        value
1486    }
1487
1488    #[inline]
1489    fn value_type(&self) -> glib::Type {
1490        Self::static_type()
1491    }
1492}
1493
1494#[cfg(feature = "v4_24")]
1495#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1496impl From<FrameResult> for glib::Value {
1497    #[inline]
1498    fn from(v: FrameResult) -> Self {
1499        skip_assert_initialized!();
1500        ToValue::to_value(&v)
1501    }
1502}
1503
1504/// Indicates which monitor a surface should span over when in fullscreen mode.
1505#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1506#[non_exhaustive]
1507#[doc(alias = "GdkFullscreenMode")]
1508pub enum FullscreenMode {
1509    /// Fullscreen on current monitor only.
1510    #[doc(alias = "GDK_FULLSCREEN_ON_CURRENT_MONITOR")]
1511    CurrentMonitor,
1512    /// Span across all monitors when fullscreen.
1513    #[doc(alias = "GDK_FULLSCREEN_ON_ALL_MONITORS")]
1514    AllMonitors,
1515    #[doc(hidden)]
1516    __Unknown(i32),
1517}
1518
1519#[doc(hidden)]
1520impl IntoGlib for FullscreenMode {
1521    type GlibType = ffi::GdkFullscreenMode;
1522
1523    #[inline]
1524    fn into_glib(self) -> ffi::GdkFullscreenMode {
1525        match self {
1526            Self::CurrentMonitor => ffi::GDK_FULLSCREEN_ON_CURRENT_MONITOR,
1527            Self::AllMonitors => ffi::GDK_FULLSCREEN_ON_ALL_MONITORS,
1528            Self::__Unknown(value) => value,
1529        }
1530    }
1531}
1532
1533#[doc(hidden)]
1534impl FromGlib<ffi::GdkFullscreenMode> for FullscreenMode {
1535    #[inline]
1536    unsafe fn from_glib(value: ffi::GdkFullscreenMode) -> Self {
1537        skip_assert_initialized!();
1538
1539        match value {
1540            ffi::GDK_FULLSCREEN_ON_CURRENT_MONITOR => Self::CurrentMonitor,
1541            ffi::GDK_FULLSCREEN_ON_ALL_MONITORS => Self::AllMonitors,
1542            value => Self::__Unknown(value),
1543        }
1544    }
1545}
1546
1547impl StaticType for FullscreenMode {
1548    #[inline]
1549    #[doc(alias = "gdk_fullscreen_mode_get_type")]
1550    fn static_type() -> glib::Type {
1551        unsafe { from_glib(ffi::gdk_fullscreen_mode_get_type()) }
1552    }
1553}
1554
1555impl glib::HasParamSpec for FullscreenMode {
1556    type ParamSpec = glib::ParamSpecEnum;
1557    type SetValue = Self;
1558    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1559
1560    fn param_spec_builder() -> Self::BuilderFn {
1561        Self::ParamSpec::builder_with_default
1562    }
1563}
1564
1565impl glib::value::ValueType for FullscreenMode {
1566    type Type = Self;
1567}
1568
1569unsafe impl<'a> glib::value::FromValue<'a> for FullscreenMode {
1570    type Checker = glib::value::GenericValueTypeChecker<Self>;
1571
1572    #[inline]
1573    unsafe fn from_value(value: &'a glib::Value) -> Self {
1574        skip_assert_initialized!();
1575        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
1576    }
1577}
1578
1579impl ToValue for FullscreenMode {
1580    #[inline]
1581    fn to_value(&self) -> glib::Value {
1582        let mut value = glib::Value::for_value_type::<Self>();
1583        unsafe {
1584            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1585        }
1586        value
1587    }
1588
1589    #[inline]
1590    fn value_type(&self) -> glib::Type {
1591        Self::static_type()
1592    }
1593}
1594
1595impl From<FullscreenMode> for glib::Value {
1596    #[inline]
1597    fn from(v: FullscreenMode) -> Self {
1598        skip_assert_initialized!();
1599        ToValue::to_value(&v)
1600    }
1601}
1602
1603/// Error enumeration for [`GLContext`][crate::GLContext].
1604#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1605#[non_exhaustive]
1606#[doc(alias = "GdkGLError")]
1607pub enum GLError {
1608    /// OpenGL support is not available
1609    #[doc(alias = "GDK_GL_ERROR_NOT_AVAILABLE")]
1610    NotAvailable,
1611    /// The requested visual format is not supported
1612    #[doc(alias = "GDK_GL_ERROR_UNSUPPORTED_FORMAT")]
1613    UnsupportedFormat,
1614    /// The requested profile is not supported
1615    #[doc(alias = "GDK_GL_ERROR_UNSUPPORTED_PROFILE")]
1616    UnsupportedProfile,
1617    /// The shader compilation failed
1618    #[doc(alias = "GDK_GL_ERROR_COMPILATION_FAILED")]
1619    CompilationFailed,
1620    /// The shader linking failed
1621    #[doc(alias = "GDK_GL_ERROR_LINK_FAILED")]
1622    LinkFailed,
1623    #[doc(hidden)]
1624    __Unknown(i32),
1625}
1626
1627#[doc(hidden)]
1628impl IntoGlib for GLError {
1629    type GlibType = ffi::GdkGLError;
1630
1631    #[inline]
1632    fn into_glib(self) -> ffi::GdkGLError {
1633        match self {
1634            Self::NotAvailable => ffi::GDK_GL_ERROR_NOT_AVAILABLE,
1635            Self::UnsupportedFormat => ffi::GDK_GL_ERROR_UNSUPPORTED_FORMAT,
1636            Self::UnsupportedProfile => ffi::GDK_GL_ERROR_UNSUPPORTED_PROFILE,
1637            Self::CompilationFailed => ffi::GDK_GL_ERROR_COMPILATION_FAILED,
1638            Self::LinkFailed => ffi::GDK_GL_ERROR_LINK_FAILED,
1639            Self::__Unknown(value) => value,
1640        }
1641    }
1642}
1643
1644#[doc(hidden)]
1645impl FromGlib<ffi::GdkGLError> for GLError {
1646    #[inline]
1647    unsafe fn from_glib(value: ffi::GdkGLError) -> Self {
1648        skip_assert_initialized!();
1649
1650        match value {
1651            ffi::GDK_GL_ERROR_NOT_AVAILABLE => Self::NotAvailable,
1652            ffi::GDK_GL_ERROR_UNSUPPORTED_FORMAT => Self::UnsupportedFormat,
1653            ffi::GDK_GL_ERROR_UNSUPPORTED_PROFILE => Self::UnsupportedProfile,
1654            ffi::GDK_GL_ERROR_COMPILATION_FAILED => Self::CompilationFailed,
1655            ffi::GDK_GL_ERROR_LINK_FAILED => Self::LinkFailed,
1656            value => Self::__Unknown(value),
1657        }
1658    }
1659}
1660
1661impl glib::error::ErrorDomain for GLError {
1662    #[inline]
1663    fn domain() -> glib::Quark {
1664        skip_assert_initialized!();
1665
1666        unsafe { from_glib(ffi::gdk_gl_error_quark()) }
1667    }
1668
1669    #[inline]
1670    fn code(self) -> i32 {
1671        self.into_glib()
1672    }
1673
1674    #[inline]
1675    #[allow(clippy::match_single_binding)]
1676    fn from(code: i32) -> Option<Self> {
1677        skip_assert_initialized!();
1678        match unsafe { from_glib(code) } {
1679            value => Some(value),
1680        }
1681    }
1682}
1683
1684impl StaticType for GLError {
1685    #[inline]
1686    #[doc(alias = "gdk_gl_error_get_type")]
1687    fn static_type() -> glib::Type {
1688        unsafe { from_glib(ffi::gdk_gl_error_get_type()) }
1689    }
1690}
1691
1692impl glib::HasParamSpec for GLError {
1693    type ParamSpec = glib::ParamSpecEnum;
1694    type SetValue = Self;
1695    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1696
1697    fn param_spec_builder() -> Self::BuilderFn {
1698        Self::ParamSpec::builder_with_default
1699    }
1700}
1701
1702impl glib::value::ValueType for GLError {
1703    type Type = Self;
1704}
1705
1706unsafe impl<'a> glib::value::FromValue<'a> for GLError {
1707    type Checker = glib::value::GenericValueTypeChecker<Self>;
1708
1709    #[inline]
1710    unsafe fn from_value(value: &'a glib::Value) -> Self {
1711        skip_assert_initialized!();
1712        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
1713    }
1714}
1715
1716impl ToValue for GLError {
1717    #[inline]
1718    fn to_value(&self) -> glib::Value {
1719        let mut value = glib::Value::for_value_type::<Self>();
1720        unsafe {
1721            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1722        }
1723        value
1724    }
1725
1726    #[inline]
1727    fn value_type(&self) -> glib::Type {
1728        Self::static_type()
1729    }
1730}
1731
1732impl From<GLError> for glib::Value {
1733    #[inline]
1734    fn from(v: GLError) -> Self {
1735        skip_assert_initialized!();
1736        ToValue::to_value(&v)
1737    }
1738}
1739
1740/// Defines the reference point of a surface and is used in [`PopupLayout`][crate::PopupLayout].
1741#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1742#[non_exhaustive]
1743#[doc(alias = "GdkGravity")]
1744pub enum Gravity {
1745    /// the reference point is at the top left corner.
1746    #[doc(alias = "GDK_GRAVITY_NORTH_WEST")]
1747    NorthWest,
1748    /// the reference point is in the middle of the top edge.
1749    #[doc(alias = "GDK_GRAVITY_NORTH")]
1750    North,
1751    /// the reference point is at the top right corner.
1752    #[doc(alias = "GDK_GRAVITY_NORTH_EAST")]
1753    NorthEast,
1754    /// the reference point is at the middle of the left edge.
1755    #[doc(alias = "GDK_GRAVITY_WEST")]
1756    West,
1757    /// the reference point is at the center of the surface.
1758    #[doc(alias = "GDK_GRAVITY_CENTER")]
1759    Center,
1760    /// the reference point is at the middle of the right edge.
1761    #[doc(alias = "GDK_GRAVITY_EAST")]
1762    East,
1763    /// the reference point is at the lower left corner.
1764    #[doc(alias = "GDK_GRAVITY_SOUTH_WEST")]
1765    SouthWest,
1766    /// the reference point is at the middle of the lower edge.
1767    #[doc(alias = "GDK_GRAVITY_SOUTH")]
1768    South,
1769    /// the reference point is at the lower right corner.
1770    #[doc(alias = "GDK_GRAVITY_SOUTH_EAST")]
1771    SouthEast,
1772    /// the reference point is at the top left corner of the
1773    ///  surface itself, ignoring window manager decorations.
1774    #[doc(alias = "GDK_GRAVITY_STATIC")]
1775    Static,
1776    #[doc(hidden)]
1777    __Unknown(i32),
1778}
1779
1780#[doc(hidden)]
1781impl IntoGlib for Gravity {
1782    type GlibType = ffi::GdkGravity;
1783
1784    #[inline]
1785    fn into_glib(self) -> ffi::GdkGravity {
1786        match self {
1787            Self::NorthWest => ffi::GDK_GRAVITY_NORTH_WEST,
1788            Self::North => ffi::GDK_GRAVITY_NORTH,
1789            Self::NorthEast => ffi::GDK_GRAVITY_NORTH_EAST,
1790            Self::West => ffi::GDK_GRAVITY_WEST,
1791            Self::Center => ffi::GDK_GRAVITY_CENTER,
1792            Self::East => ffi::GDK_GRAVITY_EAST,
1793            Self::SouthWest => ffi::GDK_GRAVITY_SOUTH_WEST,
1794            Self::South => ffi::GDK_GRAVITY_SOUTH,
1795            Self::SouthEast => ffi::GDK_GRAVITY_SOUTH_EAST,
1796            Self::Static => ffi::GDK_GRAVITY_STATIC,
1797            Self::__Unknown(value) => value,
1798        }
1799    }
1800}
1801
1802#[doc(hidden)]
1803impl FromGlib<ffi::GdkGravity> for Gravity {
1804    #[inline]
1805    unsafe fn from_glib(value: ffi::GdkGravity) -> Self {
1806        skip_assert_initialized!();
1807
1808        match value {
1809            ffi::GDK_GRAVITY_NORTH_WEST => Self::NorthWest,
1810            ffi::GDK_GRAVITY_NORTH => Self::North,
1811            ffi::GDK_GRAVITY_NORTH_EAST => Self::NorthEast,
1812            ffi::GDK_GRAVITY_WEST => Self::West,
1813            ffi::GDK_GRAVITY_CENTER => Self::Center,
1814            ffi::GDK_GRAVITY_EAST => Self::East,
1815            ffi::GDK_GRAVITY_SOUTH_WEST => Self::SouthWest,
1816            ffi::GDK_GRAVITY_SOUTH => Self::South,
1817            ffi::GDK_GRAVITY_SOUTH_EAST => Self::SouthEast,
1818            ffi::GDK_GRAVITY_STATIC => Self::Static,
1819            value => Self::__Unknown(value),
1820        }
1821    }
1822}
1823
1824impl StaticType for Gravity {
1825    #[inline]
1826    #[doc(alias = "gdk_gravity_get_type")]
1827    fn static_type() -> glib::Type {
1828        unsafe { from_glib(ffi::gdk_gravity_get_type()) }
1829    }
1830}
1831
1832impl glib::HasParamSpec for Gravity {
1833    type ParamSpec = glib::ParamSpecEnum;
1834    type SetValue = Self;
1835    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1836
1837    fn param_spec_builder() -> Self::BuilderFn {
1838        Self::ParamSpec::builder_with_default
1839    }
1840}
1841
1842impl glib::value::ValueType for Gravity {
1843    type Type = Self;
1844}
1845
1846unsafe impl<'a> glib::value::FromValue<'a> for Gravity {
1847    type Checker = glib::value::GenericValueTypeChecker<Self>;
1848
1849    #[inline]
1850    unsafe fn from_value(value: &'a glib::Value) -> Self {
1851        skip_assert_initialized!();
1852        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
1853    }
1854}
1855
1856impl ToValue for Gravity {
1857    #[inline]
1858    fn to_value(&self) -> glib::Value {
1859        let mut value = glib::Value::for_value_type::<Self>();
1860        unsafe {
1861            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1862        }
1863        value
1864    }
1865
1866    #[inline]
1867    fn value_type(&self) -> glib::Type {
1868        Self::static_type()
1869    }
1870}
1871
1872impl From<Gravity> for glib::Value {
1873    #[inline]
1874    fn from(v: Gravity) -> Self {
1875        skip_assert_initialized!();
1876        ToValue::to_value(&v)
1877    }
1878}
1879
1880/// An enumeration describing the type of an input device in general terms.
1881#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1882#[non_exhaustive]
1883#[doc(alias = "GdkInputSource")]
1884pub enum InputSource {
1885    /// the device is a mouse. (This will be reported for the core
1886    ///   pointer, even if it is something else, such as a trackball.)
1887    #[doc(alias = "GDK_SOURCE_MOUSE")]
1888    Mouse,
1889    /// the device is a stylus of a graphics tablet or similar device.
1890    #[doc(alias = "GDK_SOURCE_PEN")]
1891    Pen,
1892    /// the device is a keyboard.
1893    #[doc(alias = "GDK_SOURCE_KEYBOARD")]
1894    Keyboard,
1895    /// the device is a direct-input touch device, such
1896    ///   as a touchscreen or tablet
1897    #[doc(alias = "GDK_SOURCE_TOUCHSCREEN")]
1898    Touchscreen,
1899    /// the device is an indirect touch device, such
1900    ///   as a touchpad
1901    #[doc(alias = "GDK_SOURCE_TOUCHPAD")]
1902    Touchpad,
1903    /// the device is a trackpoint
1904    #[doc(alias = "GDK_SOURCE_TRACKPOINT")]
1905    Trackpoint,
1906    /// the device is a "pad", a collection of buttons,
1907    ///   rings and strips found in drawing tablets
1908    #[doc(alias = "GDK_SOURCE_TABLET_PAD")]
1909    TabletPad,
1910    #[doc(hidden)]
1911    __Unknown(i32),
1912}
1913
1914#[doc(hidden)]
1915impl IntoGlib for InputSource {
1916    type GlibType = ffi::GdkInputSource;
1917
1918    #[inline]
1919    fn into_glib(self) -> ffi::GdkInputSource {
1920        match self {
1921            Self::Mouse => ffi::GDK_SOURCE_MOUSE,
1922            Self::Pen => ffi::GDK_SOURCE_PEN,
1923            Self::Keyboard => ffi::GDK_SOURCE_KEYBOARD,
1924            Self::Touchscreen => ffi::GDK_SOURCE_TOUCHSCREEN,
1925            Self::Touchpad => ffi::GDK_SOURCE_TOUCHPAD,
1926            Self::Trackpoint => ffi::GDK_SOURCE_TRACKPOINT,
1927            Self::TabletPad => ffi::GDK_SOURCE_TABLET_PAD,
1928            Self::__Unknown(value) => value,
1929        }
1930    }
1931}
1932
1933#[doc(hidden)]
1934impl FromGlib<ffi::GdkInputSource> for InputSource {
1935    #[inline]
1936    unsafe fn from_glib(value: ffi::GdkInputSource) -> Self {
1937        skip_assert_initialized!();
1938
1939        match value {
1940            ffi::GDK_SOURCE_MOUSE => Self::Mouse,
1941            ffi::GDK_SOURCE_PEN => Self::Pen,
1942            ffi::GDK_SOURCE_KEYBOARD => Self::Keyboard,
1943            ffi::GDK_SOURCE_TOUCHSCREEN => Self::Touchscreen,
1944            ffi::GDK_SOURCE_TOUCHPAD => Self::Touchpad,
1945            ffi::GDK_SOURCE_TRACKPOINT => Self::Trackpoint,
1946            ffi::GDK_SOURCE_TABLET_PAD => Self::TabletPad,
1947            value => Self::__Unknown(value),
1948        }
1949    }
1950}
1951
1952impl StaticType for InputSource {
1953    #[inline]
1954    #[doc(alias = "gdk_input_source_get_type")]
1955    fn static_type() -> glib::Type {
1956        unsafe { from_glib(ffi::gdk_input_source_get_type()) }
1957    }
1958}
1959
1960impl glib::HasParamSpec for InputSource {
1961    type ParamSpec = glib::ParamSpecEnum;
1962    type SetValue = Self;
1963    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
1964
1965    fn param_spec_builder() -> Self::BuilderFn {
1966        Self::ParamSpec::builder_with_default
1967    }
1968}
1969
1970impl glib::value::ValueType for InputSource {
1971    type Type = Self;
1972}
1973
1974unsafe impl<'a> glib::value::FromValue<'a> for InputSource {
1975    type Checker = glib::value::GenericValueTypeChecker<Self>;
1976
1977    #[inline]
1978    unsafe fn from_value(value: &'a glib::Value) -> Self {
1979        skip_assert_initialized!();
1980        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
1981    }
1982}
1983
1984impl ToValue for InputSource {
1985    #[inline]
1986    fn to_value(&self) -> glib::Value {
1987        let mut value = glib::Value::for_value_type::<Self>();
1988        unsafe {
1989            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
1990        }
1991        value
1992    }
1993
1994    #[inline]
1995    fn value_type(&self) -> glib::Type {
1996        Self::static_type()
1997    }
1998}
1999
2000impl From<InputSource> for glib::Value {
2001    #[inline]
2002    fn from(v: InputSource) -> Self {
2003        skip_assert_initialized!();
2004        ToValue::to_value(&v)
2005    }
2006}
2007
2008/// Describes how well an event matches a given keyval and modifiers.
2009///
2010/// [`KeyMatch`][crate::KeyMatch] values are returned by [`KeyEvent::matches()`][crate::KeyEvent::matches()].
2011#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2012#[non_exhaustive]
2013#[doc(alias = "GdkKeyMatch")]
2014pub enum KeyMatch {
2015    /// The key event does not match
2016    #[doc(alias = "GDK_KEY_MATCH_NONE")]
2017    None,
2018    /// The key event matches if keyboard state
2019    ///   (specifically, the currently active group) is ignored
2020    #[doc(alias = "GDK_KEY_MATCH_PARTIAL")]
2021    Partial,
2022    /// The key event matches
2023    #[doc(alias = "GDK_KEY_MATCH_EXACT")]
2024    Exact,
2025    #[doc(hidden)]
2026    __Unknown(i32),
2027}
2028
2029#[doc(hidden)]
2030impl IntoGlib for KeyMatch {
2031    type GlibType = ffi::GdkKeyMatch;
2032
2033    #[inline]
2034    fn into_glib(self) -> ffi::GdkKeyMatch {
2035        match self {
2036            Self::None => ffi::GDK_KEY_MATCH_NONE,
2037            Self::Partial => ffi::GDK_KEY_MATCH_PARTIAL,
2038            Self::Exact => ffi::GDK_KEY_MATCH_EXACT,
2039            Self::__Unknown(value) => value,
2040        }
2041    }
2042}
2043
2044#[doc(hidden)]
2045impl FromGlib<ffi::GdkKeyMatch> for KeyMatch {
2046    #[inline]
2047    unsafe fn from_glib(value: ffi::GdkKeyMatch) -> Self {
2048        skip_assert_initialized!();
2049
2050        match value {
2051            ffi::GDK_KEY_MATCH_NONE => Self::None,
2052            ffi::GDK_KEY_MATCH_PARTIAL => Self::Partial,
2053            ffi::GDK_KEY_MATCH_EXACT => Self::Exact,
2054            value => Self::__Unknown(value),
2055        }
2056    }
2057}
2058
2059impl StaticType for KeyMatch {
2060    #[inline]
2061    #[doc(alias = "gdk_key_match_get_type")]
2062    fn static_type() -> glib::Type {
2063        unsafe { from_glib(ffi::gdk_key_match_get_type()) }
2064    }
2065}
2066
2067impl glib::HasParamSpec for KeyMatch {
2068    type ParamSpec = glib::ParamSpecEnum;
2069    type SetValue = Self;
2070    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
2071
2072    fn param_spec_builder() -> Self::BuilderFn {
2073        Self::ParamSpec::builder_with_default
2074    }
2075}
2076
2077impl glib::value::ValueType for KeyMatch {
2078    type Type = Self;
2079}
2080
2081unsafe impl<'a> glib::value::FromValue<'a> for KeyMatch {
2082    type Checker = glib::value::GenericValueTypeChecker<Self>;
2083
2084    #[inline]
2085    unsafe fn from_value(value: &'a glib::Value) -> Self {
2086        skip_assert_initialized!();
2087        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
2088    }
2089}
2090
2091impl ToValue for KeyMatch {
2092    #[inline]
2093    fn to_value(&self) -> glib::Value {
2094        let mut value = glib::Value::for_value_type::<Self>();
2095        unsafe {
2096            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
2097        }
2098        value
2099    }
2100
2101    #[inline]
2102    fn value_type(&self) -> glib::Type {
2103        Self::static_type()
2104    }
2105}
2106
2107impl From<KeyMatch> for glib::Value {
2108    #[inline]
2109    fn from(v: KeyMatch) -> Self {
2110        skip_assert_initialized!();
2111        ToValue::to_value(&v)
2112    }
2113}
2114
2115/// `
2116/// where CHANNELS describe how the RGBA channels are layed out in memory, with an
2117/// X denoting padding. DATA_TYPE is unsigned normalized integer if not present, or
2118/// otherwise FLOAT. The optional SUBSAMPLING defines the subsampling method used.
2119/// The optional ENDIAN term describes the endianness if it is not
2120/// host-endian. Finally, an optional PREMULTIPLIED term indicates that the color
2121/// channels are premultiplied with the alpha value, if it is omitted, the data is
2122/// not premultiplied or there is no alpha channel.
2123///
2124/// The CHANNELS are given as a list of planes seperated by underscores where
2125/// each plane is split into multiple elements describing one or more bytes of memory.
2126/// Each element is given as the list of channels folowed by the amount of bits taken
2127/// up.
2128///
2129/// So the fictional format `RGB565_A8_PREMULTIPLIED` would describe a format with 2
2130/// planes where the first plane is an unsigned 16 bit integer containing the RGB
2131/// channels with 5, 6, and 5 bits respectively while the 2nd plane contains the
2132/// alpha channel as an unisnged 8bit integer.
2133#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
2134#[non_exhaustive]
2135#[doc(alias = "GdkMemoryFormat")]
2136pub enum MemoryFormat {
2137    /// 4 bytes; for blue, green, red, alpha.
2138    ///   The color values are premultiplied with the alpha value.
2139    #[doc(alias = "GDK_MEMORY_B8G8R8A8_PREMULTIPLIED")]
2140    B8g8r8a8Premultiplied,
2141    /// 4 bytes; for alpha, red, green, blue.
2142    ///   The color values are premultiplied with the alpha value.
2143    #[doc(alias = "GDK_MEMORY_A8R8G8B8_PREMULTIPLIED")]
2144    A8r8g8b8Premultiplied,
2145    /// 4 bytes; for red, green, blue, alpha
2146    ///   The color values are premultiplied with the alpha value.
2147    #[doc(alias = "GDK_MEMORY_R8G8B8A8_PREMULTIPLIED")]
2148    R8g8b8a8Premultiplied,
2149    /// 4 bytes; for blue, green, red, alpha.
2150    #[doc(alias = "GDK_MEMORY_B8G8R8A8")]
2151    B8g8r8a8,
2152    /// 4 bytes; for alpha, red, green, blue.
2153    #[doc(alias = "GDK_MEMORY_A8R8G8B8")]
2154    A8r8g8b8,
2155    /// 4 bytes; for red, green, blue, alpha.
2156    #[doc(alias = "GDK_MEMORY_R8G8B8A8")]
2157    R8g8b8a8,
2158    /// 4 bytes; for alpha, blue, green, red.
2159    #[doc(alias = "GDK_MEMORY_A8B8G8R8")]
2160    A8b8g8r8,
2161    /// 3 bytes; for red, green, blue. The data is opaque.
2162    #[doc(alias = "GDK_MEMORY_R8G8B8")]
2163    R8g8b8,
2164    /// 3 bytes; for blue, green, red. The data is opaque.
2165    #[doc(alias = "GDK_MEMORY_B8G8R8")]
2166    B8g8r8,
2167    /// 3 guint16 values; for red, green, blue.
2168    #[cfg(feature = "v4_6")]
2169    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2170    #[doc(alias = "GDK_MEMORY_R16G16B16")]
2171    R16g16b16,
2172    /// 4 guint16 values; for red, green, blue, alpha. The color values are
2173    /// premultiplied with the alpha value.
2174    #[cfg(feature = "v4_6")]
2175    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2176    #[doc(alias = "GDK_MEMORY_R16G16B16A16_PREMULTIPLIED")]
2177    R16g16b16a16Premultiplied,
2178    /// 4 guint16 values; for red, green, blue, alpha.
2179    #[cfg(feature = "v4_6")]
2180    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2181    #[doc(alias = "GDK_MEMORY_R16G16B16A16")]
2182    R16g16b16a16,
2183    /// 3 half-float values; for red, green, blue. The data is opaque.
2184    #[cfg(feature = "v4_6")]
2185    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2186    #[doc(alias = "GDK_MEMORY_R16G16B16_FLOAT")]
2187    R16g16b16Float,
2188    /// 4 half-float values; for red, green, blue and alpha. The color values are
2189    /// premultiplied with the alpha value.
2190    #[cfg(feature = "v4_6")]
2191    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2192    #[doc(alias = "GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED")]
2193    R16g16b16a16FloatPremultiplied,
2194    /// 4 half-float values; for red, green, blue and alpha.
2195    #[cfg(feature = "v4_6")]
2196    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2197    #[doc(alias = "GDK_MEMORY_R16G16B16A16_FLOAT")]
2198    R16g16b16a16Float,
2199    /// 3 float values; for red, green, blue.
2200    #[cfg(feature = "v4_6")]
2201    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2202    #[doc(alias = "GDK_MEMORY_R32G32B32_FLOAT")]
2203    R32g32b32Float,
2204    /// 4 float values; for red, green, blue and alpha. The color values are
2205    /// premultiplied with the alpha value.
2206    #[cfg(feature = "v4_6")]
2207    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2208    #[doc(alias = "GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED")]
2209    R32g32b32a32FloatPremultiplied,
2210    /// 4 float values; for red, green, blue and alpha.
2211    #[cfg(feature = "v4_6")]
2212    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2213    #[doc(alias = "GDK_MEMORY_R32G32B32A32_FLOAT")]
2214    R32g32b32a32Float,
2215    /// 2 bytes; for grayscale, alpha. The color values are premultiplied with the
2216    /// alpha value.
2217    #[cfg(feature = "v4_12")]
2218    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2219    #[doc(alias = "GDK_MEMORY_G8A8_PREMULTIPLIED")]
2220    G8a8Premultiplied,
2221    /// 2 bytes; for grayscale, alpha.
2222    #[cfg(feature = "v4_12")]
2223    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2224    #[doc(alias = "GDK_MEMORY_G8A8")]
2225    G8a8,
2226    /// One byte; for grayscale. The data is opaque.
2227    #[cfg(feature = "v4_12")]
2228    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2229    #[doc(alias = "GDK_MEMORY_G8")]
2230    G8,
2231    /// 2 guint16 values; for grayscale, alpha. The color values are premultiplied
2232    /// with the alpha value.
2233    #[cfg(feature = "v4_12")]
2234    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2235    #[doc(alias = "GDK_MEMORY_G16A16_PREMULTIPLIED")]
2236    G16a16Premultiplied,
2237    /// 2 guint16 values; for grayscale, alpha.
2238    #[cfg(feature = "v4_12")]
2239    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2240    #[doc(alias = "GDK_MEMORY_G16A16")]
2241    G16a16,
2242    /// One guint16 value; for grayscale. The data is opaque.
2243    #[cfg(feature = "v4_12")]
2244    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2245    #[doc(alias = "GDK_MEMORY_G16")]
2246    G16,
2247    /// One byte; for alpha.
2248    #[cfg(feature = "v4_12")]
2249    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2250    #[doc(alias = "GDK_MEMORY_A8")]
2251    A8,
2252    /// One guint16 value; for alpha.
2253    #[cfg(feature = "v4_12")]
2254    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2255    #[doc(alias = "GDK_MEMORY_A16")]
2256    A16,
2257    /// One half-float value; for alpha.
2258    #[cfg(feature = "v4_12")]
2259    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2260    #[doc(alias = "GDK_MEMORY_A16_FLOAT")]
2261    A16Float,
2262    /// One float value; for alpha.
2263    #[cfg(feature = "v4_12")]
2264    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2265    #[doc(alias = "GDK_MEMORY_A32_FLOAT")]
2266    A32Float,
2267    /// 4 bytes; for alpha, blue, green, red, The color values are premultiplied with
2268    /// the alpha value.
2269    #[cfg(feature = "v4_14")]
2270    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2271    #[doc(alias = "GDK_MEMORY_A8B8G8R8_PREMULTIPLIED")]
2272    A8b8g8r8Premultiplied,
2273    /// 4 bytes; for blue, green, red, unused.
2274    #[cfg(feature = "v4_14")]
2275    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2276    #[doc(alias = "GDK_MEMORY_B8G8R8X8")]
2277    B8g8r8x8,
2278    /// 4 bytes; for unused, red, green, blue.
2279    #[cfg(feature = "v4_14")]
2280    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2281    #[doc(alias = "GDK_MEMORY_X8R8G8B8")]
2282    X8r8g8b8,
2283    /// 4 bytes; for red, green, blue, unused.
2284    #[cfg(feature = "v4_14")]
2285    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2286    #[doc(alias = "GDK_MEMORY_R8G8B8X8")]
2287    R8g8b8x8,
2288    /// 4 bytes; for unused, blue, green, red.
2289    #[cfg(feature = "v4_14")]
2290    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2291    #[doc(alias = "GDK_MEMORY_X8B8G8R8")]
2292    X8b8g8r8,
2293    /// Multiplane format with 2 planes.
2294    ///
2295    /// The first plane contains the first channel, usually containing
2296    /// luma values.
2297    /// The second plane with interleaved chroma values, Cb followed by Cr.
2298    /// Subsampled in both the X and Y direction.
2299    ///
2300    /// Commonly known by the fourcc "NV12".
2301    #[cfg(feature = "v4_20")]
2302    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2303    #[doc(alias = "GDK_MEMORY_G8_B8R8_420")]
2304    G8B8r8420,
2305    /// Multiplane format with 2 planes.
2306    ///
2307    /// The first plane contains the first channel, usually containing
2308    /// luma values.
2309    /// The second plane with interleaved chroma values, Cr followed by Cb.
2310    /// Subsampled in both the X and Y direction.
2311    ///
2312    /// Commonly known by the fourcc "NV21".
2313    #[cfg(feature = "v4_20")]
2314    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2315    #[doc(alias = "GDK_MEMORY_G8_R8B8_420")]
2316    G8R8b8420,
2317    /// Multiplane format with 2 planes.
2318    ///
2319    /// The first plane contains the first channel, usually containing
2320    /// luma values.
2321    /// The second plane with interleaved chroma values, Cb followed by Cr.
2322    /// Subsampled in the X direction.
2323    ///
2324    /// Commonly known by the fourcc "NV16".
2325    #[cfg(feature = "v4_20")]
2326    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2327    #[doc(alias = "GDK_MEMORY_G8_B8R8_422")]
2328    G8B8r8422,
2329    /// Multiplane format with 2 planes.
2330    ///
2331    /// The first plane contains the first channel, usually containing
2332    /// luma values.
2333    /// The second plane with interleaved chroma values, Cr followed by Cb.
2334    /// Subsampled in the X direction.
2335    ///
2336    /// Commonly known by the fourcc "NV61".
2337    #[cfg(feature = "v4_20")]
2338    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2339    #[doc(alias = "GDK_MEMORY_G8_R8B8_422")]
2340    G8R8b8422,
2341    /// Multiplane format with 2 planes.
2342    ///
2343    /// The first plane contains the first channel, usually containing
2344    /// luma values.
2345    /// The second plane with interleaved chroma values, Cb followed by Cr.
2346    /// This format is not subsampled.
2347    ///
2348    /// Commonly known by the fourcc "NV24".
2349    #[cfg(feature = "v4_20")]
2350    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2351    #[doc(alias = "GDK_MEMORY_G8_B8R8_444")]
2352    G8B8r8444,
2353    /// Multiplane format with 2 planes.
2354    ///
2355    /// The first plane contains the first channel, usually containing
2356    /// luma values.
2357    /// The second plane with interleaved chroma values, Cr followed by Cb.
2358    /// This format is not subsampled.
2359    ///
2360    /// Commonly known by the fourcc "NV42".
2361    #[cfg(feature = "v4_20")]
2362    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2363    #[doc(alias = "GDK_MEMORY_G8_R8B8_444")]
2364    G8R8b8444,
2365    /// Multiplane format with 2 planes.
2366    ///
2367    /// Each channel is a 16 bit integer, but only the highest 10 bits are used.
2368    ///
2369    /// The first plane contains the first channel, usually containing
2370    /// luma values.
2371    /// The second plane with interleaved chroma values, Cr followed by Cb.
2372    /// This format is not subsampled.
2373    ///
2374    /// Commonly known by the fourcc "P010".
2375    #[cfg(feature = "v4_20")]
2376    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2377    #[doc(alias = "GDK_MEMORY_G10X6_B10X6R10X6_420")]
2378    G10x6B10x6r10x6420,
2379    /// Multiplane format with 2 planes.
2380    ///
2381    /// Each channel is a 16 bit integer, but only the highest 10 bits are used.
2382    ///
2383    /// The first plane contains the first channel, usually containing
2384    /// luma values.
2385    /// The second plane with interleaved chroma values, Cr followed by Cb.
2386    /// This format is not subsampled.
2387    ///
2388    /// Commonly known by the fourcc "P012".
2389    #[cfg(feature = "v4_20")]
2390    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2391    #[doc(alias = "GDK_MEMORY_G12X4_B12X4R12X4_420")]
2392    G12x4B12x4r12x4420,
2393    /// Multiplane format with 2 planes.
2394    ///
2395    /// Each channel is a 16 bit integer.
2396    ///
2397    /// The first plane contains the first channel, usually containing
2398    /// luma values.
2399    /// The second plane with interleaved chroma values, Cr followed by Cb.
2400    /// This format is not subsampled.
2401    ///
2402    /// Commonly known by the fourcc "P016".
2403    #[cfg(feature = "v4_20")]
2404    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2405    #[doc(alias = "GDK_MEMORY_G16_B16R16_420")]
2406    G16B16r16420,
2407    /// Multiplane format with 3 planes.
2408    ///
2409    /// Each channel is a 8 bit integer.
2410    ///
2411    /// The first plane usually contains the luma channel. It is mapped
2412    /// into the 2nd channel.
2413    ///
2414    /// The second plane usually contains the first chroma chanel.
2415    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2416    /// mapped into the 3rd channel.
2417    ///
2418    /// The third plane usually contains the second chroma channel.
2419    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2420    /// mapped into the 1st channel.
2421    ///
2422    /// Commonly known by the fourcc "YUV410".
2423    #[cfg(feature = "v4_20")]
2424    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2425    #[doc(alias = "GDK_MEMORY_G8_B8_R8_410")]
2426    G8B8R8410,
2427    /// Multiplane format with 3 planes.
2428    ///
2429    /// Each channel is a 8 bit integer.
2430    ///
2431    /// The first plane usually contains the luma channel. It is mapped
2432    /// into the 2nd channel.
2433    ///
2434    /// The second plane usually contains the second chroma chanel.
2435    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2436    /// mapped into the 1st channel.
2437    ///
2438    /// The third plane usually contains the first chroma channel.
2439    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2440    /// mapped into the 3rd channel.
2441    ///
2442    /// Commonly known by the fourcc "YVU410".
2443    #[cfg(feature = "v4_20")]
2444    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2445    #[doc(alias = "GDK_MEMORY_G8_R8_B8_410")]
2446    G8R8B8410,
2447    /// Multiplane format with 3 planes.
2448    ///
2449    /// Each channel is a 8 bit integer.
2450    ///
2451    /// The first plane usually contains the luma channel. It is mapped
2452    /// into the 2nd channel.
2453    ///
2454    /// The second plane usually contains the first chroma chanel.
2455    /// Subsampled in the X direction with 4:1 ratio. It is
2456    /// mapped into the 3rd channel.
2457    ///
2458    /// The third plane usually contains the second chroma channel.
2459    /// Subsampled in the X direction with 4:1 ratio. It is
2460    /// mapped into the 1st channel.
2461    ///
2462    /// Commonly known by the fourcc "YUV411".
2463    #[cfg(feature = "v4_20")]
2464    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2465    #[doc(alias = "GDK_MEMORY_G8_B8_R8_411")]
2466    G8B8R8411,
2467    /// Multiplane format with 3 planes.
2468    ///
2469    /// Each channel is a 8 bit integer.
2470    ///
2471    /// The first plane usually contains the luma channel. It is mapped
2472    /// into the 2nd channel.
2473    ///
2474    /// The second plane usually contains the second chroma chanel.
2475    /// Subsampled in the X direction with 4:1 ratio. It is
2476    /// mapped into the 1st channel.
2477    ///
2478    /// The third plane usually contains the first chroma channel.
2479    /// Subsampled in the X direction with 4:1 ratio. It is
2480    /// mapped into the 3rd channel.
2481    ///
2482    /// Commonly known by the fourcc "YVU411".
2483    #[cfg(feature = "v4_20")]
2484    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2485    #[doc(alias = "GDK_MEMORY_G8_R8_B8_411")]
2486    G8R8B8411,
2487    /// Multiplane format with 3 planes.
2488    ///
2489    /// Each channel is a 8 bit integer.
2490    ///
2491    /// The first plane usually contains the luma channel. It is mapped
2492    /// into the 2nd channel.
2493    ///
2494    /// The second plane usually contains the first chroma chanel.
2495    /// Subsampled in both the X and Y direction. It is mapped into the
2496    /// 3rd channel.
2497    ///
2498    /// The third plane usually contains the second chroma channel.
2499    /// Subsampled in both the X and Y direction. It is mapped into the
2500    /// 1st channel.
2501    ///
2502    /// Commonly known by the fourcc "YUV420".
2503    #[cfg(feature = "v4_20")]
2504    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2505    #[doc(alias = "GDK_MEMORY_G8_B8_R8_420")]
2506    G8B8R8420,
2507    /// Multiplane format with 3 planes.
2508    ///
2509    /// Each channel is a 8 bit integer.
2510    ///
2511    /// The first plane usually contains the luma channel. It is mapped
2512    /// into the 2nd channel.
2513    ///
2514    /// The second plane usually contains the second chroma chanel.
2515    /// Subsampled in both the X and Y direction. It is mapped into the
2516    /// 1st channel.
2517    ///
2518    /// The third plane usually contains the first chroma channel.
2519    /// Subsampled in both the X and Y direction. It is mapped into the
2520    /// 3rd channel.
2521    ///
2522    /// Commonly known by the fourcc "YVU420".
2523    #[cfg(feature = "v4_20")]
2524    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2525    #[doc(alias = "GDK_MEMORY_G8_R8_B8_420")]
2526    G8R8B8420,
2527    /// Multiplane format with 3 planes.
2528    ///
2529    /// Each channel is a 8 bit integer.
2530    ///
2531    /// The first plane usually contains the luma channel. It is mapped
2532    /// into the 2nd channel.
2533    ///
2534    /// The second plane usually contains the first chroma chanel.
2535    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2536    ///
2537    /// The third plane usually contains the second chroma channel.
2538    /// Subsampled in the X direction. It is mapped into the 1st channel.
2539    ///
2540    /// Commonly known by the fourcc "YUV422".
2541    #[cfg(feature = "v4_20")]
2542    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2543    #[doc(alias = "GDK_MEMORY_G8_B8_R8_422")]
2544    G8B8R8422,
2545    /// Multiplane format with 3 planes.
2546    ///
2547    /// Each channel is a 8 bit integer.
2548    ///
2549    /// The first plane usually contains the luma channel. It is mapped
2550    /// into the 2nd channel.
2551    ///
2552    /// The second plane usually contains the second chroma chanel.
2553    /// Subsampled in the X direction. It is mapped into the 1st channel.
2554    ///
2555    /// The third plane usually contains the first chroma channel.
2556    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2557    ///
2558    /// Commonly known by the fourcc "YVU422".
2559    #[cfg(feature = "v4_20")]
2560    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2561    #[doc(alias = "GDK_MEMORY_G8_R8_B8_422")]
2562    G8R8B8422,
2563    /// Multiplane format with 3 planes.
2564    ///
2565    /// Each channel is a 8 bit integer.
2566    ///
2567    /// The first plane usually contains the luma channel. It is mapped
2568    /// into the 2nd channel.
2569    ///
2570    /// The second plane usually contains the first chroma chanel. It is
2571    /// mapped into the 3rd channel.
2572    ///
2573    /// The third plane usually contains the second chroma channel. It is
2574    /// mapped into the 1st channel.
2575    ///
2576    /// Commonly known by the fourcc "YUV444".
2577    #[cfg(feature = "v4_20")]
2578    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2579    #[doc(alias = "GDK_MEMORY_G8_B8_R8_444")]
2580    G8B8R8444,
2581    /// Multiplane format with 3 planes.
2582    ///
2583    /// Each channel is a 8 bit integer.
2584    ///
2585    /// The first plane usually contains the luma channel. It is mapped
2586    /// into the 2nd channel.
2587    ///
2588    /// The second plane usually contains the second chroma chanel.
2589    /// Subsampled in the X direction. It is mapped into the 1st channel.
2590    ///
2591    /// The third plane usually contains the first chroma channel.
2592    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2593    ///
2594    /// Commonly known by the fourcc "YVU444".
2595    #[cfg(feature = "v4_20")]
2596    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2597    #[doc(alias = "GDK_MEMORY_G8_R8_B8_444")]
2598    G8R8B8444,
2599    /// Packed format with subsampled channels.
2600    ///
2601    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2602    /// are subsampled and interleaved with the green/luma channel.
2603    ///
2604    /// Each block contains 2 pixels, so the width must be a multiple of
2605    /// 2.
2606    ///
2607    /// Commonly known by the fourcc "YUYV".
2608    #[cfg(feature = "v4_20")]
2609    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2610    #[doc(alias = "GDK_MEMORY_G8B8G8R8_422")]
2611    G8b8g8r8422,
2612    /// Packed format with subsampled channels.
2613    ///
2614    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2615    /// are subsampled and interleaved with the green/luma channel.
2616    ///
2617    /// Each block contains 2 pixels, so the width must be a multiple of
2618    /// 2.
2619    ///
2620    /// Commonly known by the fourcc "YVYU".
2621    #[cfg(feature = "v4_20")]
2622    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2623    #[doc(alias = "GDK_MEMORY_G8R8G8B8_422")]
2624    G8r8g8b8422,
2625    /// Packed format with subsampled channels.
2626    ///
2627    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2628    /// are subsampled and interleaved with the green/luma channel.
2629    ///
2630    /// Each block contains 2 pixels, so the width must be a multiple of
2631    /// 2.
2632    ///
2633    /// Commonly known by the fourcc "VYUY".
2634    #[cfg(feature = "v4_20")]
2635    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2636    #[doc(alias = "GDK_MEMORY_R8G8B8G8_422")]
2637    R8g8b8g8422,
2638    /// Packed format with subsampled channels.
2639    ///
2640    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2641    /// are subsampled and interleaved with the green/luma channel.
2642    ///
2643    /// Each block contains 2 pixels, so the width must be a multiple of
2644    /// 2.
2645    ///
2646    /// Commonly known by the fourcc "UYVY".
2647    #[cfg(feature = "v4_20")]
2648    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2649    #[doc(alias = "GDK_MEMORY_B8G8R8G8_422")]
2650    B8g8r8g8422,
2651    /// Multiplane format with 3 planes.
2652    ///
2653    /// Each channel is a 16 bit integer.
2654    ///
2655    /// Only the 10 lower bits are used. The remaining ones must be set to 0 by the
2656    /// producer.
2657    ///
2658    /// The first plane usually contains the luma channel. It is mapped
2659    /// into the 2nd channel.
2660    ///
2661    /// The second plane usually contains the first chroma chanel.
2662    /// Subsampled in both the X and Y direction. It is mapped into the
2663    /// 3rd channel.
2664    ///
2665    /// The third plane usually contains the second chroma channel.
2666    /// Subsampled in both the X and Y direction. It is mapped into the
2667    /// 1st channel.
2668    ///
2669    /// Commonly known by the fourcc "S010".
2670    #[cfg(feature = "v4_20")]
2671    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2672    #[doc(alias = "GDK_MEMORY_X6G10_X6B10_X6R10_420")]
2673    X6g10X6b10X6r10420,
2674    /// Multiplane format with 3 planes.
2675    ///
2676    /// Each channel is a 16 bit integer.
2677    ///
2678    /// Only the 10 lower bits are used. The remaining ones must be set to 0 by the
2679    /// producer.
2680    ///
2681    /// The first plane usually contains the luma channel. It is mapped
2682    /// into the 2nd channel.
2683    ///
2684    /// The second plane usually contains the first chroma chanel.
2685    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2686    ///
2687    /// The third plane usually contains the second chroma channel.
2688    /// Subsampled in the X direction. It is mapped into the 1st channel.
2689    ///
2690    /// Commonly known by the fourcc "S210".
2691    #[cfg(feature = "v4_20")]
2692    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2693    #[doc(alias = "GDK_MEMORY_X6G10_X6B10_X6R10_422")]
2694    X6g10X6b10X6r10422,
2695    /// Multiplane format with 3 planes.
2696    ///
2697    /// Each channel is a 16 bit integer.
2698    ///
2699    /// Only the 10 lower bits are used. The remaining ones must be set to 0 by the
2700    /// producer.
2701    ///
2702    /// The first plane usually contains the luma channel. It is mapped
2703    /// into the 2nd channel.
2704    ///
2705    /// The second plane usually contains the first chroma chanel. It is
2706    /// mapped into the 3rd channel.
2707    ///
2708    /// The third plane usually contains the second chroma channel. It is
2709    /// mapped into the 1st channel.
2710    ///
2711    /// Commonly known by the fourcc "S410".
2712    #[cfg(feature = "v4_20")]
2713    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2714    #[doc(alias = "GDK_MEMORY_X6G10_X6B10_X6R10_444")]
2715    X6g10X6b10X6r10444,
2716    /// Multiplane format with 3 planes.
2717    ///
2718    /// Each channel is a 16 bit integer.
2719    ///
2720    /// Only the 12 lower bits are used. The remaining ones must be set to 0 by the
2721    /// producer.
2722    ///
2723    /// The first plane usually contains the luma channel. It is mapped
2724    /// into the 2nd channel.
2725    ///
2726    /// The second plane usually contains the first chroma chanel.
2727    /// Subsampled in both the X and Y direction. It is mapped into the
2728    /// 3rd channel.
2729    ///
2730    /// The third plane usually contains the second chroma channel.
2731    /// Subsampled in both the X and Y direction. It is mapped into the
2732    /// 1st channel.
2733    ///
2734    /// Commonly known by the fourcc "S012".
2735    #[cfg(feature = "v4_20")]
2736    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2737    #[doc(alias = "GDK_MEMORY_X4G12_X4B12_X4R12_420")]
2738    X4g12X4b12X4r12420,
2739    /// Multiplane format with 3 planes.
2740    ///
2741    /// Each channel is a 16 bit integer.
2742    ///
2743    /// Only the 12 lower bits are used. The remaining ones must be set to 0 by the
2744    /// producer.
2745    ///
2746    /// The first plane usually contains the luma channel. It is mapped
2747    /// into the 2nd channel.
2748    ///
2749    /// The second plane usually contains the first chroma chanel.
2750    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2751    ///
2752    /// The third plane usually contains the second chroma channel.
2753    /// Subsampled in the X direction. It is mapped into the 1st channel.
2754    ///
2755    /// Commonly known by the fourcc "S212".
2756    #[cfg(feature = "v4_20")]
2757    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2758    #[doc(alias = "GDK_MEMORY_X4G12_X4B12_X4R12_422")]
2759    X4g12X4b12X4r12422,
2760    /// Multiplane format with 3 planes.
2761    ///
2762    /// Each channel is a 16 bit integer.
2763    ///
2764    /// Only the 12 lower bits are used. The remaining ones must be set to 0 by the
2765    /// producer.
2766    ///
2767    /// The first plane usually contains the luma channel. It is mapped
2768    /// into the 2nd channel.
2769    ///
2770    /// The second plane usually contains the first chroma chanel. It is
2771    /// mapped into the 3rd channel.
2772    ///
2773    /// The third plane usually contains the second chroma channel. It is
2774    /// mapped into the 1st channel.
2775    ///
2776    /// Commonly known by the fourcc "S412".
2777    #[cfg(feature = "v4_20")]
2778    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2779    #[doc(alias = "GDK_MEMORY_X4G12_X4B12_X4R12_444")]
2780    X4g12X4b12X4r12444,
2781    /// Multiplane format with 3 planes.
2782    ///
2783    /// Each channel is a 16 bit integer.
2784    ///
2785    /// The first plane usually contains the luma channel. It is mapped
2786    /// into the 2nd channel.
2787    ///
2788    /// The second plane usually contains the first chroma chanel.
2789    /// Subsampled in both the X and Y direction. It is mapped into the
2790    /// 3rd channel.
2791    ///
2792    /// The third plane usually contains the second chroma channel.
2793    /// Subsampled in both the X and Y direction. It is mapped into the
2794    /// 1st channel.
2795    ///
2796    /// Commonly known by the fourcc "S016".
2797    #[cfg(feature = "v4_20")]
2798    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2799    #[doc(alias = "GDK_MEMORY_G16_B16_R16_420")]
2800    G16B16R16420,
2801    /// Multiplane format with 3 planes.
2802    ///
2803    /// Each channel is a 16 bit integer.
2804    ///
2805    /// The first plane usually contains the luma channel. It is mapped
2806    /// into the 2nd channel.
2807    ///
2808    /// The second plane usually contains the first chroma chanel.
2809    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2810    ///
2811    /// The third plane usually contains the second chroma channel.
2812    /// Subsampled in the X direction. It is mapped into the 1st channel.
2813    ///
2814    /// Commonly known by the fourcc "S216".
2815    #[cfg(feature = "v4_20")]
2816    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2817    #[doc(alias = "GDK_MEMORY_G16_B16_R16_422")]
2818    G16B16R16422,
2819    /// Multiplane format with 3 planes.
2820    ///
2821    /// Each channel is a 16 bit integer.
2822    ///
2823    /// The first plane usually contains the luma channel. It is mapped
2824    /// into the 2nd channel.
2825    ///
2826    /// The second plane usually contains the first chroma chanel. It is
2827    /// mapped into the 3rd channel.
2828    ///
2829    /// The third plane usually contains the second chroma channel. It is
2830    /// mapped into the 1st channel.
2831    ///
2832    /// Commonly known by the fourcc "S416".
2833    #[cfg(feature = "v4_20")]
2834    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2835    #[doc(alias = "GDK_MEMORY_G16_B16_R16_444")]
2836    G16B16R16444,
2837    /// 4 bytes per pixel
2838    ///
2839    /// Bits 31..30 contain the alpha channel, 29..20 red, 19..10 green
2840    /// and 9..0 blue.
2841    ///
2842    /// The color values are premultiplied with the alpha value.
2843    #[cfg(feature = "v4_24")]
2844    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2845    #[doc(alias = "GDK_MEMORY_ARGB2101010_PREMULTIPLIED")]
2846    Argb2101010Premultiplied,
2847    /// 4 bytes per pixel
2848    ///
2849    /// Bits 31..30 contain the alpha channel, 29..20 red, 19..10 green
2850    /// and 9..0 blue.
2851    #[cfg(feature = "v4_24")]
2852    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2853    #[doc(alias = "GDK_MEMORY_ARGB2101010")]
2854    Argb2101010,
2855    /// 4 bytes per pixel
2856    ///
2857    /// Bits 31..30 are padding, bits 29..20 contain red, 19..10 green
2858    /// and 9..0 blue.
2859    ///
2860    /// The format is opaque.
2861    #[cfg(feature = "v4_24")]
2862    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2863    #[doc(alias = "GDK_MEMORY_XRGB2101010")]
2864    Xrgb2101010,
2865    /// 4 bytes per pixel
2866    ///
2867    /// Bits 31..30 contain the alpha channel, 29..20 blue, 19..10 green
2868    /// and 9..0 red.
2869    ///
2870    /// The color values are premultiplied with the alpha value.
2871    #[cfg(feature = "v4_24")]
2872    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2873    #[doc(alias = "GDK_MEMORY_ABGR2101010_PREMULTIPLIED")]
2874    Abgr2101010Premultiplied,
2875    /// 4 bytes per pixel
2876    ///
2877    /// Bits 31..30 contain the alpha channel, 29..20 blue, 19..10 green
2878    /// and 9..0 red.
2879    #[cfg(feature = "v4_24")]
2880    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2881    #[doc(alias = "GDK_MEMORY_ABGR2101010")]
2882    Abgr2101010,
2883    /// 4 bytes per pixel
2884    ///
2885    /// Bits 31..30 are padding, bits 29..20 contain blue, 19..10 green
2886    /// and 9..0 red.
2887    ///
2888    /// The format is opaque.
2889    #[cfg(feature = "v4_24")]
2890    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2891    #[doc(alias = "GDK_MEMORY_XBGR2101010")]
2892    Xbgr2101010,
2893    #[doc(hidden)]
2894    __Unknown(i32),
2895}
2896
2897#[doc(hidden)]
2898impl IntoGlib for MemoryFormat {
2899    type GlibType = ffi::GdkMemoryFormat;
2900
2901    fn into_glib(self) -> ffi::GdkMemoryFormat {
2902        match self {
2903            Self::B8g8r8a8Premultiplied => ffi::GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
2904            Self::A8r8g8b8Premultiplied => ffi::GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
2905            Self::R8g8b8a8Premultiplied => ffi::GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
2906            Self::B8g8r8a8 => ffi::GDK_MEMORY_B8G8R8A8,
2907            Self::A8r8g8b8 => ffi::GDK_MEMORY_A8R8G8B8,
2908            Self::R8g8b8a8 => ffi::GDK_MEMORY_R8G8B8A8,
2909            Self::A8b8g8r8 => ffi::GDK_MEMORY_A8B8G8R8,
2910            Self::R8g8b8 => ffi::GDK_MEMORY_R8G8B8,
2911            Self::B8g8r8 => ffi::GDK_MEMORY_B8G8R8,
2912            #[cfg(feature = "v4_6")]
2913            Self::R16g16b16 => ffi::GDK_MEMORY_R16G16B16,
2914            #[cfg(feature = "v4_6")]
2915            Self::R16g16b16a16Premultiplied => ffi::GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
2916            #[cfg(feature = "v4_6")]
2917            Self::R16g16b16a16 => ffi::GDK_MEMORY_R16G16B16A16,
2918            #[cfg(feature = "v4_6")]
2919            Self::R16g16b16Float => ffi::GDK_MEMORY_R16G16B16_FLOAT,
2920            #[cfg(feature = "v4_6")]
2921            Self::R16g16b16a16FloatPremultiplied => {
2922                ffi::GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED
2923            }
2924            #[cfg(feature = "v4_6")]
2925            Self::R16g16b16a16Float => ffi::GDK_MEMORY_R16G16B16A16_FLOAT,
2926            #[cfg(feature = "v4_6")]
2927            Self::R32g32b32Float => ffi::GDK_MEMORY_R32G32B32_FLOAT,
2928            #[cfg(feature = "v4_6")]
2929            Self::R32g32b32a32FloatPremultiplied => {
2930                ffi::GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED
2931            }
2932            #[cfg(feature = "v4_6")]
2933            Self::R32g32b32a32Float => ffi::GDK_MEMORY_R32G32B32A32_FLOAT,
2934            #[cfg(feature = "v4_12")]
2935            Self::G8a8Premultiplied => ffi::GDK_MEMORY_G8A8_PREMULTIPLIED,
2936            #[cfg(feature = "v4_12")]
2937            Self::G8a8 => ffi::GDK_MEMORY_G8A8,
2938            #[cfg(feature = "v4_12")]
2939            Self::G8 => ffi::GDK_MEMORY_G8,
2940            #[cfg(feature = "v4_12")]
2941            Self::G16a16Premultiplied => ffi::GDK_MEMORY_G16A16_PREMULTIPLIED,
2942            #[cfg(feature = "v4_12")]
2943            Self::G16a16 => ffi::GDK_MEMORY_G16A16,
2944            #[cfg(feature = "v4_12")]
2945            Self::G16 => ffi::GDK_MEMORY_G16,
2946            #[cfg(feature = "v4_12")]
2947            Self::A8 => ffi::GDK_MEMORY_A8,
2948            #[cfg(feature = "v4_12")]
2949            Self::A16 => ffi::GDK_MEMORY_A16,
2950            #[cfg(feature = "v4_12")]
2951            Self::A16Float => ffi::GDK_MEMORY_A16_FLOAT,
2952            #[cfg(feature = "v4_12")]
2953            Self::A32Float => ffi::GDK_MEMORY_A32_FLOAT,
2954            #[cfg(feature = "v4_14")]
2955            Self::A8b8g8r8Premultiplied => ffi::GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
2956            #[cfg(feature = "v4_14")]
2957            Self::B8g8r8x8 => ffi::GDK_MEMORY_B8G8R8X8,
2958            #[cfg(feature = "v4_14")]
2959            Self::X8r8g8b8 => ffi::GDK_MEMORY_X8R8G8B8,
2960            #[cfg(feature = "v4_14")]
2961            Self::R8g8b8x8 => ffi::GDK_MEMORY_R8G8B8X8,
2962            #[cfg(feature = "v4_14")]
2963            Self::X8b8g8r8 => ffi::GDK_MEMORY_X8B8G8R8,
2964            #[cfg(feature = "v4_20")]
2965            Self::G8B8r8420 => ffi::GDK_MEMORY_G8_B8R8_420,
2966            #[cfg(feature = "v4_20")]
2967            Self::G8R8b8420 => ffi::GDK_MEMORY_G8_R8B8_420,
2968            #[cfg(feature = "v4_20")]
2969            Self::G8B8r8422 => ffi::GDK_MEMORY_G8_B8R8_422,
2970            #[cfg(feature = "v4_20")]
2971            Self::G8R8b8422 => ffi::GDK_MEMORY_G8_R8B8_422,
2972            #[cfg(feature = "v4_20")]
2973            Self::G8B8r8444 => ffi::GDK_MEMORY_G8_B8R8_444,
2974            #[cfg(feature = "v4_20")]
2975            Self::G8R8b8444 => ffi::GDK_MEMORY_G8_R8B8_444,
2976            #[cfg(feature = "v4_20")]
2977            Self::G10x6B10x6r10x6420 => ffi::GDK_MEMORY_G10X6_B10X6R10X6_420,
2978            #[cfg(feature = "v4_20")]
2979            Self::G12x4B12x4r12x4420 => ffi::GDK_MEMORY_G12X4_B12X4R12X4_420,
2980            #[cfg(feature = "v4_20")]
2981            Self::G16B16r16420 => ffi::GDK_MEMORY_G16_B16R16_420,
2982            #[cfg(feature = "v4_20")]
2983            Self::G8B8R8410 => ffi::GDK_MEMORY_G8_B8_R8_410,
2984            #[cfg(feature = "v4_20")]
2985            Self::G8R8B8410 => ffi::GDK_MEMORY_G8_R8_B8_410,
2986            #[cfg(feature = "v4_20")]
2987            Self::G8B8R8411 => ffi::GDK_MEMORY_G8_B8_R8_411,
2988            #[cfg(feature = "v4_20")]
2989            Self::G8R8B8411 => ffi::GDK_MEMORY_G8_R8_B8_411,
2990            #[cfg(feature = "v4_20")]
2991            Self::G8B8R8420 => ffi::GDK_MEMORY_G8_B8_R8_420,
2992            #[cfg(feature = "v4_20")]
2993            Self::G8R8B8420 => ffi::GDK_MEMORY_G8_R8_B8_420,
2994            #[cfg(feature = "v4_20")]
2995            Self::G8B8R8422 => ffi::GDK_MEMORY_G8_B8_R8_422,
2996            #[cfg(feature = "v4_20")]
2997            Self::G8R8B8422 => ffi::GDK_MEMORY_G8_R8_B8_422,
2998            #[cfg(feature = "v4_20")]
2999            Self::G8B8R8444 => ffi::GDK_MEMORY_G8_B8_R8_444,
3000            #[cfg(feature = "v4_20")]
3001            Self::G8R8B8444 => ffi::GDK_MEMORY_G8_R8_B8_444,
3002            #[cfg(feature = "v4_20")]
3003            Self::G8b8g8r8422 => ffi::GDK_MEMORY_G8B8G8R8_422,
3004            #[cfg(feature = "v4_20")]
3005            Self::G8r8g8b8422 => ffi::GDK_MEMORY_G8R8G8B8_422,
3006            #[cfg(feature = "v4_20")]
3007            Self::R8g8b8g8422 => ffi::GDK_MEMORY_R8G8B8G8_422,
3008            #[cfg(feature = "v4_20")]
3009            Self::B8g8r8g8422 => ffi::GDK_MEMORY_B8G8R8G8_422,
3010            #[cfg(feature = "v4_20")]
3011            Self::X6g10X6b10X6r10420 => ffi::GDK_MEMORY_X6G10_X6B10_X6R10_420,
3012            #[cfg(feature = "v4_20")]
3013            Self::X6g10X6b10X6r10422 => ffi::GDK_MEMORY_X6G10_X6B10_X6R10_422,
3014            #[cfg(feature = "v4_20")]
3015            Self::X6g10X6b10X6r10444 => ffi::GDK_MEMORY_X6G10_X6B10_X6R10_444,
3016            #[cfg(feature = "v4_20")]
3017            Self::X4g12X4b12X4r12420 => ffi::GDK_MEMORY_X4G12_X4B12_X4R12_420,
3018            #[cfg(feature = "v4_20")]
3019            Self::X4g12X4b12X4r12422 => ffi::GDK_MEMORY_X4G12_X4B12_X4R12_422,
3020            #[cfg(feature = "v4_20")]
3021            Self::X4g12X4b12X4r12444 => ffi::GDK_MEMORY_X4G12_X4B12_X4R12_444,
3022            #[cfg(feature = "v4_20")]
3023            Self::G16B16R16420 => ffi::GDK_MEMORY_G16_B16_R16_420,
3024            #[cfg(feature = "v4_20")]
3025            Self::G16B16R16422 => ffi::GDK_MEMORY_G16_B16_R16_422,
3026            #[cfg(feature = "v4_20")]
3027            Self::G16B16R16444 => ffi::GDK_MEMORY_G16_B16_R16_444,
3028            #[cfg(feature = "v4_24")]
3029            Self::Argb2101010Premultiplied => ffi::GDK_MEMORY_ARGB2101010_PREMULTIPLIED,
3030            #[cfg(feature = "v4_24")]
3031            Self::Argb2101010 => ffi::GDK_MEMORY_ARGB2101010,
3032            #[cfg(feature = "v4_24")]
3033            Self::Xrgb2101010 => ffi::GDK_MEMORY_XRGB2101010,
3034            #[cfg(feature = "v4_24")]
3035            Self::Abgr2101010Premultiplied => ffi::GDK_MEMORY_ABGR2101010_PREMULTIPLIED,
3036            #[cfg(feature = "v4_24")]
3037            Self::Abgr2101010 => ffi::GDK_MEMORY_ABGR2101010,
3038            #[cfg(feature = "v4_24")]
3039            Self::Xbgr2101010 => ffi::GDK_MEMORY_XBGR2101010,
3040            Self::__Unknown(value) => value,
3041        }
3042    }
3043}
3044
3045#[doc(hidden)]
3046impl FromGlib<ffi::GdkMemoryFormat> for MemoryFormat {
3047    unsafe fn from_glib(value: ffi::GdkMemoryFormat) -> Self {
3048        skip_assert_initialized!();
3049
3050        match value {
3051            ffi::GDK_MEMORY_B8G8R8A8_PREMULTIPLIED => Self::B8g8r8a8Premultiplied,
3052            ffi::GDK_MEMORY_A8R8G8B8_PREMULTIPLIED => Self::A8r8g8b8Premultiplied,
3053            ffi::GDK_MEMORY_R8G8B8A8_PREMULTIPLIED => Self::R8g8b8a8Premultiplied,
3054            ffi::GDK_MEMORY_B8G8R8A8 => Self::B8g8r8a8,
3055            ffi::GDK_MEMORY_A8R8G8B8 => Self::A8r8g8b8,
3056            ffi::GDK_MEMORY_R8G8B8A8 => Self::R8g8b8a8,
3057            ffi::GDK_MEMORY_A8B8G8R8 => Self::A8b8g8r8,
3058            ffi::GDK_MEMORY_R8G8B8 => Self::R8g8b8,
3059            ffi::GDK_MEMORY_B8G8R8 => Self::B8g8r8,
3060            #[cfg(feature = "v4_6")]
3061            ffi::GDK_MEMORY_R16G16B16 => Self::R16g16b16,
3062            #[cfg(feature = "v4_6")]
3063            ffi::GDK_MEMORY_R16G16B16A16_PREMULTIPLIED => Self::R16g16b16a16Premultiplied,
3064            #[cfg(feature = "v4_6")]
3065            ffi::GDK_MEMORY_R16G16B16A16 => Self::R16g16b16a16,
3066            #[cfg(feature = "v4_6")]
3067            ffi::GDK_MEMORY_R16G16B16_FLOAT => Self::R16g16b16Float,
3068            #[cfg(feature = "v4_6")]
3069            ffi::GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED => {
3070                Self::R16g16b16a16FloatPremultiplied
3071            }
3072            #[cfg(feature = "v4_6")]
3073            ffi::GDK_MEMORY_R16G16B16A16_FLOAT => Self::R16g16b16a16Float,
3074            #[cfg(feature = "v4_6")]
3075            ffi::GDK_MEMORY_R32G32B32_FLOAT => Self::R32g32b32Float,
3076            #[cfg(feature = "v4_6")]
3077            ffi::GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED => {
3078                Self::R32g32b32a32FloatPremultiplied
3079            }
3080            #[cfg(feature = "v4_6")]
3081            ffi::GDK_MEMORY_R32G32B32A32_FLOAT => Self::R32g32b32a32Float,
3082            #[cfg(feature = "v4_12")]
3083            ffi::GDK_MEMORY_G8A8_PREMULTIPLIED => Self::G8a8Premultiplied,
3084            #[cfg(feature = "v4_12")]
3085            ffi::GDK_MEMORY_G8A8 => Self::G8a8,
3086            #[cfg(feature = "v4_12")]
3087            ffi::GDK_MEMORY_G8 => Self::G8,
3088            #[cfg(feature = "v4_12")]
3089            ffi::GDK_MEMORY_G16A16_PREMULTIPLIED => Self::G16a16Premultiplied,
3090            #[cfg(feature = "v4_12")]
3091            ffi::GDK_MEMORY_G16A16 => Self::G16a16,
3092            #[cfg(feature = "v4_12")]
3093            ffi::GDK_MEMORY_G16 => Self::G16,
3094            #[cfg(feature = "v4_12")]
3095            ffi::GDK_MEMORY_A8 => Self::A8,
3096            #[cfg(feature = "v4_12")]
3097            ffi::GDK_MEMORY_A16 => Self::A16,
3098            #[cfg(feature = "v4_12")]
3099            ffi::GDK_MEMORY_A16_FLOAT => Self::A16Float,
3100            #[cfg(feature = "v4_12")]
3101            ffi::GDK_MEMORY_A32_FLOAT => Self::A32Float,
3102            #[cfg(feature = "v4_14")]
3103            ffi::GDK_MEMORY_A8B8G8R8_PREMULTIPLIED => Self::A8b8g8r8Premultiplied,
3104            #[cfg(feature = "v4_14")]
3105            ffi::GDK_MEMORY_B8G8R8X8 => Self::B8g8r8x8,
3106            #[cfg(feature = "v4_14")]
3107            ffi::GDK_MEMORY_X8R8G8B8 => Self::X8r8g8b8,
3108            #[cfg(feature = "v4_14")]
3109            ffi::GDK_MEMORY_R8G8B8X8 => Self::R8g8b8x8,
3110            #[cfg(feature = "v4_14")]
3111            ffi::GDK_MEMORY_X8B8G8R8 => Self::X8b8g8r8,
3112            #[cfg(feature = "v4_20")]
3113            ffi::GDK_MEMORY_G8_B8R8_420 => Self::G8B8r8420,
3114            #[cfg(feature = "v4_20")]
3115            ffi::GDK_MEMORY_G8_R8B8_420 => Self::G8R8b8420,
3116            #[cfg(feature = "v4_20")]
3117            ffi::GDK_MEMORY_G8_B8R8_422 => Self::G8B8r8422,
3118            #[cfg(feature = "v4_20")]
3119            ffi::GDK_MEMORY_G8_R8B8_422 => Self::G8R8b8422,
3120            #[cfg(feature = "v4_20")]
3121            ffi::GDK_MEMORY_G8_B8R8_444 => Self::G8B8r8444,
3122            #[cfg(feature = "v4_20")]
3123            ffi::GDK_MEMORY_G8_R8B8_444 => Self::G8R8b8444,
3124            #[cfg(feature = "v4_20")]
3125            ffi::GDK_MEMORY_G10X6_B10X6R10X6_420 => Self::G10x6B10x6r10x6420,
3126            #[cfg(feature = "v4_20")]
3127            ffi::GDK_MEMORY_G12X4_B12X4R12X4_420 => Self::G12x4B12x4r12x4420,
3128            #[cfg(feature = "v4_20")]
3129            ffi::GDK_MEMORY_G16_B16R16_420 => Self::G16B16r16420,
3130            #[cfg(feature = "v4_20")]
3131            ffi::GDK_MEMORY_G8_B8_R8_410 => Self::G8B8R8410,
3132            #[cfg(feature = "v4_20")]
3133            ffi::GDK_MEMORY_G8_R8_B8_410 => Self::G8R8B8410,
3134            #[cfg(feature = "v4_20")]
3135            ffi::GDK_MEMORY_G8_B8_R8_411 => Self::G8B8R8411,
3136            #[cfg(feature = "v4_20")]
3137            ffi::GDK_MEMORY_G8_R8_B8_411 => Self::G8R8B8411,
3138            #[cfg(feature = "v4_20")]
3139            ffi::GDK_MEMORY_G8_B8_R8_420 => Self::G8B8R8420,
3140            #[cfg(feature = "v4_20")]
3141            ffi::GDK_MEMORY_G8_R8_B8_420 => Self::G8R8B8420,
3142            #[cfg(feature = "v4_20")]
3143            ffi::GDK_MEMORY_G8_B8_R8_422 => Self::G8B8R8422,
3144            #[cfg(feature = "v4_20")]
3145            ffi::GDK_MEMORY_G8_R8_B8_422 => Self::G8R8B8422,
3146            #[cfg(feature = "v4_20")]
3147            ffi::GDK_MEMORY_G8_B8_R8_444 => Self::G8B8R8444,
3148            #[cfg(feature = "v4_20")]
3149            ffi::GDK_MEMORY_G8_R8_B8_444 => Self::G8R8B8444,
3150            #[cfg(feature = "v4_20")]
3151            ffi::GDK_MEMORY_G8B8G8R8_422 => Self::G8b8g8r8422,
3152            #[cfg(feature = "v4_20")]
3153            ffi::GDK_MEMORY_G8R8G8B8_422 => Self::G8r8g8b8422,
3154            #[cfg(feature = "v4_20")]
3155            ffi::GDK_MEMORY_R8G8B8G8_422 => Self::R8g8b8g8422,
3156            #[cfg(feature = "v4_20")]
3157            ffi::GDK_MEMORY_B8G8R8G8_422 => Self::B8g8r8g8422,
3158            #[cfg(feature = "v4_20")]
3159            ffi::GDK_MEMORY_X6G10_X6B10_X6R10_420 => Self::X6g10X6b10X6r10420,
3160            #[cfg(feature = "v4_20")]
3161            ffi::GDK_MEMORY_X6G10_X6B10_X6R10_422 => Self::X6g10X6b10X6r10422,
3162            #[cfg(feature = "v4_20")]
3163            ffi::GDK_MEMORY_X6G10_X6B10_X6R10_444 => Self::X6g10X6b10X6r10444,
3164            #[cfg(feature = "v4_20")]
3165            ffi::GDK_MEMORY_X4G12_X4B12_X4R12_420 => Self::X4g12X4b12X4r12420,
3166            #[cfg(feature = "v4_20")]
3167            ffi::GDK_MEMORY_X4G12_X4B12_X4R12_422 => Self::X4g12X4b12X4r12422,
3168            #[cfg(feature = "v4_20")]
3169            ffi::GDK_MEMORY_X4G12_X4B12_X4R12_444 => Self::X4g12X4b12X4r12444,
3170            #[cfg(feature = "v4_20")]
3171            ffi::GDK_MEMORY_G16_B16_R16_420 => Self::G16B16R16420,
3172            #[cfg(feature = "v4_20")]
3173            ffi::GDK_MEMORY_G16_B16_R16_422 => Self::G16B16R16422,
3174            #[cfg(feature = "v4_20")]
3175            ffi::GDK_MEMORY_G16_B16_R16_444 => Self::G16B16R16444,
3176            #[cfg(feature = "v4_24")]
3177            ffi::GDK_MEMORY_ARGB2101010_PREMULTIPLIED => Self::Argb2101010Premultiplied,
3178            #[cfg(feature = "v4_24")]
3179            ffi::GDK_MEMORY_ARGB2101010 => Self::Argb2101010,
3180            #[cfg(feature = "v4_24")]
3181            ffi::GDK_MEMORY_XRGB2101010 => Self::Xrgb2101010,
3182            #[cfg(feature = "v4_24")]
3183            ffi::GDK_MEMORY_ABGR2101010_PREMULTIPLIED => Self::Abgr2101010Premultiplied,
3184            #[cfg(feature = "v4_24")]
3185            ffi::GDK_MEMORY_ABGR2101010 => Self::Abgr2101010,
3186            #[cfg(feature = "v4_24")]
3187            ffi::GDK_MEMORY_XBGR2101010 => Self::Xbgr2101010,
3188            value => Self::__Unknown(value),
3189        }
3190    }
3191}
3192
3193impl StaticType for MemoryFormat {
3194    #[inline]
3195    #[doc(alias = "gdk_memory_format_get_type")]
3196    fn static_type() -> glib::Type {
3197        unsafe { from_glib(ffi::gdk_memory_format_get_type()) }
3198    }
3199}
3200
3201impl glib::HasParamSpec for MemoryFormat {
3202    type ParamSpec = glib::ParamSpecEnum;
3203    type SetValue = Self;
3204    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3205
3206    fn param_spec_builder() -> Self::BuilderFn {
3207        Self::ParamSpec::builder_with_default
3208    }
3209}
3210
3211impl glib::value::ValueType for MemoryFormat {
3212    type Type = Self;
3213}
3214
3215unsafe impl<'a> glib::value::FromValue<'a> for MemoryFormat {
3216    type Checker = glib::value::GenericValueTypeChecker<Self>;
3217
3218    #[inline]
3219    unsafe fn from_value(value: &'a glib::Value) -> Self {
3220        skip_assert_initialized!();
3221        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3222    }
3223}
3224
3225impl ToValue for MemoryFormat {
3226    #[inline]
3227    fn to_value(&self) -> glib::Value {
3228        let mut value = glib::Value::for_value_type::<Self>();
3229        unsafe {
3230            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3231        }
3232        value
3233    }
3234
3235    #[inline]
3236    fn value_type(&self) -> glib::Type {
3237        Self::static_type()
3238    }
3239}
3240
3241impl From<MemoryFormat> for glib::Value {
3242    #[inline]
3243    fn from(v: MemoryFormat) -> Self {
3244        skip_assert_initialized!();
3245        ToValue::to_value(&v)
3246    }
3247}
3248
3249/// Specifies the kind of crossing for enter and leave events.
3250///
3251/// See the X11 protocol specification of LeaveNotify for
3252/// full details of crossing event generation.
3253#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3254#[non_exhaustive]
3255#[doc(alias = "GdkNotifyType")]
3256pub enum NotifyType {
3257    /// the surface is entered from an ancestor or
3258    ///   left towards an ancestor.
3259    #[doc(alias = "GDK_NOTIFY_ANCESTOR")]
3260    Ancestor,
3261    /// the pointer moves between an ancestor and an
3262    ///   inferior of the surface.
3263    #[doc(alias = "GDK_NOTIFY_VIRTUAL")]
3264    Virtual,
3265    /// the surface is entered from an inferior or
3266    ///   left towards an inferior.
3267    #[doc(alias = "GDK_NOTIFY_INFERIOR")]
3268    Inferior,
3269    /// the surface is entered from or left towards
3270    ///   a surface which is neither an ancestor nor an inferior.
3271    #[doc(alias = "GDK_NOTIFY_NONLINEAR")]
3272    Nonlinear,
3273    /// the pointer moves between two surfaces
3274    ///   which are not ancestors of each other and the surface is part of
3275    ///   the ancestor chain between one of these surfaces and their least
3276    ///   common ancestor.
3277    #[doc(alias = "GDK_NOTIFY_NONLINEAR_VIRTUAL")]
3278    NonlinearVirtual,
3279    /// an unknown type of enter/leave event occurred.
3280    #[doc(alias = "GDK_NOTIFY_UNKNOWN")]
3281    Unknown,
3282    #[doc(hidden)]
3283    __Unknown(i32),
3284}
3285
3286#[doc(hidden)]
3287impl IntoGlib for NotifyType {
3288    type GlibType = ffi::GdkNotifyType;
3289
3290    #[inline]
3291    fn into_glib(self) -> ffi::GdkNotifyType {
3292        match self {
3293            Self::Ancestor => ffi::GDK_NOTIFY_ANCESTOR,
3294            Self::Virtual => ffi::GDK_NOTIFY_VIRTUAL,
3295            Self::Inferior => ffi::GDK_NOTIFY_INFERIOR,
3296            Self::Nonlinear => ffi::GDK_NOTIFY_NONLINEAR,
3297            Self::NonlinearVirtual => ffi::GDK_NOTIFY_NONLINEAR_VIRTUAL,
3298            Self::Unknown => ffi::GDK_NOTIFY_UNKNOWN,
3299            Self::__Unknown(value) => value,
3300        }
3301    }
3302}
3303
3304#[doc(hidden)]
3305impl FromGlib<ffi::GdkNotifyType> for NotifyType {
3306    #[inline]
3307    unsafe fn from_glib(value: ffi::GdkNotifyType) -> Self {
3308        skip_assert_initialized!();
3309
3310        match value {
3311            ffi::GDK_NOTIFY_ANCESTOR => Self::Ancestor,
3312            ffi::GDK_NOTIFY_VIRTUAL => Self::Virtual,
3313            ffi::GDK_NOTIFY_INFERIOR => Self::Inferior,
3314            ffi::GDK_NOTIFY_NONLINEAR => Self::Nonlinear,
3315            ffi::GDK_NOTIFY_NONLINEAR_VIRTUAL => Self::NonlinearVirtual,
3316            ffi::GDK_NOTIFY_UNKNOWN => Self::Unknown,
3317            value => Self::__Unknown(value),
3318        }
3319    }
3320}
3321
3322impl StaticType for NotifyType {
3323    #[inline]
3324    #[doc(alias = "gdk_notify_type_get_type")]
3325    fn static_type() -> glib::Type {
3326        unsafe { from_glib(ffi::gdk_notify_type_get_type()) }
3327    }
3328}
3329
3330impl glib::HasParamSpec for NotifyType {
3331    type ParamSpec = glib::ParamSpecEnum;
3332    type SetValue = Self;
3333    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3334
3335    fn param_spec_builder() -> Self::BuilderFn {
3336        Self::ParamSpec::builder_with_default
3337    }
3338}
3339
3340impl glib::value::ValueType for NotifyType {
3341    type Type = Self;
3342}
3343
3344unsafe impl<'a> glib::value::FromValue<'a> for NotifyType {
3345    type Checker = glib::value::GenericValueTypeChecker<Self>;
3346
3347    #[inline]
3348    unsafe fn from_value(value: &'a glib::Value) -> Self {
3349        skip_assert_initialized!();
3350        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3351    }
3352}
3353
3354impl ToValue for NotifyType {
3355    #[inline]
3356    fn to_value(&self) -> glib::Value {
3357        let mut value = glib::Value::for_value_type::<Self>();
3358        unsafe {
3359            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3360        }
3361        value
3362    }
3363
3364    #[inline]
3365    fn value_type(&self) -> glib::Type {
3366        Self::static_type()
3367    }
3368}
3369
3370impl From<NotifyType> for glib::Value {
3371    #[inline]
3372    fn from(v: NotifyType) -> Self {
3373        skip_assert_initialized!();
3374        ToValue::to_value(&v)
3375    }
3376}
3377
3378/// Specifies the direction for scroll events.
3379#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3380#[non_exhaustive]
3381#[doc(alias = "GdkScrollDirection")]
3382pub enum ScrollDirection {
3383    /// the surface is scrolled up.
3384    #[doc(alias = "GDK_SCROLL_UP")]
3385    Up,
3386    /// the surface is scrolled down.
3387    #[doc(alias = "GDK_SCROLL_DOWN")]
3388    Down,
3389    /// the surface is scrolled to the left.
3390    #[doc(alias = "GDK_SCROLL_LEFT")]
3391    Left,
3392    /// the surface is scrolled to the right.
3393    #[doc(alias = "GDK_SCROLL_RIGHT")]
3394    Right,
3395    /// the scrolling is determined by the delta values
3396    ///   in scroll events. See gdk_scroll_event_get_deltas()
3397    #[doc(alias = "GDK_SCROLL_SMOOTH")]
3398    Smooth,
3399    #[doc(hidden)]
3400    __Unknown(i32),
3401}
3402
3403#[doc(hidden)]
3404impl IntoGlib for ScrollDirection {
3405    type GlibType = ffi::GdkScrollDirection;
3406
3407    #[inline]
3408    fn into_glib(self) -> ffi::GdkScrollDirection {
3409        match self {
3410            Self::Up => ffi::GDK_SCROLL_UP,
3411            Self::Down => ffi::GDK_SCROLL_DOWN,
3412            Self::Left => ffi::GDK_SCROLL_LEFT,
3413            Self::Right => ffi::GDK_SCROLL_RIGHT,
3414            Self::Smooth => ffi::GDK_SCROLL_SMOOTH,
3415            Self::__Unknown(value) => value,
3416        }
3417    }
3418}
3419
3420#[doc(hidden)]
3421impl FromGlib<ffi::GdkScrollDirection> for ScrollDirection {
3422    #[inline]
3423    unsafe fn from_glib(value: ffi::GdkScrollDirection) -> Self {
3424        skip_assert_initialized!();
3425
3426        match value {
3427            ffi::GDK_SCROLL_UP => Self::Up,
3428            ffi::GDK_SCROLL_DOWN => Self::Down,
3429            ffi::GDK_SCROLL_LEFT => Self::Left,
3430            ffi::GDK_SCROLL_RIGHT => Self::Right,
3431            ffi::GDK_SCROLL_SMOOTH => Self::Smooth,
3432            value => Self::__Unknown(value),
3433        }
3434    }
3435}
3436
3437impl StaticType for ScrollDirection {
3438    #[inline]
3439    #[doc(alias = "gdk_scroll_direction_get_type")]
3440    fn static_type() -> glib::Type {
3441        unsafe { from_glib(ffi::gdk_scroll_direction_get_type()) }
3442    }
3443}
3444
3445impl glib::HasParamSpec for ScrollDirection {
3446    type ParamSpec = glib::ParamSpecEnum;
3447    type SetValue = Self;
3448    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3449
3450    fn param_spec_builder() -> Self::BuilderFn {
3451        Self::ParamSpec::builder_with_default
3452    }
3453}
3454
3455impl glib::value::ValueType for ScrollDirection {
3456    type Type = Self;
3457}
3458
3459unsafe impl<'a> glib::value::FromValue<'a> for ScrollDirection {
3460    type Checker = glib::value::GenericValueTypeChecker<Self>;
3461
3462    #[inline]
3463    unsafe fn from_value(value: &'a glib::Value) -> Self {
3464        skip_assert_initialized!();
3465        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3466    }
3467}
3468
3469impl ToValue for ScrollDirection {
3470    #[inline]
3471    fn to_value(&self) -> glib::Value {
3472        let mut value = glib::Value::for_value_type::<Self>();
3473        unsafe {
3474            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3475        }
3476        value
3477    }
3478
3479    #[inline]
3480    fn value_type(&self) -> glib::Type {
3481        Self::static_type()
3482    }
3483}
3484
3485impl From<ScrollDirection> for glib::Value {
3486    #[inline]
3487    fn from(v: ScrollDirection) -> Self {
3488        skip_assert_initialized!();
3489        ToValue::to_value(&v)
3490    }
3491}
3492
3493/// Used in scroll events, to announce the direction relative
3494/// to physical motion.
3495#[cfg(feature = "v4_20")]
3496#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3497#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3498#[non_exhaustive]
3499#[doc(alias = "GdkScrollRelativeDirection")]
3500pub enum ScrollRelativeDirection {
3501    /// Physical motion and event motion are the same
3502    #[doc(alias = "GDK_SCROLL_RELATIVE_DIRECTION_IDENTICAL")]
3503    Identical,
3504    /// Physical motion is inverted relative to event motion
3505    #[doc(alias = "GDK_SCROLL_RELATIVE_DIRECTION_INVERTED")]
3506    Inverted,
3507    /// Relative motion is unknown on this device or backend
3508    #[doc(alias = "GDK_SCROLL_RELATIVE_DIRECTION_UNKNOWN")]
3509    Unknown,
3510    #[doc(hidden)]
3511    __Unknown(i32),
3512}
3513
3514#[cfg(feature = "v4_20")]
3515#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3516#[doc(hidden)]
3517impl IntoGlib for ScrollRelativeDirection {
3518    type GlibType = ffi::GdkScrollRelativeDirection;
3519
3520    #[inline]
3521    fn into_glib(self) -> ffi::GdkScrollRelativeDirection {
3522        match self {
3523            Self::Identical => ffi::GDK_SCROLL_RELATIVE_DIRECTION_IDENTICAL,
3524            Self::Inverted => ffi::GDK_SCROLL_RELATIVE_DIRECTION_INVERTED,
3525            Self::Unknown => ffi::GDK_SCROLL_RELATIVE_DIRECTION_UNKNOWN,
3526            Self::__Unknown(value) => value,
3527        }
3528    }
3529}
3530
3531#[cfg(feature = "v4_20")]
3532#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3533#[doc(hidden)]
3534impl FromGlib<ffi::GdkScrollRelativeDirection> for ScrollRelativeDirection {
3535    #[inline]
3536    unsafe fn from_glib(value: ffi::GdkScrollRelativeDirection) -> Self {
3537        skip_assert_initialized!();
3538
3539        match value {
3540            ffi::GDK_SCROLL_RELATIVE_DIRECTION_IDENTICAL => Self::Identical,
3541            ffi::GDK_SCROLL_RELATIVE_DIRECTION_INVERTED => Self::Inverted,
3542            ffi::GDK_SCROLL_RELATIVE_DIRECTION_UNKNOWN => Self::Unknown,
3543            value => Self::__Unknown(value),
3544        }
3545    }
3546}
3547
3548#[cfg(feature = "v4_20")]
3549#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3550impl StaticType for ScrollRelativeDirection {
3551    #[inline]
3552    #[doc(alias = "gdk_scroll_relative_direction_get_type")]
3553    fn static_type() -> glib::Type {
3554        unsafe { from_glib(ffi::gdk_scroll_relative_direction_get_type()) }
3555    }
3556}
3557
3558#[cfg(feature = "v4_20")]
3559#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3560impl glib::HasParamSpec for ScrollRelativeDirection {
3561    type ParamSpec = glib::ParamSpecEnum;
3562    type SetValue = Self;
3563    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3564
3565    fn param_spec_builder() -> Self::BuilderFn {
3566        Self::ParamSpec::builder_with_default
3567    }
3568}
3569
3570#[cfg(feature = "v4_20")]
3571#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3572impl glib::value::ValueType for ScrollRelativeDirection {
3573    type Type = Self;
3574}
3575
3576#[cfg(feature = "v4_20")]
3577#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3578unsafe impl<'a> glib::value::FromValue<'a> for ScrollRelativeDirection {
3579    type Checker = glib::value::GenericValueTypeChecker<Self>;
3580
3581    #[inline]
3582    unsafe fn from_value(value: &'a glib::Value) -> Self {
3583        skip_assert_initialized!();
3584        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3585    }
3586}
3587
3588#[cfg(feature = "v4_20")]
3589#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3590impl ToValue for ScrollRelativeDirection {
3591    #[inline]
3592    fn to_value(&self) -> glib::Value {
3593        let mut value = glib::Value::for_value_type::<Self>();
3594        unsafe {
3595            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3596        }
3597        value
3598    }
3599
3600    #[inline]
3601    fn value_type(&self) -> glib::Type {
3602        Self::static_type()
3603    }
3604}
3605
3606#[cfg(feature = "v4_20")]
3607#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3608impl From<ScrollRelativeDirection> for glib::Value {
3609    #[inline]
3610    fn from(v: ScrollRelativeDirection) -> Self {
3611        skip_assert_initialized!();
3612        ToValue::to_value(&v)
3613    }
3614}
3615
3616/// Specifies the unit of scroll deltas.
3617///
3618/// When you get [`Wheel`][Self::Wheel], a delta of 1.0 means 1 wheel detent
3619/// click in the south direction, 2.0 means 2 wheel detent clicks in the south
3620/// direction... This is the same logic for negative values but in the north
3621/// direction.
3622///
3623/// If you get [`Surface`][Self::Surface], are managing a scrollable view and get a
3624/// value of 123, you have to scroll 123 surface logical pixels right if it's
3625/// @delta_x or down if it's @delta_y. This is the same logic for negative values
3626/// but you have to scroll left instead of right if it's @delta_x and up instead
3627/// of down if it's @delta_y.
3628///
3629/// 1 surface logical pixel is equal to 1 real screen pixel multiplied by the
3630/// final scale factor of your graphical interface (the product of the desktop
3631/// scale factor and eventually a custom scale factor in your app).
3632#[cfg(feature = "v4_8")]
3633#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3634#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3635#[non_exhaustive]
3636#[doc(alias = "GdkScrollUnit")]
3637pub enum ScrollUnit {
3638    /// The delta is in number of wheel clicks.
3639    #[doc(alias = "GDK_SCROLL_UNIT_WHEEL")]
3640    Wheel,
3641    /// The delta is in surface pixels to scroll directly
3642    ///   on screen.
3643    #[doc(alias = "GDK_SCROLL_UNIT_SURFACE")]
3644    Surface,
3645    #[doc(hidden)]
3646    __Unknown(i32),
3647}
3648
3649#[cfg(feature = "v4_8")]
3650#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3651#[doc(hidden)]
3652impl IntoGlib for ScrollUnit {
3653    type GlibType = ffi::GdkScrollUnit;
3654
3655    #[inline]
3656    fn into_glib(self) -> ffi::GdkScrollUnit {
3657        match self {
3658            Self::Wheel => ffi::GDK_SCROLL_UNIT_WHEEL,
3659            Self::Surface => ffi::GDK_SCROLL_UNIT_SURFACE,
3660            Self::__Unknown(value) => value,
3661        }
3662    }
3663}
3664
3665#[cfg(feature = "v4_8")]
3666#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3667#[doc(hidden)]
3668impl FromGlib<ffi::GdkScrollUnit> for ScrollUnit {
3669    #[inline]
3670    unsafe fn from_glib(value: ffi::GdkScrollUnit) -> Self {
3671        skip_assert_initialized!();
3672
3673        match value {
3674            ffi::GDK_SCROLL_UNIT_WHEEL => Self::Wheel,
3675            ffi::GDK_SCROLL_UNIT_SURFACE => Self::Surface,
3676            value => Self::__Unknown(value),
3677        }
3678    }
3679}
3680
3681#[cfg(feature = "v4_8")]
3682#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3683impl StaticType for ScrollUnit {
3684    #[inline]
3685    #[doc(alias = "gdk_scroll_unit_get_type")]
3686    fn static_type() -> glib::Type {
3687        unsafe { from_glib(ffi::gdk_scroll_unit_get_type()) }
3688    }
3689}
3690
3691#[cfg(feature = "v4_8")]
3692#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3693impl glib::HasParamSpec for ScrollUnit {
3694    type ParamSpec = glib::ParamSpecEnum;
3695    type SetValue = Self;
3696    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3697
3698    fn param_spec_builder() -> Self::BuilderFn {
3699        Self::ParamSpec::builder_with_default
3700    }
3701}
3702
3703#[cfg(feature = "v4_8")]
3704#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3705impl glib::value::ValueType for ScrollUnit {
3706    type Type = Self;
3707}
3708
3709#[cfg(feature = "v4_8")]
3710#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3711unsafe impl<'a> glib::value::FromValue<'a> for ScrollUnit {
3712    type Checker = glib::value::GenericValueTypeChecker<Self>;
3713
3714    #[inline]
3715    unsafe fn from_value(value: &'a glib::Value) -> Self {
3716        skip_assert_initialized!();
3717        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3718    }
3719}
3720
3721#[cfg(feature = "v4_8")]
3722#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3723impl ToValue for ScrollUnit {
3724    #[inline]
3725    fn to_value(&self) -> glib::Value {
3726        let mut value = glib::Value::for_value_type::<Self>();
3727        unsafe {
3728            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3729        }
3730        value
3731    }
3732
3733    #[inline]
3734    fn value_type(&self) -> glib::Type {
3735        Self::static_type()
3736    }
3737}
3738
3739#[cfg(feature = "v4_8")]
3740#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3741impl From<ScrollUnit> for glib::Value {
3742    #[inline]
3743    fn from(v: ScrollUnit) -> Self {
3744        skip_assert_initialized!();
3745        ToValue::to_value(&v)
3746    }
3747}
3748
3749/// This enumeration describes how the red, green and blue components
3750/// of physical pixels on an output device are laid out.
3751#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3752#[non_exhaustive]
3753#[doc(alias = "GdkSubpixelLayout")]
3754pub enum SubpixelLayout {
3755    /// The layout is not known
3756    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_UNKNOWN")]
3757    Unknown,
3758    /// Not organized in this way
3759    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_NONE")]
3760    None,
3761    /// The layout is horizontal, the order is RGB
3762    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB")]
3763    HorizontalRgb,
3764    /// The layout is horizontal, the order is BGR
3765    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR")]
3766    HorizontalBgr,
3767    /// The layout is vertical, the order is RGB
3768    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB")]
3769    VerticalRgb,
3770    /// The layout is vertical, the order is BGR
3771    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR")]
3772    VerticalBgr,
3773    #[doc(hidden)]
3774    __Unknown(i32),
3775}
3776
3777#[doc(hidden)]
3778impl IntoGlib for SubpixelLayout {
3779    type GlibType = ffi::GdkSubpixelLayout;
3780
3781    #[inline]
3782    fn into_glib(self) -> ffi::GdkSubpixelLayout {
3783        match self {
3784            Self::Unknown => ffi::GDK_SUBPIXEL_LAYOUT_UNKNOWN,
3785            Self::None => ffi::GDK_SUBPIXEL_LAYOUT_NONE,
3786            Self::HorizontalRgb => ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB,
3787            Self::HorizontalBgr => ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR,
3788            Self::VerticalRgb => ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB,
3789            Self::VerticalBgr => ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR,
3790            Self::__Unknown(value) => value,
3791        }
3792    }
3793}
3794
3795#[doc(hidden)]
3796impl FromGlib<ffi::GdkSubpixelLayout> for SubpixelLayout {
3797    #[inline]
3798    unsafe fn from_glib(value: ffi::GdkSubpixelLayout) -> Self {
3799        skip_assert_initialized!();
3800
3801        match value {
3802            ffi::GDK_SUBPIXEL_LAYOUT_UNKNOWN => Self::Unknown,
3803            ffi::GDK_SUBPIXEL_LAYOUT_NONE => Self::None,
3804            ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB => Self::HorizontalRgb,
3805            ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR => Self::HorizontalBgr,
3806            ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB => Self::VerticalRgb,
3807            ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR => Self::VerticalBgr,
3808            value => Self::__Unknown(value),
3809        }
3810    }
3811}
3812
3813impl StaticType for SubpixelLayout {
3814    #[inline]
3815    #[doc(alias = "gdk_subpixel_layout_get_type")]
3816    fn static_type() -> glib::Type {
3817        unsafe { from_glib(ffi::gdk_subpixel_layout_get_type()) }
3818    }
3819}
3820
3821impl glib::HasParamSpec for SubpixelLayout {
3822    type ParamSpec = glib::ParamSpecEnum;
3823    type SetValue = Self;
3824    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3825
3826    fn param_spec_builder() -> Self::BuilderFn {
3827        Self::ParamSpec::builder_with_default
3828    }
3829}
3830
3831impl glib::value::ValueType for SubpixelLayout {
3832    type Type = Self;
3833}
3834
3835unsafe impl<'a> glib::value::FromValue<'a> for SubpixelLayout {
3836    type Checker = glib::value::GenericValueTypeChecker<Self>;
3837
3838    #[inline]
3839    unsafe fn from_value(value: &'a glib::Value) -> Self {
3840        skip_assert_initialized!();
3841        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3842    }
3843}
3844
3845impl ToValue for SubpixelLayout {
3846    #[inline]
3847    fn to_value(&self) -> glib::Value {
3848        let mut value = glib::Value::for_value_type::<Self>();
3849        unsafe {
3850            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3851        }
3852        value
3853    }
3854
3855    #[inline]
3856    fn value_type(&self) -> glib::Type {
3857        Self::static_type()
3858    }
3859}
3860
3861impl From<SubpixelLayout> for glib::Value {
3862    #[inline]
3863    fn from(v: SubpixelLayout) -> Self {
3864        skip_assert_initialized!();
3865        ToValue::to_value(&v)
3866    }
3867}
3868
3869/// Determines a surface edge or corner.
3870#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3871#[non_exhaustive]
3872#[doc(alias = "GdkSurfaceEdge")]
3873pub enum SurfaceEdge {
3874    /// the top left corner.
3875    #[doc(alias = "GDK_SURFACE_EDGE_NORTH_WEST")]
3876    NorthWest,
3877    /// the top edge.
3878    #[doc(alias = "GDK_SURFACE_EDGE_NORTH")]
3879    North,
3880    /// the top right corner.
3881    #[doc(alias = "GDK_SURFACE_EDGE_NORTH_EAST")]
3882    NorthEast,
3883    /// the left edge.
3884    #[doc(alias = "GDK_SURFACE_EDGE_WEST")]
3885    West,
3886    /// the right edge.
3887    #[doc(alias = "GDK_SURFACE_EDGE_EAST")]
3888    East,
3889    /// the lower left corner.
3890    #[doc(alias = "GDK_SURFACE_EDGE_SOUTH_WEST")]
3891    SouthWest,
3892    /// the lower edge.
3893    #[doc(alias = "GDK_SURFACE_EDGE_SOUTH")]
3894    South,
3895    /// the lower right corner.
3896    #[doc(alias = "GDK_SURFACE_EDGE_SOUTH_EAST")]
3897    SouthEast,
3898    #[doc(hidden)]
3899    __Unknown(i32),
3900}
3901
3902#[doc(hidden)]
3903impl IntoGlib for SurfaceEdge {
3904    type GlibType = ffi::GdkSurfaceEdge;
3905
3906    #[inline]
3907    fn into_glib(self) -> ffi::GdkSurfaceEdge {
3908        match self {
3909            Self::NorthWest => ffi::GDK_SURFACE_EDGE_NORTH_WEST,
3910            Self::North => ffi::GDK_SURFACE_EDGE_NORTH,
3911            Self::NorthEast => ffi::GDK_SURFACE_EDGE_NORTH_EAST,
3912            Self::West => ffi::GDK_SURFACE_EDGE_WEST,
3913            Self::East => ffi::GDK_SURFACE_EDGE_EAST,
3914            Self::SouthWest => ffi::GDK_SURFACE_EDGE_SOUTH_WEST,
3915            Self::South => ffi::GDK_SURFACE_EDGE_SOUTH,
3916            Self::SouthEast => ffi::GDK_SURFACE_EDGE_SOUTH_EAST,
3917            Self::__Unknown(value) => value,
3918        }
3919    }
3920}
3921
3922#[doc(hidden)]
3923impl FromGlib<ffi::GdkSurfaceEdge> for SurfaceEdge {
3924    #[inline]
3925    unsafe fn from_glib(value: ffi::GdkSurfaceEdge) -> Self {
3926        skip_assert_initialized!();
3927
3928        match value {
3929            ffi::GDK_SURFACE_EDGE_NORTH_WEST => Self::NorthWest,
3930            ffi::GDK_SURFACE_EDGE_NORTH => Self::North,
3931            ffi::GDK_SURFACE_EDGE_NORTH_EAST => Self::NorthEast,
3932            ffi::GDK_SURFACE_EDGE_WEST => Self::West,
3933            ffi::GDK_SURFACE_EDGE_EAST => Self::East,
3934            ffi::GDK_SURFACE_EDGE_SOUTH_WEST => Self::SouthWest,
3935            ffi::GDK_SURFACE_EDGE_SOUTH => Self::South,
3936            ffi::GDK_SURFACE_EDGE_SOUTH_EAST => Self::SouthEast,
3937            value => Self::__Unknown(value),
3938        }
3939    }
3940}
3941
3942impl StaticType for SurfaceEdge {
3943    #[inline]
3944    #[doc(alias = "gdk_surface_edge_get_type")]
3945    fn static_type() -> glib::Type {
3946        unsafe { from_glib(ffi::gdk_surface_edge_get_type()) }
3947    }
3948}
3949
3950impl glib::HasParamSpec for SurfaceEdge {
3951    type ParamSpec = glib::ParamSpecEnum;
3952    type SetValue = Self;
3953    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3954
3955    fn param_spec_builder() -> Self::BuilderFn {
3956        Self::ParamSpec::builder_with_default
3957    }
3958}
3959
3960impl glib::value::ValueType for SurfaceEdge {
3961    type Type = Self;
3962}
3963
3964unsafe impl<'a> glib::value::FromValue<'a> for SurfaceEdge {
3965    type Checker = glib::value::GenericValueTypeChecker<Self>;
3966
3967    #[inline]
3968    unsafe fn from_value(value: &'a glib::Value) -> Self {
3969        skip_assert_initialized!();
3970        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3971    }
3972}
3973
3974impl ToValue for SurfaceEdge {
3975    #[inline]
3976    fn to_value(&self) -> glib::Value {
3977        let mut value = glib::Value::for_value_type::<Self>();
3978        unsafe {
3979            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3980        }
3981        value
3982    }
3983
3984    #[inline]
3985    fn value_type(&self) -> glib::Type {
3986        Self::static_type()
3987    }
3988}
3989
3990impl From<SurfaceEdge> for glib::Value {
3991    #[inline]
3992    fn from(v: SurfaceEdge) -> Self {
3993        skip_assert_initialized!();
3994        ToValue::to_value(&v)
3995    }
3996}
3997
3998/// Possible errors that can be returned by [`Texture`][crate::Texture] constructors.
3999#[cfg(feature = "v4_6")]
4000#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4001#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4002#[non_exhaustive]
4003#[doc(alias = "GdkTextureError")]
4004pub enum TextureError {
4005    /// Not enough memory to handle this image
4006    #[doc(alias = "GDK_TEXTURE_ERROR_TOO_LARGE")]
4007    TooLarge,
4008    /// The image data appears corrupted
4009    #[doc(alias = "GDK_TEXTURE_ERROR_CORRUPT_IMAGE")]
4010    CorruptImage,
4011    /// The image contains features
4012    ///   that cannot be loaded
4013    #[doc(alias = "GDK_TEXTURE_ERROR_UNSUPPORTED_CONTENT")]
4014    UnsupportedContent,
4015    /// The image format is not supported
4016    #[doc(alias = "GDK_TEXTURE_ERROR_UNSUPPORTED_FORMAT")]
4017    UnsupportedFormat,
4018    #[doc(hidden)]
4019    __Unknown(i32),
4020}
4021
4022#[cfg(feature = "v4_6")]
4023#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4024#[doc(hidden)]
4025impl IntoGlib for TextureError {
4026    type GlibType = ffi::GdkTextureError;
4027
4028    #[inline]
4029    fn into_glib(self) -> ffi::GdkTextureError {
4030        match self {
4031            Self::TooLarge => ffi::GDK_TEXTURE_ERROR_TOO_LARGE,
4032            Self::CorruptImage => ffi::GDK_TEXTURE_ERROR_CORRUPT_IMAGE,
4033            Self::UnsupportedContent => ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_CONTENT,
4034            Self::UnsupportedFormat => ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_FORMAT,
4035            Self::__Unknown(value) => value,
4036        }
4037    }
4038}
4039
4040#[cfg(feature = "v4_6")]
4041#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4042#[doc(hidden)]
4043impl FromGlib<ffi::GdkTextureError> for TextureError {
4044    #[inline]
4045    unsafe fn from_glib(value: ffi::GdkTextureError) -> Self {
4046        skip_assert_initialized!();
4047
4048        match value {
4049            ffi::GDK_TEXTURE_ERROR_TOO_LARGE => Self::TooLarge,
4050            ffi::GDK_TEXTURE_ERROR_CORRUPT_IMAGE => Self::CorruptImage,
4051            ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_CONTENT => Self::UnsupportedContent,
4052            ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_FORMAT => Self::UnsupportedFormat,
4053            value => Self::__Unknown(value),
4054        }
4055    }
4056}
4057
4058#[cfg(feature = "v4_6")]
4059#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4060impl glib::error::ErrorDomain for TextureError {
4061    #[inline]
4062    fn domain() -> glib::Quark {
4063        skip_assert_initialized!();
4064
4065        unsafe { from_glib(ffi::gdk_texture_error_quark()) }
4066    }
4067
4068    #[inline]
4069    fn code(self) -> i32 {
4070        self.into_glib()
4071    }
4072
4073    #[inline]
4074    #[allow(clippy::match_single_binding)]
4075    fn from(code: i32) -> Option<Self> {
4076        skip_assert_initialized!();
4077        match unsafe { from_glib(code) } {
4078            value => Some(value),
4079        }
4080    }
4081}
4082
4083#[cfg(feature = "v4_6")]
4084#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4085impl StaticType for TextureError {
4086    #[inline]
4087    #[doc(alias = "gdk_texture_error_get_type")]
4088    fn static_type() -> glib::Type {
4089        unsafe { from_glib(ffi::gdk_texture_error_get_type()) }
4090    }
4091}
4092
4093#[cfg(feature = "v4_6")]
4094#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4095impl glib::HasParamSpec for TextureError {
4096    type ParamSpec = glib::ParamSpecEnum;
4097    type SetValue = Self;
4098    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4099
4100    fn param_spec_builder() -> Self::BuilderFn {
4101        Self::ParamSpec::builder_with_default
4102    }
4103}
4104
4105#[cfg(feature = "v4_6")]
4106#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4107impl glib::value::ValueType for TextureError {
4108    type Type = Self;
4109}
4110
4111#[cfg(feature = "v4_6")]
4112#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4113unsafe impl<'a> glib::value::FromValue<'a> for TextureError {
4114    type Checker = glib::value::GenericValueTypeChecker<Self>;
4115
4116    #[inline]
4117    unsafe fn from_value(value: &'a glib::Value) -> Self {
4118        skip_assert_initialized!();
4119        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4120    }
4121}
4122
4123#[cfg(feature = "v4_6")]
4124#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4125impl ToValue for TextureError {
4126    #[inline]
4127    fn to_value(&self) -> glib::Value {
4128        let mut value = glib::Value::for_value_type::<Self>();
4129        unsafe {
4130            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4131        }
4132        value
4133    }
4134
4135    #[inline]
4136    fn value_type(&self) -> glib::Type {
4137        Self::static_type()
4138    }
4139}
4140
4141#[cfg(feature = "v4_6")]
4142#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
4143impl From<TextureError> for glib::Value {
4144    #[inline]
4145    fn from(v: TextureError) -> Self {
4146        skip_assert_initialized!();
4147        ToValue::to_value(&v)
4148    }
4149}
4150
4151/// The kind of title bar gesture to emit with
4152/// [`ToplevelExt::titlebar_gesture()`][crate::prelude::ToplevelExt::titlebar_gesture()].
4153#[cfg(feature = "v4_4")]
4154#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4155#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4156#[non_exhaustive]
4157#[doc(alias = "GdkTitlebarGesture")]
4158pub enum TitlebarGesture {
4159    /// double click gesture
4160    #[doc(alias = "GDK_TITLEBAR_GESTURE_DOUBLE_CLICK")]
4161    DoubleClick,
4162    /// right click gesture
4163    #[doc(alias = "GDK_TITLEBAR_GESTURE_RIGHT_CLICK")]
4164    RightClick,
4165    /// middle click gesture
4166    #[doc(alias = "GDK_TITLEBAR_GESTURE_MIDDLE_CLICK")]
4167    MiddleClick,
4168    #[doc(hidden)]
4169    __Unknown(i32),
4170}
4171
4172#[cfg(feature = "v4_4")]
4173#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4174#[doc(hidden)]
4175impl IntoGlib for TitlebarGesture {
4176    type GlibType = ffi::GdkTitlebarGesture;
4177
4178    #[inline]
4179    fn into_glib(self) -> ffi::GdkTitlebarGesture {
4180        match self {
4181            Self::DoubleClick => ffi::GDK_TITLEBAR_GESTURE_DOUBLE_CLICK,
4182            Self::RightClick => ffi::GDK_TITLEBAR_GESTURE_RIGHT_CLICK,
4183            Self::MiddleClick => ffi::GDK_TITLEBAR_GESTURE_MIDDLE_CLICK,
4184            Self::__Unknown(value) => value,
4185        }
4186    }
4187}
4188
4189#[cfg(feature = "v4_4")]
4190#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4191#[doc(hidden)]
4192impl FromGlib<ffi::GdkTitlebarGesture> for TitlebarGesture {
4193    #[inline]
4194    unsafe fn from_glib(value: ffi::GdkTitlebarGesture) -> Self {
4195        skip_assert_initialized!();
4196
4197        match value {
4198            ffi::GDK_TITLEBAR_GESTURE_DOUBLE_CLICK => Self::DoubleClick,
4199            ffi::GDK_TITLEBAR_GESTURE_RIGHT_CLICK => Self::RightClick,
4200            ffi::GDK_TITLEBAR_GESTURE_MIDDLE_CLICK => Self::MiddleClick,
4201            value => Self::__Unknown(value),
4202        }
4203    }
4204}
4205
4206#[cfg(feature = "v4_4")]
4207#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4208impl StaticType for TitlebarGesture {
4209    #[inline]
4210    #[doc(alias = "gdk_titlebar_gesture_get_type")]
4211    fn static_type() -> glib::Type {
4212        unsafe { from_glib(ffi::gdk_titlebar_gesture_get_type()) }
4213    }
4214}
4215
4216#[cfg(feature = "v4_4")]
4217#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4218impl glib::HasParamSpec for TitlebarGesture {
4219    type ParamSpec = glib::ParamSpecEnum;
4220    type SetValue = Self;
4221    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4222
4223    fn param_spec_builder() -> Self::BuilderFn {
4224        Self::ParamSpec::builder_with_default
4225    }
4226}
4227
4228#[cfg(feature = "v4_4")]
4229#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4230impl glib::value::ValueType for TitlebarGesture {
4231    type Type = Self;
4232}
4233
4234#[cfg(feature = "v4_4")]
4235#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4236unsafe impl<'a> glib::value::FromValue<'a> for TitlebarGesture {
4237    type Checker = glib::value::GenericValueTypeChecker<Self>;
4238
4239    #[inline]
4240    unsafe fn from_value(value: &'a glib::Value) -> Self {
4241        skip_assert_initialized!();
4242        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4243    }
4244}
4245
4246#[cfg(feature = "v4_4")]
4247#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4248impl ToValue for TitlebarGesture {
4249    #[inline]
4250    fn to_value(&self) -> glib::Value {
4251        let mut value = glib::Value::for_value_type::<Self>();
4252        unsafe {
4253            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4254        }
4255        value
4256    }
4257
4258    #[inline]
4259    fn value_type(&self) -> glib::Type {
4260        Self::static_type()
4261    }
4262}
4263
4264#[cfg(feature = "v4_4")]
4265#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4266impl From<TitlebarGesture> for glib::Value {
4267    #[inline]
4268    fn from(v: TitlebarGesture) -> Self {
4269        skip_assert_initialized!();
4270        ToValue::to_value(&v)
4271    }
4272}
4273
4274/// Specifies the current state of a touchpad gesture.
4275///
4276/// All gestures are guaranteed to begin with an event with phase
4277/// [`Begin`][Self::Begin], followed by 0 or several events
4278/// with phase [`Update`][Self::Update].
4279///
4280/// A finished gesture may have 2 possible outcomes, an event with phase
4281/// [`End`][Self::End] will be emitted when the gesture is
4282/// considered successful, this should be used as the hint to perform any
4283/// permanent changes.
4284///
4285/// Cancelled gestures may be so for a variety of reasons, due to hardware
4286/// or the compositor, or due to the gesture recognition layers hinting the
4287/// gesture did not finish resolutely (eg. a 3rd finger being added during
4288/// a pinch gesture). In these cases, the last event will report the phase
4289/// [`Cancel`][Self::Cancel], this should be used as a hint
4290/// to undo any visible/permanent changes that were done throughout the
4291/// progress of the gesture.
4292#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4293#[non_exhaustive]
4294#[doc(alias = "GdkTouchpadGesturePhase")]
4295pub enum TouchpadGesturePhase {
4296    /// The gesture has begun.
4297    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_BEGIN")]
4298    Begin,
4299    /// The gesture has been updated.
4300    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_UPDATE")]
4301    Update,
4302    /// The gesture was finished, changes
4303    ///   should be permanently applied.
4304    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_END")]
4305    End,
4306    /// The gesture was cancelled, all
4307    ///   changes should be undone.
4308    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_CANCEL")]
4309    Cancel,
4310    #[doc(hidden)]
4311    __Unknown(i32),
4312}
4313
4314#[doc(hidden)]
4315impl IntoGlib for TouchpadGesturePhase {
4316    type GlibType = ffi::GdkTouchpadGesturePhase;
4317
4318    #[inline]
4319    fn into_glib(self) -> ffi::GdkTouchpadGesturePhase {
4320        match self {
4321            Self::Begin => ffi::GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
4322            Self::Update => ffi::GDK_TOUCHPAD_GESTURE_PHASE_UPDATE,
4323            Self::End => ffi::GDK_TOUCHPAD_GESTURE_PHASE_END,
4324            Self::Cancel => ffi::GDK_TOUCHPAD_GESTURE_PHASE_CANCEL,
4325            Self::__Unknown(value) => value,
4326        }
4327    }
4328}
4329
4330#[doc(hidden)]
4331impl FromGlib<ffi::GdkTouchpadGesturePhase> for TouchpadGesturePhase {
4332    #[inline]
4333    unsafe fn from_glib(value: ffi::GdkTouchpadGesturePhase) -> Self {
4334        skip_assert_initialized!();
4335
4336        match value {
4337            ffi::GDK_TOUCHPAD_GESTURE_PHASE_BEGIN => Self::Begin,
4338            ffi::GDK_TOUCHPAD_GESTURE_PHASE_UPDATE => Self::Update,
4339            ffi::GDK_TOUCHPAD_GESTURE_PHASE_END => Self::End,
4340            ffi::GDK_TOUCHPAD_GESTURE_PHASE_CANCEL => Self::Cancel,
4341            value => Self::__Unknown(value),
4342        }
4343    }
4344}
4345
4346impl StaticType for TouchpadGesturePhase {
4347    #[inline]
4348    #[doc(alias = "gdk_touchpad_gesture_phase_get_type")]
4349    fn static_type() -> glib::Type {
4350        unsafe { from_glib(ffi::gdk_touchpad_gesture_phase_get_type()) }
4351    }
4352}
4353
4354impl glib::HasParamSpec for TouchpadGesturePhase {
4355    type ParamSpec = glib::ParamSpecEnum;
4356    type SetValue = Self;
4357    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4358
4359    fn param_spec_builder() -> Self::BuilderFn {
4360        Self::ParamSpec::builder_with_default
4361    }
4362}
4363
4364impl glib::value::ValueType for TouchpadGesturePhase {
4365    type Type = Self;
4366}
4367
4368unsafe impl<'a> glib::value::FromValue<'a> for TouchpadGesturePhase {
4369    type Checker = glib::value::GenericValueTypeChecker<Self>;
4370
4371    #[inline]
4372    unsafe fn from_value(value: &'a glib::Value) -> Self {
4373        skip_assert_initialized!();
4374        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4375    }
4376}
4377
4378impl ToValue for TouchpadGesturePhase {
4379    #[inline]
4380    fn to_value(&self) -> glib::Value {
4381        let mut value = glib::Value::for_value_type::<Self>();
4382        unsafe {
4383            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4384        }
4385        value
4386    }
4387
4388    #[inline]
4389    fn value_type(&self) -> glib::Type {
4390        Self::static_type()
4391    }
4392}
4393
4394impl From<TouchpadGesturePhase> for glib::Value {
4395    #[inline]
4396    fn from(v: TouchpadGesturePhase) -> Self {
4397        skip_assert_initialized!();
4398        ToValue::to_value(&v)
4399    }
4400}
4401
4402/// Error enumeration for [`VulkanContext`][crate::VulkanContext].
4403#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4404#[non_exhaustive]
4405#[doc(alias = "GdkVulkanError")]
4406pub enum VulkanError {
4407    /// Vulkan is not supported on this backend or has not been
4408    ///   compiled in.
4409    #[doc(alias = "GDK_VULKAN_ERROR_UNSUPPORTED")]
4410    Unsupported,
4411    /// Vulkan support is not available on this Surface
4412    #[doc(alias = "GDK_VULKAN_ERROR_NOT_AVAILABLE")]
4413    NotAvailable,
4414    #[doc(hidden)]
4415    __Unknown(i32),
4416}
4417
4418#[doc(hidden)]
4419impl IntoGlib for VulkanError {
4420    type GlibType = ffi::GdkVulkanError;
4421
4422    #[inline]
4423    fn into_glib(self) -> ffi::GdkVulkanError {
4424        match self {
4425            Self::Unsupported => ffi::GDK_VULKAN_ERROR_UNSUPPORTED,
4426            Self::NotAvailable => ffi::GDK_VULKAN_ERROR_NOT_AVAILABLE,
4427            Self::__Unknown(value) => value,
4428        }
4429    }
4430}
4431
4432#[doc(hidden)]
4433impl FromGlib<ffi::GdkVulkanError> for VulkanError {
4434    #[inline]
4435    unsafe fn from_glib(value: ffi::GdkVulkanError) -> Self {
4436        skip_assert_initialized!();
4437
4438        match value {
4439            ffi::GDK_VULKAN_ERROR_UNSUPPORTED => Self::Unsupported,
4440            ffi::GDK_VULKAN_ERROR_NOT_AVAILABLE => Self::NotAvailable,
4441            value => Self::__Unknown(value),
4442        }
4443    }
4444}
4445
4446impl glib::error::ErrorDomain for VulkanError {
4447    #[inline]
4448    fn domain() -> glib::Quark {
4449        skip_assert_initialized!();
4450
4451        unsafe { from_glib(ffi::gdk_vulkan_error_quark()) }
4452    }
4453
4454    #[inline]
4455    fn code(self) -> i32 {
4456        self.into_glib()
4457    }
4458
4459    #[inline]
4460    #[allow(clippy::match_single_binding)]
4461    fn from(code: i32) -> Option<Self> {
4462        skip_assert_initialized!();
4463        match unsafe { from_glib(code) } {
4464            value => Some(value),
4465        }
4466    }
4467}
4468
4469impl StaticType for VulkanError {
4470    #[inline]
4471    #[doc(alias = "gdk_vulkan_error_get_type")]
4472    fn static_type() -> glib::Type {
4473        unsafe { from_glib(ffi::gdk_vulkan_error_get_type()) }
4474    }
4475}
4476
4477impl glib::HasParamSpec for VulkanError {
4478    type ParamSpec = glib::ParamSpecEnum;
4479    type SetValue = Self;
4480    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4481
4482    fn param_spec_builder() -> Self::BuilderFn {
4483        Self::ParamSpec::builder_with_default
4484    }
4485}
4486
4487impl glib::value::ValueType for VulkanError {
4488    type Type = Self;
4489}
4490
4491unsafe impl<'a> glib::value::FromValue<'a> for VulkanError {
4492    type Checker = glib::value::GenericValueTypeChecker<Self>;
4493
4494    #[inline]
4495    unsafe fn from_value(value: &'a glib::Value) -> Self {
4496        skip_assert_initialized!();
4497        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4498    }
4499}
4500
4501impl ToValue for VulkanError {
4502    #[inline]
4503    fn to_value(&self) -> glib::Value {
4504        let mut value = glib::Value::for_value_type::<Self>();
4505        unsafe {
4506            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4507        }
4508        value
4509    }
4510
4511    #[inline]
4512    fn value_type(&self) -> glib::Type {
4513        Self::static_type()
4514    }
4515}
4516
4517impl From<VulkanError> for glib::Value {
4518    #[inline]
4519    fn from(v: VulkanError) -> Self {
4520        skip_assert_initialized!();
4521        ToValue::to_value(&v)
4522    }
4523}