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 trait StageExt: 'static {
56 fn ensure_current(&self);
60
61 fn ensure_redraw(&self);
67
68 fn ensure_viewport(&self);
77
78 fn event(&self, event: &mut Event) -> bool;
89
90 fn get_accept_focus(&self) -> bool;
97
98 fn get_actor_at_pos(&self, pick_mode: PickMode, x: i32, y: i32) -> Option<Actor>;
115
116 fn get_fullscreen(&self) -> bool;
122
123 fn get_key_focus(&self) -> Option<Actor>;
129
130 fn get_minimum_size(&self) -> (u32, u32);
143
144 fn get_motion_events_enabled(&self) -> bool;
151
152 fn get_no_clear_hint(&self) -> bool;
159
160 fn get_perspective(&self) -> Perspective;
165
166 fn get_redraw_clip_bounds(&self) -> cairo::RectangleInt;
178
179 fn get_throttle_motion_events(&self) -> bool;
186
187 fn get_title(&self) -> Option<GString>;
195
196 fn get_use_alpha(&self) -> bool;
203
204 fn get_user_resizable(&self) -> bool;
210
211 fn hide_cursor(&self);
213
214 fn set_accept_focus(&self, accept_focus: bool);
244
245 fn set_fullscreen(&self, fullscreen: bool);
260
261 fn set_key_focus<P: IsA<Actor>>(&self, actor: Option<&P>);
267
268 fn set_minimum_size(&self, width: u32, height: u32);
283
284 fn set_motion_events_enabled(&self, enabled: bool);
308
309 fn set_no_clear_hint(&self, no_clear: bool);
326
327 fn set_perspective(&self, perspective: &mut Perspective);
333
334 fn set_throttle_motion_events(&self, throttle: bool);
345
346 fn set_title(&self, title: &str);
350
351 fn set_use_alpha(&self, use_alpha: bool);
357
358 fn set_user_resizable(&self, resizable: bool);
363
364 fn show_cursor(&self);
366
367 fn get_property_cursor_visible(&self) -> bool;
369
370 fn set_property_cursor_visible(&self, cursor_visible: bool);
372
373 fn get_property_fullscreen_set(&self) -> bool;
374
375 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
378
379 fn connect_after_paint<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
382
383 fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
386
387 fn connect_delete_event<F: Fn(&Self, &Event) -> bool + 'static>(&self, f: F)
403 -> SignalHandlerId;
404
405 fn connect_fullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
407
408 fn connect_unfullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
411
412 fn connect_property_accept_focus_notify<F: Fn(&Self) + 'static>(&self, f: F)
413 -> SignalHandlerId;
414
415 fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>(
416 &self,
417 f: F,
418 ) -> SignalHandlerId;
419
420 fn connect_property_fullscreen_set_notify<F: Fn(&Self) + 'static>(
421 &self,
422 f: F,
423 ) -> SignalHandlerId;
424
425 fn connect_property_key_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
426
427 fn connect_property_no_clear_hint_notify<F: Fn(&Self) + 'static>(
428 &self,
429 f: F,
430 ) -> SignalHandlerId;
431
432 fn connect_property_perspective_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
433
434 fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
435
436 fn connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
437
438 fn connect_property_user_resizable_notify<F: Fn(&Self) + 'static>(
439 &self,
440 f: F,
441 ) -> SignalHandlerId;
442}
443
444impl<O: IsA<Stage>> StageExt for O {
445 fn ensure_current(&self) {
446 unsafe {
447 ffi::clutter_stage_ensure_current(self.as_ref().to_glib_none().0);
448 }
449 }
450
451 fn ensure_redraw(&self) {
452 unsafe {
453 ffi::clutter_stage_ensure_redraw(self.as_ref().to_glib_none().0);
454 }
455 }
456
457 fn ensure_viewport(&self) {
458 unsafe {
459 ffi::clutter_stage_ensure_viewport(self.as_ref().to_glib_none().0);
460 }
461 }
462
463 fn event(&self, event: &mut Event) -> bool {
464 unsafe {
465 from_glib(ffi::clutter_stage_event(
466 self.as_ref().to_glib_none().0,
467 event.to_glib_none_mut().0,
468 ))
469 }
470 }
471
472 fn get_accept_focus(&self) -> bool {
473 unsafe {
474 from_glib(ffi::clutter_stage_get_accept_focus(
475 self.as_ref().to_glib_none().0,
476 ))
477 }
478 }
479
480 fn get_actor_at_pos(&self, pick_mode: PickMode, x: i32, y: i32) -> Option<Actor> {
481 unsafe {
482 from_glib_none(ffi::clutter_stage_get_actor_at_pos(
483 self.as_ref().to_glib_none().0,
484 pick_mode.to_glib(),
485 x,
486 y,
487 ))
488 }
489 }
490
491 fn get_fullscreen(&self) -> bool {
492 unsafe {
493 from_glib(ffi::clutter_stage_get_fullscreen(
494 self.as_ref().to_glib_none().0,
495 ))
496 }
497 }
498
499 fn get_key_focus(&self) -> Option<Actor> {
500 unsafe {
501 from_glib_none(ffi::clutter_stage_get_key_focus(
502 self.as_ref().to_glib_none().0,
503 ))
504 }
505 }
506
507 fn get_minimum_size(&self) -> (u32, u32) {
508 unsafe {
509 let mut width = mem::MaybeUninit::uninit();
510 let mut height = mem::MaybeUninit::uninit();
511 ffi::clutter_stage_get_minimum_size(
512 self.as_ref().to_glib_none().0,
513 width.as_mut_ptr(),
514 height.as_mut_ptr(),
515 );
516 let width = width.assume_init();
517 let height = height.assume_init();
518 (width, height)
519 }
520 }
521
522 fn get_motion_events_enabled(&self) -> bool {
523 unsafe {
524 from_glib(ffi::clutter_stage_get_motion_events_enabled(
525 self.as_ref().to_glib_none().0,
526 ))
527 }
528 }
529
530 fn get_no_clear_hint(&self) -> bool {
531 unsafe {
532 from_glib(ffi::clutter_stage_get_no_clear_hint(
533 self.as_ref().to_glib_none().0,
534 ))
535 }
536 }
537
538 fn get_perspective(&self) -> Perspective {
539 unsafe {
540 let mut perspective = Perspective::uninitialized();
541 ffi::clutter_stage_get_perspective(
542 self.as_ref().to_glib_none().0,
543 perspective.to_glib_none_mut().0,
544 );
545 perspective
546 }
547 }
548
549 fn get_redraw_clip_bounds(&self) -> cairo::RectangleInt {
550 unsafe {
551 let mut clip = cairo::RectangleInt::uninitialized();
552 ffi::clutter_stage_get_redraw_clip_bounds(
553 self.as_ref().to_glib_none().0,
554 clip.to_glib_none_mut().0,
555 );
556 clip
557 }
558 }
559
560 fn get_throttle_motion_events(&self) -> bool {
561 unsafe {
562 from_glib(ffi::clutter_stage_get_throttle_motion_events(
563 self.as_ref().to_glib_none().0,
564 ))
565 }
566 }
567
568 fn get_title(&self) -> Option<GString> {
569 unsafe { from_glib_none(ffi::clutter_stage_get_title(self.as_ref().to_glib_none().0)) }
570 }
571
572 fn get_use_alpha(&self) -> bool {
573 unsafe {
574 from_glib(ffi::clutter_stage_get_use_alpha(
575 self.as_ref().to_glib_none().0,
576 ))
577 }
578 }
579
580 fn get_user_resizable(&self) -> bool {
581 unsafe {
582 from_glib(ffi::clutter_stage_get_user_resizable(
583 self.as_ref().to_glib_none().0,
584 ))
585 }
586 }
587
588 fn hide_cursor(&self) {
589 unsafe {
590 ffi::clutter_stage_hide_cursor(self.as_ref().to_glib_none().0);
591 }
592 }
593
594 fn set_accept_focus(&self, accept_focus: bool) {
607 unsafe {
608 ffi::clutter_stage_set_accept_focus(
609 self.as_ref().to_glib_none().0,
610 accept_focus.to_glib(),
611 );
612 }
613 }
614
615 fn set_fullscreen(&self, fullscreen: bool) {
616 unsafe {
617 ffi::clutter_stage_set_fullscreen(self.as_ref().to_glib_none().0, fullscreen.to_glib());
618 }
619 }
620
621 fn set_key_focus<P: IsA<Actor>>(&self, actor: Option<&P>) {
622 unsafe {
623 ffi::clutter_stage_set_key_focus(
624 self.as_ref().to_glib_none().0,
625 actor.map(|p| p.as_ref()).to_glib_none().0,
626 );
627 }
628 }
629
630 fn set_minimum_size(&self, width: u32, height: u32) {
631 unsafe {
632 ffi::clutter_stage_set_minimum_size(self.as_ref().to_glib_none().0, width, height);
633 }
634 }
635
636 fn set_motion_events_enabled(&self, enabled: bool) {
637 unsafe {
638 ffi::clutter_stage_set_motion_events_enabled(
639 self.as_ref().to_glib_none().0,
640 enabled.to_glib(),
641 );
642 }
643 }
644
645 fn set_no_clear_hint(&self, no_clear: bool) {
646 unsafe {
647 ffi::clutter_stage_set_no_clear_hint(
648 self.as_ref().to_glib_none().0,
649 no_clear.to_glib(),
650 );
651 }
652 }
653
654 fn set_perspective(&self, perspective: &mut Perspective) {
655 unsafe {
656 ffi::clutter_stage_set_perspective(
657 self.as_ref().to_glib_none().0,
658 perspective.to_glib_none_mut().0,
659 );
660 }
661 }
662
663 fn set_throttle_motion_events(&self, throttle: bool) {
664 unsafe {
665 ffi::clutter_stage_set_throttle_motion_events(
666 self.as_ref().to_glib_none().0,
667 throttle.to_glib(),
668 );
669 }
670 }
671
672 fn set_title(&self, title: &str) {
673 unsafe {
674 ffi::clutter_stage_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
675 }
676 }
677
678 fn set_use_alpha(&self, use_alpha: bool) {
679 unsafe {
680 ffi::clutter_stage_set_use_alpha(self.as_ref().to_glib_none().0, use_alpha.to_glib());
681 }
682 }
683
684 fn set_user_resizable(&self, resizable: bool) {
685 unsafe {
686 ffi::clutter_stage_set_user_resizable(
687 self.as_ref().to_glib_none().0,
688 resizable.to_glib(),
689 );
690 }
691 }
692
693 fn show_cursor(&self) {
694 unsafe {
695 ffi::clutter_stage_show_cursor(self.as_ref().to_glib_none().0);
696 }
697 }
698
699 fn get_property_cursor_visible(&self) -> bool {
700 unsafe {
701 let mut value = Value::from_type(<bool as StaticType>::static_type());
702 gobject_sys::g_object_get_property(
703 self.to_glib_none().0 as *mut gobject_sys::GObject,
704 b"cursor-visible\0".as_ptr() as *const _,
705 value.to_glib_none_mut().0,
706 );
707 value
708 .get()
709 .expect("Return Value for property `cursor-visible` getter")
710 .unwrap()
711 }
712 }
713
714 fn set_property_cursor_visible(&self, cursor_visible: bool) {
715 unsafe {
716 gobject_sys::g_object_set_property(
717 self.to_glib_none().0 as *mut gobject_sys::GObject,
718 b"cursor-visible\0".as_ptr() as *const _,
719 Value::from(&cursor_visible).to_glib_none().0,
720 );
721 }
722 }
723
724 fn get_property_fullscreen_set(&self) -> bool {
725 unsafe {
726 let mut value = Value::from_type(<bool as StaticType>::static_type());
727 gobject_sys::g_object_get_property(
728 self.to_glib_none().0 as *mut gobject_sys::GObject,
729 b"fullscreen-set\0".as_ptr() as *const _,
730 value.to_glib_none_mut().0,
731 );
732 value
733 .get()
734 .expect("Return Value for property `fullscreen-set` getter")
735 .unwrap()
736 }
737 }
738
739 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
740 unsafe extern "C" fn activate_trampoline<P, F: Fn(&P) + 'static>(
741 this: *mut ffi::ClutterStage,
742 f: glib_sys::gpointer,
743 ) where
744 P: IsA<Stage>,
745 {
746 let f: &F = &*(f as *const F);
747 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
748 }
749 unsafe {
750 let f: Box_<F> = Box_::new(f);
751 connect_raw(
752 self.as_ptr() as *mut _,
753 b"activate\0".as_ptr() as *const _,
754 Some(transmute::<_, unsafe extern "C" fn()>(
755 activate_trampoline::<Self, F> as *const (),
756 )),
757 Box_::into_raw(f),
758 )
759 }
760 }
761
762 fn connect_after_paint<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
763 unsafe extern "C" fn after_paint_trampoline<P, F: Fn(&P) + 'static>(
764 this: *mut ffi::ClutterStage,
765 f: glib_sys::gpointer,
766 ) where
767 P: IsA<Stage>,
768 {
769 let f: &F = &*(f as *const F);
770 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
771 }
772 unsafe {
773 let f: Box_<F> = Box_::new(f);
774 connect_raw(
775 self.as_ptr() as *mut _,
776 b"after-paint\0".as_ptr() as *const _,
777 Some(transmute::<_, unsafe extern "C" fn()>(
778 after_paint_trampoline::<Self, F> as *const (),
779 )),
780 Box_::into_raw(f),
781 )
782 }
783 }
784
785 fn connect_deactivate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
786 unsafe extern "C" fn deactivate_trampoline<P, F: Fn(&P) + 'static>(
787 this: *mut ffi::ClutterStage,
788 f: glib_sys::gpointer,
789 ) where
790 P: IsA<Stage>,
791 {
792 let f: &F = &*(f as *const F);
793 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
794 }
795 unsafe {
796 let f: Box_<F> = Box_::new(f);
797 connect_raw(
798 self.as_ptr() as *mut _,
799 b"deactivate\0".as_ptr() as *const _,
800 Some(transmute::<_, unsafe extern "C" fn()>(
801 deactivate_trampoline::<Self, F> as *const (),
802 )),
803 Box_::into_raw(f),
804 )
805 }
806 }
807
808 fn connect_delete_event<F: Fn(&Self, &Event) -> bool + 'static>(
809 &self,
810 f: F,
811 ) -> SignalHandlerId {
812 unsafe extern "C" fn delete_event_trampoline<P, F: Fn(&P, &Event) -> bool + 'static>(
813 this: *mut ffi::ClutterStage,
814 event: *mut ffi::ClutterEvent,
815 f: glib_sys::gpointer,
816 ) -> glib_sys::gboolean
817 where
818 P: IsA<Stage>,
819 {
820 let f: &F = &*(f as *const F);
821 f(
822 &Stage::from_glib_borrow(this).unsafe_cast_ref(),
823 &from_glib_none(event),
824 )
825 .to_glib()
826 }
827 unsafe {
828 let f: Box_<F> = Box_::new(f);
829 connect_raw(
830 self.as_ptr() as *mut _,
831 b"delete-event\0".as_ptr() as *const _,
832 Some(transmute::<_, unsafe extern "C" fn()>(
833 delete_event_trampoline::<Self, F> as *const (),
834 )),
835 Box_::into_raw(f),
836 )
837 }
838 }
839
840 fn connect_fullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
841 unsafe extern "C" fn fullscreen_trampoline<P, F: Fn(&P) + 'static>(
842 this: *mut ffi::ClutterStage,
843 f: glib_sys::gpointer,
844 ) where
845 P: IsA<Stage>,
846 {
847 let f: &F = &*(f as *const F);
848 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
849 }
850 unsafe {
851 let f: Box_<F> = Box_::new(f);
852 connect_raw(
853 self.as_ptr() as *mut _,
854 b"fullscreen\0".as_ptr() as *const _,
855 Some(transmute::<_, unsafe extern "C" fn()>(
856 fullscreen_trampoline::<Self, F> as *const (),
857 )),
858 Box_::into_raw(f),
859 )
860 }
861 }
862
863 fn connect_unfullscreen<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
864 unsafe extern "C" fn unfullscreen_trampoline<P, F: Fn(&P) + 'static>(
865 this: *mut ffi::ClutterStage,
866 f: glib_sys::gpointer,
867 ) where
868 P: IsA<Stage>,
869 {
870 let f: &F = &*(f as *const F);
871 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
872 }
873 unsafe {
874 let f: Box_<F> = Box_::new(f);
875 connect_raw(
876 self.as_ptr() as *mut _,
877 b"unfullscreen\0".as_ptr() as *const _,
878 Some(transmute::<_, unsafe extern "C" fn()>(
879 unfullscreen_trampoline::<Self, F> as *const (),
880 )),
881 Box_::into_raw(f),
882 )
883 }
884 }
885
886 fn connect_property_accept_focus_notify<F: Fn(&Self) + 'static>(
887 &self,
888 f: F,
889 ) -> SignalHandlerId {
890 unsafe extern "C" fn notify_accept_focus_trampoline<P, F: Fn(&P) + 'static>(
891 this: *mut ffi::ClutterStage,
892 _param_spec: glib_sys::gpointer,
893 f: glib_sys::gpointer,
894 ) where
895 P: IsA<Stage>,
896 {
897 let f: &F = &*(f as *const F);
898 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
899 }
900 unsafe {
901 let f: Box_<F> = Box_::new(f);
902 connect_raw(
903 self.as_ptr() as *mut _,
904 b"notify::accept-focus\0".as_ptr() as *const _,
905 Some(transmute::<_, unsafe extern "C" fn()>(
906 notify_accept_focus_trampoline::<Self, F> as *const (),
907 )),
908 Box_::into_raw(f),
909 )
910 }
911 }
912
913 fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>(
914 &self,
915 f: F,
916 ) -> SignalHandlerId {
917 unsafe extern "C" fn notify_cursor_visible_trampoline<P, F: Fn(&P) + 'static>(
918 this: *mut ffi::ClutterStage,
919 _param_spec: glib_sys::gpointer,
920 f: glib_sys::gpointer,
921 ) where
922 P: IsA<Stage>,
923 {
924 let f: &F = &*(f as *const F);
925 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
926 }
927 unsafe {
928 let f: Box_<F> = Box_::new(f);
929 connect_raw(
930 self.as_ptr() as *mut _,
931 b"notify::cursor-visible\0".as_ptr() as *const _,
932 Some(transmute::<_, unsafe extern "C" fn()>(
933 notify_cursor_visible_trampoline::<Self, F> as *const (),
934 )),
935 Box_::into_raw(f),
936 )
937 }
938 }
939
940 fn connect_property_fullscreen_set_notify<F: Fn(&Self) + 'static>(
941 &self,
942 f: F,
943 ) -> SignalHandlerId {
944 unsafe extern "C" fn notify_fullscreen_set_trampoline<P, F: Fn(&P) + 'static>(
945 this: *mut ffi::ClutterStage,
946 _param_spec: glib_sys::gpointer,
947 f: glib_sys::gpointer,
948 ) where
949 P: IsA<Stage>,
950 {
951 let f: &F = &*(f as *const F);
952 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
953 }
954 unsafe {
955 let f: Box_<F> = Box_::new(f);
956 connect_raw(
957 self.as_ptr() as *mut _,
958 b"notify::fullscreen-set\0".as_ptr() as *const _,
959 Some(transmute::<_, unsafe extern "C" fn()>(
960 notify_fullscreen_set_trampoline::<Self, F> as *const (),
961 )),
962 Box_::into_raw(f),
963 )
964 }
965 }
966
967 fn connect_property_key_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
968 unsafe extern "C" fn notify_key_focus_trampoline<P, F: Fn(&P) + 'static>(
969 this: *mut ffi::ClutterStage,
970 _param_spec: glib_sys::gpointer,
971 f: glib_sys::gpointer,
972 ) where
973 P: IsA<Stage>,
974 {
975 let f: &F = &*(f as *const F);
976 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
977 }
978 unsafe {
979 let f: Box_<F> = Box_::new(f);
980 connect_raw(
981 self.as_ptr() as *mut _,
982 b"notify::key-focus\0".as_ptr() as *const _,
983 Some(transmute::<_, unsafe extern "C" fn()>(
984 notify_key_focus_trampoline::<Self, F> as *const (),
985 )),
986 Box_::into_raw(f),
987 )
988 }
989 }
990
991 fn connect_property_no_clear_hint_notify<F: Fn(&Self) + 'static>(
992 &self,
993 f: F,
994 ) -> SignalHandlerId {
995 unsafe extern "C" fn notify_no_clear_hint_trampoline<P, F: Fn(&P) + 'static>(
996 this: *mut ffi::ClutterStage,
997 _param_spec: glib_sys::gpointer,
998 f: glib_sys::gpointer,
999 ) where
1000 P: IsA<Stage>,
1001 {
1002 let f: &F = &*(f as *const F);
1003 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1004 }
1005 unsafe {
1006 let f: Box_<F> = Box_::new(f);
1007 connect_raw(
1008 self.as_ptr() as *mut _,
1009 b"notify::no-clear-hint\0".as_ptr() as *const _,
1010 Some(transmute::<_, unsafe extern "C" fn()>(
1011 notify_no_clear_hint_trampoline::<Self, F> as *const (),
1012 )),
1013 Box_::into_raw(f),
1014 )
1015 }
1016 }
1017
1018 fn connect_property_perspective_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1019 unsafe extern "C" fn notify_perspective_trampoline<P, F: Fn(&P) + 'static>(
1020 this: *mut ffi::ClutterStage,
1021 _param_spec: glib_sys::gpointer,
1022 f: glib_sys::gpointer,
1023 ) where
1024 P: IsA<Stage>,
1025 {
1026 let f: &F = &*(f as *const F);
1027 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1028 }
1029 unsafe {
1030 let f: Box_<F> = Box_::new(f);
1031 connect_raw(
1032 self.as_ptr() as *mut _,
1033 b"notify::perspective\0".as_ptr() as *const _,
1034 Some(transmute::<_, unsafe extern "C" fn()>(
1035 notify_perspective_trampoline::<Self, F> as *const (),
1036 )),
1037 Box_::into_raw(f),
1038 )
1039 }
1040 }
1041
1042 fn connect_property_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1043 unsafe extern "C" fn notify_title_trampoline<P, F: Fn(&P) + 'static>(
1044 this: *mut ffi::ClutterStage,
1045 _param_spec: glib_sys::gpointer,
1046 f: glib_sys::gpointer,
1047 ) where
1048 P: IsA<Stage>,
1049 {
1050 let f: &F = &*(f as *const F);
1051 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1052 }
1053 unsafe {
1054 let f: Box_<F> = Box_::new(f);
1055 connect_raw(
1056 self.as_ptr() as *mut _,
1057 b"notify::title\0".as_ptr() as *const _,
1058 Some(transmute::<_, unsafe extern "C" fn()>(
1059 notify_title_trampoline::<Self, F> as *const (),
1060 )),
1061 Box_::into_raw(f),
1062 )
1063 }
1064 }
1065
1066 fn connect_property_use_alpha_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1067 unsafe extern "C" fn notify_use_alpha_trampoline<P, F: Fn(&P) + 'static>(
1068 this: *mut ffi::ClutterStage,
1069 _param_spec: glib_sys::gpointer,
1070 f: glib_sys::gpointer,
1071 ) where
1072 P: IsA<Stage>,
1073 {
1074 let f: &F = &*(f as *const F);
1075 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1076 }
1077 unsafe {
1078 let f: Box_<F> = Box_::new(f);
1079 connect_raw(
1080 self.as_ptr() as *mut _,
1081 b"notify::use-alpha\0".as_ptr() as *const _,
1082 Some(transmute::<_, unsafe extern "C" fn()>(
1083 notify_use_alpha_trampoline::<Self, F> as *const (),
1084 )),
1085 Box_::into_raw(f),
1086 )
1087 }
1088 }
1089
1090 fn connect_property_user_resizable_notify<F: Fn(&Self) + 'static>(
1091 &self,
1092 f: F,
1093 ) -> SignalHandlerId {
1094 unsafe extern "C" fn notify_user_resizable_trampoline<P, F: Fn(&P) + 'static>(
1095 this: *mut ffi::ClutterStage,
1096 _param_spec: glib_sys::gpointer,
1097 f: glib_sys::gpointer,
1098 ) where
1099 P: IsA<Stage>,
1100 {
1101 let f: &F = &*(f as *const F);
1102 f(&Stage::from_glib_borrow(this).unsafe_cast_ref())
1103 }
1104 unsafe {
1105 let f: Box_<F> = Box_::new(f);
1106 connect_raw(
1107 self.as_ptr() as *mut _,
1108 b"notify::user-resizable\0".as_ptr() as *const _,
1109 Some(transmute::<_, unsafe extern "C" fn()>(
1110 notify_user_resizable_trampoline::<Self, F> as *const (),
1111 )),
1112 Box_::into_raw(f),
1113 )
1114 }
1115 }
1116}
1117
1118impl fmt::Display for Stage {
1119 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1120 write!(f, "Stage")
1121 }
1122}