clutter/auto/
stage.rs

1// Scriptable
2use crate::{Actor, Animatable, Container, Event, Group, Perspective, PickMode};
3use glib::{
4    object as gobject,
5    object::{Cast, IsA},
6    signal::{connect_raw, SignalHandlerId},
7    translate::*,
8    GString, StaticType, Value,
9};
10use std::boxed::Box as Box_;
11use std::{fmt, mem, mem::transmute};
12
13// TODO: implements atk::ImplementorIface, Scriptable
14glib_wrapper! {
15    pub struct Stage(Object<ffi::ClutterStage, ffi::ClutterStageClass, StageClass>) @extends Group, Actor, gobject::InitiallyUnowned, @implements Animatable, Container;
16
17    match fn {
18        get_type => || ffi::clutter_stage_get_type(),
19    }
20}
21
22impl Stage {
23    /// Creates a new, non-default stage. A non-default stage is a new
24    /// top-level actor which can be used as another container. It works
25    /// exactly like the default stage, but while `Stage::get_default`
26    /// will always return the same instance, you will have to keep a pointer
27    /// to any `Stage` returned by `Stage::new`.
28    ///
29    /// The ability to support multiple stages depends on the current
30    /// backend. Use `clutter_feature_available` and
31    /// `FeatureFlags::StageMultiple` to check at runtime whether a
32    /// backend supports multiple stages.
33    ///
34    /// # Returns
35    ///
36    /// a new stage, or `None` if the default backend does
37    ///  not support multiple stages. Use `ActorExt::destroy` to
38    ///  programmatically close the returned stage.
39    pub fn new() -> Stage {
40        unsafe { Actor::from_glib_none(ffi::clutter_stage_new()).unsafe_cast() }
41    }
42}
43
44impl Default for Stage {
45    fn default() -> Self {
46        Self::new()
47    }
48}
49
50pub const NONE_STAGE: Option<&Stage> = None;
51
52/// Trait containing all `Stage` methods.
53///
54/// # Implementors
55///
56/// [`Stage`](struct.Stage.html)
57pub trait StageExt: 'static {
58    /// This function essentially makes sure the right GL context is
59    /// current for the passed stage. It is not intended to
60    /// be used by applications.
61    fn ensure_current(&self);
62
63    /// Ensures that `self` is redrawn
64    ///
65    /// This function should not be called by applications: it is
66    /// used when embedding a `Stage` into a toolkit with
67    /// another windowing system, like GTK+.
68    fn ensure_redraw(&self);
69
70    /// Ensures that the GL viewport is updated with the current
71    /// stage window size.
72    ///
73    /// This function will queue a redraw of `self`.
74    ///
75    /// This function should not be called by applications; it is used
76    /// when embedding a `Stage` into a toolkit with another
77    /// windowing system, like GTK+.
78    fn ensure_viewport(&self);
79
80    /// This function is used to emit an event on the main stage.
81    ///
82    /// You should rarely need to use this function, except for
83    /// synthetised events.
84    /// ## `event`
85    /// a `ClutterEvent`
86    ///
87    /// # Returns
88    ///
89    /// the return value from the signal emission
90    fn event(&self, event: &mut Event) -> bool;
91
92    /// Retrieves the value set with `StageExt::set_accept_focus`.
93    ///
94    /// # Returns
95    ///
96    /// `true` if the `Stage` should accept focus, and `false`
97    ///  otherwise
98    fn get_accept_focus(&self) -> bool;
99
100    /// Checks the scene at the coordinates `x` and `y` and returns a pointer
101    /// to the `Actor` at those coordinates.
102    ///
103    /// By using `pick_mode` it is possible to control which actors will be
104    /// painted and thus available.
105    /// ## `pick_mode`
106    /// how the scene graph should be painted
107    /// ## `x`
108    /// X coordinate to check
109    /// ## `y`
110    /// Y coordinate to check
111    ///
112    /// # Returns
113    ///
114    /// the actor at the specified coordinates,
115    ///  if any
116    fn get_actor_at_pos(&self, pick_mode: PickMode, x: i32, y: i32) -> Option<Actor>;
117
118    /// Retrieves whether the stage is full screen or not
119    ///
120    /// # Returns
121    ///
122    /// `true` if the stage is full screen
123    fn get_fullscreen(&self) -> bool;
124
125    /// Retrieves the actor that is currently under key focus.
126    ///
127    /// # Returns
128    ///
129    /// the actor with key focus, or the stage
130    fn get_key_focus(&self) -> Option<Actor>;
131
132    /// Retrieves the minimum size for a stage window as set using
133    /// `StageExt::set_minimum_size`.
134    ///
135    /// The returned size may not correspond to the actual minimum size and
136    /// it is specific to the `Stage` implementation inside the
137    /// Clutter backend
138    /// ## `width`
139    /// return location for the minimum width, in pixels,
140    ///  or `None`
141    /// ## `height`
142    /// return location for the minimum height, in pixels,
143    ///  or `None`
144    fn get_minimum_size(&self) -> (u32, u32);
145
146    /// Retrieves the value set using `StageExt::set_motion_events_enabled`.
147    ///
148    /// # Returns
149    ///
150    /// `true` if the per-actor motion event delivery is enabled
151    ///  and `false` otherwise
152    fn get_motion_events_enabled(&self) -> bool;
153
154    /// Retrieves the hint set with `StageExt::set_no_clear_hint`
155    ///
156    /// # Returns
157    ///
158    /// `true` if the stage should not clear itself on every paint
159    ///  cycle, and `false` otherwise
160    fn get_no_clear_hint(&self) -> bool;
161
162    /// Retrieves the stage perspective.
163    /// ## `perspective`
164    /// return location for a
165    ///  `Perspective`
166    fn get_perspective(&self) -> Perspective;
167
168    /// Gets the bounds of the current redraw for `self` in stage pixel
169    /// coordinates. E.g., if only a single actor has queued a redraw then
170    /// Clutter may redraw the stage with a clip so that it doesn't have to
171    /// paint every pixel in the stage. This function would then return the
172    /// bounds of that clip. An application can use this information to
173    /// avoid some extra work if it knows that some regions of the stage
174    /// aren't going to be painted. This should only be called while the
175    /// stage is being painted. If there is no current redraw clip then
176    /// this function will set `clip` to the full extents of the stage.
177    /// ## `clip`
178    /// Return location for the clip bounds
179    fn get_redraw_clip_bounds(&self) -> cairo::RectangleInt;
180
181    /// Retrieves the value set with `StageExt::set_throttle_motion_events`
182    ///
183    /// # Returns
184    ///
185    /// `true` if the motion events are being throttled,
186    ///  and `false` otherwise
187    fn get_throttle_motion_events(&self) -> bool;
188
189    /// Gets the stage title.
190    ///
191    /// # Returns
192    ///
193    /// pointer to the title string for the stage. The
194    /// returned string is owned by the actor and should not
195    /// be modified or freed.
196    fn get_title(&self) -> Option<GString>;
197
198    /// Retrieves the value set using `StageExt::set_use_alpha`
199    ///
200    /// # Returns
201    ///
202    /// `true` if the stage should honour the opacity and the
203    ///  alpha channel of the stage color
204    fn get_use_alpha(&self) -> bool;
205
206    /// Retrieves the value set with `StageExt::set_user_resizable`.
207    ///
208    /// # Returns
209    ///
210    /// `true` if the stage is resizable by the user.
211    fn get_user_resizable(&self) -> bool;
212
213    /// Makes the cursor invisible on the stage window
214    fn hide_cursor(&self);
215
216    // /// Makes a screenshot of the stage in RGBA 8bit data, returns a
217    // /// linear buffer with `width` * 4 as rowstride.
218    // ///
219    // /// The alpha data contained in the returned buffer is driver-dependent,
220    // /// and not guaranteed to hold any sensible value.
221    // /// ## `x`
222    // /// x coordinate of the first pixel that is read from stage
223    // /// ## `y`
224    // /// y coordinate of the first pixel that is read from stage
225    // /// ## `width`
226    // /// Width dimention of pixels to be read, or -1 for the
227    // ///  entire stage width
228    // /// ## `height`
229    // /// Height dimention of pixels to be read, or -1 for the
230    // ///  entire stage height
231    // ///
232    // /// # Returns
233    // ///
234    // /// a pointer to newly allocated memory with the buffer
235    // ///  or `None` if the read failed. Use `g_free` on the returned data
236    // ///  to release the resources it has allocated.
237    // fn read_pixels(&self, x: i32, y: i32, width: i32, height: i32) -> Vec<u8>;
238
239    /// Sets whether the `self` should accept the key focus when shown.
240    ///
241    /// This function should be called before showing `self` using
242    /// `ActorExt::show`.
243    /// ## `accept_focus`
244    /// `true` to accept focus on show
245    fn set_accept_focus(&self, accept_focus: bool);
246
247    /// Asks to place the stage window in the fullscreen or unfullscreen
248    /// states.
249    ///
250    ///  ( Note that you shouldn't assume the window is definitely full screen
251    /// afterward, because other entities (e.g. the user or window manager)
252    /// could unfullscreen it again, and not all window managers honor
253    /// requests to fullscreen windows.
254    ///
255    /// If you want to receive notification of the fullscreen state you
256    /// should either use the `Stage::fullscreen` and
257    /// `Stage::unfullscreen` signals, or use the notify signal
258    /// for the `Stage:fullscreen-set` property
259    /// ## `fullscreen`
260    /// `true` to to set the stage fullscreen
261    fn set_fullscreen(&self, fullscreen: bool);
262
263    /// Sets the key focus on `actor`. An actor with key focus will receive
264    /// all the key events. If `actor` is `None`, the stage will receive
265    /// focus.
266    /// ## `actor`
267    /// the actor to set key focus to, or `None`
268    fn set_key_focus<P: IsA<Actor>>(&self, actor: Option<&P>);
269
270    /// Sets the minimum size for a stage window, if the default backend
271    /// uses `Stage` inside a window
272    ///
273    /// This is a convenience function, and it is equivalent to setting the
274    /// `Actor:min-width` and `Actor:min-height` on `self`
275    ///
276    /// If the current size of `self` is smaller than the minimum size, the
277    /// `self` will be resized to the new `width` and `height`
278    ///
279    /// This function has no effect if `self` is fullscreen
280    /// ## `width`
281    /// width, in pixels
282    /// ## `height`
283    /// height, in pixels
284    fn set_minimum_size(&self, width: u32, height: u32);
285
286    /// Sets whether per-actor motion events (and relative crossing
287    /// events) should be disabled or not.
288    ///
289    /// The default is `true`.
290    ///
291    /// If `enable` is `false` the following signals will not be emitted
292    /// by the actors children of `self`:
293    ///
294    ///  - `Actor::motion-event`
295    ///  - `Actor::enter-event`
296    ///  - `Actor::leave-event`
297    ///
298    /// The events will still be delivered to the `Stage`.
299    ///
300    /// The main side effect of this function is that disabling the motion
301    /// events will disable picking to detect the `Actor` underneath
302    /// the pointer for each motion event. This is useful, for instance,
303    /// when dragging a `Actor` across the `self`: the actor underneath
304    /// the pointer is not going to change, so it's meaningless to perform
305    /// a pick.
306    /// ## `enabled`
307    /// `true` to enable the motion events delivery, and `false`
308    ///  otherwise
309    fn set_motion_events_enabled(&self, enabled: bool);
310
311    /// Sets whether the `self` should clear itself at the beginning
312    /// of each paint cycle or not.
313    ///
314    /// Clearing the `Stage` can be a costly operation, especially
315    /// if the stage is always covered - for instance, in a full-screen
316    /// video player or in a game with a background texture.
317    ///
318    /// This setting is a hint; Clutter might discard this hint
319    /// depending on its internal state.
320    ///
321    /// If parts of the stage are visible and you disable clearing you
322    /// might end up with visual artifacts while painting the contents of
323    /// the stage.
324    /// ## `no_clear`
325    /// `true` if the `self` should not clear itself on every
326    ///  repaint cycle
327    fn set_no_clear_hint(&self, no_clear: bool);
328
329    /// Sets the stage perspective. Using this function is not recommended
330    /// because it will disable Clutter's attempts to generate an
331    /// appropriate perspective based on the size of the stage.
332    /// ## `perspective`
333    /// A `Perspective`
334    fn set_perspective(&self, perspective: &mut Perspective);
335
336    /// Sets whether motion events received between redraws should
337    /// be throttled or not. If motion events are throttled, those
338    /// events received by the windowing system between redraws will
339    /// be compressed so that only the last event will be propagated
340    /// to the `self` and its actors.
341    ///
342    /// This function should only be used if you want to have all
343    /// the motion events delivered to your application code.
344    /// ## `throttle`
345    /// `true` to throttle motion events
346    fn set_throttle_motion_events(&self, throttle: bool);
347
348    /// Sets the stage title.
349    /// ## `title`
350    /// A utf8 string for the stage windows title.
351    fn set_title(&self, title: &str);
352
353    /// Sets whether the `self` should honour the `Actor:opacity` and
354    /// the alpha channel of the `Stage:color`
355    /// ## `use_alpha`
356    /// whether the stage should honour the opacity or the
357    ///  alpha channel of the stage color
358    fn set_use_alpha(&self, use_alpha: bool);
359
360    /// Sets if the stage is resizable by user interaction (e.g. via
361    /// window manager controls)
362    /// ## `resizable`
363    /// whether the stage should be user resizable.
364    fn set_user_resizable(&self, resizable: bool);
365
366    /// Shows the cursor on the stage window
367    fn show_cursor(&self);
368
369    /// Whether the mouse pointer should be visible
370    fn get_property_cursor_visible(&self) -> bool;
371
372    /// Whether the mouse pointer should be visible
373    fn set_property_cursor_visible(&self, cursor_visible: bool);
374
375    fn get_property_fullscreen_set(&self) -> bool;
376
377    /// The ::activate signal is emitted when the stage receives key focus
378    /// from the underlying window system.
379    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
380
381    /// The ::after-paint signal is emitted after the stage is painted,
382    /// but before the results are displayed on the screen.
383    fn connect_after_paint<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
384
385    /// The ::deactivate signal is emitted when the stage loses key focus
386    /// from the underlying window system.
387    fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
388
389    /// The ::delete-event signal is emitted when the user closes a
390    /// `Stage` window using the window controls.
391    ///
392    /// Clutter by default will call `clutter_main_quit` if `stage` is
393    /// the default stage, and `ActorExt::destroy` for any other
394    /// stage.
395    ///
396    /// It is possible to override the default behaviour by connecting
397    /// a new handler and returning `true` there.
398    ///
399    /// This signal is emitted only on Clutter backends that
400    /// embed `Stage` in native windows. It is not emitted for
401    /// backends that use a static frame buffer.
402    /// ## `event`
403    /// a `ClutterEvent` of type `EventType::Delete`
404    fn connect_delete_event<F: Fn(&Self, &Event) -> bool + 'static>(&self, f: F)
405        -> SignalHandlerId;
406
407    /// The ::fullscreen signal is emitted when the stage is made fullscreen.
408    fn connect_fullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
409
410    /// The ::unfullscreen signal is emitted when the stage leaves a fullscreen
411    /// state.
412    fn connect_unfullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
413
414    fn connect_property_accept_focus_notify<F: Fn(&Self) + 'static>(&self, f: F)
415        -> SignalHandlerId;
416
417    fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>(
418        &self,
419        f: F,
420    ) -> SignalHandlerId;
421
422    fn connect_property_fullscreen_set_notify<F: Fn(&Self) + 'static>(
423        &self,
424        f: F,
425    ) -> SignalHandlerId;
426
427    fn connect_property_key_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
428
429    fn connect_property_no_clear_hint_notify<F: Fn(&Self) + 'static>(
430        &self,
431        f: F,
432    ) -> SignalHandlerId;
433
434    fn connect_property_perspective_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
435
436    fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
437
438    fn connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
439
440    fn connect_property_user_resizable_notify<F: Fn(&Self) + 'static>(
441        &self,
442        f: F,
443    ) -> SignalHandlerId;
444}
445
446impl<O: IsA<Stage>> StageExt for O {
447    fn ensure_current(&self) {
448        unsafe {
449            ffi::clutter_stage_ensure_current(self.as_ref().to_glib_none().0);
450        }
451    }
452
453    fn ensure_redraw(&self) {
454        unsafe {
455            ffi::clutter_stage_ensure_redraw(self.as_ref().to_glib_none().0);
456        }
457    }
458
459    fn ensure_viewport(&self) {
460        unsafe {
461            ffi::clutter_stage_ensure_viewport(self.as_ref().to_glib_none().0);
462        }
463    }
464
465    fn event(&self, event: &mut Event) -> bool {
466        unsafe {
467            from_glib(ffi::clutter_stage_event(
468                self.as_ref().to_glib_none().0,
469                event.to_glib_none_mut().0,
470            ))
471        }
472    }
473
474    fn get_accept_focus(&self) -> bool {
475        unsafe {
476            from_glib(ffi::clutter_stage_get_accept_focus(
477                self.as_ref().to_glib_none().0,
478            ))
479        }
480    }
481
482    fn get_actor_at_pos(&self, pick_mode: PickMode, x: i32, y: i32) -> Option<Actor> {
483        unsafe {
484            from_glib_none(ffi::clutter_stage_get_actor_at_pos(
485                self.as_ref().to_glib_none().0,
486                pick_mode.to_glib(),
487                x,
488                y,
489            ))
490        }
491    }
492
493    fn get_fullscreen(&self) -> bool {
494        unsafe {
495            from_glib(ffi::clutter_stage_get_fullscreen(
496                self.as_ref().to_glib_none().0,
497            ))
498        }
499    }
500
501    fn get_key_focus(&self) -> Option<Actor> {
502        unsafe {
503            from_glib_none(ffi::clutter_stage_get_key_focus(
504                self.as_ref().to_glib_none().0,
505            ))
506        }
507    }
508
509    fn get_minimum_size(&self) -> (u32, u32) {
510        unsafe {
511            let mut width = mem::MaybeUninit::uninit();
512            let mut height = mem::MaybeUninit::uninit();
513            ffi::clutter_stage_get_minimum_size(
514                self.as_ref().to_glib_none().0,
515                width.as_mut_ptr(),
516                height.as_mut_ptr(),
517            );
518            let width = width.assume_init();
519            let height = height.assume_init();
520            (width, height)
521        }
522    }
523
524    fn get_motion_events_enabled(&self) -> bool {
525        unsafe {
526            from_glib(ffi::clutter_stage_get_motion_events_enabled(
527                self.as_ref().to_glib_none().0,
528            ))
529        }
530    }
531
532    fn get_no_clear_hint(&self) -> bool {
533        unsafe {
534            from_glib(ffi::clutter_stage_get_no_clear_hint(
535                self.as_ref().to_glib_none().0,
536            ))
537        }
538    }
539
540    fn get_perspective(&self) -> Perspective {
541        unsafe {
542            let mut perspective = Perspective::uninitialized();
543            ffi::clutter_stage_get_perspective(
544                self.as_ref().to_glib_none().0,
545                perspective.to_glib_none_mut().0,
546            );
547            perspective
548        }
549    }
550
551    fn get_redraw_clip_bounds(&self) -> cairo::RectangleInt {
552        unsafe {
553            let mut clip = cairo::RectangleInt::uninitialized();
554            ffi::clutter_stage_get_redraw_clip_bounds(
555                self.as_ref().to_glib_none().0,
556                clip.to_glib_none_mut().0,
557            );
558            clip
559        }
560    }
561
562    fn get_throttle_motion_events(&self) -> bool {
563        unsafe {
564            from_glib(ffi::clutter_stage_get_throttle_motion_events(
565                self.as_ref().to_glib_none().0,
566            ))
567        }
568    }
569
570    fn get_title(&self) -> Option<GString> {
571        unsafe { from_glib_none(ffi::clutter_stage_get_title(self.as_ref().to_glib_none().0)) }
572    }
573
574    fn get_use_alpha(&self) -> bool {
575        unsafe {
576            from_glib(ffi::clutter_stage_get_use_alpha(
577                self.as_ref().to_glib_none().0,
578            ))
579        }
580    }
581
582    fn get_user_resizable(&self) -> bool {
583        unsafe {
584            from_glib(ffi::clutter_stage_get_user_resizable(
585                self.as_ref().to_glib_none().0,
586            ))
587        }
588    }
589
590    fn hide_cursor(&self) {
591        unsafe {
592            ffi::clutter_stage_hide_cursor(self.as_ref().to_glib_none().0);
593        }
594    }
595
596    // fn read_pixels(&self, x: i32, y: i32, width: i32, height: i32) -> Vec<u8> {
597    //     unsafe {
598    //         FromGlibPtrContainer::from_glib_full(ffi::clutter_stage_read_pixels(
599    //             self.as_ref().to_glib_none().0,
600    //             x,
601    //             y,
602    //             width,
603    //             height,
604    //         ))
605    //     }
606    // }
607
608    fn set_accept_focus(&self, accept_focus: bool) {
609        unsafe {
610            ffi::clutter_stage_set_accept_focus(
611                self.as_ref().to_glib_none().0,
612                accept_focus.to_glib(),
613            );
614        }
615    }
616
617    fn set_fullscreen(&self, fullscreen: bool) {
618        unsafe {
619            ffi::clutter_stage_set_fullscreen(self.as_ref().to_glib_none().0, fullscreen.to_glib());
620        }
621    }
622
623    fn set_key_focus<P: IsA<Actor>>(&self, actor: Option<&P>) {
624        unsafe {
625            ffi::clutter_stage_set_key_focus(
626                self.as_ref().to_glib_none().0,
627                actor.map(|p| p.as_ref()).to_glib_none().0,
628            );
629        }
630    }
631
632    fn set_minimum_size(&self, width: u32, height: u32) {
633        unsafe {
634            ffi::clutter_stage_set_minimum_size(self.as_ref().to_glib_none().0, width, height);
635        }
636    }
637
638    fn set_motion_events_enabled(&self, enabled: bool) {
639        unsafe {
640            ffi::clutter_stage_set_motion_events_enabled(
641                self.as_ref().to_glib_none().0,
642                enabled.to_glib(),
643            );
644        }
645    }
646
647    fn set_no_clear_hint(&self, no_clear: bool) {
648        unsafe {
649            ffi::clutter_stage_set_no_clear_hint(
650                self.as_ref().to_glib_none().0,
651                no_clear.to_glib(),
652            );
653        }
654    }
655
656    fn set_perspective(&self, perspective: &mut Perspective) {
657        unsafe {
658            ffi::clutter_stage_set_perspective(
659                self.as_ref().to_glib_none().0,
660                perspective.to_glib_none_mut().0,
661            );
662        }
663    }
664
665    fn set_throttle_motion_events(&self, throttle: bool) {
666        unsafe {
667            ffi::clutter_stage_set_throttle_motion_events(
668                self.as_ref().to_glib_none().0,
669                throttle.to_glib(),
670            );
671        }
672    }
673
674    fn set_title(&self, title: &str) {
675        unsafe {
676            ffi::clutter_stage_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
677        }
678    }
679
680    fn set_use_alpha(&self, use_alpha: bool) {
681        unsafe {
682            ffi::clutter_stage_set_use_alpha(self.as_ref().to_glib_none().0, use_alpha.to_glib());
683        }
684    }
685
686    fn set_user_resizable(&self, resizable: bool) {
687        unsafe {
688            ffi::clutter_stage_set_user_resizable(
689                self.as_ref().to_glib_none().0,
690                resizable.to_glib(),
691            );
692        }
693    }
694
695    fn show_cursor(&self) {
696        unsafe {
697            ffi::clutter_stage_show_cursor(self.as_ref().to_glib_none().0);
698        }
699    }
700
701    fn get_property_cursor_visible(&self) -> bool {
702        unsafe {
703            let mut value = Value::from_type(<bool as StaticType>::static_type());
704            gobject_sys::g_object_get_property(
705                self.to_glib_none().0 as *mut gobject_sys::GObject,
706                b"cursor-visible\0".as_ptr() as *const _,
707                value.to_glib_none_mut().0,
708            );
709            value
710                .get()
711                .expect("Return Value for property `cursor-visible` getter")
712                .unwrap()
713        }
714    }
715
716    fn set_property_cursor_visible(&self, cursor_visible: bool) {
717        unsafe {
718            gobject_sys::g_object_set_property(
719                self.to_glib_none().0 as *mut gobject_sys::GObject,
720                b"cursor-visible\0".as_ptr() as *const _,
721                Value::from(&cursor_visible).to_glib_none().0,
722            );
723        }
724    }
725
726    fn get_property_fullscreen_set(&self) -> bool {
727        unsafe {
728            let mut value = Value::from_type(<bool as StaticType>::static_type());
729            gobject_sys::g_object_get_property(
730                self.to_glib_none().0 as *mut gobject_sys::GObject,
731                b"fullscreen-set\0".as_ptr() as *const _,
732                value.to_glib_none_mut().0,
733            );
734            value
735                .get()
736                .expect("Return Value for property `fullscreen-set` getter")
737                .unwrap()
738        }
739    }
740
741    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
742        unsafe extern "C" fn activate_trampoline<P, F: Fn(&P) + 'static>(
743            this: *mut ffi::ClutterStage,
744            f: glib_sys::gpointer,
745        ) where
746            P: IsA<Stage>,
747        {
748            let f: &F = &*(f as *const F);
749            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
750        }
751        unsafe {
752            let f: Box_<F> = Box_::new(f);
753            connect_raw(
754                self.as_ptr() as *mut _,
755                b"activate\0".as_ptr() as *const _,
756                Some(transmute::<_, unsafe extern "C" fn()>(
757                    activate_trampoline::<Self, F> as *const (),
758                )),
759                Box_::into_raw(f),
760            )
761        }
762    }
763
764    fn connect_after_paint<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
765        unsafe extern "C" fn after_paint_trampoline<P, F: Fn(&P) + 'static>(
766            this: *mut ffi::ClutterStage,
767            f: glib_sys::gpointer,
768        ) where
769            P: IsA<Stage>,
770        {
771            let f: &F = &*(f as *const F);
772            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
773        }
774        unsafe {
775            let f: Box_<F> = Box_::new(f);
776            connect_raw(
777                self.as_ptr() as *mut _,
778                b"after-paint\0".as_ptr() as *const _,
779                Some(transmute::<_, unsafe extern "C" fn()>(
780                    after_paint_trampoline::<Self, F> as *const (),
781                )),
782                Box_::into_raw(f),
783            )
784        }
785    }
786
787    fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
788        unsafe extern "C" fn deactivate_trampoline<P, F: Fn(&P) + 'static>(
789            this: *mut ffi::ClutterStage,
790            f: glib_sys::gpointer,
791        ) where
792            P: IsA<Stage>,
793        {
794            let f: &F = &*(f as *const F);
795            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
796        }
797        unsafe {
798            let f: Box_<F> = Box_::new(f);
799            connect_raw(
800                self.as_ptr() as *mut _,
801                b"deactivate\0".as_ptr() as *const _,
802                Some(transmute::<_, unsafe extern "C" fn()>(
803                    deactivate_trampoline::<Self, F> as *const (),
804                )),
805                Box_::into_raw(f),
806            )
807        }
808    }
809
810    fn connect_delete_event<F: Fn(&Self, &Event) -> bool + 'static>(
811        &self,
812        f: F,
813    ) -> SignalHandlerId {
814        unsafe extern "C" fn delete_event_trampoline<P, F: Fn(&P, &Event) -> bool + 'static>(
815            this: *mut ffi::ClutterStage,
816            event: *mut ffi::ClutterEvent,
817            f: glib_sys::gpointer,
818        ) -> glib_sys::gboolean
819        where
820            P: IsA<Stage>,
821        {
822            let f: &F = &*(f as *const F);
823            f(
824                &Stage::from_glib_borrow(this).unsafe_cast_ref(),
825                &from_glib_none(event),
826            )
827            .to_glib()
828        }
829        unsafe {
830            let f: Box_<F> = Box_::new(f);
831            connect_raw(
832                self.as_ptr() as *mut _,
833                b"delete-event\0".as_ptr() as *const _,
834                Some(transmute::<_, unsafe extern "C" fn()>(
835                    delete_event_trampoline::<Self, F> as *const (),
836                )),
837                Box_::into_raw(f),
838            )
839        }
840    }
841
842    fn connect_fullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
843        unsafe extern "C" fn fullscreen_trampoline<P, F: Fn(&P) + 'static>(
844            this: *mut ffi::ClutterStage,
845            f: glib_sys::gpointer,
846        ) where
847            P: IsA<Stage>,
848        {
849            let f: &F = &*(f as *const F);
850            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
851        }
852        unsafe {
853            let f: Box_<F> = Box_::new(f);
854            connect_raw(
855                self.as_ptr() as *mut _,
856                b"fullscreen\0".as_ptr() as *const _,
857                Some(transmute::<_, unsafe extern "C" fn()>(
858                    fullscreen_trampoline::<Self, F> as *const (),
859                )),
860                Box_::into_raw(f),
861            )
862        }
863    }
864
865    fn connect_unfullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
866        unsafe extern "C" fn unfullscreen_trampoline<P, F: Fn(&P) + 'static>(
867            this: *mut ffi::ClutterStage,
868            f: glib_sys::gpointer,
869        ) where
870            P: IsA<Stage>,
871        {
872            let f: &F = &*(f as *const F);
873            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
874        }
875        unsafe {
876            let f: Box_<F> = Box_::new(f);
877            connect_raw(
878                self.as_ptr() as *mut _,
879                b"unfullscreen\0".as_ptr() as *const _,
880                Some(transmute::<_, unsafe extern "C" fn()>(
881                    unfullscreen_trampoline::<Self, F> as *const (),
882                )),
883                Box_::into_raw(f),
884            )
885        }
886    }
887
888    fn connect_property_accept_focus_notify<F: Fn(&Self) + 'static>(
889        &self,
890        f: F,
891    ) -> SignalHandlerId {
892        unsafe extern "C" fn notify_accept_focus_trampoline<P, F: Fn(&P) + 'static>(
893            this: *mut ffi::ClutterStage,
894            _param_spec: glib_sys::gpointer,
895            f: glib_sys::gpointer,
896        ) where
897            P: IsA<Stage>,
898        {
899            let f: &F = &*(f as *const F);
900            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
901        }
902        unsafe {
903            let f: Box_<F> = Box_::new(f);
904            connect_raw(
905                self.as_ptr() as *mut _,
906                b"notify::accept-focus\0".as_ptr() as *const _,
907                Some(transmute::<_, unsafe extern "C" fn()>(
908                    notify_accept_focus_trampoline::<Self, F> as *const (),
909                )),
910                Box_::into_raw(f),
911            )
912        }
913    }
914
915    fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>(
916        &self,
917        f: F,
918    ) -> SignalHandlerId {
919        unsafe extern "C" fn notify_cursor_visible_trampoline<P, F: Fn(&P) + 'static>(
920            this: *mut ffi::ClutterStage,
921            _param_spec: glib_sys::gpointer,
922            f: glib_sys::gpointer,
923        ) where
924            P: IsA<Stage>,
925        {
926            let f: &F = &*(f as *const F);
927            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
928        }
929        unsafe {
930            let f: Box_<F> = Box_::new(f);
931            connect_raw(
932                self.as_ptr() as *mut _,
933                b"notify::cursor-visible\0".as_ptr() as *const _,
934                Some(transmute::<_, unsafe extern "C" fn()>(
935                    notify_cursor_visible_trampoline::<Self, F> as *const (),
936                )),
937                Box_::into_raw(f),
938            )
939        }
940    }
941
942    fn connect_property_fullscreen_set_notify<F: Fn(&Self) + 'static>(
943        &self,
944        f: F,
945    ) -> SignalHandlerId {
946        unsafe extern "C" fn notify_fullscreen_set_trampoline<P, F: Fn(&P) + 'static>(
947            this: *mut ffi::ClutterStage,
948            _param_spec: glib_sys::gpointer,
949            f: glib_sys::gpointer,
950        ) where
951            P: IsA<Stage>,
952        {
953            let f: &F = &*(f as *const F);
954            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
955        }
956        unsafe {
957            let f: Box_<F> = Box_::new(f);
958            connect_raw(
959                self.as_ptr() as *mut _,
960                b"notify::fullscreen-set\0".as_ptr() as *const _,
961                Some(transmute::<_, unsafe extern "C" fn()>(
962                    notify_fullscreen_set_trampoline::<Self, F> as *const (),
963                )),
964                Box_::into_raw(f),
965            )
966        }
967    }
968
969    fn connect_property_key_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
970        unsafe extern "C" fn notify_key_focus_trampoline<P, F: Fn(&P) + 'static>(
971            this: *mut ffi::ClutterStage,
972            _param_spec: glib_sys::gpointer,
973            f: glib_sys::gpointer,
974        ) where
975            P: IsA<Stage>,
976        {
977            let f: &F = &*(f as *const F);
978            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
979        }
980        unsafe {
981            let f: Box_<F> = Box_::new(f);
982            connect_raw(
983                self.as_ptr() as *mut _,
984                b"notify::key-focus\0".as_ptr() as *const _,
985                Some(transmute::<_, unsafe extern "C" fn()>(
986                    notify_key_focus_trampoline::<Self, F> as *const (),
987                )),
988                Box_::into_raw(f),
989            )
990        }
991    }
992
993    fn connect_property_no_clear_hint_notify<F: Fn(&Self) + 'static>(
994        &self,
995        f: F,
996    ) -> SignalHandlerId {
997        unsafe extern "C" fn notify_no_clear_hint_trampoline<P, F: Fn(&P) + 'static>(
998            this: *mut ffi::ClutterStage,
999            _param_spec: glib_sys::gpointer,
1000            f: glib_sys::gpointer,
1001        ) where
1002            P: IsA<Stage>,
1003        {
1004            let f: &F = &*(f as *const F);
1005            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1006        }
1007        unsafe {
1008            let f: Box_<F> = Box_::new(f);
1009            connect_raw(
1010                self.as_ptr() as *mut _,
1011                b"notify::no-clear-hint\0".as_ptr() as *const _,
1012                Some(transmute::<_, unsafe extern "C" fn()>(
1013                    notify_no_clear_hint_trampoline::<Self, F> as *const (),
1014                )),
1015                Box_::into_raw(f),
1016            )
1017        }
1018    }
1019
1020    fn connect_property_perspective_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1021        unsafe extern "C" fn notify_perspective_trampoline<P, F: Fn(&P) + 'static>(
1022            this: *mut ffi::ClutterStage,
1023            _param_spec: glib_sys::gpointer,
1024            f: glib_sys::gpointer,
1025        ) where
1026            P: IsA<Stage>,
1027        {
1028            let f: &F = &*(f as *const F);
1029            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1030        }
1031        unsafe {
1032            let f: Box_<F> = Box_::new(f);
1033            connect_raw(
1034                self.as_ptr() as *mut _,
1035                b"notify::perspective\0".as_ptr() as *const _,
1036                Some(transmute::<_, unsafe extern "C" fn()>(
1037                    notify_perspective_trampoline::<Self, F> as *const (),
1038                )),
1039                Box_::into_raw(f),
1040            )
1041        }
1042    }
1043
1044    fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1045        unsafe extern "C" fn notify_title_trampoline<P, F: Fn(&P) + 'static>(
1046            this: *mut ffi::ClutterStage,
1047            _param_spec: glib_sys::gpointer,
1048            f: glib_sys::gpointer,
1049        ) where
1050            P: IsA<Stage>,
1051        {
1052            let f: &F = &*(f as *const F);
1053            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1054        }
1055        unsafe {
1056            let f: Box_<F> = Box_::new(f);
1057            connect_raw(
1058                self.as_ptr() as *mut _,
1059                b"notify::title\0".as_ptr() as *const _,
1060                Some(transmute::<_, unsafe extern "C" fn()>(
1061                    notify_title_trampoline::<Self, F> as *const (),
1062                )),
1063                Box_::into_raw(f),
1064            )
1065        }
1066    }
1067
1068    fn connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1069        unsafe extern "C" fn notify_use_alpha_trampoline<P, F: Fn(&P) + 'static>(
1070            this: *mut ffi::ClutterStage,
1071            _param_spec: glib_sys::gpointer,
1072            f: glib_sys::gpointer,
1073        ) where
1074            P: IsA<Stage>,
1075        {
1076            let f: &F = &*(f as *const F);
1077            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1078        }
1079        unsafe {
1080            let f: Box_<F> = Box_::new(f);
1081            connect_raw(
1082                self.as_ptr() as *mut _,
1083                b"notify::use-alpha\0".as_ptr() as *const _,
1084                Some(transmute::<_, unsafe extern "C" fn()>(
1085                    notify_use_alpha_trampoline::<Self, F> as *const (),
1086                )),
1087                Box_::into_raw(f),
1088            )
1089        }
1090    }
1091
1092    fn connect_property_user_resizable_notify<F: Fn(&Self) + 'static>(
1093        &self,
1094        f: F,
1095    ) -> SignalHandlerId {
1096        unsafe extern "C" fn notify_user_resizable_trampoline<P, F: Fn(&P) + 'static>(
1097            this: *mut ffi::ClutterStage,
1098            _param_spec: glib_sys::gpointer,
1099            f: glib_sys::gpointer,
1100        ) where
1101            P: IsA<Stage>,
1102        {
1103            let f: &F = &*(f as *const F);
1104            f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1105        }
1106        unsafe {
1107            let f: Box_<F> = Box_::new(f);
1108            connect_raw(
1109                self.as_ptr() as *mut _,
1110                b"notify::user-resizable\0".as_ptr() as *const _,
1111                Some(transmute::<_, unsafe extern "C" fn()>(
1112                    notify_user_resizable_trampoline::<Self, F> as *const (),
1113                )),
1114                Box_::into_raw(f),
1115            )
1116        }
1117    }
1118}
1119
1120impl fmt::Display for Stage {
1121    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1122        write!(f, "Stage")
1123    }
1124}