Skip to main content

gdk/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 glib::{bitflags::bitflags, prelude::*, translate::*};
6use std::fmt;
7
8bitflags! {
9    /// Positioning hints for aligning a window relative to a rectangle.
10    ///
11    /// These hints determine how the window should be positioned in the case that
12    /// the window 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 window extends beyond the left
16    /// or right edges of the monitor.
17    ///
18    /// If [`SLIDE_X`][Self::SLIDE_X] is set, the window can be shifted horizontally to fit
19    /// on-screen. If [`RESIZE_X`][Self::RESIZE_X] is set, the window 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 window horizontally
34        #[doc(alias = "GDK_ANCHOR_SLIDE_X")]
35        const SLIDE_X = ffi::GDK_ANCHOR_SLIDE_X as _;
36        /// allow sliding window vertically
37        #[doc(alias = "GDK_ANCHOR_SLIDE_Y")]
38        const SLIDE_Y = ffi::GDK_ANCHOR_SLIDE_Y as _;
39        /// allow resizing window horizontally
40        #[doc(alias = "GDK_ANCHOR_RESIZE_X")]
41        const RESIZE_X = ffi::GDK_ANCHOR_RESIZE_X as _;
42        /// allow resizing window 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 window on both axes
49        #[doc(alias = "GDK_ANCHOR_SLIDE")]
50        const SLIDE = ffi::GDK_ANCHOR_SLIDE as _;
51        /// allow resizing window on both axes
52        #[doc(alias = "GDK_ANCHOR_RESIZE")]
53        const RESIZE = ffi::GDK_ANCHOR_RESIZE as _;
54    }
55}
56
57impl fmt::Display for AnchorHints {
58    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
59        <Self as fmt::Debug>::fmt(self, f)
60    }
61}
62
63#[doc(hidden)]
64impl IntoGlib for AnchorHints {
65    type GlibType = ffi::GdkAnchorHints;
66
67    #[inline]
68    fn into_glib(self) -> ffi::GdkAnchorHints {
69        self.bits()
70    }
71}
72
73#[doc(hidden)]
74impl FromGlib<ffi::GdkAnchorHints> for AnchorHints {
75    #[inline]
76    unsafe fn from_glib(value: ffi::GdkAnchorHints) -> Self {
77        skip_assert_initialized!();
78        Self::from_bits_truncate(value)
79    }
80}
81
82impl StaticType for AnchorHints {
83    #[inline]
84    fn static_type() -> glib::Type {
85        unsafe { from_glib(ffi::gdk_anchor_hints_get_type()) }
86    }
87}
88
89impl glib::HasParamSpec for AnchorHints {
90    type ParamSpec = glib::ParamSpecFlags;
91    type SetValue = Self;
92    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
93
94    fn param_spec_builder() -> Self::BuilderFn {
95        |name| Self::ParamSpec::builder(name)
96    }
97}
98
99impl glib::value::ValueType for AnchorHints {
100    type Type = Self;
101}
102
103unsafe impl<'a> glib::value::FromValue<'a> for AnchorHints {
104    type Checker = glib::value::GenericValueTypeChecker<Self>;
105
106    #[inline]
107    unsafe fn from_value(value: &'a glib::Value) -> Self {
108        skip_assert_initialized!();
109        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
110    }
111}
112
113impl ToValue for AnchorHints {
114    #[inline]
115    fn to_value(&self) -> glib::Value {
116        let mut value = glib::Value::for_value_type::<Self>();
117        unsafe {
118            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
119        }
120        value
121    }
122
123    #[inline]
124    fn value_type(&self) -> glib::Type {
125        Self::static_type()
126    }
127}
128
129impl From<AnchorHints> for glib::Value {
130    #[inline]
131    fn from(v: AnchorHints) -> Self {
132        skip_assert_initialized!();
133        ToValue::to_value(&v)
134    }
135}
136
137bitflags! {
138    /// Flags describing the current capabilities of a device/tool.
139    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
140    #[doc(alias = "GdkAxisFlags")]
141    pub struct AxisFlags: u32 {
142        /// X axis is present
143        #[doc(alias = "GDK_AXIS_FLAG_X")]
144        const X = ffi::GDK_AXIS_FLAG_X as _;
145        /// Y axis is present
146        #[doc(alias = "GDK_AXIS_FLAG_Y")]
147        const Y = ffi::GDK_AXIS_FLAG_Y as _;
148        /// Pressure axis is present
149        #[doc(alias = "GDK_AXIS_FLAG_PRESSURE")]
150        const PRESSURE = ffi::GDK_AXIS_FLAG_PRESSURE as _;
151        /// X tilt axis is present
152        #[doc(alias = "GDK_AXIS_FLAG_XTILT")]
153        const XTILT = ffi::GDK_AXIS_FLAG_XTILT as _;
154        /// Y tilt axis is present
155        #[doc(alias = "GDK_AXIS_FLAG_YTILT")]
156        const YTILT = ffi::GDK_AXIS_FLAG_YTILT as _;
157        /// Wheel axis is present
158        #[doc(alias = "GDK_AXIS_FLAG_WHEEL")]
159        const WHEEL = ffi::GDK_AXIS_FLAG_WHEEL as _;
160        /// Distance axis is present
161        #[doc(alias = "GDK_AXIS_FLAG_DISTANCE")]
162        const DISTANCE = ffi::GDK_AXIS_FLAG_DISTANCE as _;
163        /// Z-axis rotation is present
164        #[doc(alias = "GDK_AXIS_FLAG_ROTATION")]
165        const ROTATION = ffi::GDK_AXIS_FLAG_ROTATION as _;
166        /// Slider axis is present
167        #[doc(alias = "GDK_AXIS_FLAG_SLIDER")]
168        const SLIDER = ffi::GDK_AXIS_FLAG_SLIDER as _;
169    }
170}
171
172impl fmt::Display for AxisFlags {
173    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
174        <Self as fmt::Debug>::fmt(self, f)
175    }
176}
177
178#[doc(hidden)]
179impl IntoGlib for AxisFlags {
180    type GlibType = ffi::GdkAxisFlags;
181
182    #[inline]
183    fn into_glib(self) -> ffi::GdkAxisFlags {
184        self.bits()
185    }
186}
187
188#[doc(hidden)]
189impl FromGlib<ffi::GdkAxisFlags> for AxisFlags {
190    #[inline]
191    unsafe fn from_glib(value: ffi::GdkAxisFlags) -> Self {
192        skip_assert_initialized!();
193        Self::from_bits_truncate(value)
194    }
195}
196
197impl StaticType for AxisFlags {
198    #[inline]
199    fn static_type() -> glib::Type {
200        unsafe { from_glib(ffi::gdk_axis_flags_get_type()) }
201    }
202}
203
204impl glib::HasParamSpec for AxisFlags {
205    type ParamSpec = glib::ParamSpecFlags;
206    type SetValue = Self;
207    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
208
209    fn param_spec_builder() -> Self::BuilderFn {
210        |name| Self::ParamSpec::builder(name)
211    }
212}
213
214impl glib::value::ValueType for AxisFlags {
215    type Type = Self;
216}
217
218unsafe impl<'a> glib::value::FromValue<'a> for AxisFlags {
219    type Checker = glib::value::GenericValueTypeChecker<Self>;
220
221    #[inline]
222    unsafe fn from_value(value: &'a glib::Value) -> Self {
223        skip_assert_initialized!();
224        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
225    }
226}
227
228impl ToValue for AxisFlags {
229    #[inline]
230    fn to_value(&self) -> glib::Value {
231        let mut value = glib::Value::for_value_type::<Self>();
232        unsafe {
233            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
234        }
235        value
236    }
237
238    #[inline]
239    fn value_type(&self) -> glib::Type {
240        Self::static_type()
241    }
242}
243
244impl From<AxisFlags> for glib::Value {
245    #[inline]
246    fn from(v: AxisFlags) -> Self {
247        skip_assert_initialized!();
248        ToValue::to_value(&v)
249    }
250}
251
252bitflags! {
253    /// Used in [`DragContext`][crate::DragContext] to indicate what the destination
254    /// should do with the dropped data.
255    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
256    #[doc(alias = "GdkDragAction")]
257    pub struct DragAction: u32 {
258        /// Means nothing, and should not be used.
259        #[doc(alias = "GDK_ACTION_DEFAULT")]
260        const DEFAULT = ffi::GDK_ACTION_DEFAULT as _;
261        /// Copy the data.
262        #[doc(alias = "GDK_ACTION_COPY")]
263        const COPY = ffi::GDK_ACTION_COPY as _;
264        /// Move the data, i.e. first copy it, then delete
265        ///  it from the source using the DELETE target of the X selection protocol.
266        #[doc(alias = "GDK_ACTION_MOVE")]
267        const MOVE = ffi::GDK_ACTION_MOVE as _;
268        /// Add a link to the data. Note that this is only
269        ///  useful if source and destination agree on what it means.
270        #[doc(alias = "GDK_ACTION_LINK")]
271        const LINK = ffi::GDK_ACTION_LINK as _;
272        /// Special action which tells the source that the
273        ///  destination will do something that the source doesn’t understand.
274        #[doc(alias = "GDK_ACTION_PRIVATE")]
275        const PRIVATE = ffi::GDK_ACTION_PRIVATE as _;
276        /// Ask the user what to do with the data.
277        #[doc(alias = "GDK_ACTION_ASK")]
278        const ASK = ffi::GDK_ACTION_ASK as _;
279    }
280}
281
282impl fmt::Display for DragAction {
283    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
284        <Self as fmt::Debug>::fmt(self, f)
285    }
286}
287
288#[doc(hidden)]
289impl IntoGlib for DragAction {
290    type GlibType = ffi::GdkDragAction;
291
292    #[inline]
293    fn into_glib(self) -> ffi::GdkDragAction {
294        self.bits()
295    }
296}
297
298#[doc(hidden)]
299impl FromGlib<ffi::GdkDragAction> for DragAction {
300    #[inline]
301    unsafe fn from_glib(value: ffi::GdkDragAction) -> Self {
302        skip_assert_initialized!();
303        Self::from_bits_truncate(value)
304    }
305}
306
307impl StaticType for DragAction {
308    #[inline]
309    fn static_type() -> glib::Type {
310        unsafe { from_glib(ffi::gdk_drag_action_get_type()) }
311    }
312}
313
314impl glib::HasParamSpec for DragAction {
315    type ParamSpec = glib::ParamSpecFlags;
316    type SetValue = Self;
317    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
318
319    fn param_spec_builder() -> Self::BuilderFn {
320        |name| Self::ParamSpec::builder(name)
321    }
322}
323
324impl glib::value::ValueType for DragAction {
325    type Type = Self;
326}
327
328unsafe impl<'a> glib::value::FromValue<'a> for DragAction {
329    type Checker = glib::value::GenericValueTypeChecker<Self>;
330
331    #[inline]
332    unsafe fn from_value(value: &'a glib::Value) -> Self {
333        skip_assert_initialized!();
334        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
335    }
336}
337
338impl ToValue for DragAction {
339    #[inline]
340    fn to_value(&self) -> glib::Value {
341        let mut value = glib::Value::for_value_type::<Self>();
342        unsafe {
343            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
344        }
345        value
346    }
347
348    #[inline]
349    fn value_type(&self) -> glib::Type {
350        Self::static_type()
351    }
352}
353
354impl From<DragAction> for glib::Value {
355    #[inline]
356    fn from(v: DragAction) -> Self {
357        skip_assert_initialized!();
358        ToValue::to_value(&v)
359    }
360}
361
362bitflags! {
363    /// A set of bit-flags to indicate which events a window is to receive.
364    /// Most of these masks map onto one or more of the [`EventType`][crate::EventType] event types
365    /// above.
366    ///
367    /// See the [input handling overview][chap-input-handling] for details of
368    /// [event masks][event-masks] and [event propagation][event-propagation].
369    ///
370    /// [`POINTER_MOTION_HINT_MASK`][Self::POINTER_MOTION_HINT_MASK] is deprecated. It is a special mask
371    /// to reduce the number of [`EventType::MotionNotify`][crate::EventType::MotionNotify] events received. When using
372    /// [`POINTER_MOTION_HINT_MASK`][Self::POINTER_MOTION_HINT_MASK], fewer [`EventType::MotionNotify`][crate::EventType::MotionNotify] events will
373    /// be sent, some of which are marked as a hint (the is_hint member is
374    /// [`true`]). To receive more motion events after a motion hint event,
375    /// the application needs to asks for more, by calling
376    /// `gdk_event_request_motions()`.
377    ///
378    /// Since GTK 3.8, motion events are already compressed by default, independent
379    /// of this mechanism. This compression can be disabled with
380    /// [`Window::set_event_compression()`][crate::Window::set_event_compression()]. See the documentation of that function
381    /// for details.
382    ///
383    /// If [`TOUCH_MASK`][Self::TOUCH_MASK] is enabled, the window will receive touch events
384    /// from touch-enabled devices. Those will come as sequences of [`EventTouch`][crate::EventTouch]
385    /// with type [`EventType::TouchUpdate`][crate::EventType::TouchUpdate], enclosed by two events with
386    /// type [`EventType::TouchBegin`][crate::EventType::TouchBegin] and [`EventType::TouchEnd`][crate::EventType::TouchEnd] (or [`EventType::TouchCancel`][crate::EventType::TouchCancel]).
387    /// `gdk_event_get_event_sequence()` returns the event sequence for these
388    /// events, so different sequences may be distinguished.
389    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
390    #[doc(alias = "GdkEventMask")]
391    pub struct EventMask: u32 {
392        /// receive expose events
393        #[doc(alias = "GDK_EXPOSURE_MASK")]
394        const EXPOSURE_MASK = ffi::GDK_EXPOSURE_MASK as _;
395        /// receive all pointer motion events
396        #[doc(alias = "GDK_POINTER_MOTION_MASK")]
397        const POINTER_MOTION_MASK = ffi::GDK_POINTER_MOTION_MASK as _;
398        /// deprecated. see the explanation above
399        #[doc(alias = "GDK_POINTER_MOTION_HINT_MASK")]
400        const POINTER_MOTION_HINT_MASK = ffi::GDK_POINTER_MOTION_HINT_MASK as _;
401        /// receive pointer motion events while any button is pressed
402        #[doc(alias = "GDK_BUTTON_MOTION_MASK")]
403        const BUTTON_MOTION_MASK = ffi::GDK_BUTTON_MOTION_MASK as _;
404        /// receive pointer motion events while 1 button is pressed
405        #[doc(alias = "GDK_BUTTON1_MOTION_MASK")]
406        const BUTTON1_MOTION_MASK = ffi::GDK_BUTTON1_MOTION_MASK as _;
407        /// receive pointer motion events while 2 button is pressed
408        #[doc(alias = "GDK_BUTTON2_MOTION_MASK")]
409        const BUTTON2_MOTION_MASK = ffi::GDK_BUTTON2_MOTION_MASK as _;
410        /// receive pointer motion events while 3 button is pressed
411        #[doc(alias = "GDK_BUTTON3_MOTION_MASK")]
412        const BUTTON3_MOTION_MASK = ffi::GDK_BUTTON3_MOTION_MASK as _;
413        /// receive button press events
414        #[doc(alias = "GDK_BUTTON_PRESS_MASK")]
415        const BUTTON_PRESS_MASK = ffi::GDK_BUTTON_PRESS_MASK as _;
416        /// receive button release events
417        #[doc(alias = "GDK_BUTTON_RELEASE_MASK")]
418        const BUTTON_RELEASE_MASK = ffi::GDK_BUTTON_RELEASE_MASK as _;
419        /// receive key press events
420        #[doc(alias = "GDK_KEY_PRESS_MASK")]
421        const KEY_PRESS_MASK = ffi::GDK_KEY_PRESS_MASK as _;
422        /// receive key release events
423        #[doc(alias = "GDK_KEY_RELEASE_MASK")]
424        const KEY_RELEASE_MASK = ffi::GDK_KEY_RELEASE_MASK as _;
425        /// receive window enter events
426        #[doc(alias = "GDK_ENTER_NOTIFY_MASK")]
427        const ENTER_NOTIFY_MASK = ffi::GDK_ENTER_NOTIFY_MASK as _;
428        /// receive window leave events
429        #[doc(alias = "GDK_LEAVE_NOTIFY_MASK")]
430        const LEAVE_NOTIFY_MASK = ffi::GDK_LEAVE_NOTIFY_MASK as _;
431        /// receive focus change events
432        #[doc(alias = "GDK_FOCUS_CHANGE_MASK")]
433        const FOCUS_CHANGE_MASK = ffi::GDK_FOCUS_CHANGE_MASK as _;
434        /// receive events about window configuration change
435        #[doc(alias = "GDK_STRUCTURE_MASK")]
436        const STRUCTURE_MASK = ffi::GDK_STRUCTURE_MASK as _;
437        /// receive property change events
438        #[doc(alias = "GDK_PROPERTY_CHANGE_MASK")]
439        const PROPERTY_CHANGE_MASK = ffi::GDK_PROPERTY_CHANGE_MASK as _;
440        /// receive visibility change events
441        #[doc(alias = "GDK_VISIBILITY_NOTIFY_MASK")]
442        const VISIBILITY_NOTIFY_MASK = ffi::GDK_VISIBILITY_NOTIFY_MASK as _;
443        /// receive proximity in events
444        #[doc(alias = "GDK_PROXIMITY_IN_MASK")]
445        const PROXIMITY_IN_MASK = ffi::GDK_PROXIMITY_IN_MASK as _;
446        /// receive proximity out events
447        #[doc(alias = "GDK_PROXIMITY_OUT_MASK")]
448        const PROXIMITY_OUT_MASK = ffi::GDK_PROXIMITY_OUT_MASK as _;
449        /// receive events about window configuration changes of
450        ///  child windows
451        #[doc(alias = "GDK_SUBSTRUCTURE_MASK")]
452        const SUBSTRUCTURE_MASK = ffi::GDK_SUBSTRUCTURE_MASK as _;
453        /// receive scroll events
454        #[doc(alias = "GDK_SCROLL_MASK")]
455        const SCROLL_MASK = ffi::GDK_SCROLL_MASK as _;
456        /// receive touch events. Since 3.4
457        #[doc(alias = "GDK_TOUCH_MASK")]
458        const TOUCH_MASK = ffi::GDK_TOUCH_MASK as _;
459        /// receive smooth scrolling events. Since 3.4
460        #[doc(alias = "GDK_SMOOTH_SCROLL_MASK")]
461        const SMOOTH_SCROLL_MASK = ffi::GDK_SMOOTH_SCROLL_MASK as _;
462        /// receive touchpad gesture events. Since 3.18
463        #[doc(alias = "GDK_TOUCHPAD_GESTURE_MASK")]
464        const TOUCHPAD_GESTURE_MASK = ffi::GDK_TOUCHPAD_GESTURE_MASK as _;
465        /// receive tablet pad events. Since 3.22
466        #[doc(alias = "GDK_TABLET_PAD_MASK")]
467        const TABLET_PAD_MASK = ffi::GDK_TABLET_PAD_MASK as _;
468        /// the combination of all the above event masks.
469        #[doc(alias = "GDK_ALL_EVENTS_MASK")]
470        const ALL_EVENTS_MASK = ffi::GDK_ALL_EVENTS_MASK as _;
471    }
472}
473
474impl fmt::Display for EventMask {
475    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
476        <Self as fmt::Debug>::fmt(self, f)
477    }
478}
479
480#[doc(hidden)]
481impl IntoGlib for EventMask {
482    type GlibType = ffi::GdkEventMask;
483
484    #[inline]
485    fn into_glib(self) -> ffi::GdkEventMask {
486        self.bits()
487    }
488}
489
490#[doc(hidden)]
491impl FromGlib<ffi::GdkEventMask> for EventMask {
492    #[inline]
493    unsafe fn from_glib(value: ffi::GdkEventMask) -> Self {
494        skip_assert_initialized!();
495        Self::from_bits_truncate(value)
496    }
497}
498
499impl StaticType for EventMask {
500    #[inline]
501    fn static_type() -> glib::Type {
502        unsafe { from_glib(ffi::gdk_event_mask_get_type()) }
503    }
504}
505
506impl glib::HasParamSpec for EventMask {
507    type ParamSpec = glib::ParamSpecFlags;
508    type SetValue = Self;
509    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
510
511    fn param_spec_builder() -> Self::BuilderFn {
512        |name| Self::ParamSpec::builder(name)
513    }
514}
515
516impl glib::value::ValueType for EventMask {
517    type Type = Self;
518}
519
520unsafe impl<'a> glib::value::FromValue<'a> for EventMask {
521    type Checker = glib::value::GenericValueTypeChecker<Self>;
522
523    #[inline]
524    unsafe fn from_value(value: &'a glib::Value) -> Self {
525        skip_assert_initialized!();
526        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
527    }
528}
529
530impl ToValue for EventMask {
531    #[inline]
532    fn to_value(&self) -> glib::Value {
533        let mut value = glib::Value::for_value_type::<Self>();
534        unsafe {
535            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
536        }
537        value
538    }
539
540    #[inline]
541    fn value_type(&self) -> glib::Type {
542        Self::static_type()
543    }
544}
545
546impl From<EventMask> for glib::Value {
547    #[inline]
548    fn from(v: EventMask) -> Self {
549        skip_assert_initialized!();
550        ToValue::to_value(&v)
551    }
552}
553
554bitflags! {
555    /// [`FrameClockPhase`][crate::FrameClockPhase] is used to represent the different paint clock
556    /// phases that can be requested. The elements of the enumeration
557    /// correspond to the signals of [`FrameClock`][crate::FrameClock].
558    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
559    #[doc(alias = "GdkFrameClockPhase")]
560    pub struct FrameClockPhase: u32 {
561        /// no phase
562        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_NONE")]
563        const NONE = ffi::GDK_FRAME_CLOCK_PHASE_NONE as _;
564        /// corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
565        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS")]
566        const FLUSH_EVENTS = ffi::GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS as _;
567        /// corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
568        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT")]
569        const BEFORE_PAINT = ffi::GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT as _;
570        /// corresponds to GdkFrameClock::update.
571        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_UPDATE")]
572        const UPDATE = ffi::GDK_FRAME_CLOCK_PHASE_UPDATE as _;
573        /// corresponds to GdkFrameClock::layout.
574        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_LAYOUT")]
575        const LAYOUT = ffi::GDK_FRAME_CLOCK_PHASE_LAYOUT as _;
576        /// corresponds to GdkFrameClock::paint.
577        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_PAINT")]
578        const PAINT = ffi::GDK_FRAME_CLOCK_PHASE_PAINT as _;
579        /// corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
580        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS")]
581        const RESUME_EVENTS = ffi::GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS as _;
582        /// corresponds to GdkFrameClock::after-paint. Should not be handled by applications.
583        #[doc(alias = "GDK_FRAME_CLOCK_PHASE_AFTER_PAINT")]
584        const AFTER_PAINT = ffi::GDK_FRAME_CLOCK_PHASE_AFTER_PAINT as _;
585    }
586}
587
588impl fmt::Display for FrameClockPhase {
589    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
590        <Self as fmt::Debug>::fmt(self, f)
591    }
592}
593
594#[doc(hidden)]
595impl IntoGlib for FrameClockPhase {
596    type GlibType = ffi::GdkFrameClockPhase;
597
598    #[inline]
599    fn into_glib(self) -> ffi::GdkFrameClockPhase {
600        self.bits()
601    }
602}
603
604#[doc(hidden)]
605impl FromGlib<ffi::GdkFrameClockPhase> for FrameClockPhase {
606    #[inline]
607    unsafe fn from_glib(value: ffi::GdkFrameClockPhase) -> Self {
608        skip_assert_initialized!();
609        Self::from_bits_truncate(value)
610    }
611}
612
613impl StaticType for FrameClockPhase {
614    #[inline]
615    fn static_type() -> glib::Type {
616        unsafe { from_glib(ffi::gdk_frame_clock_phase_get_type()) }
617    }
618}
619
620impl glib::HasParamSpec for FrameClockPhase {
621    type ParamSpec = glib::ParamSpecFlags;
622    type SetValue = Self;
623    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
624
625    fn param_spec_builder() -> Self::BuilderFn {
626        |name| Self::ParamSpec::builder(name)
627    }
628}
629
630impl glib::value::ValueType for FrameClockPhase {
631    type Type = Self;
632}
633
634unsafe impl<'a> glib::value::FromValue<'a> for FrameClockPhase {
635    type Checker = glib::value::GenericValueTypeChecker<Self>;
636
637    #[inline]
638    unsafe fn from_value(value: &'a glib::Value) -> Self {
639        skip_assert_initialized!();
640        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
641    }
642}
643
644impl ToValue for FrameClockPhase {
645    #[inline]
646    fn to_value(&self) -> glib::Value {
647        let mut value = glib::Value::for_value_type::<Self>();
648        unsafe {
649            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
650        }
651        value
652    }
653
654    #[inline]
655    fn value_type(&self) -> glib::Type {
656        Self::static_type()
657    }
658}
659
660impl From<FrameClockPhase> for glib::Value {
661    #[inline]
662    fn from(v: FrameClockPhase) -> Self {
663        skip_assert_initialized!();
664        ToValue::to_value(&v)
665    }
666}
667
668bitflags! {
669    /// A set of bit-flags to indicate the state of modifier keys and mouse buttons
670    /// in various event types. Typical modifier keys are Shift, Control, Meta,
671    /// Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
672    ///
673    /// Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
674    ///
675    /// Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
676    /// to Mod2 - Mod5, and indicates this by setting [`SUPER_MASK`][Self::SUPER_MASK],
677    /// [`HYPER_MASK`][Self::HYPER_MASK] or [`META_MASK`][Self::META_MASK] in the state field of key events.
678    ///
679    /// Note that GDK may add internal values to events which include
680    /// reserved values such as [`MODIFIER_RESERVED_13_MASK`][Self::MODIFIER_RESERVED_13_MASK]. Your code
681    /// should preserve and ignore them. You can use [`MODIFIER_MASK`][Self::MODIFIER_MASK] to
682    /// remove all reserved values.
683    ///
684    /// Also note that the GDK X backend interprets button press events for button
685    /// 4-7 as scroll events, so [`BUTTON4_MASK`][Self::BUTTON4_MASK] and [`BUTTON5_MASK`][Self::BUTTON5_MASK] will never
686    /// be set.
687    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
688    #[doc(alias = "GdkModifierType")]
689    pub struct ModifierType: u32 {
690        /// the Shift key.
691        #[doc(alias = "GDK_SHIFT_MASK")]
692        const SHIFT_MASK = ffi::GDK_SHIFT_MASK as _;
693        /// a Lock key (depending on the modifier mapping of the
694        ///  X server this may either be CapsLock or ShiftLock).
695        #[doc(alias = "GDK_LOCK_MASK")]
696        const LOCK_MASK = ffi::GDK_LOCK_MASK as _;
697        /// the Control key.
698        #[doc(alias = "GDK_CONTROL_MASK")]
699        const CONTROL_MASK = ffi::GDK_CONTROL_MASK as _;
700        /// the fourth modifier key (it depends on the modifier
701        ///  mapping of the X server which key is interpreted as this modifier, but
702        ///  normally it is the Alt key).
703        #[doc(alias = "GDK_MOD1_MASK")]
704        const MOD1_MASK = ffi::GDK_MOD1_MASK as _;
705        /// the fifth modifier key (it depends on the modifier
706        ///  mapping of the X server which key is interpreted as this modifier).
707        #[doc(alias = "GDK_MOD2_MASK")]
708        const MOD2_MASK = ffi::GDK_MOD2_MASK as _;
709        /// the sixth modifier key (it depends on the modifier
710        ///  mapping of the X server which key is interpreted as this modifier).
711        #[doc(alias = "GDK_MOD3_MASK")]
712        const MOD3_MASK = ffi::GDK_MOD3_MASK as _;
713        /// the seventh modifier key (it depends on the modifier
714        ///  mapping of the X server which key is interpreted as this modifier).
715        #[doc(alias = "GDK_MOD4_MASK")]
716        const MOD4_MASK = ffi::GDK_MOD4_MASK as _;
717        /// the eighth modifier key (it depends on the modifier
718        ///  mapping of the X server which key is interpreted as this modifier).
719        #[doc(alias = "GDK_MOD5_MASK")]
720        const MOD5_MASK = ffi::GDK_MOD5_MASK as _;
721        /// the first mouse button.
722        #[doc(alias = "GDK_BUTTON1_MASK")]
723        const BUTTON1_MASK = ffi::GDK_BUTTON1_MASK as _;
724        /// the second mouse button.
725        #[doc(alias = "GDK_BUTTON2_MASK")]
726        const BUTTON2_MASK = ffi::GDK_BUTTON2_MASK as _;
727        /// the third mouse button.
728        #[doc(alias = "GDK_BUTTON3_MASK")]
729        const BUTTON3_MASK = ffi::GDK_BUTTON3_MASK as _;
730        /// the fourth mouse button.
731        #[doc(alias = "GDK_BUTTON4_MASK")]
732        const BUTTON4_MASK = ffi::GDK_BUTTON4_MASK as _;
733        /// the fifth mouse button.
734        #[doc(alias = "GDK_BUTTON5_MASK")]
735        const BUTTON5_MASK = ffi::GDK_BUTTON5_MASK as _;
736        /// A reserved bit flag; do not use in your own code
737        #[doc(alias = "GDK_MODIFIER_RESERVED_13_MASK")]
738        const MODIFIER_RESERVED_13_MASK = ffi::GDK_MODIFIER_RESERVED_13_MASK as _;
739        /// A reserved bit flag; do not use in your own code
740        #[doc(alias = "GDK_MODIFIER_RESERVED_14_MASK")]
741        const MODIFIER_RESERVED_14_MASK = ffi::GDK_MODIFIER_RESERVED_14_MASK as _;
742        /// A reserved bit flag; do not use in your own code
743        #[doc(alias = "GDK_MODIFIER_RESERVED_15_MASK")]
744        const MODIFIER_RESERVED_15_MASK = ffi::GDK_MODIFIER_RESERVED_15_MASK as _;
745        /// A reserved bit flag; do not use in your own code
746        #[doc(alias = "GDK_MODIFIER_RESERVED_16_MASK")]
747        const MODIFIER_RESERVED_16_MASK = ffi::GDK_MODIFIER_RESERVED_16_MASK as _;
748        /// A reserved bit flag; do not use in your own code
749        #[doc(alias = "GDK_MODIFIER_RESERVED_17_MASK")]
750        const MODIFIER_RESERVED_17_MASK = ffi::GDK_MODIFIER_RESERVED_17_MASK as _;
751        /// A reserved bit flag; do not use in your own code
752        #[doc(alias = "GDK_MODIFIER_RESERVED_18_MASK")]
753        const MODIFIER_RESERVED_18_MASK = ffi::GDK_MODIFIER_RESERVED_18_MASK as _;
754        /// A reserved bit flag; do not use in your own code
755        #[doc(alias = "GDK_MODIFIER_RESERVED_19_MASK")]
756        const MODIFIER_RESERVED_19_MASK = ffi::GDK_MODIFIER_RESERVED_19_MASK as _;
757        /// A reserved bit flag; do not use in your own code
758        #[doc(alias = "GDK_MODIFIER_RESERVED_20_MASK")]
759        const MODIFIER_RESERVED_20_MASK = ffi::GDK_MODIFIER_RESERVED_20_MASK as _;
760        /// A reserved bit flag; do not use in your own code
761        #[doc(alias = "GDK_MODIFIER_RESERVED_21_MASK")]
762        const MODIFIER_RESERVED_21_MASK = ffi::GDK_MODIFIER_RESERVED_21_MASK as _;
763        /// A reserved bit flag; do not use in your own code
764        #[doc(alias = "GDK_MODIFIER_RESERVED_22_MASK")]
765        const MODIFIER_RESERVED_22_MASK = ffi::GDK_MODIFIER_RESERVED_22_MASK as _;
766        /// A reserved bit flag; do not use in your own code
767        #[doc(alias = "GDK_MODIFIER_RESERVED_23_MASK")]
768        const MODIFIER_RESERVED_23_MASK = ffi::GDK_MODIFIER_RESERVED_23_MASK as _;
769        /// A reserved bit flag; do not use in your own code
770        #[doc(alias = "GDK_MODIFIER_RESERVED_24_MASK")]
771        const MODIFIER_RESERVED_24_MASK = ffi::GDK_MODIFIER_RESERVED_24_MASK as _;
772        /// A reserved bit flag; do not use in your own code
773        #[doc(alias = "GDK_MODIFIER_RESERVED_25_MASK")]
774        const MODIFIER_RESERVED_25_MASK = ffi::GDK_MODIFIER_RESERVED_25_MASK as _;
775        /// the Super modifier. Since 2.10
776        #[doc(alias = "GDK_SUPER_MASK")]
777        const SUPER_MASK = ffi::GDK_SUPER_MASK as _;
778        /// the Hyper modifier. Since 2.10
779        #[doc(alias = "GDK_HYPER_MASK")]
780        const HYPER_MASK = ffi::GDK_HYPER_MASK as _;
781        /// the Meta modifier. Since 2.10
782        #[doc(alias = "GDK_META_MASK")]
783        const META_MASK = ffi::GDK_META_MASK as _;
784        /// A reserved bit flag; do not use in your own code
785        #[doc(alias = "GDK_MODIFIER_RESERVED_29_MASK")]
786        const MODIFIER_RESERVED_29_MASK = ffi::GDK_MODIFIER_RESERVED_29_MASK as _;
787        /// not used in GDK itself. GTK+ uses it to differentiate
788        ///  between (keyval, modifiers) pairs from key press and release events.
789        #[doc(alias = "GDK_RELEASE_MASK")]
790        const RELEASE_MASK = ffi::GDK_RELEASE_MASK as _;
791        /// a mask covering all modifier types.
792        #[doc(alias = "GDK_MODIFIER_MASK")]
793        const MODIFIER_MASK = ffi::GDK_MODIFIER_MASK as _;
794    }
795}
796
797impl fmt::Display for ModifierType {
798    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
799        <Self as fmt::Debug>::fmt(self, f)
800    }
801}
802
803#[doc(hidden)]
804impl IntoGlib for ModifierType {
805    type GlibType = ffi::GdkModifierType;
806
807    #[inline]
808    fn into_glib(self) -> ffi::GdkModifierType {
809        self.bits()
810    }
811}
812
813#[doc(hidden)]
814impl FromGlib<ffi::GdkModifierType> for ModifierType {
815    #[inline]
816    unsafe fn from_glib(value: ffi::GdkModifierType) -> Self {
817        skip_assert_initialized!();
818        Self::from_bits_truncate(value)
819    }
820}
821
822impl StaticType for ModifierType {
823    #[inline]
824    fn static_type() -> glib::Type {
825        unsafe { from_glib(ffi::gdk_modifier_type_get_type()) }
826    }
827}
828
829impl glib::HasParamSpec for ModifierType {
830    type ParamSpec = glib::ParamSpecFlags;
831    type SetValue = Self;
832    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
833
834    fn param_spec_builder() -> Self::BuilderFn {
835        |name| Self::ParamSpec::builder(name)
836    }
837}
838
839impl glib::value::ValueType for ModifierType {
840    type Type = Self;
841}
842
843unsafe impl<'a> glib::value::FromValue<'a> for ModifierType {
844    type Checker = glib::value::GenericValueTypeChecker<Self>;
845
846    #[inline]
847    unsafe fn from_value(value: &'a glib::Value) -> Self {
848        skip_assert_initialized!();
849        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
850    }
851}
852
853impl ToValue for ModifierType {
854    #[inline]
855    fn to_value(&self) -> glib::Value {
856        let mut value = glib::Value::for_value_type::<Self>();
857        unsafe {
858            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
859        }
860        value
861    }
862
863    #[inline]
864    fn value_type(&self) -> glib::Type {
865        Self::static_type()
866    }
867}
868
869impl From<ModifierType> for glib::Value {
870    #[inline]
871    fn from(v: ModifierType) -> Self {
872        skip_assert_initialized!();
873        ToValue::to_value(&v)
874    }
875}
876
877bitflags! {
878    /// Flags describing the seat capabilities.
879    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
880    #[doc(alias = "GdkSeatCapabilities")]
881    pub struct SeatCapabilities: u32 {
882        /// No input capabilities
883        #[doc(alias = "GDK_SEAT_CAPABILITY_NONE")]
884        const NONE = ffi::GDK_SEAT_CAPABILITY_NONE as _;
885        /// The seat has a pointer (e.g. mouse)
886        #[doc(alias = "GDK_SEAT_CAPABILITY_POINTER")]
887        const POINTER = ffi::GDK_SEAT_CAPABILITY_POINTER as _;
888        /// The seat has touchscreen(s) attached
889        #[doc(alias = "GDK_SEAT_CAPABILITY_TOUCH")]
890        const TOUCH = ffi::GDK_SEAT_CAPABILITY_TOUCH as _;
891        /// The seat has drawing tablet(s) attached
892        #[doc(alias = "GDK_SEAT_CAPABILITY_TABLET_STYLUS")]
893        const TABLET_STYLUS = ffi::GDK_SEAT_CAPABILITY_TABLET_STYLUS as _;
894        /// The seat has keyboard(s) attached
895        #[doc(alias = "GDK_SEAT_CAPABILITY_KEYBOARD")]
896        const KEYBOARD = ffi::GDK_SEAT_CAPABILITY_KEYBOARD as _;
897        /// The union of all pointing capabilities
898        #[doc(alias = "GDK_SEAT_CAPABILITY_ALL_POINTING")]
899        const ALL_POINTING = ffi::GDK_SEAT_CAPABILITY_ALL_POINTING as _;
900        /// The union of all capabilities
901        #[doc(alias = "GDK_SEAT_CAPABILITY_ALL")]
902        const ALL = ffi::GDK_SEAT_CAPABILITY_ALL as _;
903    }
904}
905
906impl fmt::Display for SeatCapabilities {
907    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
908        <Self as fmt::Debug>::fmt(self, f)
909    }
910}
911
912#[doc(hidden)]
913impl IntoGlib for SeatCapabilities {
914    type GlibType = ffi::GdkSeatCapabilities;
915
916    #[inline]
917    fn into_glib(self) -> ffi::GdkSeatCapabilities {
918        self.bits()
919    }
920}
921
922#[doc(hidden)]
923impl FromGlib<ffi::GdkSeatCapabilities> for SeatCapabilities {
924    #[inline]
925    unsafe fn from_glib(value: ffi::GdkSeatCapabilities) -> Self {
926        skip_assert_initialized!();
927        Self::from_bits_truncate(value)
928    }
929}
930
931impl StaticType for SeatCapabilities {
932    #[inline]
933    fn static_type() -> glib::Type {
934        unsafe { from_glib(ffi::gdk_seat_capabilities_get_type()) }
935    }
936}
937
938impl glib::HasParamSpec for SeatCapabilities {
939    type ParamSpec = glib::ParamSpecFlags;
940    type SetValue = Self;
941    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
942
943    fn param_spec_builder() -> Self::BuilderFn {
944        |name| Self::ParamSpec::builder(name)
945    }
946}
947
948impl glib::value::ValueType for SeatCapabilities {
949    type Type = Self;
950}
951
952unsafe impl<'a> glib::value::FromValue<'a> for SeatCapabilities {
953    type Checker = glib::value::GenericValueTypeChecker<Self>;
954
955    #[inline]
956    unsafe fn from_value(value: &'a glib::Value) -> Self {
957        skip_assert_initialized!();
958        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
959    }
960}
961
962impl ToValue for SeatCapabilities {
963    #[inline]
964    fn to_value(&self) -> glib::Value {
965        let mut value = glib::Value::for_value_type::<Self>();
966        unsafe {
967            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
968        }
969        value
970    }
971
972    #[inline]
973    fn value_type(&self) -> glib::Type {
974        Self::static_type()
975    }
976}
977
978impl From<SeatCapabilities> for glib::Value {
979    #[inline]
980    fn from(v: SeatCapabilities) -> Self {
981        skip_assert_initialized!();
982        ToValue::to_value(&v)
983    }
984}
985
986bitflags! {
987    /// These are hints originally defined by the Motif toolkit.
988    /// The window manager can use them when determining how to decorate
989    /// the window. The hint must be set before mapping the window.
990    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
991    #[doc(alias = "GdkWMDecoration")]
992    pub struct WMDecoration: u32 {
993        /// all decorations should be applied.
994        #[doc(alias = "GDK_DECOR_ALL")]
995        const ALL = ffi::GDK_DECOR_ALL as _;
996        /// a frame should be drawn around the window.
997        #[doc(alias = "GDK_DECOR_BORDER")]
998        const BORDER = ffi::GDK_DECOR_BORDER as _;
999        /// the frame should have resize handles.
1000        #[doc(alias = "GDK_DECOR_RESIZEH")]
1001        const RESIZEH = ffi::GDK_DECOR_RESIZEH as _;
1002        /// a titlebar should be placed above the window.
1003        #[doc(alias = "GDK_DECOR_TITLE")]
1004        const TITLE = ffi::GDK_DECOR_TITLE as _;
1005        /// a button for opening a menu should be included.
1006        #[doc(alias = "GDK_DECOR_MENU")]
1007        const MENU = ffi::GDK_DECOR_MENU as _;
1008        /// a minimize button should be included.
1009        #[doc(alias = "GDK_DECOR_MINIMIZE")]
1010        const MINIMIZE = ffi::GDK_DECOR_MINIMIZE as _;
1011        /// a maximize button should be included.
1012        #[doc(alias = "GDK_DECOR_MAXIMIZE")]
1013        const MAXIMIZE = ffi::GDK_DECOR_MAXIMIZE as _;
1014    }
1015}
1016
1017impl fmt::Display for WMDecoration {
1018    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1019        <Self as fmt::Debug>::fmt(self, f)
1020    }
1021}
1022
1023#[doc(hidden)]
1024impl IntoGlib for WMDecoration {
1025    type GlibType = ffi::GdkWMDecoration;
1026
1027    #[inline]
1028    fn into_glib(self) -> ffi::GdkWMDecoration {
1029        self.bits()
1030    }
1031}
1032
1033#[doc(hidden)]
1034impl FromGlib<ffi::GdkWMDecoration> for WMDecoration {
1035    #[inline]
1036    unsafe fn from_glib(value: ffi::GdkWMDecoration) -> Self {
1037        skip_assert_initialized!();
1038        Self::from_bits_truncate(value)
1039    }
1040}
1041
1042impl StaticType for WMDecoration {
1043    #[inline]
1044    fn static_type() -> glib::Type {
1045        unsafe { from_glib(ffi::gdk_wm_decoration_get_type()) }
1046    }
1047}
1048
1049impl glib::HasParamSpec for WMDecoration {
1050    type ParamSpec = glib::ParamSpecFlags;
1051    type SetValue = Self;
1052    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
1053
1054    fn param_spec_builder() -> Self::BuilderFn {
1055        |name| Self::ParamSpec::builder(name)
1056    }
1057}
1058
1059impl glib::value::ValueType for WMDecoration {
1060    type Type = Self;
1061}
1062
1063unsafe impl<'a> glib::value::FromValue<'a> for WMDecoration {
1064    type Checker = glib::value::GenericValueTypeChecker<Self>;
1065
1066    #[inline]
1067    unsafe fn from_value(value: &'a glib::Value) -> Self {
1068        skip_assert_initialized!();
1069        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
1070    }
1071}
1072
1073impl ToValue for WMDecoration {
1074    #[inline]
1075    fn to_value(&self) -> glib::Value {
1076        let mut value = glib::Value::for_value_type::<Self>();
1077        unsafe {
1078            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
1079        }
1080        value
1081    }
1082
1083    #[inline]
1084    fn value_type(&self) -> glib::Type {
1085        Self::static_type()
1086    }
1087}
1088
1089impl From<WMDecoration> for glib::Value {
1090    #[inline]
1091    fn from(v: WMDecoration) -> Self {
1092        skip_assert_initialized!();
1093        ToValue::to_value(&v)
1094    }
1095}
1096
1097bitflags! {
1098    /// These are hints originally defined by the Motif toolkit. The window manager
1099    /// can use them when determining the functions to offer for the window. The
1100    /// hint must be set before mapping the window.
1101    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
1102    #[doc(alias = "GdkWMFunction")]
1103    pub struct WMFunction: u32 {
1104        /// all functions should be offered.
1105        #[doc(alias = "GDK_FUNC_ALL")]
1106        const ALL = ffi::GDK_FUNC_ALL as _;
1107        /// the window should be resizable.
1108        #[doc(alias = "GDK_FUNC_RESIZE")]
1109        const RESIZE = ffi::GDK_FUNC_RESIZE as _;
1110        /// the window should be movable.
1111        #[doc(alias = "GDK_FUNC_MOVE")]
1112        const MOVE = ffi::GDK_FUNC_MOVE as _;
1113        /// the window should be minimizable.
1114        #[doc(alias = "GDK_FUNC_MINIMIZE")]
1115        const MINIMIZE = ffi::GDK_FUNC_MINIMIZE as _;
1116        /// the window should be maximizable.
1117        #[doc(alias = "GDK_FUNC_MAXIMIZE")]
1118        const MAXIMIZE = ffi::GDK_FUNC_MAXIMIZE as _;
1119        /// the window should be closable.
1120        #[doc(alias = "GDK_FUNC_CLOSE")]
1121        const CLOSE = ffi::GDK_FUNC_CLOSE as _;
1122    }
1123}
1124
1125impl fmt::Display for WMFunction {
1126    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1127        <Self as fmt::Debug>::fmt(self, f)
1128    }
1129}
1130
1131#[doc(hidden)]
1132impl IntoGlib for WMFunction {
1133    type GlibType = ffi::GdkWMFunction;
1134
1135    #[inline]
1136    fn into_glib(self) -> ffi::GdkWMFunction {
1137        self.bits()
1138    }
1139}
1140
1141#[doc(hidden)]
1142impl FromGlib<ffi::GdkWMFunction> for WMFunction {
1143    #[inline]
1144    unsafe fn from_glib(value: ffi::GdkWMFunction) -> Self {
1145        skip_assert_initialized!();
1146        Self::from_bits_truncate(value)
1147    }
1148}
1149
1150impl StaticType for WMFunction {
1151    #[inline]
1152    fn static_type() -> glib::Type {
1153        unsafe { from_glib(ffi::gdk_wm_function_get_type()) }
1154    }
1155}
1156
1157impl glib::HasParamSpec for WMFunction {
1158    type ParamSpec = glib::ParamSpecFlags;
1159    type SetValue = Self;
1160    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
1161
1162    fn param_spec_builder() -> Self::BuilderFn {
1163        |name| Self::ParamSpec::builder(name)
1164    }
1165}
1166
1167impl glib::value::ValueType for WMFunction {
1168    type Type = Self;
1169}
1170
1171unsafe impl<'a> glib::value::FromValue<'a> for WMFunction {
1172    type Checker = glib::value::GenericValueTypeChecker<Self>;
1173
1174    #[inline]
1175    unsafe fn from_value(value: &'a glib::Value) -> Self {
1176        skip_assert_initialized!();
1177        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
1178    }
1179}
1180
1181impl ToValue for WMFunction {
1182    #[inline]
1183    fn to_value(&self) -> glib::Value {
1184        let mut value = glib::Value::for_value_type::<Self>();
1185        unsafe {
1186            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
1187        }
1188        value
1189    }
1190
1191    #[inline]
1192    fn value_type(&self) -> glib::Type {
1193        Self::static_type()
1194    }
1195}
1196
1197impl From<WMFunction> for glib::Value {
1198    #[inline]
1199    fn from(v: WMFunction) -> Self {
1200        skip_assert_initialized!();
1201        ToValue::to_value(&v)
1202    }
1203}
1204
1205bitflags! {
1206    /// Used to indicate which fields of a [`Geometry`][crate::Geometry] struct should be paid
1207    /// attention to. Also, the presence/absence of [`POS`][Self::POS],
1208    /// [`USER_POS`][Self::USER_POS], and [`USER_SIZE`][Self::USER_SIZE] is significant, though they don't
1209    /// directly refer to [`Geometry`][crate::Geometry] fields. [`USER_POS`][Self::USER_POS] will be set
1210    /// automatically by `GtkWindow` if you call `gtk_window_move()`.
1211    /// [`USER_POS`][Self::USER_POS] and [`USER_SIZE`][Self::USER_SIZE] should be set if the user
1212    /// specified a size/position using a --geometry command-line argument;
1213    /// `gtk_window_parse_geometry()` automatically sets these flags.
1214    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
1215    #[doc(alias = "GdkWindowHints")]
1216    pub struct WindowHints: u32 {
1217        /// indicates that the program has positioned the window
1218        #[doc(alias = "GDK_HINT_POS")]
1219        const POS = ffi::GDK_HINT_POS as _;
1220        /// min size fields are set
1221        #[doc(alias = "GDK_HINT_MIN_SIZE")]
1222        const MIN_SIZE = ffi::GDK_HINT_MIN_SIZE as _;
1223        /// max size fields are set
1224        #[doc(alias = "GDK_HINT_MAX_SIZE")]
1225        const MAX_SIZE = ffi::GDK_HINT_MAX_SIZE as _;
1226        /// base size fields are set
1227        #[doc(alias = "GDK_HINT_BASE_SIZE")]
1228        const BASE_SIZE = ffi::GDK_HINT_BASE_SIZE as _;
1229        /// aspect ratio fields are set
1230        #[doc(alias = "GDK_HINT_ASPECT")]
1231        const ASPECT = ffi::GDK_HINT_ASPECT as _;
1232        /// resize increment fields are set
1233        #[doc(alias = "GDK_HINT_RESIZE_INC")]
1234        const RESIZE_INC = ffi::GDK_HINT_RESIZE_INC as _;
1235        /// window gravity field is set
1236        #[doc(alias = "GDK_HINT_WIN_GRAVITY")]
1237        const WIN_GRAVITY = ffi::GDK_HINT_WIN_GRAVITY as _;
1238        /// indicates that the window’s position was explicitly set
1239        ///  by the user
1240        #[doc(alias = "GDK_HINT_USER_POS")]
1241        const USER_POS = ffi::GDK_HINT_USER_POS as _;
1242        /// indicates that the window’s size was explicitly set by
1243        ///  the user
1244        #[doc(alias = "GDK_HINT_USER_SIZE")]
1245        const USER_SIZE = ffi::GDK_HINT_USER_SIZE as _;
1246    }
1247}
1248
1249impl fmt::Display for WindowHints {
1250    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1251        <Self as fmt::Debug>::fmt(self, f)
1252    }
1253}
1254
1255#[doc(hidden)]
1256impl IntoGlib for WindowHints {
1257    type GlibType = ffi::GdkWindowHints;
1258
1259    #[inline]
1260    fn into_glib(self) -> ffi::GdkWindowHints {
1261        self.bits()
1262    }
1263}
1264
1265#[doc(hidden)]
1266impl FromGlib<ffi::GdkWindowHints> for WindowHints {
1267    #[inline]
1268    unsafe fn from_glib(value: ffi::GdkWindowHints) -> Self {
1269        skip_assert_initialized!();
1270        Self::from_bits_truncate(value)
1271    }
1272}
1273
1274impl StaticType for WindowHints {
1275    #[inline]
1276    fn static_type() -> glib::Type {
1277        unsafe { from_glib(ffi::gdk_window_hints_get_type()) }
1278    }
1279}
1280
1281impl glib::HasParamSpec for WindowHints {
1282    type ParamSpec = glib::ParamSpecFlags;
1283    type SetValue = Self;
1284    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
1285
1286    fn param_spec_builder() -> Self::BuilderFn {
1287        |name| Self::ParamSpec::builder(name)
1288    }
1289}
1290
1291impl glib::value::ValueType for WindowHints {
1292    type Type = Self;
1293}
1294
1295unsafe impl<'a> glib::value::FromValue<'a> for WindowHints {
1296    type Checker = glib::value::GenericValueTypeChecker<Self>;
1297
1298    #[inline]
1299    unsafe fn from_value(value: &'a glib::Value) -> Self {
1300        skip_assert_initialized!();
1301        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
1302    }
1303}
1304
1305impl ToValue for WindowHints {
1306    #[inline]
1307    fn to_value(&self) -> glib::Value {
1308        let mut value = glib::Value::for_value_type::<Self>();
1309        unsafe {
1310            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
1311        }
1312        value
1313    }
1314
1315    #[inline]
1316    fn value_type(&self) -> glib::Type {
1317        Self::static_type()
1318    }
1319}
1320
1321impl From<WindowHints> for glib::Value {
1322    #[inline]
1323    fn from(v: WindowHints) -> Self {
1324        skip_assert_initialized!();
1325        ToValue::to_value(&v)
1326    }
1327}
1328
1329bitflags! {
1330    /// Specifies the state of a toplevel window.
1331    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
1332    #[doc(alias = "GdkWindowState")]
1333    pub struct WindowState: u32 {
1334        /// the window is not shown.
1335        #[doc(alias = "GDK_WINDOW_STATE_WITHDRAWN")]
1336        const WITHDRAWN = ffi::GDK_WINDOW_STATE_WITHDRAWN as _;
1337        /// the window is minimized.
1338        #[doc(alias = "GDK_WINDOW_STATE_ICONIFIED")]
1339        const ICONIFIED = ffi::GDK_WINDOW_STATE_ICONIFIED as _;
1340        /// the window is maximized.
1341        #[doc(alias = "GDK_WINDOW_STATE_MAXIMIZED")]
1342        const MAXIMIZED = ffi::GDK_WINDOW_STATE_MAXIMIZED as _;
1343        /// the window is sticky.
1344        #[doc(alias = "GDK_WINDOW_STATE_STICKY")]
1345        const STICKY = ffi::GDK_WINDOW_STATE_STICKY as _;
1346        /// the window is maximized without
1347        ///  decorations.
1348        #[doc(alias = "GDK_WINDOW_STATE_FULLSCREEN")]
1349        const FULLSCREEN = ffi::GDK_WINDOW_STATE_FULLSCREEN as _;
1350        /// the window is kept above other windows.
1351        #[doc(alias = "GDK_WINDOW_STATE_ABOVE")]
1352        const ABOVE = ffi::GDK_WINDOW_STATE_ABOVE as _;
1353        /// the window is kept below other windows.
1354        #[doc(alias = "GDK_WINDOW_STATE_BELOW")]
1355        const BELOW = ffi::GDK_WINDOW_STATE_BELOW as _;
1356        /// the window is presented as focused (with active decorations).
1357        #[doc(alias = "GDK_WINDOW_STATE_FOCUSED")]
1358        const FOCUSED = ffi::GDK_WINDOW_STATE_FOCUSED as _;
1359        /// the window is in a tiled state, Since 3.10. Since 3.22.23, this
1360        ///  is deprecated in favor of per-edge information.
1361        #[doc(alias = "GDK_WINDOW_STATE_TILED")]
1362        const TILED = ffi::GDK_WINDOW_STATE_TILED as _;
1363        /// whether the top edge is tiled, Since 3.22.23
1364        #[doc(alias = "GDK_WINDOW_STATE_TOP_TILED")]
1365        const TOP_TILED = ffi::GDK_WINDOW_STATE_TOP_TILED as _;
1366        /// whether the top edge is resizable, Since 3.22.23
1367        #[doc(alias = "GDK_WINDOW_STATE_TOP_RESIZABLE")]
1368        const TOP_RESIZABLE = ffi::GDK_WINDOW_STATE_TOP_RESIZABLE as _;
1369        /// whether the right edge is tiled, Since 3.22.23
1370        #[doc(alias = "GDK_WINDOW_STATE_RIGHT_TILED")]
1371        const RIGHT_TILED = ffi::GDK_WINDOW_STATE_RIGHT_TILED as _;
1372        /// whether the right edge is resizable, Since 3.22.23
1373        #[doc(alias = "GDK_WINDOW_STATE_RIGHT_RESIZABLE")]
1374        const RIGHT_RESIZABLE = ffi::GDK_WINDOW_STATE_RIGHT_RESIZABLE as _;
1375        /// whether the bottom edge is tiled, Since 3.22.23
1376        #[doc(alias = "GDK_WINDOW_STATE_BOTTOM_TILED")]
1377        const BOTTOM_TILED = ffi::GDK_WINDOW_STATE_BOTTOM_TILED as _;
1378        /// whether the bottom edge is resizable, Since 3.22.23
1379        #[doc(alias = "GDK_WINDOW_STATE_BOTTOM_RESIZABLE")]
1380        const BOTTOM_RESIZABLE = ffi::GDK_WINDOW_STATE_BOTTOM_RESIZABLE as _;
1381        /// whether the left edge is tiled, Since 3.22.23
1382        #[doc(alias = "GDK_WINDOW_STATE_LEFT_TILED")]
1383        const LEFT_TILED = ffi::GDK_WINDOW_STATE_LEFT_TILED as _;
1384        /// whether the left edge is resizable, Since 3.22.23
1385        #[doc(alias = "GDK_WINDOW_STATE_LEFT_RESIZABLE")]
1386        const LEFT_RESIZABLE = ffi::GDK_WINDOW_STATE_LEFT_RESIZABLE as _;
1387    }
1388}
1389
1390impl fmt::Display for WindowState {
1391    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1392        <Self as fmt::Debug>::fmt(self, f)
1393    }
1394}
1395
1396#[doc(hidden)]
1397impl IntoGlib for WindowState {
1398    type GlibType = ffi::GdkWindowState;
1399
1400    #[inline]
1401    fn into_glib(self) -> ffi::GdkWindowState {
1402        self.bits()
1403    }
1404}
1405
1406#[doc(hidden)]
1407impl FromGlib<ffi::GdkWindowState> for WindowState {
1408    #[inline]
1409    unsafe fn from_glib(value: ffi::GdkWindowState) -> Self {
1410        skip_assert_initialized!();
1411        Self::from_bits_truncate(value)
1412    }
1413}
1414
1415impl StaticType for WindowState {
1416    #[inline]
1417    fn static_type() -> glib::Type {
1418        unsafe { from_glib(ffi::gdk_window_state_get_type()) }
1419    }
1420}
1421
1422impl glib::HasParamSpec for WindowState {
1423    type ParamSpec = glib::ParamSpecFlags;
1424    type SetValue = Self;
1425    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;
1426
1427    fn param_spec_builder() -> Self::BuilderFn {
1428        |name| Self::ParamSpec::builder(name)
1429    }
1430}
1431
1432impl glib::value::ValueType for WindowState {
1433    type Type = Self;
1434}
1435
1436unsafe impl<'a> glib::value::FromValue<'a> for WindowState {
1437    type Checker = glib::value::GenericValueTypeChecker<Self>;
1438
1439    #[inline]
1440    unsafe fn from_value(value: &'a glib::Value) -> Self {
1441        skip_assert_initialized!();
1442        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
1443    }
1444}
1445
1446impl ToValue for WindowState {
1447    #[inline]
1448    fn to_value(&self) -> glib::Value {
1449        let mut value = glib::Value::for_value_type::<Self>();
1450        unsafe {
1451            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
1452        }
1453        value
1454    }
1455
1456    #[inline]
1457    fn value_type(&self) -> glib::Type {
1458        Self::static_type()
1459    }
1460}
1461
1462impl From<WindowState> for glib::Value {
1463    #[inline]
1464    fn from(v: WindowState) -> Self {
1465        skip_assert_initialized!();
1466        ToValue::to_value(&v)
1467    }
1468}