1use 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
13glib_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 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
52pub trait StageExt: 'static {
58 fn ensure_current(&self);
62
63 fn ensure_redraw(&self);
69
70 fn ensure_viewport(&self);
79
80 fn event(&self, event: &mut Event) -> bool;
91
92 fn get_accept_focus(&self) -> bool;
99
100 fn get_actor_at_pos(&self, pick_mode: PickMode, x: i32, y: i32) -> Option<Actor>;
117
118 fn get_fullscreen(&self) -> bool;
124
125 fn get_key_focus(&self) -> Option<Actor>;
131
132 fn get_minimum_size(&self) -> (u32, u32);
145
146 fn get_motion_events_enabled(&self) -> bool;
153
154 fn get_no_clear_hint(&self) -> bool;
161
162 fn get_perspective(&self) -> Perspective;
167
168 fn get_redraw_clip_bounds(&self) -> cairo::RectangleInt;
180
181 fn get_throttle_motion_events(&self) -> bool;
188
189 fn get_title(&self) -> Option<GString>;
197
198 fn get_use_alpha(&self) -> bool;
205
206 fn get_user_resizable(&self) -> bool;
212
213 fn hide_cursor(&self);
215
216 fn set_accept_focus(&self, accept_focus: bool);
246
247 fn set_fullscreen(&self, fullscreen: bool);
262
263 fn set_key_focus<P: IsA<Actor>>(&self, actor: Option<&P>);
269
270 fn set_minimum_size(&self, width: u32, height: u32);
285
286 fn set_motion_events_enabled(&self, enabled: bool);
310
311 fn set_no_clear_hint(&self, no_clear: bool);
328
329 fn set_perspective(&self, perspective: &mut Perspective);
335
336 fn set_throttle_motion_events(&self, throttle: bool);
347
348 fn set_title(&self, title: &str);
352
353 fn set_use_alpha(&self, use_alpha: bool);
359
360 fn set_user_resizable(&self, resizable: bool);
365
366 fn show_cursor(&self);
368
369 fn get_property_cursor_visible(&self) -> bool;
371
372 fn set_property_cursor_visible(&self, cursor_visible: bool);
374
375 fn get_property_fullscreen_set(&self) -> bool;
376
377 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
380
381 fn connect_after_paint<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
384
385 fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
388
389 fn connect_delete_event<F: Fn(&Self, &Event) -> bool + 'static>(&self, f: F)
405 -> SignalHandlerId;
406
407 fn connect_fullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
409
410 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 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}