Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit b17cc04

Browse files
Merge pull request #694 from GuillaumeGomez/more-types
More types
2 parents 6296d56 + 6c95318 commit b17cc04

File tree

6 files changed

+180
-92
lines changed

6 files changed

+180
-92
lines changed

Gir.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ ignore = [
235235

236236
manual = [
237237
"cairo.Context",
238+
"cairo.FontOptions",
238239
"cairo.RectangleInt",
239240
"cairo.Region",
240241
"cairo.Surface",
@@ -259,6 +260,7 @@ manual = [
259260
"Gdk.EventProximity",
260261
"Gdk.EventScroll",
261262
"Gdk.EventSelection",
263+
"Gdk.EventSequence",
262264
"Gdk.EventVisibility",
263265
"Gdk.EventWindowState",
264266
"Gdk.FrameClock",

src/auto/gesture.rs

Lines changed: 148 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use EventSequenceState;
88
use ffi;
99
#[cfg(any(feature = "v3_14", feature = "dox"))]
1010
use gdk;
11+
#[cfg(any(feature = "v3_14", feature = "dox"))]
12+
use gdk_ffi;
1113
use glib;
1214
#[cfg(any(feature = "v3_14", feature = "dox"))]
1315
use glib::StaticType;
@@ -51,29 +53,29 @@ pub trait GestureExt {
5153
#[cfg(any(feature = "v3_14", feature = "dox"))]
5254
fn get_group(&self) -> Vec<Gesture>;
5355

54-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
55-
//fn get_last_event(&self, sequence: /*Ignored*/&gdk::EventSequence) -> Option<gdk::Event>;
56+
#[cfg(any(feature = "v3_14", feature = "dox"))]
57+
fn get_last_event(&self, sequence: &gdk::EventSequence) -> Option<gdk::Event>;
5658

57-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
58-
//fn get_last_updated_sequence(&self) -> /*Ignored*/Option<gdk::EventSequence>;
59+
#[cfg(any(feature = "v3_14", feature = "dox"))]
60+
fn get_last_updated_sequence(&self) -> Option<gdk::EventSequence>;
5961

60-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
61-
//fn get_point<'a, P: Into<Option<&'a /*Ignored*/gdk::EventSequence>>>(&self, sequence: P) -> Option<(f64, f64)>;
62+
#[cfg(any(feature = "v3_14", feature = "dox"))]
63+
fn get_point<'a, P: Into<Option<&'a gdk::EventSequence>>>(&self, sequence: P) -> Option<(f64, f64)>;
6264

63-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
64-
//fn get_sequence_state(&self, sequence: /*Ignored*/&gdk::EventSequence) -> EventSequenceState;
65+
#[cfg(any(feature = "v3_14", feature = "dox"))]
66+
fn get_sequence_state(&self, sequence: &gdk::EventSequence) -> EventSequenceState;
6567

66-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
67-
//fn get_sequences(&self) -> /*Ignored*/Vec<gdk::EventSequence>;
68+
#[cfg(any(feature = "v3_14", feature = "dox"))]
69+
fn get_sequences(&self) -> Vec<gdk::EventSequence>;
6870

6971
#[cfg(any(feature = "v3_14", feature = "dox"))]
7072
fn get_window(&self) -> Option<gdk::Window>;
7173

7274
#[cfg(any(feature = "v3_14", feature = "dox"))]
7375
fn group<P: IsA<Gesture>>(&self, gesture: &P);
7476

75-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
76-
//fn handles_sequence<'a, P: Into<Option<&'a /*Ignored*/gdk::EventSequence>>>(&self, sequence: P) -> bool;
77+
#[cfg(any(feature = "v3_14", feature = "dox"))]
78+
fn handles_sequence<'a, P: Into<Option<&'a gdk::EventSequence>>>(&self, sequence: P) -> bool;
7779

7880
#[cfg(any(feature = "v3_14", feature = "dox"))]
7981
fn is_active(&self) -> bool;
@@ -84,8 +86,8 @@ pub trait GestureExt {
8486
#[cfg(any(feature = "v3_14", feature = "dox"))]
8587
fn is_recognized(&self) -> bool;
8688

87-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
88-
//fn set_sequence_state(&self, sequence: /*Ignored*/&gdk::EventSequence, state: EventSequenceState) -> bool;
89+
#[cfg(any(feature = "v3_14", feature = "dox"))]
90+
fn set_sequence_state(&self, sequence: &gdk::EventSequence, state: EventSequenceState) -> bool;
8991

9092
#[cfg(any(feature = "v3_14", feature = "dox"))]
9193
fn set_state(&self, state: EventSequenceState) -> bool;
@@ -99,20 +101,20 @@ pub trait GestureExt {
99101
#[cfg(any(feature = "v3_14", feature = "dox"))]
100102
fn get_property_n_points(&self) -> u32;
101103

102-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
103-
//fn connect_begin<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
104+
#[cfg(any(feature = "v3_14", feature = "dox"))]
105+
fn connect_begin<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId;
104106

105-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
106-
//fn connect_cancel<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
107+
#[cfg(any(feature = "v3_14", feature = "dox"))]
108+
fn connect_cancel<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId;
107109

108-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
109-
//fn connect_end<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
110+
#[cfg(any(feature = "v3_14", feature = "dox"))]
111+
fn connect_end<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId;
110112

111-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
112-
//fn connect_sequence_state_changed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
113+
#[cfg(any(feature = "v3_14", feature = "dox"))]
114+
fn connect_sequence_state_changed<F: Fn(&Self, &gdk::EventSequence, EventSequenceState) + 'static>(&self, f: F) -> SignalHandlerId;
113115

114-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
115-
//fn connect_update<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
116+
#[cfg(any(feature = "v3_14", feature = "dox"))]
117+
fn connect_update<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId;
116118

117119
#[cfg(any(feature = "v3_14", feature = "dox"))]
118120
fn connect_property_n_points_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
@@ -155,30 +157,44 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
155157
}
156158
}
157159

158-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
159-
//fn get_last_event(&self, sequence: /*Ignored*/&gdk::EventSequence) -> Option<gdk::Event> {
160-
// unsafe { TODO: call ffi::gtk_gesture_get_last_event() }
161-
//}
160+
#[cfg(any(feature = "v3_14", feature = "dox"))]
161+
fn get_last_event(&self, sequence: &gdk::EventSequence) -> Option<gdk::Event> {
162+
unsafe {
163+
from_glib_none(ffi::gtk_gesture_get_last_event(self.to_glib_none().0, mut_override(sequence.to_glib_none().0)))
164+
}
165+
}
162166

163-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
164-
//fn get_last_updated_sequence(&self) -> /*Ignored*/Option<gdk::EventSequence> {
165-
// unsafe { TODO: call ffi::gtk_gesture_get_last_updated_sequence() }
166-
//}
167+
#[cfg(any(feature = "v3_14", feature = "dox"))]
168+
fn get_last_updated_sequence(&self) -> Option<gdk::EventSequence> {
169+
unsafe {
170+
from_glib_none(ffi::gtk_gesture_get_last_updated_sequence(self.to_glib_none().0))
171+
}
172+
}
167173

168-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
169-
//fn get_point<'a, P: Into<Option<&'a /*Ignored*/gdk::EventSequence>>>(&self, sequence: P) -> Option<(f64, f64)> {
170-
// unsafe { TODO: call ffi::gtk_gesture_get_point() }
171-
//}
174+
#[cfg(any(feature = "v3_14", feature = "dox"))]
175+
fn get_point<'a, P: Into<Option<&'a gdk::EventSequence>>>(&self, sequence: P) -> Option<(f64, f64)> {
176+
let sequence = sequence.into();
177+
unsafe {
178+
let mut x = mem::uninitialized();
179+
let mut y = mem::uninitialized();
180+
let ret = from_glib(ffi::gtk_gesture_get_point(self.to_glib_none().0, mut_override(sequence.to_glib_none().0), &mut x, &mut y));
181+
if ret { Some((x, y)) } else { None }
182+
}
183+
}
172184

173-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
174-
//fn get_sequence_state(&self, sequence: /*Ignored*/&gdk::EventSequence) -> EventSequenceState {
175-
// unsafe { TODO: call ffi::gtk_gesture_get_sequence_state() }
176-
//}
185+
#[cfg(any(feature = "v3_14", feature = "dox"))]
186+
fn get_sequence_state(&self, sequence: &gdk::EventSequence) -> EventSequenceState {
187+
unsafe {
188+
from_glib(ffi::gtk_gesture_get_sequence_state(self.to_glib_none().0, mut_override(sequence.to_glib_none().0)))
189+
}
190+
}
177191

178-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
179-
//fn get_sequences(&self) -> /*Ignored*/Vec<gdk::EventSequence> {
180-
// unsafe { TODO: call ffi::gtk_gesture_get_sequences() }
181-
//}
192+
#[cfg(any(feature = "v3_14", feature = "dox"))]
193+
fn get_sequences(&self) -> Vec<gdk::EventSequence> {
194+
unsafe {
195+
FromGlibPtrContainer::from_glib_container(ffi::gtk_gesture_get_sequences(self.to_glib_none().0))
196+
}
197+
}
182198

183199
#[cfg(any(feature = "v3_14", feature = "dox"))]
184200
fn get_window(&self) -> Option<gdk::Window> {
@@ -194,10 +210,13 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
194210
}
195211
}
196212

197-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
198-
//fn handles_sequence<'a, P: Into<Option<&'a /*Ignored*/gdk::EventSequence>>>(&self, sequence: P) -> bool {
199-
// unsafe { TODO: call ffi::gtk_gesture_handles_sequence() }
200-
//}
213+
#[cfg(any(feature = "v3_14", feature = "dox"))]
214+
fn handles_sequence<'a, P: Into<Option<&'a gdk::EventSequence>>>(&self, sequence: P) -> bool {
215+
let sequence = sequence.into();
216+
unsafe {
217+
from_glib(ffi::gtk_gesture_handles_sequence(self.to_glib_none().0, mut_override(sequence.to_glib_none().0)))
218+
}
219+
}
201220

202221
#[cfg(any(feature = "v3_14", feature = "dox"))]
203222
fn is_active(&self) -> bool {
@@ -220,10 +239,12 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
220239
}
221240
}
222241

223-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
224-
//fn set_sequence_state(&self, sequence: /*Ignored*/&gdk::EventSequence, state: EventSequenceState) -> bool {
225-
// unsafe { TODO: call ffi::gtk_gesture_set_sequence_state() }
226-
//}
242+
#[cfg(any(feature = "v3_14", feature = "dox"))]
243+
fn set_sequence_state(&self, sequence: &gdk::EventSequence, state: EventSequenceState) -> bool {
244+
unsafe {
245+
from_glib(ffi::gtk_gesture_set_sequence_state(self.to_glib_none().0, mut_override(sequence.to_glib_none().0), state.to_glib()))
246+
}
247+
}
227248

228249
#[cfg(any(feature = "v3_14", feature = "dox"))]
229250
fn set_state(&self, state: EventSequenceState) -> bool {
@@ -257,30 +278,50 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
257278
}
258279
}
259280

260-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
261-
//fn connect_begin<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
262-
// Ignored sequence: Gdk.EventSequence
263-
//}
281+
#[cfg(any(feature = "v3_14", feature = "dox"))]
282+
fn connect_begin<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId {
283+
unsafe {
284+
let f: Box_<Box_<Fn(&Self, &gdk::EventSequence) + 'static>> = Box_::new(Box_::new(f));
285+
connect(self.to_glib_none().0, "begin",
286+
transmute(begin_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
287+
}
288+
}
264289

265-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
266-
//fn connect_cancel<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
267-
// Ignored sequence: Gdk.EventSequence
268-
//}
290+
#[cfg(any(feature = "v3_14", feature = "dox"))]
291+
fn connect_cancel<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId {
292+
unsafe {
293+
let f: Box_<Box_<Fn(&Self, &gdk::EventSequence) + 'static>> = Box_::new(Box_::new(f));
294+
connect(self.to_glib_none().0, "cancel",
295+
transmute(cancel_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
296+
}
297+
}
269298

270-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
271-
//fn connect_end<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
272-
// Ignored sequence: Gdk.EventSequence
273-
//}
299+
#[cfg(any(feature = "v3_14", feature = "dox"))]
300+
fn connect_end<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId {
301+
unsafe {
302+
let f: Box_<Box_<Fn(&Self, &gdk::EventSequence) + 'static>> = Box_::new(Box_::new(f));
303+
connect(self.to_glib_none().0, "end",
304+
transmute(end_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
305+
}
306+
}
274307

275-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
276-
//fn connect_sequence_state_changed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
277-
// Ignored sequence: Gdk.EventSequence
278-
//}
308+
#[cfg(any(feature = "v3_14", feature = "dox"))]
309+
fn connect_sequence_state_changed<F: Fn(&Self, &gdk::EventSequence, EventSequenceState) + 'static>(&self, f: F) -> SignalHandlerId {
310+
unsafe {
311+
let f: Box_<Box_<Fn(&Self, &gdk::EventSequence, EventSequenceState) + 'static>> = Box_::new(Box_::new(f));
312+
connect(self.to_glib_none().0, "sequence-state-changed",
313+
transmute(sequence_state_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
314+
}
315+
}
279316

280-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
281-
//fn connect_update<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
282-
// Ignored sequence: Gdk.EventSequence
283-
//}
317+
#[cfg(any(feature = "v3_14", feature = "dox"))]
318+
fn connect_update<F: Fn(&Self, &gdk::EventSequence) + 'static>(&self, f: F) -> SignalHandlerId {
319+
unsafe {
320+
let f: Box_<Box_<Fn(&Self, &gdk::EventSequence) + 'static>> = Box_::new(Box_::new(f));
321+
connect(self.to_glib_none().0, "update",
322+
transmute(update_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
323+
}
324+
}
284325

285326
#[cfg(any(feature = "v3_14", feature = "dox"))]
286327
fn connect_property_n_points_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
@@ -301,6 +342,41 @@ impl<O: IsA<Gesture> + IsA<glib::object::Object>> GestureExt for O {
301342
}
302343
}
303344

345+
#[cfg(any(feature = "v3_14", feature = "dox"))]
346+
unsafe extern "C" fn begin_trampoline<P>(this: *mut ffi::GtkGesture, sequence: *mut gdk_ffi::GdkEventSequence, f: glib_ffi::gpointer)
347+
where P: IsA<Gesture> {
348+
let f: &&(Fn(&P, &gdk::EventSequence) + 'static) = transmute(f);
349+
f(&Gesture::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(sequence))
350+
}
351+
352+
#[cfg(any(feature = "v3_14", feature = "dox"))]
353+
unsafe extern "C" fn cancel_trampoline<P>(this: *mut ffi::GtkGesture, sequence: *mut gdk_ffi::GdkEventSequence, f: glib_ffi::gpointer)
354+
where P: IsA<Gesture> {
355+
let f: &&(Fn(&P, &gdk::EventSequence) + 'static) = transmute(f);
356+
f(&Gesture::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(sequence))
357+
}
358+
359+
#[cfg(any(feature = "v3_14", feature = "dox"))]
360+
unsafe extern "C" fn end_trampoline<P>(this: *mut ffi::GtkGesture, sequence: *mut gdk_ffi::GdkEventSequence, f: glib_ffi::gpointer)
361+
where P: IsA<Gesture> {
362+
let f: &&(Fn(&P, &gdk::EventSequence) + 'static) = transmute(f);
363+
f(&Gesture::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(sequence))
364+
}
365+
366+
#[cfg(any(feature = "v3_14", feature = "dox"))]
367+
unsafe extern "C" fn sequence_state_changed_trampoline<P>(this: *mut ffi::GtkGesture, sequence: *mut gdk_ffi::GdkEventSequence, state: ffi::GtkEventSequenceState, f: glib_ffi::gpointer)
368+
where P: IsA<Gesture> {
369+
let f: &&(Fn(&P, &gdk::EventSequence, EventSequenceState) + 'static) = transmute(f);
370+
f(&Gesture::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(sequence), from_glib(state))
371+
}
372+
373+
#[cfg(any(feature = "v3_14", feature = "dox"))]
374+
unsafe extern "C" fn update_trampoline<P>(this: *mut ffi::GtkGesture, sequence: *mut gdk_ffi::GdkEventSequence, f: glib_ffi::gpointer)
375+
where P: IsA<Gesture> {
376+
let f: &&(Fn(&P, &gdk::EventSequence) + 'static) = transmute(f);
377+
f(&Gesture::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(sequence))
378+
}
379+
304380
#[cfg(any(feature = "v3_14", feature = "dox"))]
305381
unsafe extern "C" fn notify_n_points_trampoline<P>(this: *mut ffi::GtkGesture, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
306382
where P: IsA<Gesture> {

src/auto/gesture_single.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use EventController;
66
use Gesture;
77
use ffi;
8+
#[cfg(any(feature = "v3_14", feature = "dox"))]
9+
use gdk;
810
use glib;
911
#[cfg(any(feature = "v3_14", feature = "dox"))]
1012
use glib::object::Downcast;
@@ -38,8 +40,8 @@ pub trait GestureSingleExt {
3840
#[cfg(any(feature = "v3_14", feature = "dox"))]
3941
fn get_current_button(&self) -> u32;
4042

41-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
42-
//fn get_current_sequence(&self) -> /*Ignored*/Option<gdk::EventSequence>;
43+
#[cfg(any(feature = "v3_14", feature = "dox"))]
44+
fn get_current_sequence(&self) -> Option<gdk::EventSequence>;
4345

4446
#[cfg(any(feature = "v3_14", feature = "dox"))]
4547
fn get_exclusive(&self) -> bool;
@@ -81,10 +83,12 @@ impl<O: IsA<GestureSingle> + IsA<glib::object::Object>> GestureSingleExt for O {
8183
}
8284
}
8385

84-
//#[cfg(any(feature = "v3_14", feature = "dox"))]
85-
//fn get_current_sequence(&self) -> /*Ignored*/Option<gdk::EventSequence> {
86-
// unsafe { TODO: call ffi::gtk_gesture_single_get_current_sequence() }
87-
//}
86+
#[cfg(any(feature = "v3_14", feature = "dox"))]
87+
fn get_current_sequence(&self) -> Option<gdk::EventSequence> {
88+
unsafe {
89+
from_glib_full(ffi::gtk_gesture_single_get_current_sequence(self.to_glib_none().0))
90+
}
91+
}
8892

8993
#[cfg(any(feature = "v3_14", feature = "dox"))]
9094
fn get_exclusive(&self) -> bool {

src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 04c26a8)
1+
Generated by gir (https://github.com/gtk-rs/gir @ d3116ca)
22
from gir-files (https://github.com/gtk-rs/gir-files @ b8f5ef1)

0 commit comments

Comments
 (0)