1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use crate::NavigationCommand;
use glib::object::IsA;
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstNavigation")]
pub struct Navigation(Interface<ffi::GstNavigation, ffi::GstNavigationInterface>);
match fn {
type_ => || ffi::gst_navigation_get_type(),
}
}
impl Navigation {
pub const NONE: Option<&'static Navigation> = None;
}
unsafe impl Send for Navigation {}
unsafe impl Sync for Navigation {}
pub trait NavigationExt: 'static {
#[doc(alias = "gst_navigation_send_command")]
fn send_command(&self, command: NavigationCommand);
#[doc(alias = "gst_navigation_send_key_event")]
fn send_key_event(&self, event: &str, key: &str);
#[doc(alias = "gst_navigation_send_mouse_event")]
fn send_mouse_event(&self, event: &str, button: i32, x: f64, y: f64);
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_navigation_send_mouse_scroll_event")]
fn send_mouse_scroll_event(&self, x: f64, y: f64, delta_x: f64, delta_y: f64);
}
impl<O: IsA<Navigation>> NavigationExt for O {
fn send_command(&self, command: NavigationCommand) {
unsafe {
ffi::gst_navigation_send_command(self.as_ref().to_glib_none().0, command.into_glib());
}
}
fn send_key_event(&self, event: &str, key: &str) {
unsafe {
ffi::gst_navigation_send_key_event(
self.as_ref().to_glib_none().0,
event.to_glib_none().0,
key.to_glib_none().0,
);
}
}
fn send_mouse_event(&self, event: &str, button: i32, x: f64, y: f64) {
unsafe {
ffi::gst_navigation_send_mouse_event(
self.as_ref().to_glib_none().0,
event.to_glib_none().0,
button,
x,
y,
);
}
}
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
fn send_mouse_scroll_event(&self, x: f64, y: f64, delta_x: f64, delta_y: f64) {
unsafe {
ffi::gst_navigation_send_mouse_scroll_event(
self.as_ref().to_glib_none().0,
x,
y,
delta_x,
delta_y,
);
}
}
}