spice_client_glib/auto/
inputs_channel.rs1use crate::{ffi, Channel};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "SpiceInputsChannel")]
17 pub struct InputsChannel(Object<ffi::SpiceInputsChannel, ffi::SpiceInputsChannelClass>) @extends Channel;
18
19 match fn {
20 type_ => || ffi::spice_inputs_channel_get_type(),
21 }
22}
23
24impl InputsChannel {
25 #[doc(alias = "spice_inputs_channel_button_press")]
26 pub fn button_press(&self, button: i32, button_state: i32) {
27 unsafe {
28 ffi::spice_inputs_channel_button_press(self.to_glib_none().0, button, button_state);
29 }
30 }
31
32 #[doc(alias = "spice_inputs_channel_button_release")]
33 pub fn button_release(&self, button: i32, button_state: i32) {
34 unsafe {
35 ffi::spice_inputs_channel_button_release(self.to_glib_none().0, button, button_state);
36 }
37 }
38
39 #[doc(alias = "spice_inputs_channel_key_press")]
40 pub fn key_press(&self, scancode: u32) {
41 unsafe {
42 ffi::spice_inputs_channel_key_press(self.to_glib_none().0, scancode);
43 }
44 }
45
46 #[doc(alias = "spice_inputs_channel_key_press_and_release")]
47 pub fn key_press_and_release(&self, scancode: u32) {
48 unsafe {
49 ffi::spice_inputs_channel_key_press_and_release(self.to_glib_none().0, scancode);
50 }
51 }
52
53 #[doc(alias = "spice_inputs_channel_key_release")]
54 pub fn key_release(&self, scancode: u32) {
55 unsafe {
56 ffi::spice_inputs_channel_key_release(self.to_glib_none().0, scancode);
57 }
58 }
59
60 #[doc(alias = "spice_inputs_channel_motion")]
61 pub fn motion(&self, dx: i32, dy: i32, button_state: i32) {
62 unsafe {
63 ffi::spice_inputs_channel_motion(self.to_glib_none().0, dx, dy, button_state);
64 }
65 }
66
67 #[doc(alias = "spice_inputs_channel_position")]
68 pub fn position(&self, x: i32, y: i32, display: i32, button_state: i32) {
69 unsafe {
70 ffi::spice_inputs_channel_position(self.to_glib_none().0, x, y, display, button_state);
71 }
72 }
73
74 #[doc(alias = "spice_inputs_channel_set_key_locks")]
75 pub fn set_key_locks(&self, locks: u32) {
76 unsafe {
77 ffi::spice_inputs_channel_set_key_locks(self.to_glib_none().0, locks);
78 }
79 }
80
81 #[doc(alias = "key-modifiers")]
82 pub fn key_modifiers(&self) -> i32 {
83 ObjectExt::property(self, "key-modifiers")
84 }
85
86 #[doc(alias = "inputs-modifiers")]
87 pub fn connect_inputs_modifiers<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
88 unsafe extern "C" fn inputs_modifiers_trampoline<F: Fn(&InputsChannel) + 'static>(
89 this: *mut ffi::SpiceInputsChannel,
90 f: glib::ffi::gpointer,
91 ) {
92 unsafe {
93 let f: &F = &*(f as *const F);
94 f(&from_glib_borrow(this))
95 }
96 }
97 unsafe {
98 let f: Box_<F> = Box_::new(f);
99 connect_raw(
100 self.as_ptr() as *mut _,
101 c"inputs-modifiers".as_ptr(),
102 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
103 inputs_modifiers_trampoline::<F> as *const (),
104 )),
105 Box_::into_raw(f),
106 )
107 }
108 }
109
110 #[doc(alias = "key-modifiers")]
111 pub fn connect_key_modifiers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
112 unsafe extern "C" fn notify_key_modifiers_trampoline<F: Fn(&InputsChannel) + 'static>(
113 this: *mut ffi::SpiceInputsChannel,
114 _param_spec: glib::ffi::gpointer,
115 f: glib::ffi::gpointer,
116 ) {
117 unsafe {
118 let f: &F = &*(f as *const F);
119 f(&from_glib_borrow(this))
120 }
121 }
122 unsafe {
123 let f: Box_<F> = Box_::new(f);
124 connect_raw(
125 self.as_ptr() as *mut _,
126 c"notify::key-modifiers".as_ptr(),
127 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
128 notify_key_modifiers_trampoline::<F> as *const (),
129 )),
130 Box_::into_raw(f),
131 )
132 }
133 }
134}