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