Skip to main content

gdk4/auto/
enums.rs

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