gdk4/auto/
flags.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::{bitflags::bitflags, prelude::*, translate::*};
7
8bitflags! {
9    /// Positioning hints for aligning a surface relative to a rectangle.
10    ///
11    /// These hints determine how the surface should be positioned in the case that
12    /// the surface would fall off-screen if placed in its ideal position.
13    ///
14    /// For example, [`FLIP_X`][Self::FLIP_X] will replace [`Gravity::NorthWest`][crate::Gravity::NorthWest] with
15    /// [`Gravity::NorthEast`][crate::Gravity::NorthEast] and vice versa if the surface extends beyond the left
16    /// or right edges of the monitor.
17    ///
18    /// If [`SLIDE_X`][Self::SLIDE_X] is set, the surface can be shifted horizontally to fit
19    /// on-screen. If [`RESIZE_X`][Self::RESIZE_X] is set, the surface can be shrunken
20    /// horizontally to fit.
21    ///
22    /// In general, when multiple flags are set, flipping should take precedence over
23    /// sliding, which should take precedence over resizing.
24    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
25    #[doc(alias = "GdkAnchorHints")]
26    pub struct AnchorHints: u32 {
27        /// allow flipping anchors horizontally
28        #[doc(alias = "GDK_ANCHOR_FLIP_X")]
29        const FLIP_X = ffi::GDK_ANCHOR_FLIP_X as _;
30        /// allow flipping anchors vertically
31        #[doc(alias = "GDK_ANCHOR_FLIP_Y")]
32        const FLIP_Y = ffi::GDK_ANCHOR_FLIP_Y as _;
33        /// allow sliding surface horizontally
34        #[doc(alias = "GDK_ANCHOR_SLIDE_X")]
35        const SLIDE_X = ffi::GDK_ANCHOR_SLIDE_X as _;
36        /// allow sliding surface vertically
37        #[doc(alias = "GDK_ANCHOR_SLIDE_Y")]
38        const SLIDE_Y = ffi::GDK_ANCHOR_SLIDE_Y as _;
39        /// allow resizing surface horizontally
40        #[doc(alias = "GDK_ANCHOR_RESIZE_X")]
41        const RESIZE_X = ffi::GDK_ANCHOR_RESIZE_X as _;
42        /// allow resizing surface vertically
43        #[doc(alias = "GDK_ANCHOR_RESIZE_Y")]
44        const RESIZE_Y = ffi::GDK_ANCHOR_RESIZE_Y as _;
45        /// allow flipping anchors on both axes
46        #[doc(alias = "GDK_ANCHOR_FLIP")]
47        const FLIP = ffi::GDK_ANCHOR_FLIP as _;
48        /// allow sliding surface on both axes
49        #[doc(alias = "GDK_ANCHOR_SLIDE")]
50        const SLIDE = ffi::GDK_ANCHOR_SLIDE as _;
51        /// allow resizing surface on both axes
52        #[doc(alias = "GDK_ANCHOR_RESIZE")]
53        const RESIZE = ffi::GDK_ANCHOR_RESIZE as _;
54    }
55}
56
57#[doc(hidden)]
58impl IntoGlib for AnchorHints {
59    type GlibType = ffi::GdkAnchorHints;
60
61    #[inline]
62    fn into_glib(self) -> ffi::GdkAnchorHints {
63        self.bits()
64    }
65}
66
67#[doc(hidden)]
68impl FromGlib<ffi::GdkAnchorHints> for AnchorHints {
69    #[inline]
70    unsafe fn from_glib(value: ffi::GdkAnchorHints) -> Self {
71        skip_assert_initialized!();
72        Self::from_bits_truncate(value)
73    }
74}
75
76impl StaticType for AnchorHints {
77    #[inline]
78    #[doc(alias = "gdk_anchor_hints_get_type")]
79    fn static_type() -> glib::Type {
80        unsafe { from_glib(ffi::gdk_anchor_hints_get_type()) }
81    }
82}
83
84impl glib::HasParamSpec for AnchorHints {
85    type ParamSpec = glib::ParamSpecFlags;
86    type SetValue = Self;
87    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
88
89    fn param_spec_builder() -> Self::BuilderFn {
90        Self::ParamSpec::builder
91    }
92}
93
94impl glib::value::ValueType for AnchorHints {
95    type Type = Self;
96}
97
98unsafe impl<'a> glib::value::FromValue<'a> for AnchorHints {
99    type Checker = glib::value::GenericValueTypeChecker<Self>;
100
101    #[inline]
102    unsafe fn from_value(value: &'a glib::Value) -> Self {
103        skip_assert_initialized!();
104        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
105    }
106}
107
108impl ToValue for AnchorHints {
109    #[inline]
110    fn to_value(&self) -> glib::Value {
111        let mut value = glib::Value::for_value_type::<Self>();
112        unsafe {
113            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
114        }
115        value
116    }
117
118    #[inline]
119    fn value_type(&self) -> glib::Type {
120        Self::static_type()
121    }
122}
123
124impl From<AnchorHints> for glib::Value {
125    #[inline]
126    fn from(v: AnchorHints) -> Self {
127        skip_assert_initialized!();
128        ToValue::to_value(&v)
129    }
130}
131
132bitflags! {
133    /// Flags describing the current capabilities of a device/tool.
134    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
135    #[doc(alias = "GdkAxisFlags")]
136    pub struct AxisFlags: u32 {
137        /// X axis is present
138        #[doc(alias = "GDK_AXIS_FLAG_X")]
139        const X = ffi::GDK_AXIS_FLAG_X as _;
140        /// Y axis is present
141        #[doc(alias = "GDK_AXIS_FLAG_Y")]
142        const Y = ffi::GDK_AXIS_FLAG_Y as _;
143        /// Scroll X delta axis is present
144        #[doc(alias = "GDK_AXIS_FLAG_DELTA_X")]
145        const DELTA_X = ffi::GDK_AXIS_FLAG_DELTA_X as _;
146        /// Scroll Y delta axis is present
147        #[doc(alias = "GDK_AXIS_FLAG_DELTA_Y")]
148        const DELTA_Y = ffi::GDK_AXIS_FLAG_DELTA_Y as _;
149        /// Pressure axis is present
150        #[doc(alias = "GDK_AXIS_FLAG_PRESSURE")]
151        const PRESSURE = ffi::GDK_AXIS_FLAG_PRESSURE as _;
152        /// X tilt axis is present
153        #[doc(alias = "GDK_AXIS_FLAG_XTILT")]
154        const XTILT = ffi::GDK_AXIS_FLAG_XTILT as _;
155        /// Y tilt axis is present
156        #[doc(alias = "GDK_AXIS_FLAG_YTILT")]
157        const YTILT = ffi::GDK_AXIS_FLAG_YTILT as _;
158        /// Wheel axis is present
159        #[doc(alias = "GDK_AXIS_FLAG_WHEEL")]
160        const WHEEL = ffi::GDK_AXIS_FLAG_WHEEL as _;
161        /// Distance axis is present
162        #[doc(alias = "GDK_AXIS_FLAG_DISTANCE")]
163        const DISTANCE = ffi::GDK_AXIS_FLAG_DISTANCE as _;
164        /// Z-axis rotation is present
165        #[doc(alias = "GDK_AXIS_FLAG_ROTATION")]
166        const ROTATION = ffi::GDK_AXIS_FLAG_ROTATION as _;
167        /// Slider axis is present
168        #[doc(alias = "GDK_AXIS_FLAG_SLIDER")]
169        const SLIDER = ffi::GDK_AXIS_FLAG_SLIDER as _;
170    }
171}
172
173#[doc(hidden)]
174impl IntoGlib for AxisFlags {
175    type GlibType = ffi::GdkAxisFlags;
176
177    #[inline]
178    fn into_glib(self) -> ffi::GdkAxisFlags {
179        self.bits()
180    }
181}
182
183#[doc(hidden)]
184impl FromGlib<ffi::GdkAxisFlags> for AxisFlags {
185    #[inline]
186    unsafe fn from_glib(value: ffi::GdkAxisFlags) -> Self {
187        skip_assert_initialized!();
188        Self::from_bits_truncate(value)
189    }
190}
191
192impl StaticType for AxisFlags {
193    #[inline]
194    #[doc(alias = "gdk_axis_flags_get_type")]
195    fn static_type() -> glib::Type {
196        unsafe { from_glib(ffi::gdk_axis_flags_get_type()) }
197    }
198}
199
200impl glib::HasParamSpec for AxisFlags {
201    type ParamSpec = glib::ParamSpecFlags;
202    type SetValue = Self;
203    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
204
205    fn param_spec_builder() -> Self::BuilderFn {
206        Self::ParamSpec::builder
207    }
208}
209
210impl glib::value::ValueType for AxisFlags {
211    type Type = Self;
212}
213
214unsafe impl<'a> glib::value::FromValue<'a> for AxisFlags {
215    type Checker = glib::value::GenericValueTypeChecker<Self>;
216
217    #[inline]
218    unsafe fn from_value(value: &'a glib::Value) -> Self {
219        skip_assert_initialized!();
220        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
221    }
222}
223
224impl ToValue for AxisFlags {
225    #[inline]
226    fn to_value(&self) -> glib::Value {
227        let mut value = glib::Value::for_value_type::<Self>();
228        unsafe {
229            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
230        }
231        value
232    }
233
234    #[inline]
235    fn value_type(&self) -> glib::Type {
236        Self::static_type()
237    }
238}
239
240impl From<AxisFlags> for glib::Value {
241    #[inline]
242    fn from(v: AxisFlags) -> Self {
243        skip_assert_initialized!();
244        ToValue::to_value(&v)
245    }
246}
247
248bitflags! {
249    /// Used in [`Drop`][crate::Drop] and [`Drag`][crate::Drag] to indicate the actions that the
250    /// destination can and should do with the dropped data.
251    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
252    #[doc(alias = "GdkDragAction")]
253    pub struct DragAction: u32 {
254        /// Copy the data.
255        #[doc(alias = "GDK_ACTION_COPY")]
256        const COPY = ffi::GDK_ACTION_COPY as _;
257        /// Move the data, i.e. first copy it, then delete
258        ///   it from the source using the DELETE target of the X selection protocol.
259        #[doc(alias = "GDK_ACTION_MOVE")]
260        const MOVE = ffi::GDK_ACTION_MOVE as _;
261        /// Add a link to the data. Note that this is only
262        ///   useful if source and destination agree on what it means, and is not
263        ///   supported on all platforms.
264        #[doc(alias = "GDK_ACTION_LINK")]
265        const LINK = ffi::GDK_ACTION_LINK as _;
266        /// Ask the user what to do with the data.
267        #[doc(alias = "GDK_ACTION_ASK")]
268        const ASK = ffi::GDK_ACTION_ASK as _;
269    }
270}
271
272impl DragAction {
273    #[doc(alias = "gdk_drag_action_is_unique")]
274    pub fn is_unique(self) -> bool {
275        assert_initialized_main_thread!();
276        unsafe { from_glib(ffi::gdk_drag_action_is_unique(self.into_glib())) }
277    }
278}
279
280#[doc(hidden)]
281impl IntoGlib for DragAction {
282    type GlibType = ffi::GdkDragAction;
283
284    #[inline]
285    fn into_glib(self) -> ffi::GdkDragAction {
286        self.bits()
287    }
288}
289
290#[doc(hidden)]
291impl FromGlib<ffi::GdkDragAction> for DragAction {
292    #[inline]
293    unsafe fn from_glib(value: ffi::GdkDragAction) -> Self {
294        skip_assert_initialized!();
295        Self::from_bits_truncate(value)
296    }
297}
298
299impl StaticType for DragAction {
300    #[inline]
301    #[doc(alias = "gdk_drag_action_get_type")]
302    fn static_type() -> glib::Type {
303        unsafe { from_glib(ffi::gdk_drag_action_get_type()) }
304    }
305}
306
307impl glib::HasParamSpec for DragAction {
308    type ParamSpec = glib::ParamSpecFlags;
309    type SetValue = Self;
310    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
311
312    fn param_spec_builder() -> Self::BuilderFn {
313        Self::ParamSpec::builder
314    }
315}
316
317impl glib::value::ValueType for DragAction {
318    type Type = Self;
319}
320
321unsafe impl<'a> glib::value::FromValue<'a> for DragAction {
322    type Checker = glib::value::GenericValueTypeChecker<Self>;
323
324    #[inline]
325    unsafe fn from_value(value: &'a glib::Value) -> Self {
326        skip_assert_initialized!();
327        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
328    }
329}
330
331impl ToValue for DragAction {
332    #[inline]
333    fn to_value(&self) -> glib::Value {
334        let mut value = glib::Value::for_value_type::<Self>();
335        unsafe {
336            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
337        }
338        value
339    }
340
341    #[inline]
342    fn value_type(&self) -> glib::Type {
343        Self::static_type()
344    }
345}
346
347impl From<DragAction> for glib::Value {
348    #[inline]
349    fn from(v: DragAction) -> Self {
350        skip_assert_initialized!();
351        ToValue::to_value(&v)
352    }
353}
354
355bitflags! {
356    /// Used to represent the different paint clock phases that can be requested.
357    ///
358    /// The elements of the enumeration correspond to the signals of [`FrameClock`][crate::FrameClock].
359    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
360    #[doc(alias = "GdkFrameClockPhase")]
361    pub struct FrameClockPhase: u32 {
362        /// no phase
363        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_NONE")]
364        const NONE = ffi::GDK_FRAME_CLOCK_PHASE_NONE as _;
365        /// corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
366        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS")]
367        const FLUSH_EVENTS = ffi::GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS as _;
368        /// corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
369        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT")]
370        const BEFORE_PAINT = ffi::GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT as _;
371        /// corresponds to GdkFrameClock::update.
372        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_UPDATE")]
373        const UPDATE = ffi::GDK_FRAME_CLOCK_PHASE_UPDATE as _;
374        /// corresponds to GdkFrameClock::layout. Should not be handled by applications.
375        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_LAYOUT")]
376        const LAYOUT = ffi::GDK_FRAME_CLOCK_PHASE_LAYOUT as _;
377        /// corresponds to GdkFrameClock::paint.
378        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_PAINT")]
379        const PAINT = ffi::GDK_FRAME_CLOCK_PHASE_PAINT as _;
380        /// corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
381        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS")]
382        const RESUME_EVENTS = ffi::GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS as _;
383        /// corresponds to GdkFrameClock::after-paint. Should not be handled by applications.
384        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_AFTER_PAINT")]
385        const AFTER_PAINT = ffi::GDK_FRAME_CLOCK_PHASE_AFTER_PAINT as _;
386    }
387}
388
389#[doc(hidden)]
390impl IntoGlib for FrameClockPhase {
391    type GlibType = ffi::GdkFrameClockPhase;
392
393    #[inline]
394    fn into_glib(self) -> ffi::GdkFrameClockPhase {
395        self.bits()
396    }
397}
398
399#[doc(hidden)]
400impl FromGlib<ffi::GdkFrameClockPhase> for FrameClockPhase {
401    #[inline]
402    unsafe fn from_glib(value: ffi::GdkFrameClockPhase) -> Self {
403        skip_assert_initialized!();
404        Self::from_bits_truncate(value)
405    }
406}
407
408impl StaticType for FrameClockPhase {
409    #[inline]
410    #[doc(alias = "gdk_frame_clock_phase_get_type")]
411    fn static_type() -> glib::Type {
412        unsafe { from_glib(ffi::gdk_frame_clock_phase_get_type()) }
413    }
414}
415
416impl glib::HasParamSpec for FrameClockPhase {
417    type ParamSpec = glib::ParamSpecFlags;
418    type SetValue = Self;
419    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
420
421    fn param_spec_builder() -> Self::BuilderFn {
422        Self::ParamSpec::builder
423    }
424}
425
426impl glib::value::ValueType for FrameClockPhase {
427    type Type = Self;
428}
429
430unsafe impl<'a> glib::value::FromValue<'a> for FrameClockPhase {
431    type Checker = glib::value::GenericValueTypeChecker<Self>;
432
433    #[inline]
434    unsafe fn from_value(value: &'a glib::Value) -> Self {
435        skip_assert_initialized!();
436        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
437    }
438}
439
440impl ToValue for FrameClockPhase {
441    #[inline]
442    fn to_value(&self) -> glib::Value {
443        let mut value = glib::Value::for_value_type::<Self>();
444        unsafe {
445            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
446        }
447        value
448    }
449
450    #[inline]
451    fn value_type(&self) -> glib::Type {
452        Self::static_type()
453    }
454}
455
456impl From<FrameClockPhase> for glib::Value {
457    #[inline]
458    fn from(v: FrameClockPhase) -> Self {
459        skip_assert_initialized!();
460        ToValue::to_value(&v)
461    }
462}
463
464#[cfg(feature = "v4_6")]
465bitflags! {
466    /// The list of the different APIs that GdkGLContext can potentially support.
467    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
468    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
469    #[doc(alias = "GdkGLAPI")]
470    pub struct GLAPI: u32 {
471        /// The OpenGL API
472        #[doc(alias = "GDK_GL_API_GL")]
473        const GL = ffi::GDK_GL_API_GL as _;
474        /// The OpenGL ES API
475        #[doc(alias = "GDK_GL_API_GLES")]
476        const GLES = ffi::GDK_GL_API_GLES as _;
477    }
478}
479
480#[cfg(feature = "v4_6")]
481#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
482#[doc(hidden)]
483impl IntoGlib for GLAPI {
484    type GlibType = ffi::GdkGLAPI;
485
486    #[inline]
487    fn into_glib(self) -> ffi::GdkGLAPI {
488        self.bits()
489    }
490}
491
492#[cfg(feature = "v4_6")]
493#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
494#[doc(hidden)]
495impl FromGlib<ffi::GdkGLAPI> for GLAPI {
496    #[inline]
497    unsafe fn from_glib(value: ffi::GdkGLAPI) -> Self {
498        skip_assert_initialized!();
499        Self::from_bits_truncate(value)
500    }
501}
502
503#[cfg(feature = "v4_6")]
504#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
505impl StaticType for GLAPI {
506    #[inline]
507    #[doc(alias = "gdk_gl_api_get_type")]
508    fn static_type() -> glib::Type {
509        unsafe { from_glib(ffi::gdk_gl_api_get_type()) }
510    }
511}
512
513#[cfg(feature = "v4_6")]
514#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
515impl glib::HasParamSpec for GLAPI {
516    type ParamSpec = glib::ParamSpecFlags;
517    type SetValue = Self;
518    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
519
520    fn param_spec_builder() -> Self::BuilderFn {
521        Self::ParamSpec::builder
522    }
523}
524
525#[cfg(feature = "v4_6")]
526#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
527impl glib::value::ValueType for GLAPI {
528    type Type = Self;
529}
530
531#[cfg(feature = "v4_6")]
532#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
533unsafe impl<'a> glib::value::FromValue<'a> for GLAPI {
534    type Checker = glib::value::GenericValueTypeChecker<Self>;
535
536    #[inline]
537    unsafe fn from_value(value: &'a glib::Value) -> Self {
538        skip_assert_initialized!();
539        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
540    }
541}
542
543#[cfg(feature = "v4_6")]
544#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
545impl ToValue for GLAPI {
546    #[inline]
547    fn to_value(&self) -> glib::Value {
548        let mut value = glib::Value::for_value_type::<Self>();
549        unsafe {
550            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
551        }
552        value
553    }
554
555    #[inline]
556    fn value_type(&self) -> glib::Type {
557        Self::static_type()
558    }
559}
560
561#[cfg(feature = "v4_6")]
562#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
563impl From<GLAPI> for glib::Value {
564    #[inline]
565    fn from(v: GLAPI) -> Self {
566        skip_assert_initialized!();
567        ToValue::to_value(&v)
568    }
569}
570
571bitflags! {
572    /// Flags to indicate the state of modifier keys and mouse buttons
573    /// in events.
574    ///
575    /// Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose,
576    /// Apple, CapsLock or ShiftLock.
577    ///
578    /// Note that GDK may add internal values to events which include values outside
579    /// of this enumeration. Your code should preserve and ignore them. You can use
580    /// `GDK_MODIFIER_MASK` to remove all private values.
581    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
582    #[doc(alias = "GdkModifierType")]
583    pub struct ModifierType: u32 {
584        /// No modifier.
585        #[cfg(feature = "v4_14")]
586        #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
587        #[doc(alias = "GDK_NO_MODIFIER_MASK")]
588        const NO_MODIFIER_MASK = ffi::GDK_NO_MODIFIER_MASK as _;
589        /// the Shift key.
590        #[doc(alias = "GDK_SHIFT_MASK")]
591        const SHIFT_MASK = ffi::GDK_SHIFT_MASK as _;
592        /// a Lock key (depending on the Windowing System configuration,
593        ///    this may either be <kbd>CapsLock</kbd> or <kbd>ShiftLock</kbd>).
594        #[doc(alias = "GDK_LOCK_MASK")]
595        const LOCK_MASK = ffi::GDK_LOCK_MASK as _;
596        /// the Control key.
597        #[doc(alias = "GDK_CONTROL_MASK")]
598        const CONTROL_MASK = ffi::GDK_CONTROL_MASK as _;
599        /// the fourth modifier key (it depends on the Windowing System
600        ///    configuration which key is interpreted as this modifier, but normally it
601        ///    is the <kbd>Alt</kbd> key).
602        #[doc(alias = "GDK_ALT_MASK")]
603        const ALT_MASK = ffi::GDK_ALT_MASK as _;
604        /// the first mouse button.
605        #[doc(alias = "GDK_BUTTON1_MASK")]
606        const BUTTON1_MASK = ffi::GDK_BUTTON1_MASK as _;
607        /// the second mouse button.
608        #[doc(alias = "GDK_BUTTON2_MASK")]
609        const BUTTON2_MASK = ffi::GDK_BUTTON2_MASK as _;
610        /// the third mouse button.
611        #[doc(alias = "GDK_BUTTON3_MASK")]
612        const BUTTON3_MASK = ffi::GDK_BUTTON3_MASK as _;
613        /// the fourth mouse button.
614        #[doc(alias = "GDK_BUTTON4_MASK")]
615        const BUTTON4_MASK = ffi::GDK_BUTTON4_MASK as _;
616        /// the fifth mouse button.
617        #[doc(alias = "GDK_BUTTON5_MASK")]
618        const BUTTON5_MASK = ffi::GDK_BUTTON5_MASK as _;
619        /// the Super modifier.
620        #[doc(alias = "GDK_SUPER_MASK")]
621        const SUPER_MASK = ffi::GDK_SUPER_MASK as _;
622        /// the Hyper modifier.
623        #[doc(alias = "GDK_HYPER_MASK")]
624        const HYPER_MASK = ffi::GDK_HYPER_MASK as _;
625        /// the Meta modifier. Maps to Command on macOS.
626        #[doc(alias = "GDK_META_MASK")]
627        const META_MASK = ffi::GDK_META_MASK as _;
628    }
629}
630
631#[doc(hidden)]
632impl IntoGlib for ModifierType {
633    type GlibType = ffi::GdkModifierType;
634
635    #[inline]
636    fn into_glib(self) -> ffi::GdkModifierType {
637        self.bits()
638    }
639}
640
641#[doc(hidden)]
642impl FromGlib<ffi::GdkModifierType> for ModifierType {
643    #[inline]
644    unsafe fn from_glib(value: ffi::GdkModifierType) -> Self {
645        skip_assert_initialized!();
646        Self::from_bits_truncate(value)
647    }
648}
649
650impl StaticType for ModifierType {
651    #[inline]
652    #[doc(alias = "gdk_modifier_type_get_type")]
653    fn static_type() -> glib::Type {
654        unsafe { from_glib(ffi::gdk_modifier_type_get_type()) }
655    }
656}
657
658impl glib::HasParamSpec for ModifierType {
659    type ParamSpec = glib::ParamSpecFlags;
660    type SetValue = Self;
661    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
662
663    fn param_spec_builder() -> Self::BuilderFn {
664        Self::ParamSpec::builder
665    }
666}
667
668impl glib::value::ValueType for ModifierType {
669    type Type = Self;
670}
671
672unsafe impl<'a> glib::value::FromValue<'a> for ModifierType {
673    type Checker = glib::value::GenericValueTypeChecker<Self>;
674
675    #[inline]
676    unsafe fn from_value(value: &'a glib::Value) -> Self {
677        skip_assert_initialized!();
678        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
679    }
680}
681
682impl ToValue for ModifierType {
683    #[inline]
684    fn to_value(&self) -> glib::Value {
685        let mut value = glib::Value::for_value_type::<Self>();
686        unsafe {
687            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
688        }
689        value
690    }
691
692    #[inline]
693    fn value_type(&self) -> glib::Type {
694        Self::static_type()
695    }
696}
697
698impl From<ModifierType> for glib::Value {
699    #[inline]
700    fn from(v: ModifierType) -> Self {
701        skip_assert_initialized!();
702        ToValue::to_value(&v)
703    }
704}
705
706bitflags! {
707    /// Flags about a paintable object.
708    ///
709    /// Implementations use these for optimizations such as caching.
710    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
711    #[doc(alias = "GdkPaintableFlags")]
712    pub struct PaintableFlags: u32 {
713        /// The size is immutable.
714        ///   The [`invalidate-size`][struct@crate::Paintable#invalidate-size] signal will never be
715        ///   emitted.
716        #[doc(alias = "GDK_PAINTABLE_STATIC_SIZE")]
717        const SIZE = ffi::GDK_PAINTABLE_STATIC_SIZE as _;
718        /// The content is immutable.
719        ///   The [`invalidate-contents`][struct@crate::Paintable#invalidate-contents] signal will never be
720        ///   emitted.
721        #[doc(alias = "GDK_PAINTABLE_STATIC_CONTENTS")]
722        const CONTENTS = ffi::GDK_PAINTABLE_STATIC_CONTENTS as _;
723    }
724}
725
726#[doc(hidden)]
727impl IntoGlib for PaintableFlags {
728    type GlibType = ffi::GdkPaintableFlags;
729
730    #[inline]
731    fn into_glib(self) -> ffi::GdkPaintableFlags {
732        self.bits()
733    }
734}
735
736#[doc(hidden)]
737impl FromGlib<ffi::GdkPaintableFlags> for PaintableFlags {
738    #[inline]
739    unsafe fn from_glib(value: ffi::GdkPaintableFlags) -> Self {
740        skip_assert_initialized!();
741        Self::from_bits_truncate(value)
742    }
743}
744
745impl StaticType for PaintableFlags {
746    #[inline]
747    #[doc(alias = "gdk_paintable_flags_get_type")]
748    fn static_type() -> glib::Type {
749        unsafe { from_glib(ffi::gdk_paintable_flags_get_type()) }
750    }
751}
752
753impl glib::HasParamSpec for PaintableFlags {
754    type ParamSpec = glib::ParamSpecFlags;
755    type SetValue = Self;
756    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
757
758    fn param_spec_builder() -> Self::BuilderFn {
759        Self::ParamSpec::builder
760    }
761}
762
763impl glib::value::ValueType for PaintableFlags {
764    type Type = Self;
765}
766
767unsafe impl<'a> glib::value::FromValue<'a> for PaintableFlags {
768    type Checker = glib::value::GenericValueTypeChecker<Self>;
769
770    #[inline]
771    unsafe fn from_value(value: &'a glib::Value) -> Self {
772        skip_assert_initialized!();
773        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
774    }
775}
776
777impl ToValue for PaintableFlags {
778    #[inline]
779    fn to_value(&self) -> glib::Value {
780        let mut value = glib::Value::for_value_type::<Self>();
781        unsafe {
782            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
783        }
784        value
785    }
786
787    #[inline]
788    fn value_type(&self) -> glib::Type {
789        Self::static_type()
790    }
791}
792
793impl From<PaintableFlags> for glib::Value {
794    #[inline]
795    fn from(v: PaintableFlags) -> Self {
796        skip_assert_initialized!();
797        ToValue::to_value(&v)
798    }
799}
800
801bitflags! {
802    /// Flags describing the seat capabilities.
803    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
804    #[doc(alias = "GdkSeatCapabilities")]
805    pub struct SeatCapabilities: u32 {
806        /// No input capabilities
807        #[doc(alias = "GDK_SEAT_CAPABILITY_NONE")]
808        const NONE = ffi::GDK_SEAT_CAPABILITY_NONE as _;
809        /// The seat has a pointer (e.g. mouse)
810        #[doc(alias = "GDK_SEAT_CAPABILITY_POINTER")]
811        const POINTER = ffi::GDK_SEAT_CAPABILITY_POINTER as _;
812        /// The seat has touchscreen(s) attached
813        #[doc(alias = "GDK_SEAT_CAPABILITY_TOUCH")]
814        const TOUCH = ffi::GDK_SEAT_CAPABILITY_TOUCH as _;
815        /// The seat has drawing tablet(s) attached
816        #[doc(alias = "GDK_SEAT_CAPABILITY_TABLET_STYLUS")]
817        const TABLET_STYLUS = ffi::GDK_SEAT_CAPABILITY_TABLET_STYLUS as _;
818        /// The seat has keyboard(s) attached
819        #[doc(alias = "GDK_SEAT_CAPABILITY_KEYBOARD")]
820        const KEYBOARD = ffi::GDK_SEAT_CAPABILITY_KEYBOARD as _;
821        /// The seat has drawing tablet pad(s) attached
822        #[doc(alias = "GDK_SEAT_CAPABILITY_TABLET_PAD")]
823        const TABLET_PAD = ffi::GDK_SEAT_CAPABILITY_TABLET_PAD as _;
824        /// The union of all pointing capabilities
825        #[doc(alias = "GDK_SEAT_CAPABILITY_ALL_POINTING")]
826        const ALL_POINTING = ffi::GDK_SEAT_CAPABILITY_ALL_POINTING as _;
827        /// The union of all capabilities
828        #[doc(alias = "GDK_SEAT_CAPABILITY_ALL")]
829        const ALL = ffi::GDK_SEAT_CAPABILITY_ALL as _;
830    }
831}
832
833#[doc(hidden)]
834impl IntoGlib for SeatCapabilities {
835    type GlibType = ffi::GdkSeatCapabilities;
836
837    #[inline]
838    fn into_glib(self) -> ffi::GdkSeatCapabilities {
839        self.bits()
840    }
841}
842
843#[doc(hidden)]
844impl FromGlib<ffi::GdkSeatCapabilities> for SeatCapabilities {
845    #[inline]
846    unsafe fn from_glib(value: ffi::GdkSeatCapabilities) -> Self {
847        skip_assert_initialized!();
848        Self::from_bits_truncate(value)
849    }
850}
851
852impl StaticType for SeatCapabilities {
853    #[inline]
854    #[doc(alias = "gdk_seat_capabilities_get_type")]
855    fn static_type() -> glib::Type {
856        unsafe { from_glib(ffi::gdk_seat_capabilities_get_type()) }
857    }
858}
859
860impl glib::HasParamSpec for SeatCapabilities {
861    type ParamSpec = glib::ParamSpecFlags;
862    type SetValue = Self;
863    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
864
865    fn param_spec_builder() -> Self::BuilderFn {
866        Self::ParamSpec::builder
867    }
868}
869
870impl glib::value::ValueType for SeatCapabilities {
871    type Type = Self;
872}
873
874unsafe impl<'a> glib::value::FromValue<'a> for SeatCapabilities {
875    type Checker = glib::value::GenericValueTypeChecker<Self>;
876
877    #[inline]
878    unsafe fn from_value(value: &'a glib::Value) -> Self {
879        skip_assert_initialized!();
880        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
881    }
882}
883
884impl ToValue for SeatCapabilities {
885    #[inline]
886    fn to_value(&self) -> glib::Value {
887        let mut value = glib::Value::for_value_type::<Self>();
888        unsafe {
889            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
890        }
891        value
892    }
893
894    #[inline]
895    fn value_type(&self) -> glib::Type {
896        Self::static_type()
897    }
898}
899
900impl From<SeatCapabilities> for glib::Value {
901    #[inline]
902    fn from(v: SeatCapabilities) -> Self {
903        skip_assert_initialized!();
904        ToValue::to_value(&v)
905    }
906}
907
908bitflags! {
909    /// Specifies the state of a toplevel surface.
910    ///
911    /// On platforms that support information about individual edges, the
912    /// [`TILED`][Self::TILED] state will be set whenever any of the individual
913    /// tiled states is set. On platforms that lack that support, the tiled state
914    /// will give an indication of tiledness without any of the per-edge states
915    /// being set.
916    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
917    #[doc(alias = "GdkToplevelState")]
918    pub struct ToplevelState: u32 {
919        /// the surface is minimized
920        #[doc(alias = "GDK_TOPLEVEL_STATE_MINIMIZED")]
921        const MINIMIZED = ffi::GDK_TOPLEVEL_STATE_MINIMIZED as _;
922        /// the surface is maximized
923        #[doc(alias = "GDK_TOPLEVEL_STATE_MAXIMIZED")]
924        const MAXIMIZED = ffi::GDK_TOPLEVEL_STATE_MAXIMIZED as _;
925        /// the surface is sticky
926        #[doc(alias = "GDK_TOPLEVEL_STATE_STICKY")]
927        const STICKY = ffi::GDK_TOPLEVEL_STATE_STICKY as _;
928        /// the surface is maximized without decorations
929        #[doc(alias = "GDK_TOPLEVEL_STATE_FULLSCREEN")]
930        const FULLSCREEN = ffi::GDK_TOPLEVEL_STATE_FULLSCREEN as _;
931        /// the surface is kept above other surfaces
932        #[doc(alias = "GDK_TOPLEVEL_STATE_ABOVE")]
933        const ABOVE = ffi::GDK_TOPLEVEL_STATE_ABOVE as _;
934        /// the surface is kept below other surfaces
935        #[doc(alias = "GDK_TOPLEVEL_STATE_BELOW")]
936        const BELOW = ffi::GDK_TOPLEVEL_STATE_BELOW as _;
937        /// the surface is presented as focused (with active decorations)
938        #[doc(alias = "GDK_TOPLEVEL_STATE_FOCUSED")]
939        const FOCUSED = ffi::GDK_TOPLEVEL_STATE_FOCUSED as _;
940        /// the surface is in a tiled state
941        #[doc(alias = "GDK_TOPLEVEL_STATE_TILED")]
942        const TILED = ffi::GDK_TOPLEVEL_STATE_TILED as _;
943        /// whether the top edge is tiled
944        #[doc(alias = "GDK_TOPLEVEL_STATE_TOP_TILED")]
945        const TOP_TILED = ffi::GDK_TOPLEVEL_STATE_TOP_TILED as _;
946        /// whether the top edge is resizable
947        #[doc(alias = "GDK_TOPLEVEL_STATE_TOP_RESIZABLE")]
948        const TOP_RESIZABLE = ffi::GDK_TOPLEVEL_STATE_TOP_RESIZABLE as _;
949        /// whether the right edge is tiled
950        #[doc(alias = "GDK_TOPLEVEL_STATE_RIGHT_TILED")]
951        const RIGHT_TILED = ffi::GDK_TOPLEVEL_STATE_RIGHT_TILED as _;
952        /// whether the right edge is resizable
953        #[doc(alias = "GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE")]
954        const RIGHT_RESIZABLE = ffi::GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE as _;
955        /// whether the bottom edge is tiled
956        #[doc(alias = "GDK_TOPLEVEL_STATE_BOTTOM_TILED")]
957        const BOTTOM_TILED = ffi::GDK_TOPLEVEL_STATE_BOTTOM_TILED as _;
958        /// whether the bottom edge is resizable
959        #[doc(alias = "GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE")]
960        const BOTTOM_RESIZABLE = ffi::GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE as _;
961        /// whether the left edge is tiled
962        #[doc(alias = "GDK_TOPLEVEL_STATE_LEFT_TILED")]
963        const LEFT_TILED = ffi::GDK_TOPLEVEL_STATE_LEFT_TILED as _;
964        /// whether the left edge is resizable
965        #[doc(alias = "GDK_TOPLEVEL_STATE_LEFT_RESIZABLE")]
966        const LEFT_RESIZABLE = ffi::GDK_TOPLEVEL_STATE_LEFT_RESIZABLE as _;
967        /// The surface is not visible to the user.
968        #[cfg(feature = "v4_12")]
969        #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
970        #[doc(alias = "GDK_TOPLEVEL_STATE_SUSPENDED")]
971        const SUSPENDED = ffi::GDK_TOPLEVEL_STATE_SUSPENDED as _;
972    }
973}
974
975#[doc(hidden)]
976impl IntoGlib for ToplevelState {
977    type GlibType = ffi::GdkToplevelState;
978
979    #[inline]
980    fn into_glib(self) -> ffi::GdkToplevelState {
981        self.bits()
982    }
983}
984
985#[doc(hidden)]
986impl FromGlib<ffi::GdkToplevelState> for ToplevelState {
987    #[inline]
988    unsafe fn from_glib(value: ffi::GdkToplevelState) -> Self {
989        skip_assert_initialized!();
990        Self::from_bits_truncate(value)
991    }
992}
993
994impl StaticType for ToplevelState {
995    #[inline]
996    #[doc(alias = "gdk_toplevel_state_get_type")]
997    fn static_type() -> glib::Type {
998        unsafe { from_glib(ffi::gdk_toplevel_state_get_type()) }
999    }
1000}
1001
1002impl glib::HasParamSpec for ToplevelState {
1003    type ParamSpec = glib::ParamSpecFlags;
1004    type SetValue = Self;
1005    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
1006
1007    fn param_spec_builder() -> Self::BuilderFn {
1008        Self::ParamSpec::builder
1009    }
1010}
1011
1012impl glib::value::ValueType for ToplevelState {
1013    type Type = Self;
1014}
1015
1016unsafe impl<'a> glib::value::FromValue<'a> for ToplevelState {
1017    type Checker = glib::value::GenericValueTypeChecker<Self>;
1018
1019    #[inline]
1020    unsafe fn from_value(value: &'a glib::Value) -> Self {
1021        skip_assert_initialized!();
1022        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
1023    }
1024}
1025
1026impl ToValue for ToplevelState {
1027    #[inline]
1028    fn to_value(&self) -> glib::Value {
1029        let mut value = glib::Value::for_value_type::<Self>();
1030        unsafe {
1031            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
1032        }
1033        value
1034    }
1035
1036    #[inline]
1037    fn value_type(&self) -> glib::Type {
1038        Self::static_type()
1039    }
1040}
1041
1042impl From<ToplevelState> for glib::Value {
1043    #[inline]
1044    fn from(v: ToplevelState) -> Self {
1045        skip_assert_initialized!();
1046        ToValue::to_value(&v)
1047    }
1048}