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/// # A note on naming
1924///
1925/// The format names are roughly modelled after
1926/// [VkFormat](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat).
1927/// A name follows `GDK_MEMORY_<CHANNELS>_<DATA_TYPE>_<SUBSAMPLING> <PREMULTIPLIED>`
1928/// where CHANNELS describe how the RGBA channels are layed out in memory, with an
1929/// X denoting padding. DATA_TYPE is unsigned normalized integer if not present, or
1930/// otherwise FLOAT. The optional SUBSAMPLING defines the subsampling method used.
1931/// The optional ENDIAN term describes the endianness if it is not
1932/// host-endian. Finally, an optional PREMULTIPLIED term indicates that the color
1933/// channels are premultiplied with the alpha value, if it is omitted, the data is
1934/// not premultiplied or there is no alpha channel.
1935///
1936/// The CHANNELS are given as a list of planes seperated by underscores where
1937/// each plane is split into multiple elements describing one or more bytes of memory.
1938/// Each element is given as the list of channels folowed by the amount of bits taken
1939/// up.
1940///
1941/// So the fictional format `RGB565_A8_PREMULTIPLIED` would describe a format with 2
1942/// planes where the first plane is an unsigned 16 bit integer containing the RGB
1943/// channels with 5, 6, and 5 bits respectively while the 2nd plane contains the
1944/// alpha channel as an unisnged 8bit integer.
1945#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
1946#[non_exhaustive]
1947#[doc(alias = "GdkMemoryFormat")]
1948pub enum MemoryFormat {
1949    /// 4 bytes; for blue, green, red, alpha.
1950    ///   The color values are premultiplied with the alpha value.
1951    #[doc(alias = "GDK_MEMORY_B8G8R8A8_PREMULTIPLIED")]
1952    B8g8r8a8Premultiplied,
1953    /// 4 bytes; for alpha, red, green, blue.
1954    ///   The color values are premultiplied with the alpha value.
1955    #[doc(alias = "GDK_MEMORY_A8R8G8B8_PREMULTIPLIED")]
1956    A8r8g8b8Premultiplied,
1957    /// 4 bytes; for red, green, blue, alpha
1958    ///   The color values are premultiplied with the alpha value.
1959    #[doc(alias = "GDK_MEMORY_R8G8B8A8_PREMULTIPLIED")]
1960    R8g8b8a8Premultiplied,
1961    /// 4 bytes; for blue, green, red, alpha.
1962    #[doc(alias = "GDK_MEMORY_B8G8R8A8")]
1963    B8g8r8a8,
1964    /// 4 bytes; for alpha, red, green, blue.
1965    #[doc(alias = "GDK_MEMORY_A8R8G8B8")]
1966    A8r8g8b8,
1967    /// 4 bytes; for red, green, blue, alpha.
1968    #[doc(alias = "GDK_MEMORY_R8G8B8A8")]
1969    R8g8b8a8,
1970    /// 4 bytes; for alpha, blue, green, red.
1971    #[doc(alias = "GDK_MEMORY_A8B8G8R8")]
1972    A8b8g8r8,
1973    /// 3 bytes; for red, green, blue. The data is opaque.
1974    #[doc(alias = "GDK_MEMORY_R8G8B8")]
1975    R8g8b8,
1976    /// 3 bytes; for blue, green, red. The data is opaque.
1977    #[doc(alias = "GDK_MEMORY_B8G8R8")]
1978    B8g8r8,
1979    /// 3 guint16 values; for red, green, blue.
1980    #[cfg(feature = "v4_6")]
1981    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1982    #[doc(alias = "GDK_MEMORY_R16G16B16")]
1983    R16g16b16,
1984    /// 4 guint16 values; for red, green, blue, alpha. The color values are
1985    /// premultiplied with the alpha value.
1986    #[cfg(feature = "v4_6")]
1987    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1988    #[doc(alias = "GDK_MEMORY_R16G16B16A16_PREMULTIPLIED")]
1989    R16g16b16a16Premultiplied,
1990    /// 4 guint16 values; for red, green, blue, alpha.
1991    #[cfg(feature = "v4_6")]
1992    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1993    #[doc(alias = "GDK_MEMORY_R16G16B16A16")]
1994    R16g16b16a16,
1995    /// 3 half-float values; for red, green, blue. The data is opaque.
1996    #[cfg(feature = "v4_6")]
1997    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1998    #[doc(alias = "GDK_MEMORY_R16G16B16_FLOAT")]
1999    R16g16b16Float,
2000    /// 4 half-float values; for red, green, blue and alpha. The color values are
2001    /// premultiplied with the alpha value.
2002    #[cfg(feature = "v4_6")]
2003    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2004    #[doc(alias = "GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED")]
2005    R16g16b16a16FloatPremultiplied,
2006    /// 4 half-float values; for red, green, blue and alpha.
2007    #[cfg(feature = "v4_6")]
2008    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2009    #[doc(alias = "GDK_MEMORY_R16G16B16A16_FLOAT")]
2010    R16g16b16a16Float,
2011    /// 3 float values; for red, green, blue.
2012    #[cfg(feature = "v4_6")]
2013    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2014    #[doc(alias = "GDK_MEMORY_R32G32B32_FLOAT")]
2015    R32g32b32Float,
2016    /// 4 float values; for red, green, blue and alpha. The color values are
2017    /// premultiplied with the alpha value.
2018    #[cfg(feature = "v4_6")]
2019    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2020    #[doc(alias = "GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED")]
2021    R32g32b32a32FloatPremultiplied,
2022    /// 4 float values; for red, green, blue and alpha.
2023    #[cfg(feature = "v4_6")]
2024    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2025    #[doc(alias = "GDK_MEMORY_R32G32B32A32_FLOAT")]
2026    R32g32b32a32Float,
2027    /// 2 bytes; for grayscale, alpha. The color values are premultiplied with the
2028    /// alpha value.
2029    #[cfg(feature = "v4_12")]
2030    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2031    #[doc(alias = "GDK_MEMORY_G8A8_PREMULTIPLIED")]
2032    G8a8Premultiplied,
2033    /// 2 bytes; for grayscale, alpha.
2034    #[cfg(feature = "v4_12")]
2035    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2036    #[doc(alias = "GDK_MEMORY_G8A8")]
2037    G8a8,
2038    /// One byte; for grayscale. The data is opaque.
2039    #[cfg(feature = "v4_12")]
2040    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2041    #[doc(alias = "GDK_MEMORY_G8")]
2042    G8,
2043    /// 2 guint16 values; for grayscale, alpha. The color values are premultiplied
2044    /// with the alpha value.
2045    #[cfg(feature = "v4_12")]
2046    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2047    #[doc(alias = "GDK_MEMORY_G16A16_PREMULTIPLIED")]
2048    G16a16Premultiplied,
2049    /// 2 guint16 values; for grayscale, alpha.
2050    #[cfg(feature = "v4_12")]
2051    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2052    #[doc(alias = "GDK_MEMORY_G16A16")]
2053    G16a16,
2054    /// One guint16 value; for grayscale. The data is opaque.
2055    #[cfg(feature = "v4_12")]
2056    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2057    #[doc(alias = "GDK_MEMORY_G16")]
2058    G16,
2059    /// One byte; for alpha.
2060    #[cfg(feature = "v4_12")]
2061    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2062    #[doc(alias = "GDK_MEMORY_A8")]
2063    A8,
2064    /// One guint16 value; for alpha.
2065    #[cfg(feature = "v4_12")]
2066    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2067    #[doc(alias = "GDK_MEMORY_A16")]
2068    A16,
2069    /// One half-float value; for alpha.
2070    #[cfg(feature = "v4_12")]
2071    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2072    #[doc(alias = "GDK_MEMORY_A16_FLOAT")]
2073    A16Float,
2074    /// One float value; for alpha.
2075    #[cfg(feature = "v4_12")]
2076    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
2077    #[doc(alias = "GDK_MEMORY_A32_FLOAT")]
2078    A32Float,
2079    /// 4 bytes; for alpha, blue, green, red, The color values are premultiplied with
2080    /// the alpha value.
2081    #[cfg(feature = "v4_14")]
2082    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2083    #[doc(alias = "GDK_MEMORY_A8B8G8R8_PREMULTIPLIED")]
2084    A8b8g8r8Premultiplied,
2085    /// 4 bytes; for blue, green, red, unused.
2086    #[cfg(feature = "v4_14")]
2087    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2088    #[doc(alias = "GDK_MEMORY_B8G8R8X8")]
2089    B8g8r8x8,
2090    /// 4 bytes; for unused, red, green, blue.
2091    #[cfg(feature = "v4_14")]
2092    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2093    #[doc(alias = "GDK_MEMORY_X8R8G8B8")]
2094    X8r8g8b8,
2095    /// 4 bytes; for red, green, blue, unused.
2096    #[cfg(feature = "v4_14")]
2097    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2098    #[doc(alias = "GDK_MEMORY_R8G8B8X8")]
2099    R8g8b8x8,
2100    /// 4 bytes; for unused, blue, green, red.
2101    #[cfg(feature = "v4_14")]
2102    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
2103    #[doc(alias = "GDK_MEMORY_X8B8G8R8")]
2104    X8b8g8r8,
2105    /// Multiplane format with 2 planes.
2106    ///
2107    /// The first plane contains the first channel, usually containing
2108    /// luma values.
2109    /// The second plane with interleaved chroma values, Cb followed by Cr.
2110    /// Subsampled in both the X and Y direction.
2111    ///
2112    /// Commonly known by the fourcc "NV12".
2113    #[cfg(feature = "v4_20")]
2114    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2115    #[doc(alias = "GDK_MEMORY_G8_B8R8_420")]
2116    G8B8r8420,
2117    /// Multiplane format with 2 planes.
2118    ///
2119    /// The first plane contains the first channel, usually containing
2120    /// luma values.
2121    /// The second plane with interleaved chroma values, Cr followed by Cb.
2122    /// Subsampled in both the X and Y direction.
2123    ///
2124    /// Commonly known by the fourcc "NV21".
2125    #[cfg(feature = "v4_20")]
2126    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2127    #[doc(alias = "GDK_MEMORY_G8_R8B8_420")]
2128    G8R8b8420,
2129    /// Multiplane format with 2 planes.
2130    ///
2131    /// The first plane contains the first channel, usually containing
2132    /// luma values.
2133    /// The second plane with interleaved chroma values, Cb followed by Cr.
2134    /// Subsampled in the X direction.
2135    ///
2136    /// Commonly known by the fourcc "NV16".
2137    #[cfg(feature = "v4_20")]
2138    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2139    #[doc(alias = "GDK_MEMORY_G8_B8R8_422")]
2140    G8B8r8422,
2141    /// Multiplane format with 2 planes.
2142    ///
2143    /// The first plane contains the first channel, usually containing
2144    /// luma values.
2145    /// The second plane with interleaved chroma values, Cr followed by Cb.
2146    /// Subsampled in the X direction.
2147    ///
2148    /// Commonly known by the fourcc "NV61".
2149    #[cfg(feature = "v4_20")]
2150    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2151    #[doc(alias = "GDK_MEMORY_G8_R8B8_422")]
2152    G8R8b8422,
2153    /// Multiplane format with 2 planes.
2154    ///
2155    /// The first plane contains the first channel, usually containing
2156    /// luma values.
2157    /// The second plane with interleaved chroma values, Cb followed by Cr.
2158    /// This format is not subsampled.
2159    ///
2160    /// Commonly known by the fourcc "NV24".
2161    #[cfg(feature = "v4_20")]
2162    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2163    #[doc(alias = "GDK_MEMORY_G8_B8R8_444")]
2164    G8B8r8444,
2165    /// Multiplane format with 2 planes.
2166    ///
2167    /// The first plane contains the first channel, usually containing
2168    /// luma values.
2169    /// The second plane with interleaved chroma values, Cr followed by Cb.
2170    /// This format is not subsampled.
2171    ///
2172    /// Commonly known by the fourcc "NV42".
2173    #[cfg(feature = "v4_20")]
2174    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2175    #[doc(alias = "GDK_MEMORY_G8_R8B8_444")]
2176    G8R8b8444,
2177    /// Multiplane format with 2 planes.
2178    ///
2179    /// Each channel is a 16 bit integer, but only the highest 10 bits are used.
2180    ///
2181    /// The first plane contains the first channel, usually containing
2182    /// luma values.
2183    /// The second plane with interleaved chroma values, Cr followed by Cb.
2184    /// This format is not subsampled.
2185    ///
2186    /// Commonly known by the fourcc "P010".
2187    #[cfg(feature = "v4_20")]
2188    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2189    #[doc(alias = "GDK_MEMORY_G10X6_B10X6R10X6_420")]
2190    G10x6B10x6r10x6420,
2191    /// Multiplane format with 2 planes.
2192    ///
2193    /// Each channel is a 16 bit integer, but only the highest 10 bits are used.
2194    ///
2195    /// The first plane contains the first channel, usually containing
2196    /// luma values.
2197    /// The second plane with interleaved chroma values, Cr followed by Cb.
2198    /// This format is not subsampled.
2199    ///
2200    /// Commonly known by the fourcc "P012".
2201    #[cfg(feature = "v4_20")]
2202    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2203    #[doc(alias = "GDK_MEMORY_G12X4_B12X4R12X4_420")]
2204    G12x4B12x4r12x4420,
2205    /// Multiplane format with 2 planes.
2206    ///
2207    /// Each channel is a 16 bit integer.
2208    ///
2209    /// The first plane contains the first channel, usually containing
2210    /// luma values.
2211    /// The second plane with interleaved chroma values, Cr followed by Cb.
2212    /// This format is not subsampled.
2213    ///
2214    /// Commonly known by the fourcc "P016".
2215    #[cfg(feature = "v4_20")]
2216    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2217    #[doc(alias = "GDK_MEMORY_G16_B16R16_420")]
2218    G16B16r16420,
2219    /// Multiplane format with 3 planes.
2220    ///
2221    /// Each channel is a 8 bit integer.
2222    ///
2223    /// The first plane usually contains the luma channel. It is mapped
2224    /// into the 2nd channel.
2225    ///
2226    /// The second plane usually contains the first chroma chanel.
2227    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2228    /// mapped into the 3rd channel.
2229    ///
2230    /// The third plane usually contains the second chroma channel.
2231    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2232    /// mapped into the 1st channel.
2233    ///
2234    /// Commonly known by the fourcc "YUV410".
2235    #[cfg(feature = "v4_20")]
2236    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2237    #[doc(alias = "GDK_MEMORY_G8_B8_R8_410")]
2238    G8B8R8410,
2239    /// Multiplane format with 3 planes.
2240    ///
2241    /// Each channel is a 8 bit integer.
2242    ///
2243    /// The first plane usually contains the luma channel. It is mapped
2244    /// into the 2nd channel.
2245    ///
2246    /// The second plane usually contains the second chroma chanel.
2247    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2248    /// mapped into the 1st channel.
2249    ///
2250    /// The third plane usually contains the first chroma channel.
2251    /// Subsampled in both the X and Y direction with 4:1 ratio. It is
2252    /// mapped into the 3rd channel.
2253    ///
2254    /// Commonly known by the fourcc "YVU410".
2255    #[cfg(feature = "v4_20")]
2256    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2257    #[doc(alias = "GDK_MEMORY_G8_R8_B8_410")]
2258    G8R8B8410,
2259    /// Multiplane format with 3 planes.
2260    ///
2261    /// Each channel is a 8 bit integer.
2262    ///
2263    /// The first plane usually contains the luma channel. It is mapped
2264    /// into the 2nd channel.
2265    ///
2266    /// The second plane usually contains the first chroma chanel.
2267    /// Subsampled in the X direction with 4:1 ratio. It is
2268    /// mapped into the 3rd channel.
2269    ///
2270    /// The third plane usually contains the second chroma channel.
2271    /// Subsampled in the X direction with 4:1 ratio. It is
2272    /// mapped into the 1st channel.
2273    ///
2274    /// Commonly known by the fourcc "YUV411".
2275    #[cfg(feature = "v4_20")]
2276    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2277    #[doc(alias = "GDK_MEMORY_G8_B8_R8_411")]
2278    G8B8R8411,
2279    /// Multiplane format with 3 planes.
2280    ///
2281    /// Each channel is a 8 bit integer.
2282    ///
2283    /// The first plane usually contains the luma channel. It is mapped
2284    /// into the 2nd channel.
2285    ///
2286    /// The second plane usually contains the second chroma chanel.
2287    /// Subsampled in the X direction with 4:1 ratio. It is
2288    /// mapped into the 1st channel.
2289    ///
2290    /// The third plane usually contains the first chroma channel.
2291    /// Subsampled in the X direction with 4:1 ratio. It is
2292    /// mapped into the 3rd channel.
2293    ///
2294    /// Commonly known by the fourcc "YVU411".
2295    #[cfg(feature = "v4_20")]
2296    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2297    #[doc(alias = "GDK_MEMORY_G8_R8_B8_411")]
2298    G8R8B8411,
2299    /// Multiplane format with 3 planes.
2300    ///
2301    /// Each channel is a 8 bit integer.
2302    ///
2303    /// The first plane usually contains the luma channel. It is mapped
2304    /// into the 2nd channel.
2305    ///
2306    /// The second plane usually contains the first chroma chanel.
2307    /// Subsampled in both the X and Y direction. It is mapped into the
2308    /// 3rd channel.
2309    ///
2310    /// The third plane usually contains the second chroma channel.
2311    /// Subsampled in both the X and Y direction. It is mapped into the
2312    /// 1st channel.
2313    ///
2314    /// Commonly known by the fourcc "YUV420".
2315    #[cfg(feature = "v4_20")]
2316    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2317    #[doc(alias = "GDK_MEMORY_G8_B8_R8_420")]
2318    G8B8R8420,
2319    /// Multiplane format with 3 planes.
2320    ///
2321    /// Each channel is a 8 bit integer.
2322    ///
2323    /// The first plane usually contains the luma channel. It is mapped
2324    /// into the 2nd channel.
2325    ///
2326    /// The second plane usually contains the second chroma chanel.
2327    /// Subsampled in both the X and Y direction. It is mapped into the
2328    /// 1st channel.
2329    ///
2330    /// The third plane usually contains the first chroma channel.
2331    /// Subsampled in both the X and Y direction. It is mapped into the
2332    /// 3rd channel.
2333    ///
2334    /// Commonly known by the fourcc "YVU420".
2335    #[cfg(feature = "v4_20")]
2336    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2337    #[doc(alias = "GDK_MEMORY_G8_R8_B8_420")]
2338    G8R8B8420,
2339    /// Multiplane format with 3 planes.
2340    ///
2341    /// Each channel is a 8 bit integer.
2342    ///
2343    /// The first plane usually contains the luma channel. It is mapped
2344    /// into the 2nd channel.
2345    ///
2346    /// The second plane usually contains the first chroma chanel.
2347    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2348    ///
2349    /// The third plane usually contains the second chroma channel.
2350    /// Subsampled in the X direction. It is mapped into the 1st channel.
2351    ///
2352    /// Commonly known by the fourcc "YUV422".
2353    #[cfg(feature = "v4_20")]
2354    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2355    #[doc(alias = "GDK_MEMORY_G8_B8_R8_422")]
2356    G8B8R8422,
2357    /// Multiplane format with 3 planes.
2358    ///
2359    /// Each channel is a 8 bit integer.
2360    ///
2361    /// The first plane usually contains the luma channel. It is mapped
2362    /// into the 2nd channel.
2363    ///
2364    /// The second plane usually contains the second chroma chanel.
2365    /// Subsampled in the X direction. It is mapped into the 1st channel.
2366    ///
2367    /// The third plane usually contains the first chroma channel.
2368    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2369    ///
2370    /// Commonly known by the fourcc "YVU422".
2371    #[cfg(feature = "v4_20")]
2372    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2373    #[doc(alias = "GDK_MEMORY_G8_R8_B8_422")]
2374    G8R8B8422,
2375    /// Multiplane format with 3 planes.
2376    ///
2377    /// Each channel is a 8 bit integer.
2378    ///
2379    /// The first plane usually contains the luma channel. It is mapped
2380    /// into the 2nd channel.
2381    ///
2382    /// The second plane usually contains the first chroma chanel. It is
2383    /// mapped into the 3rd channel.
2384    ///
2385    /// The third plane usually contains the second chroma channel. It is
2386    /// mapped into the 1st channel.
2387    ///
2388    /// Commonly known by the fourcc "YUV444".
2389    #[cfg(feature = "v4_20")]
2390    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2391    #[doc(alias = "GDK_MEMORY_G8_B8_R8_444")]
2392    G8B8R8444,
2393    /// Multiplane format with 3 planes.
2394    ///
2395    /// Each channel is a 8 bit integer.
2396    ///
2397    /// The first plane usually contains the luma channel. It is mapped
2398    /// into the 2nd channel.
2399    ///
2400    /// The second plane usually contains the second chroma chanel.
2401    /// Subsampled in the X direction. It is mapped into the 1st channel.
2402    ///
2403    /// The third plane usually contains the first chroma channel.
2404    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2405    ///
2406    /// Commonly known by the fourcc "YVU444".
2407    #[cfg(feature = "v4_20")]
2408    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2409    #[doc(alias = "GDK_MEMORY_G8_R8_B8_444")]
2410    G8R8B8444,
2411    /// Packed format with subsampled channels.
2412    ///
2413    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2414    /// are subsampled and interleaved with the green/luma channel.
2415    ///
2416    /// Each block contains 2 pixels, so the width must be a multiple of
2417    /// 2.
2418    ///
2419    /// Commonly known by the fourcc "YUYV".
2420    #[cfg(feature = "v4_20")]
2421    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2422    #[doc(alias = "GDK_MEMORY_G8B8G8R8_422")]
2423    G8b8g8r8422,
2424    /// Packed format with subsampled channels.
2425    ///
2426    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2427    /// are subsampled and interleaved with the green/luma channel.
2428    ///
2429    /// Each block contains 2 pixels, so the width must be a multiple of
2430    /// 2.
2431    ///
2432    /// Commonly known by the fourcc "YVYU".
2433    #[cfg(feature = "v4_20")]
2434    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2435    #[doc(alias = "GDK_MEMORY_G8R8G8B8_422")]
2436    G8r8g8b8422,
2437    /// Packed format with subsampled channels.
2438    ///
2439    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2440    /// are subsampled and interleaved with the green/luma channel.
2441    ///
2442    /// Each block contains 2 pixels, so the width must be a multiple of
2443    /// 2.
2444    ///
2445    /// Commonly known by the fourcc "VYUY".
2446    #[cfg(feature = "v4_20")]
2447    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2448    #[doc(alias = "GDK_MEMORY_R8G8B8G8_422")]
2449    R8g8b8g8422,
2450    /// Packed format with subsampled channels.
2451    ///
2452    /// Each channel is a 8 bit integer. The red and blue/chroma channels
2453    /// are subsampled and interleaved with the green/luma channel.
2454    ///
2455    /// Each block contains 2 pixels, so the width must be a multiple of
2456    /// 2.
2457    ///
2458    /// Commonly known by the fourcc "UYVY".
2459    #[cfg(feature = "v4_20")]
2460    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2461    #[doc(alias = "GDK_MEMORY_B8G8R8G8_422")]
2462    B8g8r8g8422,
2463    /// Multiplane format with 3 planes.
2464    ///
2465    /// Each channel is a 16 bit integer.
2466    ///
2467    /// Only the 10 lower bits are used. The remaining ones must be set to 0 by the
2468    /// producer.
2469    ///
2470    /// The first plane usually contains the luma channel. It is mapped
2471    /// into the 2nd channel.
2472    ///
2473    /// The second plane usually contains the first chroma chanel.
2474    /// Subsampled in both the X and Y direction. It is mapped into the
2475    /// 3rd channel.
2476    ///
2477    /// The third plane usually contains the second chroma channel.
2478    /// Subsampled in both the X and Y direction. It is mapped into the
2479    /// 1st channel.
2480    ///
2481    /// Commonly known by the fourcc "S010".
2482    #[cfg(feature = "v4_20")]
2483    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2484    #[doc(alias = "GDK_MEMORY_X6G10_X6B10_X6R10_420")]
2485    X6g10X6b10X6r10420,
2486    /// Multiplane format with 3 planes.
2487    ///
2488    /// Each channel is a 16 bit integer.
2489    ///
2490    /// Only the 10 lower bits are used. The remaining ones must be set to 0 by the
2491    /// producer.
2492    ///
2493    /// The first plane usually contains the luma channel. It is mapped
2494    /// into the 2nd channel.
2495    ///
2496    /// The second plane usually contains the first chroma chanel.
2497    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2498    ///
2499    /// The third plane usually contains the second chroma channel.
2500    /// Subsampled in the X direction. It is mapped into the 1st channel.
2501    ///
2502    /// Commonly known by the fourcc "S210".
2503    #[cfg(feature = "v4_20")]
2504    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2505    #[doc(alias = "GDK_MEMORY_X6G10_X6B10_X6R10_422")]
2506    X6g10X6b10X6r10422,
2507    /// Multiplane format with 3 planes.
2508    ///
2509    /// Each channel is a 16 bit integer.
2510    ///
2511    /// Only the 10 lower bits are used. The remaining ones must be set to 0 by the
2512    /// producer.
2513    ///
2514    /// The first plane usually contains the luma channel. It is mapped
2515    /// into the 2nd channel.
2516    ///
2517    /// The second plane usually contains the first chroma chanel. It is
2518    /// mapped into the 3rd channel.
2519    ///
2520    /// The third plane usually contains the second chroma channel. It is
2521    /// mapped into the 1st channel.
2522    ///
2523    /// Commonly known by the fourcc "S410".
2524    #[cfg(feature = "v4_20")]
2525    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2526    #[doc(alias = "GDK_MEMORY_X6G10_X6B10_X6R10_444")]
2527    X6g10X6b10X6r10444,
2528    /// Multiplane format with 3 planes.
2529    ///
2530    /// Each channel is a 16 bit integer.
2531    ///
2532    /// Only the 12 lower bits are used. The remaining ones must be set to 0 by the
2533    /// producer.
2534    ///
2535    /// The first plane usually contains the luma channel. It is mapped
2536    /// into the 2nd channel.
2537    ///
2538    /// The second plane usually contains the first chroma chanel.
2539    /// Subsampled in both the X and Y direction. It is mapped into the
2540    /// 3rd channel.
2541    ///
2542    /// The third plane usually contains the second chroma channel.
2543    /// Subsampled in both the X and Y direction. It is mapped into the
2544    /// 1st channel.
2545    ///
2546    /// Commonly known by the fourcc "S012".
2547    #[cfg(feature = "v4_20")]
2548    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2549    #[doc(alias = "GDK_MEMORY_X4G12_X4B12_X4R12_420")]
2550    X4g12X4b12X4r12420,
2551    /// Multiplane format with 3 planes.
2552    ///
2553    /// Each channel is a 16 bit integer.
2554    ///
2555    /// Only the 12 lower bits are used. The remaining ones must be set to 0 by the
2556    /// producer.
2557    ///
2558    /// The first plane usually contains the luma channel. It is mapped
2559    /// into the 2nd channel.
2560    ///
2561    /// The second plane usually contains the first chroma chanel.
2562    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2563    ///
2564    /// The third plane usually contains the second chroma channel.
2565    /// Subsampled in the X direction. It is mapped into the 1st channel.
2566    ///
2567    /// Commonly known by the fourcc "S212".
2568    #[cfg(feature = "v4_20")]
2569    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2570    #[doc(alias = "GDK_MEMORY_X4G12_X4B12_X4R12_422")]
2571    X4g12X4b12X4r12422,
2572    /// Multiplane format with 3 planes.
2573    ///
2574    /// Each channel is a 16 bit integer.
2575    ///
2576    /// Only the 12 lower bits are used. The remaining ones must be set to 0 by the
2577    /// producer.
2578    ///
2579    /// The first plane usually contains the luma channel. It is mapped
2580    /// into the 2nd channel.
2581    ///
2582    /// The second plane usually contains the first chroma chanel. It is
2583    /// mapped into the 3rd channel.
2584    ///
2585    /// The third plane usually contains the second chroma channel. It is
2586    /// mapped into the 1st channel.
2587    ///
2588    /// Commonly known by the fourcc "S412".
2589    #[cfg(feature = "v4_20")]
2590    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2591    #[doc(alias = "GDK_MEMORY_X4G12_X4B12_X4R12_444")]
2592    X4g12X4b12X4r12444,
2593    /// Multiplane format with 3 planes.
2594    ///
2595    /// Each channel is a 16 bit integer.
2596    ///
2597    /// The first plane usually contains the luma channel. It is mapped
2598    /// into the 2nd channel.
2599    ///
2600    /// The second plane usually contains the first chroma chanel.
2601    /// Subsampled in both the X and Y direction. It is mapped into the
2602    /// 3rd channel.
2603    ///
2604    /// The third plane usually contains the second chroma channel.
2605    /// Subsampled in both the X and Y direction. It is mapped into the
2606    /// 1st channel.
2607    ///
2608    /// Commonly known by the fourcc "S016".
2609    #[cfg(feature = "v4_20")]
2610    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2611    #[doc(alias = "GDK_MEMORY_G16_B16_R16_420")]
2612    G16B16R16420,
2613    /// Multiplane format with 3 planes.
2614    ///
2615    /// Each channel is a 16 bit integer.
2616    ///
2617    /// The first plane usually contains the luma channel. It is mapped
2618    /// into the 2nd channel.
2619    ///
2620    /// The second plane usually contains the first chroma chanel.
2621    /// Subsampled in the X direction. It is mapped into the 3rd channel.
2622    ///
2623    /// The third plane usually contains the second chroma channel.
2624    /// Subsampled in the X direction. It is mapped into the 1st channel.
2625    ///
2626    /// Commonly known by the fourcc "S216".
2627    #[cfg(feature = "v4_20")]
2628    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2629    #[doc(alias = "GDK_MEMORY_G16_B16_R16_422")]
2630    G16B16R16422,
2631    /// Multiplane format with 3 planes.
2632    ///
2633    /// Each channel is a 16 bit integer.
2634    ///
2635    /// The first plane usually contains the luma channel. It is mapped
2636    /// into the 2nd channel.
2637    ///
2638    /// The second plane usually contains the first chroma chanel. It is
2639    /// mapped into the 3rd channel.
2640    ///
2641    /// The third plane usually contains the second chroma channel. It is
2642    /// mapped into the 1st channel.
2643    ///
2644    /// Commonly known by the fourcc "S416".
2645    #[cfg(feature = "v4_20")]
2646    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2647    #[doc(alias = "GDK_MEMORY_G16_B16_R16_444")]
2648    G16B16R16444,
2649    /// 4 bytes per pixel
2650    ///
2651    /// Bits 31..30 contain the alpha channel, 29..20 red, 19..10 green
2652    /// and 9..0 blue.
2653    ///
2654    /// The color values are premultiplied with the alpha value.
2655    #[cfg(feature = "v4_24")]
2656    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2657    #[doc(alias = "GDK_MEMORY_ARGB2101010_PREMULTIPLIED")]
2658    Argb2101010Premultiplied,
2659    /// 4 bytes per pixel
2660    ///
2661    /// Bits 31..30 contain the alpha channel, 29..20 red, 19..10 green
2662    /// and 9..0 blue.
2663    #[cfg(feature = "v4_24")]
2664    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2665    #[doc(alias = "GDK_MEMORY_ARGB2101010")]
2666    Argb2101010,
2667    /// 4 bytes per pixel
2668    ///
2669    /// Bits 31..30 are padding, bits 29..20 contain red, 19..10 green
2670    /// and 9..0 blue.
2671    ///
2672    /// The format is opaque.
2673    #[cfg(feature = "v4_24")]
2674    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2675    #[doc(alias = "GDK_MEMORY_XRGB2101010")]
2676    Xrgb2101010,
2677    #[doc(alias = "GDK_MEMORY_ABGR2101010_PREMULTIPLIED")]
2678    Abgr2101010Premultiplied,
2679    /// 4 bytes per pixel
2680    ///
2681    /// Bits 31..30 contain the alpha channel, 29..20 blue, 19..10 green
2682    /// and 9..0 red.
2683    #[cfg(feature = "v4_24")]
2684    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2685    #[doc(alias = "GDK_MEMORY_ABGR2101010")]
2686    Abgr2101010,
2687    /// 4 bytes per pixel
2688    ///
2689    /// Bits 31..30 are padding, bits 29..20 contain blue, 19..10 green
2690    /// and 9..0 red.
2691    ///
2692    /// The format is opaque.
2693    #[cfg(feature = "v4_24")]
2694    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2695    #[doc(alias = "GDK_MEMORY_XBGR2101010")]
2696    Xbgr2101010,
2697    #[doc(hidden)]
2698    __Unknown(i32),
2699}
2700
2701#[doc(hidden)]
2702impl IntoGlib for MemoryFormat {
2703    type GlibType = ffi::GdkMemoryFormat;
2704
2705    fn into_glib(self) -> ffi::GdkMemoryFormat {
2706        match self {
2707            Self::B8g8r8a8Premultiplied => ffi::GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
2708            Self::A8r8g8b8Premultiplied => ffi::GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
2709            Self::R8g8b8a8Premultiplied => ffi::GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
2710            Self::B8g8r8a8 => ffi::GDK_MEMORY_B8G8R8A8,
2711            Self::A8r8g8b8 => ffi::GDK_MEMORY_A8R8G8B8,
2712            Self::R8g8b8a8 => ffi::GDK_MEMORY_R8G8B8A8,
2713            Self::A8b8g8r8 => ffi::GDK_MEMORY_A8B8G8R8,
2714            Self::R8g8b8 => ffi::GDK_MEMORY_R8G8B8,
2715            Self::B8g8r8 => ffi::GDK_MEMORY_B8G8R8,
2716            #[cfg(feature = "v4_6")]
2717            Self::R16g16b16 => ffi::GDK_MEMORY_R16G16B16,
2718            #[cfg(feature = "v4_6")]
2719            Self::R16g16b16a16Premultiplied => ffi::GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
2720            #[cfg(feature = "v4_6")]
2721            Self::R16g16b16a16 => ffi::GDK_MEMORY_R16G16B16A16,
2722            #[cfg(feature = "v4_6")]
2723            Self::R16g16b16Float => ffi::GDK_MEMORY_R16G16B16_FLOAT,
2724            #[cfg(feature = "v4_6")]
2725            Self::R16g16b16a16FloatPremultiplied => {
2726                ffi::GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED
2727            }
2728            #[cfg(feature = "v4_6")]
2729            Self::R16g16b16a16Float => ffi::GDK_MEMORY_R16G16B16A16_FLOAT,
2730            #[cfg(feature = "v4_6")]
2731            Self::R32g32b32Float => ffi::GDK_MEMORY_R32G32B32_FLOAT,
2732            #[cfg(feature = "v4_6")]
2733            Self::R32g32b32a32FloatPremultiplied => {
2734                ffi::GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED
2735            }
2736            #[cfg(feature = "v4_6")]
2737            Self::R32g32b32a32Float => ffi::GDK_MEMORY_R32G32B32A32_FLOAT,
2738            #[cfg(feature = "v4_12")]
2739            Self::G8a8Premultiplied => ffi::GDK_MEMORY_G8A8_PREMULTIPLIED,
2740            #[cfg(feature = "v4_12")]
2741            Self::G8a8 => ffi::GDK_MEMORY_G8A8,
2742            #[cfg(feature = "v4_12")]
2743            Self::G8 => ffi::GDK_MEMORY_G8,
2744            #[cfg(feature = "v4_12")]
2745            Self::G16a16Premultiplied => ffi::GDK_MEMORY_G16A16_PREMULTIPLIED,
2746            #[cfg(feature = "v4_12")]
2747            Self::G16a16 => ffi::GDK_MEMORY_G16A16,
2748            #[cfg(feature = "v4_12")]
2749            Self::G16 => ffi::GDK_MEMORY_G16,
2750            #[cfg(feature = "v4_12")]
2751            Self::A8 => ffi::GDK_MEMORY_A8,
2752            #[cfg(feature = "v4_12")]
2753            Self::A16 => ffi::GDK_MEMORY_A16,
2754            #[cfg(feature = "v4_12")]
2755            Self::A16Float => ffi::GDK_MEMORY_A16_FLOAT,
2756            #[cfg(feature = "v4_12")]
2757            Self::A32Float => ffi::GDK_MEMORY_A32_FLOAT,
2758            #[cfg(feature = "v4_14")]
2759            Self::A8b8g8r8Premultiplied => ffi::GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
2760            #[cfg(feature = "v4_14")]
2761            Self::B8g8r8x8 => ffi::GDK_MEMORY_B8G8R8X8,
2762            #[cfg(feature = "v4_14")]
2763            Self::X8r8g8b8 => ffi::GDK_MEMORY_X8R8G8B8,
2764            #[cfg(feature = "v4_14")]
2765            Self::R8g8b8x8 => ffi::GDK_MEMORY_R8G8B8X8,
2766            #[cfg(feature = "v4_14")]
2767            Self::X8b8g8r8 => ffi::GDK_MEMORY_X8B8G8R8,
2768            #[cfg(feature = "v4_20")]
2769            Self::G8B8r8420 => ffi::GDK_MEMORY_G8_B8R8_420,
2770            #[cfg(feature = "v4_20")]
2771            Self::G8R8b8420 => ffi::GDK_MEMORY_G8_R8B8_420,
2772            #[cfg(feature = "v4_20")]
2773            Self::G8B8r8422 => ffi::GDK_MEMORY_G8_B8R8_422,
2774            #[cfg(feature = "v4_20")]
2775            Self::G8R8b8422 => ffi::GDK_MEMORY_G8_R8B8_422,
2776            #[cfg(feature = "v4_20")]
2777            Self::G8B8r8444 => ffi::GDK_MEMORY_G8_B8R8_444,
2778            #[cfg(feature = "v4_20")]
2779            Self::G8R8b8444 => ffi::GDK_MEMORY_G8_R8B8_444,
2780            #[cfg(feature = "v4_20")]
2781            Self::G10x6B10x6r10x6420 => ffi::GDK_MEMORY_G10X6_B10X6R10X6_420,
2782            #[cfg(feature = "v4_20")]
2783            Self::G12x4B12x4r12x4420 => ffi::GDK_MEMORY_G12X4_B12X4R12X4_420,
2784            #[cfg(feature = "v4_20")]
2785            Self::G16B16r16420 => ffi::GDK_MEMORY_G16_B16R16_420,
2786            #[cfg(feature = "v4_20")]
2787            Self::G8B8R8410 => ffi::GDK_MEMORY_G8_B8_R8_410,
2788            #[cfg(feature = "v4_20")]
2789            Self::G8R8B8410 => ffi::GDK_MEMORY_G8_R8_B8_410,
2790            #[cfg(feature = "v4_20")]
2791            Self::G8B8R8411 => ffi::GDK_MEMORY_G8_B8_R8_411,
2792            #[cfg(feature = "v4_20")]
2793            Self::G8R8B8411 => ffi::GDK_MEMORY_G8_R8_B8_411,
2794            #[cfg(feature = "v4_20")]
2795            Self::G8B8R8420 => ffi::GDK_MEMORY_G8_B8_R8_420,
2796            #[cfg(feature = "v4_20")]
2797            Self::G8R8B8420 => ffi::GDK_MEMORY_G8_R8_B8_420,
2798            #[cfg(feature = "v4_20")]
2799            Self::G8B8R8422 => ffi::GDK_MEMORY_G8_B8_R8_422,
2800            #[cfg(feature = "v4_20")]
2801            Self::G8R8B8422 => ffi::GDK_MEMORY_G8_R8_B8_422,
2802            #[cfg(feature = "v4_20")]
2803            Self::G8B8R8444 => ffi::GDK_MEMORY_G8_B8_R8_444,
2804            #[cfg(feature = "v4_20")]
2805            Self::G8R8B8444 => ffi::GDK_MEMORY_G8_R8_B8_444,
2806            #[cfg(feature = "v4_20")]
2807            Self::G8b8g8r8422 => ffi::GDK_MEMORY_G8B8G8R8_422,
2808            #[cfg(feature = "v4_20")]
2809            Self::G8r8g8b8422 => ffi::GDK_MEMORY_G8R8G8B8_422,
2810            #[cfg(feature = "v4_20")]
2811            Self::R8g8b8g8422 => ffi::GDK_MEMORY_R8G8B8G8_422,
2812            #[cfg(feature = "v4_20")]
2813            Self::B8g8r8g8422 => ffi::GDK_MEMORY_B8G8R8G8_422,
2814            #[cfg(feature = "v4_20")]
2815            Self::X6g10X6b10X6r10420 => ffi::GDK_MEMORY_X6G10_X6B10_X6R10_420,
2816            #[cfg(feature = "v4_20")]
2817            Self::X6g10X6b10X6r10422 => ffi::GDK_MEMORY_X6G10_X6B10_X6R10_422,
2818            #[cfg(feature = "v4_20")]
2819            Self::X6g10X6b10X6r10444 => ffi::GDK_MEMORY_X6G10_X6B10_X6R10_444,
2820            #[cfg(feature = "v4_20")]
2821            Self::X4g12X4b12X4r12420 => ffi::GDK_MEMORY_X4G12_X4B12_X4R12_420,
2822            #[cfg(feature = "v4_20")]
2823            Self::X4g12X4b12X4r12422 => ffi::GDK_MEMORY_X4G12_X4B12_X4R12_422,
2824            #[cfg(feature = "v4_20")]
2825            Self::X4g12X4b12X4r12444 => ffi::GDK_MEMORY_X4G12_X4B12_X4R12_444,
2826            #[cfg(feature = "v4_20")]
2827            Self::G16B16R16420 => ffi::GDK_MEMORY_G16_B16_R16_420,
2828            #[cfg(feature = "v4_20")]
2829            Self::G16B16R16422 => ffi::GDK_MEMORY_G16_B16_R16_422,
2830            #[cfg(feature = "v4_20")]
2831            Self::G16B16R16444 => ffi::GDK_MEMORY_G16_B16_R16_444,
2832            #[cfg(feature = "v4_24")]
2833            Self::Argb2101010Premultiplied => ffi::GDK_MEMORY_ARGB2101010_PREMULTIPLIED,
2834            #[cfg(feature = "v4_24")]
2835            Self::Argb2101010 => ffi::GDK_MEMORY_ARGB2101010,
2836            #[cfg(feature = "v4_24")]
2837            Self::Xrgb2101010 => ffi::GDK_MEMORY_XRGB2101010,
2838            Self::Abgr2101010Premultiplied => ffi::GDK_MEMORY_ABGR2101010_PREMULTIPLIED,
2839            #[cfg(feature = "v4_24")]
2840            Self::Abgr2101010 => ffi::GDK_MEMORY_ABGR2101010,
2841            #[cfg(feature = "v4_24")]
2842            Self::Xbgr2101010 => ffi::GDK_MEMORY_XBGR2101010,
2843            Self::__Unknown(value) => value,
2844        }
2845    }
2846}
2847
2848#[doc(hidden)]
2849impl FromGlib<ffi::GdkMemoryFormat> for MemoryFormat {
2850    unsafe fn from_glib(value: ffi::GdkMemoryFormat) -> Self {
2851        skip_assert_initialized!();
2852
2853        match value {
2854            ffi::GDK_MEMORY_B8G8R8A8_PREMULTIPLIED => Self::B8g8r8a8Premultiplied,
2855            ffi::GDK_MEMORY_A8R8G8B8_PREMULTIPLIED => Self::A8r8g8b8Premultiplied,
2856            ffi::GDK_MEMORY_R8G8B8A8_PREMULTIPLIED => Self::R8g8b8a8Premultiplied,
2857            ffi::GDK_MEMORY_B8G8R8A8 => Self::B8g8r8a8,
2858            ffi::GDK_MEMORY_A8R8G8B8 => Self::A8r8g8b8,
2859            ffi::GDK_MEMORY_R8G8B8A8 => Self::R8g8b8a8,
2860            ffi::GDK_MEMORY_A8B8G8R8 => Self::A8b8g8r8,
2861            ffi::GDK_MEMORY_R8G8B8 => Self::R8g8b8,
2862            ffi::GDK_MEMORY_B8G8R8 => Self::B8g8r8,
2863            #[cfg(feature = "v4_6")]
2864            ffi::GDK_MEMORY_R16G16B16 => Self::R16g16b16,
2865            #[cfg(feature = "v4_6")]
2866            ffi::GDK_MEMORY_R16G16B16A16_PREMULTIPLIED => Self::R16g16b16a16Premultiplied,
2867            #[cfg(feature = "v4_6")]
2868            ffi::GDK_MEMORY_R16G16B16A16 => Self::R16g16b16a16,
2869            #[cfg(feature = "v4_6")]
2870            ffi::GDK_MEMORY_R16G16B16_FLOAT => Self::R16g16b16Float,
2871            #[cfg(feature = "v4_6")]
2872            ffi::GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED => {
2873                Self::R16g16b16a16FloatPremultiplied
2874            }
2875            #[cfg(feature = "v4_6")]
2876            ffi::GDK_MEMORY_R16G16B16A16_FLOAT => Self::R16g16b16a16Float,
2877            #[cfg(feature = "v4_6")]
2878            ffi::GDK_MEMORY_R32G32B32_FLOAT => Self::R32g32b32Float,
2879            #[cfg(feature = "v4_6")]
2880            ffi::GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED => {
2881                Self::R32g32b32a32FloatPremultiplied
2882            }
2883            #[cfg(feature = "v4_6")]
2884            ffi::GDK_MEMORY_R32G32B32A32_FLOAT => Self::R32g32b32a32Float,
2885            #[cfg(feature = "v4_12")]
2886            ffi::GDK_MEMORY_G8A8_PREMULTIPLIED => Self::G8a8Premultiplied,
2887            #[cfg(feature = "v4_12")]
2888            ffi::GDK_MEMORY_G8A8 => Self::G8a8,
2889            #[cfg(feature = "v4_12")]
2890            ffi::GDK_MEMORY_G8 => Self::G8,
2891            #[cfg(feature = "v4_12")]
2892            ffi::GDK_MEMORY_G16A16_PREMULTIPLIED => Self::G16a16Premultiplied,
2893            #[cfg(feature = "v4_12")]
2894            ffi::GDK_MEMORY_G16A16 => Self::G16a16,
2895            #[cfg(feature = "v4_12")]
2896            ffi::GDK_MEMORY_G16 => Self::G16,
2897            #[cfg(feature = "v4_12")]
2898            ffi::GDK_MEMORY_A8 => Self::A8,
2899            #[cfg(feature = "v4_12")]
2900            ffi::GDK_MEMORY_A16 => Self::A16,
2901            #[cfg(feature = "v4_12")]
2902            ffi::GDK_MEMORY_A16_FLOAT => Self::A16Float,
2903            #[cfg(feature = "v4_12")]
2904            ffi::GDK_MEMORY_A32_FLOAT => Self::A32Float,
2905            #[cfg(feature = "v4_14")]
2906            ffi::GDK_MEMORY_A8B8G8R8_PREMULTIPLIED => Self::A8b8g8r8Premultiplied,
2907            #[cfg(feature = "v4_14")]
2908            ffi::GDK_MEMORY_B8G8R8X8 => Self::B8g8r8x8,
2909            #[cfg(feature = "v4_14")]
2910            ffi::GDK_MEMORY_X8R8G8B8 => Self::X8r8g8b8,
2911            #[cfg(feature = "v4_14")]
2912            ffi::GDK_MEMORY_R8G8B8X8 => Self::R8g8b8x8,
2913            #[cfg(feature = "v4_14")]
2914            ffi::GDK_MEMORY_X8B8G8R8 => Self::X8b8g8r8,
2915            #[cfg(feature = "v4_20")]
2916            ffi::GDK_MEMORY_G8_B8R8_420 => Self::G8B8r8420,
2917            #[cfg(feature = "v4_20")]
2918            ffi::GDK_MEMORY_G8_R8B8_420 => Self::G8R8b8420,
2919            #[cfg(feature = "v4_20")]
2920            ffi::GDK_MEMORY_G8_B8R8_422 => Self::G8B8r8422,
2921            #[cfg(feature = "v4_20")]
2922            ffi::GDK_MEMORY_G8_R8B8_422 => Self::G8R8b8422,
2923            #[cfg(feature = "v4_20")]
2924            ffi::GDK_MEMORY_G8_B8R8_444 => Self::G8B8r8444,
2925            #[cfg(feature = "v4_20")]
2926            ffi::GDK_MEMORY_G8_R8B8_444 => Self::G8R8b8444,
2927            #[cfg(feature = "v4_20")]
2928            ffi::GDK_MEMORY_G10X6_B10X6R10X6_420 => Self::G10x6B10x6r10x6420,
2929            #[cfg(feature = "v4_20")]
2930            ffi::GDK_MEMORY_G12X4_B12X4R12X4_420 => Self::G12x4B12x4r12x4420,
2931            #[cfg(feature = "v4_20")]
2932            ffi::GDK_MEMORY_G16_B16R16_420 => Self::G16B16r16420,
2933            #[cfg(feature = "v4_20")]
2934            ffi::GDK_MEMORY_G8_B8_R8_410 => Self::G8B8R8410,
2935            #[cfg(feature = "v4_20")]
2936            ffi::GDK_MEMORY_G8_R8_B8_410 => Self::G8R8B8410,
2937            #[cfg(feature = "v4_20")]
2938            ffi::GDK_MEMORY_G8_B8_R8_411 => Self::G8B8R8411,
2939            #[cfg(feature = "v4_20")]
2940            ffi::GDK_MEMORY_G8_R8_B8_411 => Self::G8R8B8411,
2941            #[cfg(feature = "v4_20")]
2942            ffi::GDK_MEMORY_G8_B8_R8_420 => Self::G8B8R8420,
2943            #[cfg(feature = "v4_20")]
2944            ffi::GDK_MEMORY_G8_R8_B8_420 => Self::G8R8B8420,
2945            #[cfg(feature = "v4_20")]
2946            ffi::GDK_MEMORY_G8_B8_R8_422 => Self::G8B8R8422,
2947            #[cfg(feature = "v4_20")]
2948            ffi::GDK_MEMORY_G8_R8_B8_422 => Self::G8R8B8422,
2949            #[cfg(feature = "v4_20")]
2950            ffi::GDK_MEMORY_G8_B8_R8_444 => Self::G8B8R8444,
2951            #[cfg(feature = "v4_20")]
2952            ffi::GDK_MEMORY_G8_R8_B8_444 => Self::G8R8B8444,
2953            #[cfg(feature = "v4_20")]
2954            ffi::GDK_MEMORY_G8B8G8R8_422 => Self::G8b8g8r8422,
2955            #[cfg(feature = "v4_20")]
2956            ffi::GDK_MEMORY_G8R8G8B8_422 => Self::G8r8g8b8422,
2957            #[cfg(feature = "v4_20")]
2958            ffi::GDK_MEMORY_R8G8B8G8_422 => Self::R8g8b8g8422,
2959            #[cfg(feature = "v4_20")]
2960            ffi::GDK_MEMORY_B8G8R8G8_422 => Self::B8g8r8g8422,
2961            #[cfg(feature = "v4_20")]
2962            ffi::GDK_MEMORY_X6G10_X6B10_X6R10_420 => Self::X6g10X6b10X6r10420,
2963            #[cfg(feature = "v4_20")]
2964            ffi::GDK_MEMORY_X6G10_X6B10_X6R10_422 => Self::X6g10X6b10X6r10422,
2965            #[cfg(feature = "v4_20")]
2966            ffi::GDK_MEMORY_X6G10_X6B10_X6R10_444 => Self::X6g10X6b10X6r10444,
2967            #[cfg(feature = "v4_20")]
2968            ffi::GDK_MEMORY_X4G12_X4B12_X4R12_420 => Self::X4g12X4b12X4r12420,
2969            #[cfg(feature = "v4_20")]
2970            ffi::GDK_MEMORY_X4G12_X4B12_X4R12_422 => Self::X4g12X4b12X4r12422,
2971            #[cfg(feature = "v4_20")]
2972            ffi::GDK_MEMORY_X4G12_X4B12_X4R12_444 => Self::X4g12X4b12X4r12444,
2973            #[cfg(feature = "v4_20")]
2974            ffi::GDK_MEMORY_G16_B16_R16_420 => Self::G16B16R16420,
2975            #[cfg(feature = "v4_20")]
2976            ffi::GDK_MEMORY_G16_B16_R16_422 => Self::G16B16R16422,
2977            #[cfg(feature = "v4_20")]
2978            ffi::GDK_MEMORY_G16_B16_R16_444 => Self::G16B16R16444,
2979            #[cfg(feature = "v4_24")]
2980            ffi::GDK_MEMORY_ARGB2101010_PREMULTIPLIED => Self::Argb2101010Premultiplied,
2981            #[cfg(feature = "v4_24")]
2982            ffi::GDK_MEMORY_ARGB2101010 => Self::Argb2101010,
2983            #[cfg(feature = "v4_24")]
2984            ffi::GDK_MEMORY_XRGB2101010 => Self::Xrgb2101010,
2985            ffi::GDK_MEMORY_ABGR2101010_PREMULTIPLIED => Self::Abgr2101010Premultiplied,
2986            #[cfg(feature = "v4_24")]
2987            ffi::GDK_MEMORY_ABGR2101010 => Self::Abgr2101010,
2988            #[cfg(feature = "v4_24")]
2989            ffi::GDK_MEMORY_XBGR2101010 => Self::Xbgr2101010,
2990            value => Self::__Unknown(value),
2991        }
2992    }
2993}
2994
2995impl StaticType for MemoryFormat {
2996    #[inline]
2997    #[doc(alias = "gdk_memory_format_get_type")]
2998    fn static_type() -> glib::Type {
2999        unsafe { from_glib(ffi::gdk_memory_format_get_type()) }
3000    }
3001}
3002
3003impl glib::HasParamSpec for MemoryFormat {
3004    type ParamSpec = glib::ParamSpecEnum;
3005    type SetValue = Self;
3006    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3007
3008    fn param_spec_builder() -> Self::BuilderFn {
3009        Self::ParamSpec::builder_with_default
3010    }
3011}
3012
3013impl glib::value::ValueType for MemoryFormat {
3014    type Type = Self;
3015}
3016
3017unsafe impl<'a> glib::value::FromValue<'a> for MemoryFormat {
3018    type Checker = glib::value::GenericValueTypeChecker<Self>;
3019
3020    #[inline]
3021    unsafe fn from_value(value: &'a glib::Value) -> Self {
3022        skip_assert_initialized!();
3023        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3024    }
3025}
3026
3027impl ToValue for MemoryFormat {
3028    #[inline]
3029    fn to_value(&self) -> glib::Value {
3030        let mut value = glib::Value::for_value_type::<Self>();
3031        unsafe {
3032            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3033        }
3034        value
3035    }
3036
3037    #[inline]
3038    fn value_type(&self) -> glib::Type {
3039        Self::static_type()
3040    }
3041}
3042
3043impl From<MemoryFormat> for glib::Value {
3044    #[inline]
3045    fn from(v: MemoryFormat) -> Self {
3046        skip_assert_initialized!();
3047        ToValue::to_value(&v)
3048    }
3049}
3050
3051/// Specifies the kind of crossing for enter and leave events.
3052///
3053/// See the X11 protocol specification of LeaveNotify for
3054/// full details of crossing event generation.
3055#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3056#[non_exhaustive]
3057#[doc(alias = "GdkNotifyType")]
3058pub enum NotifyType {
3059    /// the surface is entered from an ancestor or
3060    ///   left towards an ancestor.
3061    #[doc(alias = "GDK_NOTIFY_ANCESTOR")]
3062    Ancestor,
3063    /// the pointer moves between an ancestor and an
3064    ///   inferior of the surface.
3065    #[doc(alias = "GDK_NOTIFY_VIRTUAL")]
3066    Virtual,
3067    /// the surface is entered from an inferior or
3068    ///   left towards an inferior.
3069    #[doc(alias = "GDK_NOTIFY_INFERIOR")]
3070    Inferior,
3071    /// the surface is entered from or left towards
3072    ///   a surface which is neither an ancestor nor an inferior.
3073    #[doc(alias = "GDK_NOTIFY_NONLINEAR")]
3074    Nonlinear,
3075    /// the pointer moves between two surfaces
3076    ///   which are not ancestors of each other and the surface is part of
3077    ///   the ancestor chain between one of these surfaces and their least
3078    ///   common ancestor.
3079    #[doc(alias = "GDK_NOTIFY_NONLINEAR_VIRTUAL")]
3080    NonlinearVirtual,
3081    /// an unknown type of enter/leave event occurred.
3082    #[doc(alias = "GDK_NOTIFY_UNKNOWN")]
3083    Unknown,
3084    #[doc(hidden)]
3085    __Unknown(i32),
3086}
3087
3088#[doc(hidden)]
3089impl IntoGlib for NotifyType {
3090    type GlibType = ffi::GdkNotifyType;
3091
3092    #[inline]
3093    fn into_glib(self) -> ffi::GdkNotifyType {
3094        match self {
3095            Self::Ancestor => ffi::GDK_NOTIFY_ANCESTOR,
3096            Self::Virtual => ffi::GDK_NOTIFY_VIRTUAL,
3097            Self::Inferior => ffi::GDK_NOTIFY_INFERIOR,
3098            Self::Nonlinear => ffi::GDK_NOTIFY_NONLINEAR,
3099            Self::NonlinearVirtual => ffi::GDK_NOTIFY_NONLINEAR_VIRTUAL,
3100            Self::Unknown => ffi::GDK_NOTIFY_UNKNOWN,
3101            Self::__Unknown(value) => value,
3102        }
3103    }
3104}
3105
3106#[doc(hidden)]
3107impl FromGlib<ffi::GdkNotifyType> for NotifyType {
3108    #[inline]
3109    unsafe fn from_glib(value: ffi::GdkNotifyType) -> Self {
3110        skip_assert_initialized!();
3111
3112        match value {
3113            ffi::GDK_NOTIFY_ANCESTOR => Self::Ancestor,
3114            ffi::GDK_NOTIFY_VIRTUAL => Self::Virtual,
3115            ffi::GDK_NOTIFY_INFERIOR => Self::Inferior,
3116            ffi::GDK_NOTIFY_NONLINEAR => Self::Nonlinear,
3117            ffi::GDK_NOTIFY_NONLINEAR_VIRTUAL => Self::NonlinearVirtual,
3118            ffi::GDK_NOTIFY_UNKNOWN => Self::Unknown,
3119            value => Self::__Unknown(value),
3120        }
3121    }
3122}
3123
3124impl StaticType for NotifyType {
3125    #[inline]
3126    #[doc(alias = "gdk_notify_type_get_type")]
3127    fn static_type() -> glib::Type {
3128        unsafe { from_glib(ffi::gdk_notify_type_get_type()) }
3129    }
3130}
3131
3132impl glib::HasParamSpec for NotifyType {
3133    type ParamSpec = glib::ParamSpecEnum;
3134    type SetValue = Self;
3135    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3136
3137    fn param_spec_builder() -> Self::BuilderFn {
3138        Self::ParamSpec::builder_with_default
3139    }
3140}
3141
3142impl glib::value::ValueType for NotifyType {
3143    type Type = Self;
3144}
3145
3146unsafe impl<'a> glib::value::FromValue<'a> for NotifyType {
3147    type Checker = glib::value::GenericValueTypeChecker<Self>;
3148
3149    #[inline]
3150    unsafe fn from_value(value: &'a glib::Value) -> Self {
3151        skip_assert_initialized!();
3152        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3153    }
3154}
3155
3156impl ToValue for NotifyType {
3157    #[inline]
3158    fn to_value(&self) -> glib::Value {
3159        let mut value = glib::Value::for_value_type::<Self>();
3160        unsafe {
3161            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3162        }
3163        value
3164    }
3165
3166    #[inline]
3167    fn value_type(&self) -> glib::Type {
3168        Self::static_type()
3169    }
3170}
3171
3172impl From<NotifyType> for glib::Value {
3173    #[inline]
3174    fn from(v: NotifyType) -> Self {
3175        skip_assert_initialized!();
3176        ToValue::to_value(&v)
3177    }
3178}
3179
3180/// Specifies the direction for scroll events.
3181#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3182#[non_exhaustive]
3183#[doc(alias = "GdkScrollDirection")]
3184pub enum ScrollDirection {
3185    /// the surface is scrolled up.
3186    #[doc(alias = "GDK_SCROLL_UP")]
3187    Up,
3188    /// the surface is scrolled down.
3189    #[doc(alias = "GDK_SCROLL_DOWN")]
3190    Down,
3191    /// the surface is scrolled to the left.
3192    #[doc(alias = "GDK_SCROLL_LEFT")]
3193    Left,
3194    /// the surface is scrolled to the right.
3195    #[doc(alias = "GDK_SCROLL_RIGHT")]
3196    Right,
3197    /// the scrolling is determined by the delta values
3198    ///   in scroll events. See gdk_scroll_event_get_deltas()
3199    #[doc(alias = "GDK_SCROLL_SMOOTH")]
3200    Smooth,
3201    #[doc(hidden)]
3202    __Unknown(i32),
3203}
3204
3205#[doc(hidden)]
3206impl IntoGlib for ScrollDirection {
3207    type GlibType = ffi::GdkScrollDirection;
3208
3209    #[inline]
3210    fn into_glib(self) -> ffi::GdkScrollDirection {
3211        match self {
3212            Self::Up => ffi::GDK_SCROLL_UP,
3213            Self::Down => ffi::GDK_SCROLL_DOWN,
3214            Self::Left => ffi::GDK_SCROLL_LEFT,
3215            Self::Right => ffi::GDK_SCROLL_RIGHT,
3216            Self::Smooth => ffi::GDK_SCROLL_SMOOTH,
3217            Self::__Unknown(value) => value,
3218        }
3219    }
3220}
3221
3222#[doc(hidden)]
3223impl FromGlib<ffi::GdkScrollDirection> for ScrollDirection {
3224    #[inline]
3225    unsafe fn from_glib(value: ffi::GdkScrollDirection) -> Self {
3226        skip_assert_initialized!();
3227
3228        match value {
3229            ffi::GDK_SCROLL_UP => Self::Up,
3230            ffi::GDK_SCROLL_DOWN => Self::Down,
3231            ffi::GDK_SCROLL_LEFT => Self::Left,
3232            ffi::GDK_SCROLL_RIGHT => Self::Right,
3233            ffi::GDK_SCROLL_SMOOTH => Self::Smooth,
3234            value => Self::__Unknown(value),
3235        }
3236    }
3237}
3238
3239impl StaticType for ScrollDirection {
3240    #[inline]
3241    #[doc(alias = "gdk_scroll_direction_get_type")]
3242    fn static_type() -> glib::Type {
3243        unsafe { from_glib(ffi::gdk_scroll_direction_get_type()) }
3244    }
3245}
3246
3247impl glib::HasParamSpec for ScrollDirection {
3248    type ParamSpec = glib::ParamSpecEnum;
3249    type SetValue = Self;
3250    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3251
3252    fn param_spec_builder() -> Self::BuilderFn {
3253        Self::ParamSpec::builder_with_default
3254    }
3255}
3256
3257impl glib::value::ValueType for ScrollDirection {
3258    type Type = Self;
3259}
3260
3261unsafe impl<'a> glib::value::FromValue<'a> for ScrollDirection {
3262    type Checker = glib::value::GenericValueTypeChecker<Self>;
3263
3264    #[inline]
3265    unsafe fn from_value(value: &'a glib::Value) -> Self {
3266        skip_assert_initialized!();
3267        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3268    }
3269}
3270
3271impl ToValue for ScrollDirection {
3272    #[inline]
3273    fn to_value(&self) -> glib::Value {
3274        let mut value = glib::Value::for_value_type::<Self>();
3275        unsafe {
3276            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3277        }
3278        value
3279    }
3280
3281    #[inline]
3282    fn value_type(&self) -> glib::Type {
3283        Self::static_type()
3284    }
3285}
3286
3287impl From<ScrollDirection> for glib::Value {
3288    #[inline]
3289    fn from(v: ScrollDirection) -> Self {
3290        skip_assert_initialized!();
3291        ToValue::to_value(&v)
3292    }
3293}
3294
3295/// Used in scroll events, to announce the direction relative
3296/// to physical motion.
3297#[cfg(feature = "v4_20")]
3298#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3299#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3300#[non_exhaustive]
3301#[doc(alias = "GdkScrollRelativeDirection")]
3302pub enum ScrollRelativeDirection {
3303    /// Physical motion and event motion are the same
3304    #[doc(alias = "GDK_SCROLL_RELATIVE_DIRECTION_IDENTICAL")]
3305    Identical,
3306    /// Physical motion is inverted relative to event motion
3307    #[doc(alias = "GDK_SCROLL_RELATIVE_DIRECTION_INVERTED")]
3308    Inverted,
3309    /// Relative motion is unknown on this device or backend
3310    #[doc(alias = "GDK_SCROLL_RELATIVE_DIRECTION_UNKNOWN")]
3311    Unknown,
3312    #[doc(hidden)]
3313    __Unknown(i32),
3314}
3315
3316#[cfg(feature = "v4_20")]
3317#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3318#[doc(hidden)]
3319impl IntoGlib for ScrollRelativeDirection {
3320    type GlibType = ffi::GdkScrollRelativeDirection;
3321
3322    #[inline]
3323    fn into_glib(self) -> ffi::GdkScrollRelativeDirection {
3324        match self {
3325            Self::Identical => ffi::GDK_SCROLL_RELATIVE_DIRECTION_IDENTICAL,
3326            Self::Inverted => ffi::GDK_SCROLL_RELATIVE_DIRECTION_INVERTED,
3327            Self::Unknown => ffi::GDK_SCROLL_RELATIVE_DIRECTION_UNKNOWN,
3328            Self::__Unknown(value) => value,
3329        }
3330    }
3331}
3332
3333#[cfg(feature = "v4_20")]
3334#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3335#[doc(hidden)]
3336impl FromGlib<ffi::GdkScrollRelativeDirection> for ScrollRelativeDirection {
3337    #[inline]
3338    unsafe fn from_glib(value: ffi::GdkScrollRelativeDirection) -> Self {
3339        skip_assert_initialized!();
3340
3341        match value {
3342            ffi::GDK_SCROLL_RELATIVE_DIRECTION_IDENTICAL => Self::Identical,
3343            ffi::GDK_SCROLL_RELATIVE_DIRECTION_INVERTED => Self::Inverted,
3344            ffi::GDK_SCROLL_RELATIVE_DIRECTION_UNKNOWN => Self::Unknown,
3345            value => Self::__Unknown(value),
3346        }
3347    }
3348}
3349
3350#[cfg(feature = "v4_20")]
3351#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3352impl StaticType for ScrollRelativeDirection {
3353    #[inline]
3354    #[doc(alias = "gdk_scroll_relative_direction_get_type")]
3355    fn static_type() -> glib::Type {
3356        unsafe { from_glib(ffi::gdk_scroll_relative_direction_get_type()) }
3357    }
3358}
3359
3360#[cfg(feature = "v4_20")]
3361#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3362impl glib::HasParamSpec for ScrollRelativeDirection {
3363    type ParamSpec = glib::ParamSpecEnum;
3364    type SetValue = Self;
3365    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3366
3367    fn param_spec_builder() -> Self::BuilderFn {
3368        Self::ParamSpec::builder_with_default
3369    }
3370}
3371
3372#[cfg(feature = "v4_20")]
3373#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3374impl glib::value::ValueType for ScrollRelativeDirection {
3375    type Type = Self;
3376}
3377
3378#[cfg(feature = "v4_20")]
3379#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3380unsafe impl<'a> glib::value::FromValue<'a> for ScrollRelativeDirection {
3381    type Checker = glib::value::GenericValueTypeChecker<Self>;
3382
3383    #[inline]
3384    unsafe fn from_value(value: &'a glib::Value) -> Self {
3385        skip_assert_initialized!();
3386        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3387    }
3388}
3389
3390#[cfg(feature = "v4_20")]
3391#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3392impl ToValue for ScrollRelativeDirection {
3393    #[inline]
3394    fn to_value(&self) -> glib::Value {
3395        let mut value = glib::Value::for_value_type::<Self>();
3396        unsafe {
3397            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3398        }
3399        value
3400    }
3401
3402    #[inline]
3403    fn value_type(&self) -> glib::Type {
3404        Self::static_type()
3405    }
3406}
3407
3408#[cfg(feature = "v4_20")]
3409#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3410impl From<ScrollRelativeDirection> for glib::Value {
3411    #[inline]
3412    fn from(v: ScrollRelativeDirection) -> Self {
3413        skip_assert_initialized!();
3414        ToValue::to_value(&v)
3415    }
3416}
3417
3418/// Specifies the unit of scroll deltas.
3419///
3420/// When you get [`Wheel`][Self::Wheel], a delta of 1.0 means 1 wheel detent
3421/// click in the south direction, 2.0 means 2 wheel detent clicks in the south
3422/// direction... This is the same logic for negative values but in the north
3423/// direction.
3424///
3425/// If you get [`Surface`][Self::Surface], are managing a scrollable view and get a
3426/// value of 123, you have to scroll 123 surface logical pixels right if it's
3427/// @delta_x or down if it's @delta_y. This is the same logic for negative values
3428/// but you have to scroll left instead of right if it's @delta_x and up instead
3429/// of down if it's @delta_y.
3430///
3431/// 1 surface logical pixel is equal to 1 real screen pixel multiplied by the
3432/// final scale factor of your graphical interface (the product of the desktop
3433/// scale factor and eventually a custom scale factor in your app).
3434#[cfg(feature = "v4_8")]
3435#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3436#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3437#[non_exhaustive]
3438#[doc(alias = "GdkScrollUnit")]
3439pub enum ScrollUnit {
3440    /// The delta is in number of wheel clicks.
3441    #[doc(alias = "GDK_SCROLL_UNIT_WHEEL")]
3442    Wheel,
3443    /// The delta is in surface pixels to scroll directly
3444    ///   on screen.
3445    #[doc(alias = "GDK_SCROLL_UNIT_SURFACE")]
3446    Surface,
3447    #[doc(hidden)]
3448    __Unknown(i32),
3449}
3450
3451#[cfg(feature = "v4_8")]
3452#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3453#[doc(hidden)]
3454impl IntoGlib for ScrollUnit {
3455    type GlibType = ffi::GdkScrollUnit;
3456
3457    #[inline]
3458    fn into_glib(self) -> ffi::GdkScrollUnit {
3459        match self {
3460            Self::Wheel => ffi::GDK_SCROLL_UNIT_WHEEL,
3461            Self::Surface => ffi::GDK_SCROLL_UNIT_SURFACE,
3462            Self::__Unknown(value) => value,
3463        }
3464    }
3465}
3466
3467#[cfg(feature = "v4_8")]
3468#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3469#[doc(hidden)]
3470impl FromGlib<ffi::GdkScrollUnit> for ScrollUnit {
3471    #[inline]
3472    unsafe fn from_glib(value: ffi::GdkScrollUnit) -> Self {
3473        skip_assert_initialized!();
3474
3475        match value {
3476            ffi::GDK_SCROLL_UNIT_WHEEL => Self::Wheel,
3477            ffi::GDK_SCROLL_UNIT_SURFACE => Self::Surface,
3478            value => Self::__Unknown(value),
3479        }
3480    }
3481}
3482
3483#[cfg(feature = "v4_8")]
3484#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3485impl StaticType for ScrollUnit {
3486    #[inline]
3487    #[doc(alias = "gdk_scroll_unit_get_type")]
3488    fn static_type() -> glib::Type {
3489        unsafe { from_glib(ffi::gdk_scroll_unit_get_type()) }
3490    }
3491}
3492
3493#[cfg(feature = "v4_8")]
3494#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3495impl glib::HasParamSpec for ScrollUnit {
3496    type ParamSpec = glib::ParamSpecEnum;
3497    type SetValue = Self;
3498    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3499
3500    fn param_spec_builder() -> Self::BuilderFn {
3501        Self::ParamSpec::builder_with_default
3502    }
3503}
3504
3505#[cfg(feature = "v4_8")]
3506#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3507impl glib::value::ValueType for ScrollUnit {
3508    type Type = Self;
3509}
3510
3511#[cfg(feature = "v4_8")]
3512#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3513unsafe impl<'a> glib::value::FromValue<'a> for ScrollUnit {
3514    type Checker = glib::value::GenericValueTypeChecker<Self>;
3515
3516    #[inline]
3517    unsafe fn from_value(value: &'a glib::Value) -> Self {
3518        skip_assert_initialized!();
3519        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3520    }
3521}
3522
3523#[cfg(feature = "v4_8")]
3524#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3525impl ToValue for ScrollUnit {
3526    #[inline]
3527    fn to_value(&self) -> glib::Value {
3528        let mut value = glib::Value::for_value_type::<Self>();
3529        unsafe {
3530            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3531        }
3532        value
3533    }
3534
3535    #[inline]
3536    fn value_type(&self) -> glib::Type {
3537        Self::static_type()
3538    }
3539}
3540
3541#[cfg(feature = "v4_8")]
3542#[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
3543impl From<ScrollUnit> for glib::Value {
3544    #[inline]
3545    fn from(v: ScrollUnit) -> Self {
3546        skip_assert_initialized!();
3547        ToValue::to_value(&v)
3548    }
3549}
3550
3551/// This enumeration describes how the red, green and blue components
3552/// of physical pixels on an output device are laid out.
3553#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3554#[non_exhaustive]
3555#[doc(alias = "GdkSubpixelLayout")]
3556pub enum SubpixelLayout {
3557    /// The layout is not known
3558    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_UNKNOWN")]
3559    Unknown,
3560    /// Not organized in this way
3561    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_NONE")]
3562    None,
3563    /// The layout is horizontal, the order is RGB
3564    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB")]
3565    HorizontalRgb,
3566    /// The layout is horizontal, the order is BGR
3567    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR")]
3568    HorizontalBgr,
3569    /// The layout is vertical, the order is RGB
3570    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB")]
3571    VerticalRgb,
3572    /// The layout is vertical, the order is BGR
3573    #[doc(alias = "GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR")]
3574    VerticalBgr,
3575    #[doc(hidden)]
3576    __Unknown(i32),
3577}
3578
3579#[doc(hidden)]
3580impl IntoGlib for SubpixelLayout {
3581    type GlibType = ffi::GdkSubpixelLayout;
3582
3583    #[inline]
3584    fn into_glib(self) -> ffi::GdkSubpixelLayout {
3585        match self {
3586            Self::Unknown => ffi::GDK_SUBPIXEL_LAYOUT_UNKNOWN,
3587            Self::None => ffi::GDK_SUBPIXEL_LAYOUT_NONE,
3588            Self::HorizontalRgb => ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB,
3589            Self::HorizontalBgr => ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR,
3590            Self::VerticalRgb => ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB,
3591            Self::VerticalBgr => ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR,
3592            Self::__Unknown(value) => value,
3593        }
3594    }
3595}
3596
3597#[doc(hidden)]
3598impl FromGlib<ffi::GdkSubpixelLayout> for SubpixelLayout {
3599    #[inline]
3600    unsafe fn from_glib(value: ffi::GdkSubpixelLayout) -> Self {
3601        skip_assert_initialized!();
3602
3603        match value {
3604            ffi::GDK_SUBPIXEL_LAYOUT_UNKNOWN => Self::Unknown,
3605            ffi::GDK_SUBPIXEL_LAYOUT_NONE => Self::None,
3606            ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB => Self::HorizontalRgb,
3607            ffi::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR => Self::HorizontalBgr,
3608            ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB => Self::VerticalRgb,
3609            ffi::GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR => Self::VerticalBgr,
3610            value => Self::__Unknown(value),
3611        }
3612    }
3613}
3614
3615impl StaticType for SubpixelLayout {
3616    #[inline]
3617    #[doc(alias = "gdk_subpixel_layout_get_type")]
3618    fn static_type() -> glib::Type {
3619        unsafe { from_glib(ffi::gdk_subpixel_layout_get_type()) }
3620    }
3621}
3622
3623impl glib::HasParamSpec for SubpixelLayout {
3624    type ParamSpec = glib::ParamSpecEnum;
3625    type SetValue = Self;
3626    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3627
3628    fn param_spec_builder() -> Self::BuilderFn {
3629        Self::ParamSpec::builder_with_default
3630    }
3631}
3632
3633impl glib::value::ValueType for SubpixelLayout {
3634    type Type = Self;
3635}
3636
3637unsafe impl<'a> glib::value::FromValue<'a> for SubpixelLayout {
3638    type Checker = glib::value::GenericValueTypeChecker<Self>;
3639
3640    #[inline]
3641    unsafe fn from_value(value: &'a glib::Value) -> Self {
3642        skip_assert_initialized!();
3643        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3644    }
3645}
3646
3647impl ToValue for SubpixelLayout {
3648    #[inline]
3649    fn to_value(&self) -> glib::Value {
3650        let mut value = glib::Value::for_value_type::<Self>();
3651        unsafe {
3652            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3653        }
3654        value
3655    }
3656
3657    #[inline]
3658    fn value_type(&self) -> glib::Type {
3659        Self::static_type()
3660    }
3661}
3662
3663impl From<SubpixelLayout> for glib::Value {
3664    #[inline]
3665    fn from(v: SubpixelLayout) -> Self {
3666        skip_assert_initialized!();
3667        ToValue::to_value(&v)
3668    }
3669}
3670
3671/// Determines a surface edge or corner.
3672#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3673#[non_exhaustive]
3674#[doc(alias = "GdkSurfaceEdge")]
3675pub enum SurfaceEdge {
3676    /// the top left corner.
3677    #[doc(alias = "GDK_SURFACE_EDGE_NORTH_WEST")]
3678    NorthWest,
3679    /// the top edge.
3680    #[doc(alias = "GDK_SURFACE_EDGE_NORTH")]
3681    North,
3682    /// the top right corner.
3683    #[doc(alias = "GDK_SURFACE_EDGE_NORTH_EAST")]
3684    NorthEast,
3685    /// the left edge.
3686    #[doc(alias = "GDK_SURFACE_EDGE_WEST")]
3687    West,
3688    /// the right edge.
3689    #[doc(alias = "GDK_SURFACE_EDGE_EAST")]
3690    East,
3691    /// the lower left corner.
3692    #[doc(alias = "GDK_SURFACE_EDGE_SOUTH_WEST")]
3693    SouthWest,
3694    /// the lower edge.
3695    #[doc(alias = "GDK_SURFACE_EDGE_SOUTH")]
3696    South,
3697    /// the lower right corner.
3698    #[doc(alias = "GDK_SURFACE_EDGE_SOUTH_EAST")]
3699    SouthEast,
3700    #[doc(hidden)]
3701    __Unknown(i32),
3702}
3703
3704#[doc(hidden)]
3705impl IntoGlib for SurfaceEdge {
3706    type GlibType = ffi::GdkSurfaceEdge;
3707
3708    #[inline]
3709    fn into_glib(self) -> ffi::GdkSurfaceEdge {
3710        match self {
3711            Self::NorthWest => ffi::GDK_SURFACE_EDGE_NORTH_WEST,
3712            Self::North => ffi::GDK_SURFACE_EDGE_NORTH,
3713            Self::NorthEast => ffi::GDK_SURFACE_EDGE_NORTH_EAST,
3714            Self::West => ffi::GDK_SURFACE_EDGE_WEST,
3715            Self::East => ffi::GDK_SURFACE_EDGE_EAST,
3716            Self::SouthWest => ffi::GDK_SURFACE_EDGE_SOUTH_WEST,
3717            Self::South => ffi::GDK_SURFACE_EDGE_SOUTH,
3718            Self::SouthEast => ffi::GDK_SURFACE_EDGE_SOUTH_EAST,
3719            Self::__Unknown(value) => value,
3720        }
3721    }
3722}
3723
3724#[doc(hidden)]
3725impl FromGlib<ffi::GdkSurfaceEdge> for SurfaceEdge {
3726    #[inline]
3727    unsafe fn from_glib(value: ffi::GdkSurfaceEdge) -> Self {
3728        skip_assert_initialized!();
3729
3730        match value {
3731            ffi::GDK_SURFACE_EDGE_NORTH_WEST => Self::NorthWest,
3732            ffi::GDK_SURFACE_EDGE_NORTH => Self::North,
3733            ffi::GDK_SURFACE_EDGE_NORTH_EAST => Self::NorthEast,
3734            ffi::GDK_SURFACE_EDGE_WEST => Self::West,
3735            ffi::GDK_SURFACE_EDGE_EAST => Self::East,
3736            ffi::GDK_SURFACE_EDGE_SOUTH_WEST => Self::SouthWest,
3737            ffi::GDK_SURFACE_EDGE_SOUTH => Self::South,
3738            ffi::GDK_SURFACE_EDGE_SOUTH_EAST => Self::SouthEast,
3739            value => Self::__Unknown(value),
3740        }
3741    }
3742}
3743
3744impl StaticType for SurfaceEdge {
3745    #[inline]
3746    #[doc(alias = "gdk_surface_edge_get_type")]
3747    fn static_type() -> glib::Type {
3748        unsafe { from_glib(ffi::gdk_surface_edge_get_type()) }
3749    }
3750}
3751
3752impl glib::HasParamSpec for SurfaceEdge {
3753    type ParamSpec = glib::ParamSpecEnum;
3754    type SetValue = Self;
3755    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3756
3757    fn param_spec_builder() -> Self::BuilderFn {
3758        Self::ParamSpec::builder_with_default
3759    }
3760}
3761
3762impl glib::value::ValueType for SurfaceEdge {
3763    type Type = Self;
3764}
3765
3766unsafe impl<'a> glib::value::FromValue<'a> for SurfaceEdge {
3767    type Checker = glib::value::GenericValueTypeChecker<Self>;
3768
3769    #[inline]
3770    unsafe fn from_value(value: &'a glib::Value) -> Self {
3771        skip_assert_initialized!();
3772        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3773    }
3774}
3775
3776impl ToValue for SurfaceEdge {
3777    #[inline]
3778    fn to_value(&self) -> glib::Value {
3779        let mut value = glib::Value::for_value_type::<Self>();
3780        unsafe {
3781            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3782        }
3783        value
3784    }
3785
3786    #[inline]
3787    fn value_type(&self) -> glib::Type {
3788        Self::static_type()
3789    }
3790}
3791
3792impl From<SurfaceEdge> for glib::Value {
3793    #[inline]
3794    fn from(v: SurfaceEdge) -> Self {
3795        skip_assert_initialized!();
3796        ToValue::to_value(&v)
3797    }
3798}
3799
3800/// Possible errors that can be returned by [`Texture`][crate::Texture] constructors.
3801#[cfg(feature = "v4_6")]
3802#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3803#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3804#[non_exhaustive]
3805#[doc(alias = "GdkTextureError")]
3806pub enum TextureError {
3807    /// Not enough memory to handle this image
3808    #[doc(alias = "GDK_TEXTURE_ERROR_TOO_LARGE")]
3809    TooLarge,
3810    /// The image data appears corrupted
3811    #[doc(alias = "GDK_TEXTURE_ERROR_CORRUPT_IMAGE")]
3812    CorruptImage,
3813    /// The image contains features
3814    ///   that cannot be loaded
3815    #[doc(alias = "GDK_TEXTURE_ERROR_UNSUPPORTED_CONTENT")]
3816    UnsupportedContent,
3817    /// The image format is not supported
3818    #[doc(alias = "GDK_TEXTURE_ERROR_UNSUPPORTED_FORMAT")]
3819    UnsupportedFormat,
3820    #[doc(hidden)]
3821    __Unknown(i32),
3822}
3823
3824#[cfg(feature = "v4_6")]
3825#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3826#[doc(hidden)]
3827impl IntoGlib for TextureError {
3828    type GlibType = ffi::GdkTextureError;
3829
3830    #[inline]
3831    fn into_glib(self) -> ffi::GdkTextureError {
3832        match self {
3833            Self::TooLarge => ffi::GDK_TEXTURE_ERROR_TOO_LARGE,
3834            Self::CorruptImage => ffi::GDK_TEXTURE_ERROR_CORRUPT_IMAGE,
3835            Self::UnsupportedContent => ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_CONTENT,
3836            Self::UnsupportedFormat => ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_FORMAT,
3837            Self::__Unknown(value) => value,
3838        }
3839    }
3840}
3841
3842#[cfg(feature = "v4_6")]
3843#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3844#[doc(hidden)]
3845impl FromGlib<ffi::GdkTextureError> for TextureError {
3846    #[inline]
3847    unsafe fn from_glib(value: ffi::GdkTextureError) -> Self {
3848        skip_assert_initialized!();
3849
3850        match value {
3851            ffi::GDK_TEXTURE_ERROR_TOO_LARGE => Self::TooLarge,
3852            ffi::GDK_TEXTURE_ERROR_CORRUPT_IMAGE => Self::CorruptImage,
3853            ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_CONTENT => Self::UnsupportedContent,
3854            ffi::GDK_TEXTURE_ERROR_UNSUPPORTED_FORMAT => Self::UnsupportedFormat,
3855            value => Self::__Unknown(value),
3856        }
3857    }
3858}
3859
3860#[cfg(feature = "v4_6")]
3861#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3862impl glib::error::ErrorDomain for TextureError {
3863    #[inline]
3864    fn domain() -> glib::Quark {
3865        skip_assert_initialized!();
3866
3867        unsafe { from_glib(ffi::gdk_texture_error_quark()) }
3868    }
3869
3870    #[inline]
3871    fn code(self) -> i32 {
3872        self.into_glib()
3873    }
3874
3875    #[inline]
3876    #[allow(clippy::match_single_binding)]
3877    fn from(code: i32) -> Option<Self> {
3878        skip_assert_initialized!();
3879        match unsafe { from_glib(code) } {
3880            value => Some(value),
3881        }
3882    }
3883}
3884
3885#[cfg(feature = "v4_6")]
3886#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3887impl StaticType for TextureError {
3888    #[inline]
3889    #[doc(alias = "gdk_texture_error_get_type")]
3890    fn static_type() -> glib::Type {
3891        unsafe { from_glib(ffi::gdk_texture_error_get_type()) }
3892    }
3893}
3894
3895#[cfg(feature = "v4_6")]
3896#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3897impl glib::HasParamSpec for TextureError {
3898    type ParamSpec = glib::ParamSpecEnum;
3899    type SetValue = Self;
3900    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
3901
3902    fn param_spec_builder() -> Self::BuilderFn {
3903        Self::ParamSpec::builder_with_default
3904    }
3905}
3906
3907#[cfg(feature = "v4_6")]
3908#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3909impl glib::value::ValueType for TextureError {
3910    type Type = Self;
3911}
3912
3913#[cfg(feature = "v4_6")]
3914#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3915unsafe impl<'a> glib::value::FromValue<'a> for TextureError {
3916    type Checker = glib::value::GenericValueTypeChecker<Self>;
3917
3918    #[inline]
3919    unsafe fn from_value(value: &'a glib::Value) -> Self {
3920        skip_assert_initialized!();
3921        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
3922    }
3923}
3924
3925#[cfg(feature = "v4_6")]
3926#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3927impl ToValue for TextureError {
3928    #[inline]
3929    fn to_value(&self) -> glib::Value {
3930        let mut value = glib::Value::for_value_type::<Self>();
3931        unsafe {
3932            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
3933        }
3934        value
3935    }
3936
3937    #[inline]
3938    fn value_type(&self) -> glib::Type {
3939        Self::static_type()
3940    }
3941}
3942
3943#[cfg(feature = "v4_6")]
3944#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3945impl From<TextureError> for glib::Value {
3946    #[inline]
3947    fn from(v: TextureError) -> Self {
3948        skip_assert_initialized!();
3949        ToValue::to_value(&v)
3950    }
3951}
3952
3953/// The kind of title bar gesture to emit with
3954/// [`ToplevelExt::titlebar_gesture()`][crate::prelude::ToplevelExt::titlebar_gesture()].
3955#[cfg(feature = "v4_4")]
3956#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
3957#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
3958#[non_exhaustive]
3959#[doc(alias = "GdkTitlebarGesture")]
3960pub enum TitlebarGesture {
3961    /// double click gesture
3962    #[doc(alias = "GDK_TITLEBAR_GESTURE_DOUBLE_CLICK")]
3963    DoubleClick,
3964    /// right click gesture
3965    #[doc(alias = "GDK_TITLEBAR_GESTURE_RIGHT_CLICK")]
3966    RightClick,
3967    /// middle click gesture
3968    #[doc(alias = "GDK_TITLEBAR_GESTURE_MIDDLE_CLICK")]
3969    MiddleClick,
3970    #[doc(hidden)]
3971    __Unknown(i32),
3972}
3973
3974#[cfg(feature = "v4_4")]
3975#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
3976#[doc(hidden)]
3977impl IntoGlib for TitlebarGesture {
3978    type GlibType = ffi::GdkTitlebarGesture;
3979
3980    #[inline]
3981    fn into_glib(self) -> ffi::GdkTitlebarGesture {
3982        match self {
3983            Self::DoubleClick => ffi::GDK_TITLEBAR_GESTURE_DOUBLE_CLICK,
3984            Self::RightClick => ffi::GDK_TITLEBAR_GESTURE_RIGHT_CLICK,
3985            Self::MiddleClick => ffi::GDK_TITLEBAR_GESTURE_MIDDLE_CLICK,
3986            Self::__Unknown(value) => value,
3987        }
3988    }
3989}
3990
3991#[cfg(feature = "v4_4")]
3992#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
3993#[doc(hidden)]
3994impl FromGlib<ffi::GdkTitlebarGesture> for TitlebarGesture {
3995    #[inline]
3996    unsafe fn from_glib(value: ffi::GdkTitlebarGesture) -> Self {
3997        skip_assert_initialized!();
3998
3999        match value {
4000            ffi::GDK_TITLEBAR_GESTURE_DOUBLE_CLICK => Self::DoubleClick,
4001            ffi::GDK_TITLEBAR_GESTURE_RIGHT_CLICK => Self::RightClick,
4002            ffi::GDK_TITLEBAR_GESTURE_MIDDLE_CLICK => Self::MiddleClick,
4003            value => Self::__Unknown(value),
4004        }
4005    }
4006}
4007
4008#[cfg(feature = "v4_4")]
4009#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4010impl StaticType for TitlebarGesture {
4011    #[inline]
4012    #[doc(alias = "gdk_titlebar_gesture_get_type")]
4013    fn static_type() -> glib::Type {
4014        unsafe { from_glib(ffi::gdk_titlebar_gesture_get_type()) }
4015    }
4016}
4017
4018#[cfg(feature = "v4_4")]
4019#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4020impl glib::HasParamSpec for TitlebarGesture {
4021    type ParamSpec = glib::ParamSpecEnum;
4022    type SetValue = Self;
4023    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4024
4025    fn param_spec_builder() -> Self::BuilderFn {
4026        Self::ParamSpec::builder_with_default
4027    }
4028}
4029
4030#[cfg(feature = "v4_4")]
4031#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4032impl glib::value::ValueType for TitlebarGesture {
4033    type Type = Self;
4034}
4035
4036#[cfg(feature = "v4_4")]
4037#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4038unsafe impl<'a> glib::value::FromValue<'a> for TitlebarGesture {
4039    type Checker = glib::value::GenericValueTypeChecker<Self>;
4040
4041    #[inline]
4042    unsafe fn from_value(value: &'a glib::Value) -> Self {
4043        skip_assert_initialized!();
4044        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4045    }
4046}
4047
4048#[cfg(feature = "v4_4")]
4049#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4050impl ToValue for TitlebarGesture {
4051    #[inline]
4052    fn to_value(&self) -> glib::Value {
4053        let mut value = glib::Value::for_value_type::<Self>();
4054        unsafe {
4055            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4056        }
4057        value
4058    }
4059
4060    #[inline]
4061    fn value_type(&self) -> glib::Type {
4062        Self::static_type()
4063    }
4064}
4065
4066#[cfg(feature = "v4_4")]
4067#[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
4068impl From<TitlebarGesture> for glib::Value {
4069    #[inline]
4070    fn from(v: TitlebarGesture) -> Self {
4071        skip_assert_initialized!();
4072        ToValue::to_value(&v)
4073    }
4074}
4075
4076/// Specifies the current state of a touchpad gesture.
4077///
4078/// All gestures are guaranteed to begin with an event with phase
4079/// [`Begin`][Self::Begin], followed by 0 or several events
4080/// with phase [`Update`][Self::Update].
4081///
4082/// A finished gesture may have 2 possible outcomes, an event with phase
4083/// [`End`][Self::End] will be emitted when the gesture is
4084/// considered successful, this should be used as the hint to perform any
4085/// permanent changes.
4086///
4087/// Cancelled gestures may be so for a variety of reasons, due to hardware
4088/// or the compositor, or due to the gesture recognition layers hinting the
4089/// gesture did not finish resolutely (eg. a 3rd finger being added during
4090/// a pinch gesture). In these cases, the last event will report the phase
4091/// [`Cancel`][Self::Cancel], this should be used as a hint
4092/// to undo any visible/permanent changes that were done throughout the
4093/// progress of the gesture.
4094#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4095#[non_exhaustive]
4096#[doc(alias = "GdkTouchpadGesturePhase")]
4097pub enum TouchpadGesturePhase {
4098    /// The gesture has begun.
4099    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_BEGIN")]
4100    Begin,
4101    /// The gesture has been updated.
4102    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_UPDATE")]
4103    Update,
4104    /// The gesture was finished, changes
4105    ///   should be permanently applied.
4106    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_END")]
4107    End,
4108    /// The gesture was cancelled, all
4109    ///   changes should be undone.
4110    #[doc(alias = "GDK_TOUCHPAD_GESTURE_PHASE_CANCEL")]
4111    Cancel,
4112    #[doc(hidden)]
4113    __Unknown(i32),
4114}
4115
4116#[doc(hidden)]
4117impl IntoGlib for TouchpadGesturePhase {
4118    type GlibType = ffi::GdkTouchpadGesturePhase;
4119
4120    #[inline]
4121    fn into_glib(self) -> ffi::GdkTouchpadGesturePhase {
4122        match self {
4123            Self::Begin => ffi::GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
4124            Self::Update => ffi::GDK_TOUCHPAD_GESTURE_PHASE_UPDATE,
4125            Self::End => ffi::GDK_TOUCHPAD_GESTURE_PHASE_END,
4126            Self::Cancel => ffi::GDK_TOUCHPAD_GESTURE_PHASE_CANCEL,
4127            Self::__Unknown(value) => value,
4128        }
4129    }
4130}
4131
4132#[doc(hidden)]
4133impl FromGlib<ffi::GdkTouchpadGesturePhase> for TouchpadGesturePhase {
4134    #[inline]
4135    unsafe fn from_glib(value: ffi::GdkTouchpadGesturePhase) -> Self {
4136        skip_assert_initialized!();
4137
4138        match value {
4139            ffi::GDK_TOUCHPAD_GESTURE_PHASE_BEGIN => Self::Begin,
4140            ffi::GDK_TOUCHPAD_GESTURE_PHASE_UPDATE => Self::Update,
4141            ffi::GDK_TOUCHPAD_GESTURE_PHASE_END => Self::End,
4142            ffi::GDK_TOUCHPAD_GESTURE_PHASE_CANCEL => Self::Cancel,
4143            value => Self::__Unknown(value),
4144        }
4145    }
4146}
4147
4148impl StaticType for TouchpadGesturePhase {
4149    #[inline]
4150    #[doc(alias = "gdk_touchpad_gesture_phase_get_type")]
4151    fn static_type() -> glib::Type {
4152        unsafe { from_glib(ffi::gdk_touchpad_gesture_phase_get_type()) }
4153    }
4154}
4155
4156impl glib::HasParamSpec for TouchpadGesturePhase {
4157    type ParamSpec = glib::ParamSpecEnum;
4158    type SetValue = Self;
4159    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4160
4161    fn param_spec_builder() -> Self::BuilderFn {
4162        Self::ParamSpec::builder_with_default
4163    }
4164}
4165
4166impl glib::value::ValueType for TouchpadGesturePhase {
4167    type Type = Self;
4168}
4169
4170unsafe impl<'a> glib::value::FromValue<'a> for TouchpadGesturePhase {
4171    type Checker = glib::value::GenericValueTypeChecker<Self>;
4172
4173    #[inline]
4174    unsafe fn from_value(value: &'a glib::Value) -> Self {
4175        skip_assert_initialized!();
4176        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4177    }
4178}
4179
4180impl ToValue for TouchpadGesturePhase {
4181    #[inline]
4182    fn to_value(&self) -> glib::Value {
4183        let mut value = glib::Value::for_value_type::<Self>();
4184        unsafe {
4185            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4186        }
4187        value
4188    }
4189
4190    #[inline]
4191    fn value_type(&self) -> glib::Type {
4192        Self::static_type()
4193    }
4194}
4195
4196impl From<TouchpadGesturePhase> for glib::Value {
4197    #[inline]
4198    fn from(v: TouchpadGesturePhase) -> Self {
4199        skip_assert_initialized!();
4200        ToValue::to_value(&v)
4201    }
4202}
4203
4204/// Error enumeration for [`VulkanContext`][crate::VulkanContext].
4205#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
4206#[non_exhaustive]
4207#[doc(alias = "GdkVulkanError")]
4208pub enum VulkanError {
4209    /// Vulkan is not supported on this backend or has not been
4210    ///   compiled in.
4211    #[doc(alias = "GDK_VULKAN_ERROR_UNSUPPORTED")]
4212    Unsupported,
4213    /// Vulkan support is not available on this Surface
4214    #[doc(alias = "GDK_VULKAN_ERROR_NOT_AVAILABLE")]
4215    NotAvailable,
4216    #[doc(hidden)]
4217    __Unknown(i32),
4218}
4219
4220#[doc(hidden)]
4221impl IntoGlib for VulkanError {
4222    type GlibType = ffi::GdkVulkanError;
4223
4224    #[inline]
4225    fn into_glib(self) -> ffi::GdkVulkanError {
4226        match self {
4227            Self::Unsupported => ffi::GDK_VULKAN_ERROR_UNSUPPORTED,
4228            Self::NotAvailable => ffi::GDK_VULKAN_ERROR_NOT_AVAILABLE,
4229            Self::__Unknown(value) => value,
4230        }
4231    }
4232}
4233
4234#[doc(hidden)]
4235impl FromGlib<ffi::GdkVulkanError> for VulkanError {
4236    #[inline]
4237    unsafe fn from_glib(value: ffi::GdkVulkanError) -> Self {
4238        skip_assert_initialized!();
4239
4240        match value {
4241            ffi::GDK_VULKAN_ERROR_UNSUPPORTED => Self::Unsupported,
4242            ffi::GDK_VULKAN_ERROR_NOT_AVAILABLE => Self::NotAvailable,
4243            value => Self::__Unknown(value),
4244        }
4245    }
4246}
4247
4248impl glib::error::ErrorDomain for VulkanError {
4249    #[inline]
4250    fn domain() -> glib::Quark {
4251        skip_assert_initialized!();
4252
4253        unsafe { from_glib(ffi::gdk_vulkan_error_quark()) }
4254    }
4255
4256    #[inline]
4257    fn code(self) -> i32 {
4258        self.into_glib()
4259    }
4260
4261    #[inline]
4262    #[allow(clippy::match_single_binding)]
4263    fn from(code: i32) -> Option<Self> {
4264        skip_assert_initialized!();
4265        match unsafe { from_glib(code) } {
4266            value => Some(value),
4267        }
4268    }
4269}
4270
4271impl StaticType for VulkanError {
4272    #[inline]
4273    #[doc(alias = "gdk_vulkan_error_get_type")]
4274    fn static_type() -> glib::Type {
4275        unsafe { from_glib(ffi::gdk_vulkan_error_get_type()) }
4276    }
4277}
4278
4279impl glib::HasParamSpec for VulkanError {
4280    type ParamSpec = glib::ParamSpecEnum;
4281    type SetValue = Self;
4282    type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
4283
4284    fn param_spec_builder() -> Self::BuilderFn {
4285        Self::ParamSpec::builder_with_default
4286    }
4287}
4288
4289impl glib::value::ValueType for VulkanError {
4290    type Type = Self;
4291}
4292
4293unsafe impl<'a> glib::value::FromValue<'a> for VulkanError {
4294    type Checker = glib::value::GenericValueTypeChecker<Self>;
4295
4296    #[inline]
4297    unsafe fn from_value(value: &'a glib::Value) -> Self {
4298        skip_assert_initialized!();
4299        unsafe { from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) }
4300    }
4301}
4302
4303impl ToValue for VulkanError {
4304    #[inline]
4305    fn to_value(&self) -> glib::Value {
4306        let mut value = glib::Value::for_value_type::<Self>();
4307        unsafe {
4308            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
4309        }
4310        value
4311    }
4312
4313    #[inline]
4314    fn value_type(&self) -> glib::Type {
4315        Self::static_type()
4316    }
4317}
4318
4319impl From<VulkanError> for glib::Value {
4320    #[inline]
4321    fn from(v: VulkanError) -> Self {
4322        skip_assert_initialized!();
4323        ToValue::to_value(&v)
4324    }
4325}