1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use cairo;
6 use cairo_sys;
7 use gdk_pixbuf;
8 use gdk_sys;
9 use glib::object::Cast;
10 use glib::object::IsA;
11 use glib::signal::connect_raw;
12 use glib::signal::SignalHandlerId;
13 use glib::translate::*;
14 use glib_sys;
15 use libc;
16 use std::boxed::Box as Box_;
17 use std::fmt;
18 use std::mem;
19 use std::mem::transmute;
20 use std::ptr;
21 #[cfg(any(feature = "v3_24", feature = "dox"))]
22 use AnchorHints;
23 use Cursor;
24 use Device;
25 use Display;
26 use DragProtocol;
27 #[cfg(any(feature = "v3_22", feature = "dox"))]
28 use DrawingContext;
29 #[cfg(any(feature = "v3_16", feature = "dox"))]
30 use Error;
31 use Event;
32 use EventMask;
33 use FrameClock;
34 use FullscreenMode;
35 #[cfg(any(feature = "v3_16", feature = "dox"))]
36 use GLContext;
37 use Geometry;
38 #[cfg(any(feature = "v3_24", feature = "dox"))]
39 use Gravity;
40 use InputSource;
41 use ModifierType;
42 use Rectangle;
43 use Screen;
44 use Visual;
45 use WMDecoration;
46 use WMFunction;
47 use WindowEdge;
48 use WindowHints;
49 use WindowState;
50 use WindowType;
51 use WindowTypeHint;
52 use RGBA;
53 
54 glib_wrapper! {
55     pub struct Window(Object<gdk_sys::GdkWindow, gdk_sys::GdkWindowClass, WindowClass>);
56 
57     match fn {
58         get_type => || gdk_sys::gdk_window_get_type(),
59     }
60 }
61 
62 impl Window {
constrain_size( geometry: &mut Geometry, flags: WindowHints, width: i32, height: i32, ) -> (i32, i32)63     pub fn constrain_size(
64         geometry: &mut Geometry,
65         flags: WindowHints,
66         width: i32,
67         height: i32,
68     ) -> (i32, i32) {
69         assert_initialized_main_thread!();
70         unsafe {
71             let mut new_width = mem::uninitialized();
72             let mut new_height = mem::uninitialized();
73             gdk_sys::gdk_window_constrain_size(
74                 geometry.to_glib_none_mut().0,
75                 flags.to_glib(),
76                 width,
77                 height,
78                 &mut new_width,
79                 &mut new_height,
80             );
81             (new_width, new_height)
82         }
83     }
84 
85     #[cfg_attr(feature = "v3_22", deprecated)]
process_all_updates()86     pub fn process_all_updates() {
87         assert_initialized_main_thread!();
88         unsafe {
89             gdk_sys::gdk_window_process_all_updates();
90         }
91     }
92 
93     #[cfg_attr(feature = "v3_22", deprecated)]
set_debug_updates(setting: bool)94     pub fn set_debug_updates(setting: bool) {
95         assert_initialized_main_thread!();
96         unsafe {
97             gdk_sys::gdk_window_set_debug_updates(setting.to_glib());
98         }
99     }
100 }
101 
102 pub const NONE_WINDOW: Option<&Window> = None;
103 
104 pub trait WindowExt: 'static {
105     //fn add_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>);
106 
beep(&self)107     fn beep(&self);
108 
109     #[cfg(any(feature = "v3_22", feature = "dox"))]
begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext>110     fn begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext>;
111 
begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32)112     fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32);
113 
begin_move_drag_for_device( &self, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, )114     fn begin_move_drag_for_device(
115         &self,
116         device: &Device,
117         button: i32,
118         root_x: i32,
119         root_y: i32,
120         timestamp: u32,
121     );
122 
123     #[cfg_attr(feature = "v3_22", deprecated)]
begin_paint_rect(&self, rectangle: &Rectangle)124     fn begin_paint_rect(&self, rectangle: &Rectangle);
125 
126     #[cfg_attr(feature = "v3_22", deprecated)]
begin_paint_region(&self, region: &cairo::Region)127     fn begin_paint_region(&self, region: &cairo::Region);
128 
begin_resize_drag( &self, edge: WindowEdge, button: i32, root_x: i32, root_y: i32, timestamp: u32, )129     fn begin_resize_drag(
130         &self,
131         edge: WindowEdge,
132         button: i32,
133         root_x: i32,
134         root_y: i32,
135         timestamp: u32,
136     );
137 
begin_resize_drag_for_device( &self, edge: WindowEdge, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, )138     fn begin_resize_drag_for_device(
139         &self,
140         edge: WindowEdge,
141         device: &Device,
142         button: i32,
143         root_x: i32,
144         root_y: i32,
145         timestamp: u32,
146     );
147 
coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64)148     fn coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64);
149 
coords_to_parent(&self, x: f64, y: f64) -> (f64, f64)150     fn coords_to_parent(&self, x: f64, y: f64) -> (f64, f64);
151 
152     #[cfg(any(feature = "v3_16", feature = "dox"))]
create_gl_context(&self) -> Result<GLContext, Error>153     fn create_gl_context(&self) -> Result<GLContext, Error>;
154 
create_similar_image_surface( &self, format: i32, width: i32, height: i32, scale: i32, ) -> Option<cairo::Surface>155     fn create_similar_image_surface(
156         &self,
157         format: i32,
158         width: i32,
159         height: i32,
160         scale: i32,
161     ) -> Option<cairo::Surface>;
162 
deiconify(&self)163     fn deiconify(&self);
164 
destroy(&self)165     fn destroy(&self);
166 
destroy_notify(&self)167     fn destroy_notify(&self);
168 
169     #[cfg(any(feature = "v3_22", feature = "dox"))]
end_draw_frame(&self, context: &DrawingContext)170     fn end_draw_frame(&self, context: &DrawingContext);
171 
end_paint(&self)172     fn end_paint(&self);
173 
ensure_native(&self) -> bool174     fn ensure_native(&self) -> bool;
175 
focus(&self, timestamp: u32)176     fn focus(&self, timestamp: u32);
177 
178     #[cfg_attr(feature = "v3_16", deprecated)]
freeze_toplevel_updates_libgtk_only(&self)179     fn freeze_toplevel_updates_libgtk_only(&self);
180 
freeze_updates(&self)181     fn freeze_updates(&self);
182 
fullscreen(&self)183     fn fullscreen(&self);
184 
185     #[cfg(any(feature = "v3_18", feature = "dox"))]
fullscreen_on_monitor(&self, monitor: i32)186     fn fullscreen_on_monitor(&self, monitor: i32);
187 
geometry_changed(&self)188     fn geometry_changed(&self);
189 
get_accept_focus(&self) -> bool190     fn get_accept_focus(&self) -> bool;
191 
get_children(&self) -> Vec<Window>192     fn get_children(&self) -> Vec<Window>;
193 
194     //fn get_children_with_user_data(&self, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Vec<Window>;
195 
get_clip_region(&self) -> Option<cairo::Region>196     fn get_clip_region(&self) -> Option<cairo::Region>;
197 
198     #[cfg_attr(feature = "v3_16", deprecated)]
get_composited(&self) -> bool199     fn get_composited(&self) -> bool;
200 
get_cursor(&self) -> Option<Cursor>201     fn get_cursor(&self) -> Option<Cursor>;
202 
get_decorations(&self) -> Option<WMDecoration>203     fn get_decorations(&self) -> Option<WMDecoration>;
204 
get_device_cursor(&self, device: &Device) -> Option<Cursor>205     fn get_device_cursor(&self, device: &Device) -> Option<Cursor>;
206 
get_device_events(&self, device: &Device) -> EventMask207     fn get_device_events(&self, device: &Device) -> EventMask;
208 
get_device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType)209     fn get_device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType);
210 
get_device_position_double( &self, device: &Device, ) -> (Option<Window>, f64, f64, ModifierType)211     fn get_device_position_double(
212         &self,
213         device: &Device,
214     ) -> (Option<Window>, f64, f64, ModifierType);
215 
get_display(&self) -> Display216     fn get_display(&self) -> Display;
217 
get_drag_protocol(&self) -> (DragProtocol, Window)218     fn get_drag_protocol(&self) -> (DragProtocol, Window);
219 
get_effective_parent(&self) -> Option<Window>220     fn get_effective_parent(&self) -> Option<Window>;
221 
get_effective_toplevel(&self) -> Window222     fn get_effective_toplevel(&self) -> Window;
223 
get_event_compression(&self) -> bool224     fn get_event_compression(&self) -> bool;
225 
get_events(&self) -> EventMask226     fn get_events(&self) -> EventMask;
227 
get_focus_on_map(&self) -> bool228     fn get_focus_on_map(&self) -> bool;
229 
get_frame_clock(&self) -> Option<FrameClock>230     fn get_frame_clock(&self) -> Option<FrameClock>;
231 
get_frame_extents(&self) -> Rectangle232     fn get_frame_extents(&self) -> Rectangle;
233 
get_fullscreen_mode(&self) -> FullscreenMode234     fn get_fullscreen_mode(&self) -> FullscreenMode;
235 
get_geometry(&self) -> (i32, i32, i32, i32)236     fn get_geometry(&self) -> (i32, i32, i32, i32);
237 
get_group(&self) -> Option<Window>238     fn get_group(&self) -> Option<Window>;
239 
get_height(&self) -> i32240     fn get_height(&self) -> i32;
241 
get_modal_hint(&self) -> bool242     fn get_modal_hint(&self) -> bool;
243 
get_origin(&self) -> (i32, i32, i32)244     fn get_origin(&self) -> (i32, i32, i32);
245 
get_parent(&self) -> Option<Window>246     fn get_parent(&self) -> Option<Window>;
247 
248     #[cfg(any(feature = "v3_18", feature = "dox"))]
get_pass_through(&self) -> bool249     fn get_pass_through(&self) -> bool;
250 
get_position(&self) -> (i32, i32)251     fn get_position(&self) -> (i32, i32);
252 
get_root_coords(&self, x: i32, y: i32) -> (i32, i32)253     fn get_root_coords(&self, x: i32, y: i32) -> (i32, i32);
254 
get_root_origin(&self) -> (i32, i32)255     fn get_root_origin(&self) -> (i32, i32);
256 
get_scale_factor(&self) -> i32257     fn get_scale_factor(&self) -> i32;
258 
get_screen(&self) -> Screen259     fn get_screen(&self) -> Screen;
260 
get_source_events(&self, source: InputSource) -> EventMask261     fn get_source_events(&self, source: InputSource) -> EventMask;
262 
get_state(&self) -> WindowState263     fn get_state(&self) -> WindowState;
264 
get_support_multidevice(&self) -> bool265     fn get_support_multidevice(&self) -> bool;
266 
get_toplevel(&self) -> Window267     fn get_toplevel(&self) -> Window;
268 
get_type_hint(&self) -> WindowTypeHint269     fn get_type_hint(&self) -> WindowTypeHint;
270 
get_update_area(&self) -> Option<cairo::Region>271     fn get_update_area(&self) -> Option<cairo::Region>;
272 
273     //fn get_user_data(&self, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>);
274 
get_visible_region(&self) -> Option<cairo::Region>275     fn get_visible_region(&self) -> Option<cairo::Region>;
276 
get_visual(&self) -> Visual277     fn get_visual(&self) -> Visual;
278 
get_width(&self) -> i32279     fn get_width(&self) -> i32;
280 
get_window_type(&self) -> WindowType281     fn get_window_type(&self) -> WindowType;
282 
has_native(&self) -> bool283     fn has_native(&self) -> bool;
284 
hide(&self)285     fn hide(&self);
286 
iconify(&self)287     fn iconify(&self);
288 
input_shape_combine_region( &self, shape_region: &cairo::Region, offset_x: i32, offset_y: i32, )289     fn input_shape_combine_region(
290         &self,
291         shape_region: &cairo::Region,
292         offset_x: i32,
293         offset_y: i32,
294     );
295 
invalidate_maybe_recurse( &self, region: &cairo::Region, child_func: Option<&mut dyn (FnMut(&Window) -> bool)>, )296     fn invalidate_maybe_recurse(
297         &self,
298         region: &cairo::Region,
299         child_func: Option<&mut dyn (FnMut(&Window) -> bool)>,
300     );
301 
invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool)302     fn invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool);
303 
invalidate_region(&self, region: &cairo::Region, invalidate_children: bool)304     fn invalidate_region(&self, region: &cairo::Region, invalidate_children: bool);
305 
is_destroyed(&self) -> bool306     fn is_destroyed(&self) -> bool;
307 
is_input_only(&self) -> bool308     fn is_input_only(&self) -> bool;
309 
is_shaped(&self) -> bool310     fn is_shaped(&self) -> bool;
311 
is_viewable(&self) -> bool312     fn is_viewable(&self) -> bool;
313 
is_visible(&self) -> bool314     fn is_visible(&self) -> bool;
315 
lower(&self)316     fn lower(&self);
317 
318     #[cfg(any(feature = "v3_16", feature = "dox"))]
mark_paint_from_clip(&self, cr: &cairo::Context)319     fn mark_paint_from_clip(&self, cr: &cairo::Context);
320 
maximize(&self)321     fn maximize(&self);
322 
merge_child_input_shapes(&self)323     fn merge_child_input_shapes(&self);
324 
merge_child_shapes(&self)325     fn merge_child_shapes(&self);
326 
move_(&self, x: i32, y: i32)327     fn move_(&self, x: i32, y: i32);
328 
move_region(&self, region: &cairo::Region, dx: i32, dy: i32)329     fn move_region(&self, region: &cairo::Region, dx: i32, dy: i32);
330 
move_resize(&self, x: i32, y: i32, width: i32, height: i32)331     fn move_resize(&self, x: i32, y: i32, width: i32, height: i32);
332 
333     #[cfg(any(feature = "v3_24", feature = "dox"))]
move_to_rect( &self, rect: &Rectangle, rect_anchor: Gravity, window_anchor: Gravity, anchor_hints: AnchorHints, rect_anchor_dx: i32, rect_anchor_dy: i32, )334     fn move_to_rect(
335         &self,
336         rect: &Rectangle,
337         rect_anchor: Gravity,
338         window_anchor: Gravity,
339         anchor_hints: AnchorHints,
340         rect_anchor_dx: i32,
341         rect_anchor_dy: i32,
342     );
343 
peek_children(&self) -> Vec<Window>344     fn peek_children(&self) -> Vec<Window>;
345 
346     #[cfg_attr(feature = "v3_22", deprecated)]
process_updates(&self, update_children: bool)347     fn process_updates(&self, update_children: bool);
348 
raise(&self)349     fn raise(&self);
350 
register_dnd(&self)351     fn register_dnd(&self);
352 
353     //fn remove_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>);
354 
reparent<P: IsA<Window>>(&self, new_parent: &P, x: i32, y: i32)355     fn reparent<P: IsA<Window>>(&self, new_parent: &P, x: i32, y: i32);
356 
resize(&self, width: i32, height: i32)357     fn resize(&self, width: i32, height: i32);
358 
restack<P: IsA<Window>>(&self, sibling: Option<&P>, above: bool)359     fn restack<P: IsA<Window>>(&self, sibling: Option<&P>, above: bool);
360 
scroll(&self, dx: i32, dy: i32)361     fn scroll(&self, dx: i32, dy: i32);
362 
set_accept_focus(&self, accept_focus: bool)363     fn set_accept_focus(&self, accept_focus: bool);
364 
365     #[cfg_attr(feature = "v3_22", deprecated)]
set_background_rgba(&self, rgba: &RGBA)366     fn set_background_rgba(&self, rgba: &RGBA);
367 
set_child_input_shapes(&self)368     fn set_child_input_shapes(&self);
369 
set_child_shapes(&self)370     fn set_child_shapes(&self);
371 
372     #[cfg_attr(feature = "v3_16", deprecated)]
set_composited(&self, composited: bool)373     fn set_composited(&self, composited: bool);
374 
set_cursor(&self, cursor: Option<&Cursor>)375     fn set_cursor(&self, cursor: Option<&Cursor>);
376 
set_decorations(&self, decorations: WMDecoration)377     fn set_decorations(&self, decorations: WMDecoration);
378 
set_device_cursor(&self, device: &Device, cursor: &Cursor)379     fn set_device_cursor(&self, device: &Device, cursor: &Cursor);
380 
set_device_events(&self, device: &Device, event_mask: EventMask)381     fn set_device_events(&self, device: &Device, event_mask: EventMask);
382 
set_event_compression(&self, event_compression: bool)383     fn set_event_compression(&self, event_compression: bool);
384 
set_events(&self, event_mask: EventMask)385     fn set_events(&self, event_mask: EventMask);
386 
set_focus_on_map(&self, focus_on_map: bool)387     fn set_focus_on_map(&self, focus_on_map: bool);
388 
set_fullscreen_mode(&self, mode: FullscreenMode)389     fn set_fullscreen_mode(&self, mode: FullscreenMode);
390 
set_functions(&self, functions: WMFunction)391     fn set_functions(&self, functions: WMFunction);
392 
set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints)393     fn set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints);
394 
set_group<P: IsA<Window>>(&self, leader: Option<&P>)395     fn set_group<P: IsA<Window>>(&self, leader: Option<&P>);
396 
set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf])397     fn set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf]);
398 
set_icon_name(&self, name: Option<&str>)399     fn set_icon_name(&self, name: Option<&str>);
400 
401     //fn set_invalidate_handler<P: Fn(&Window, &cairo::Region) + 'static>(&self, handler: P);
402 
set_keep_above(&self, setting: bool)403     fn set_keep_above(&self, setting: bool);
404 
set_keep_below(&self, setting: bool)405     fn set_keep_below(&self, setting: bool);
406 
set_modal_hint(&self, modal: bool)407     fn set_modal_hint(&self, modal: bool);
408 
set_opacity(&self, opacity: f64)409     fn set_opacity(&self, opacity: f64);
410 
set_opaque_region(&self, region: Option<&cairo::Region>)411     fn set_opaque_region(&self, region: Option<&cairo::Region>);
412 
set_override_redirect(&self, override_redirect: bool)413     fn set_override_redirect(&self, override_redirect: bool);
414 
415     #[cfg(any(feature = "v3_18", feature = "dox"))]
set_pass_through(&self, pass_through: bool)416     fn set_pass_through(&self, pass_through: bool);
417 
set_role(&self, role: &str)418     fn set_role(&self, role: &str);
419 
set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32)420     fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32);
421 
set_skip_pager_hint(&self, skips_pager: bool)422     fn set_skip_pager_hint(&self, skips_pager: bool);
423 
set_skip_taskbar_hint(&self, skips_taskbar: bool)424     fn set_skip_taskbar_hint(&self, skips_taskbar: bool);
425 
set_source_events(&self, source: InputSource, event_mask: EventMask)426     fn set_source_events(&self, source: InputSource, event_mask: EventMask);
427 
set_startup_id(&self, startup_id: &str)428     fn set_startup_id(&self, startup_id: &str);
429 
430     #[cfg_attr(feature = "v3_16", deprecated)]
set_static_gravities(&self, use_static: bool) -> bool431     fn set_static_gravities(&self, use_static: bool) -> bool;
432 
set_support_multidevice(&self, support_multidevice: bool)433     fn set_support_multidevice(&self, support_multidevice: bool);
434 
set_title(&self, title: &str)435     fn set_title(&self, title: &str);
436 
set_transient_for<P: IsA<Window>>(&self, parent: &P)437     fn set_transient_for<P: IsA<Window>>(&self, parent: &P);
438 
set_type_hint(&self, hint: WindowTypeHint)439     fn set_type_hint(&self, hint: WindowTypeHint);
440 
set_urgency_hint(&self, urgent: bool)441     fn set_urgency_hint(&self, urgent: bool);
442 
443     //fn set_user_data(&self, user_data: /*Ignored*/Option<&glib::Object>);
444 
shape_combine_region( &self, shape_region: Option<&cairo::Region>, offset_x: i32, offset_y: i32, )445     fn shape_combine_region(
446         &self,
447         shape_region: Option<&cairo::Region>,
448         offset_x: i32,
449         offset_y: i32,
450     );
451 
show(&self)452     fn show(&self);
453 
show_unraised(&self)454     fn show_unraised(&self);
455 
show_window_menu(&self, event: &mut Event) -> bool456     fn show_window_menu(&self, event: &mut Event) -> bool;
457 
stick(&self)458     fn stick(&self);
459 
460     #[cfg_attr(feature = "v3_16", deprecated)]
thaw_toplevel_updates_libgtk_only(&self)461     fn thaw_toplevel_updates_libgtk_only(&self);
462 
thaw_updates(&self)463     fn thaw_updates(&self);
464 
unfullscreen(&self)465     fn unfullscreen(&self);
466 
unmaximize(&self)467     fn unmaximize(&self);
468 
unstick(&self)469     fn unstick(&self);
470 
withdraw(&self)471     fn withdraw(&self);
472 
connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>( &self, f: F, ) -> SignalHandlerId473     fn connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>(
474         &self,
475         f: F,
476     ) -> SignalHandlerId;
477 
478     //fn connect_from_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
479 
480     //#[cfg(any(feature = "v3_22", feature = "dox"))]
481     //fn connect_moved_to_rect<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
482 
connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>( &self, f: F, ) -> SignalHandlerId483     fn connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>(
484         &self,
485         f: F,
486     ) -> SignalHandlerId;
487 
488     //fn connect_to_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
489 
connect_property_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId490     fn connect_property_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
491 }
492 
493 impl<O: IsA<Window>> WindowExt for O {
494     //fn add_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
495     //    unsafe { TODO: call gdk_sys:gdk_window_add_filter() }
496     //}
497 
beep(&self)498     fn beep(&self) {
499         unsafe {
500             gdk_sys::gdk_window_beep(self.as_ref().to_glib_none().0);
501         }
502     }
503 
504     #[cfg(any(feature = "v3_22", feature = "dox"))]
begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext>505     fn begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext> {
506         unsafe {
507             from_glib_none(gdk_sys::gdk_window_begin_draw_frame(
508                 self.as_ref().to_glib_none().0,
509                 region.to_glib_none().0,
510             ))
511         }
512     }
513 
begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32)514     fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32) {
515         unsafe {
516             gdk_sys::gdk_window_begin_move_drag(
517                 self.as_ref().to_glib_none().0,
518                 button,
519                 root_x,
520                 root_y,
521                 timestamp,
522             );
523         }
524     }
525 
begin_move_drag_for_device( &self, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, )526     fn begin_move_drag_for_device(
527         &self,
528         device: &Device,
529         button: i32,
530         root_x: i32,
531         root_y: i32,
532         timestamp: u32,
533     ) {
534         unsafe {
535             gdk_sys::gdk_window_begin_move_drag_for_device(
536                 self.as_ref().to_glib_none().0,
537                 device.to_glib_none().0,
538                 button,
539                 root_x,
540                 root_y,
541                 timestamp,
542             );
543         }
544     }
545 
begin_paint_rect(&self, rectangle: &Rectangle)546     fn begin_paint_rect(&self, rectangle: &Rectangle) {
547         unsafe {
548             gdk_sys::gdk_window_begin_paint_rect(
549                 self.as_ref().to_glib_none().0,
550                 rectangle.to_glib_none().0,
551             );
552         }
553     }
554 
begin_paint_region(&self, region: &cairo::Region)555     fn begin_paint_region(&self, region: &cairo::Region) {
556         unsafe {
557             gdk_sys::gdk_window_begin_paint_region(
558                 self.as_ref().to_glib_none().0,
559                 region.to_glib_none().0,
560             );
561         }
562     }
563 
begin_resize_drag( &self, edge: WindowEdge, button: i32, root_x: i32, root_y: i32, timestamp: u32, )564     fn begin_resize_drag(
565         &self,
566         edge: WindowEdge,
567         button: i32,
568         root_x: i32,
569         root_y: i32,
570         timestamp: u32,
571     ) {
572         unsafe {
573             gdk_sys::gdk_window_begin_resize_drag(
574                 self.as_ref().to_glib_none().0,
575                 edge.to_glib(),
576                 button,
577                 root_x,
578                 root_y,
579                 timestamp,
580             );
581         }
582     }
583 
begin_resize_drag_for_device( &self, edge: WindowEdge, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, )584     fn begin_resize_drag_for_device(
585         &self,
586         edge: WindowEdge,
587         device: &Device,
588         button: i32,
589         root_x: i32,
590         root_y: i32,
591         timestamp: u32,
592     ) {
593         unsafe {
594             gdk_sys::gdk_window_begin_resize_drag_for_device(
595                 self.as_ref().to_glib_none().0,
596                 edge.to_glib(),
597                 device.to_glib_none().0,
598                 button,
599                 root_x,
600                 root_y,
601                 timestamp,
602             );
603         }
604     }
605 
coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64)606     fn coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64) {
607         unsafe {
608             let mut x = mem::uninitialized();
609             let mut y = mem::uninitialized();
610             gdk_sys::gdk_window_coords_from_parent(
611                 self.as_ref().to_glib_none().0,
612                 parent_x,
613                 parent_y,
614                 &mut x,
615                 &mut y,
616             );
617             (x, y)
618         }
619     }
620 
coords_to_parent(&self, x: f64, y: f64) -> (f64, f64)621     fn coords_to_parent(&self, x: f64, y: f64) -> (f64, f64) {
622         unsafe {
623             let mut parent_x = mem::uninitialized();
624             let mut parent_y = mem::uninitialized();
625             gdk_sys::gdk_window_coords_to_parent(
626                 self.as_ref().to_glib_none().0,
627                 x,
628                 y,
629                 &mut parent_x,
630                 &mut parent_y,
631             );
632             (parent_x, parent_y)
633         }
634     }
635 
636     #[cfg(any(feature = "v3_16", feature = "dox"))]
create_gl_context(&self) -> Result<GLContext, Error>637     fn create_gl_context(&self) -> Result<GLContext, Error> {
638         unsafe {
639             let mut error = ptr::null_mut();
640             let ret =
641                 gdk_sys::gdk_window_create_gl_context(self.as_ref().to_glib_none().0, &mut error);
642             if error.is_null() {
643                 Ok(from_glib_full(ret))
644             } else {
645                 Err(from_glib_full(error))
646             }
647         }
648     }
649 
create_similar_image_surface( &self, format: i32, width: i32, height: i32, scale: i32, ) -> Option<cairo::Surface>650     fn create_similar_image_surface(
651         &self,
652         format: i32,
653         width: i32,
654         height: i32,
655         scale: i32,
656     ) -> Option<cairo::Surface> {
657         unsafe {
658             from_glib_full(gdk_sys::gdk_window_create_similar_image_surface(
659                 self.as_ref().to_glib_none().0,
660                 format,
661                 width,
662                 height,
663                 scale,
664             ))
665         }
666     }
667 
deiconify(&self)668     fn deiconify(&self) {
669         unsafe {
670             gdk_sys::gdk_window_deiconify(self.as_ref().to_glib_none().0);
671         }
672     }
673 
destroy(&self)674     fn destroy(&self) {
675         unsafe {
676             gdk_sys::gdk_window_destroy(self.as_ref().to_glib_none().0);
677         }
678     }
679 
destroy_notify(&self)680     fn destroy_notify(&self) {
681         unsafe {
682             gdk_sys::gdk_window_destroy_notify(self.as_ref().to_glib_none().0);
683         }
684     }
685 
686     #[cfg(any(feature = "v3_22", feature = "dox"))]
end_draw_frame(&self, context: &DrawingContext)687     fn end_draw_frame(&self, context: &DrawingContext) {
688         unsafe {
689             gdk_sys::gdk_window_end_draw_frame(
690                 self.as_ref().to_glib_none().0,
691                 context.to_glib_none().0,
692             );
693         }
694     }
695 
end_paint(&self)696     fn end_paint(&self) {
697         unsafe {
698             gdk_sys::gdk_window_end_paint(self.as_ref().to_glib_none().0);
699         }
700     }
701 
ensure_native(&self) -> bool702     fn ensure_native(&self) -> bool {
703         unsafe {
704             from_glib(gdk_sys::gdk_window_ensure_native(
705                 self.as_ref().to_glib_none().0,
706             ))
707         }
708     }
709 
focus(&self, timestamp: u32)710     fn focus(&self, timestamp: u32) {
711         unsafe {
712             gdk_sys::gdk_window_focus(self.as_ref().to_glib_none().0, timestamp);
713         }
714     }
715 
freeze_toplevel_updates_libgtk_only(&self)716     fn freeze_toplevel_updates_libgtk_only(&self) {
717         unsafe {
718             gdk_sys::gdk_window_freeze_toplevel_updates_libgtk_only(self.as_ref().to_glib_none().0);
719         }
720     }
721 
freeze_updates(&self)722     fn freeze_updates(&self) {
723         unsafe {
724             gdk_sys::gdk_window_freeze_updates(self.as_ref().to_glib_none().0);
725         }
726     }
727 
fullscreen(&self)728     fn fullscreen(&self) {
729         unsafe {
730             gdk_sys::gdk_window_fullscreen(self.as_ref().to_glib_none().0);
731         }
732     }
733 
734     #[cfg(any(feature = "v3_18", feature = "dox"))]
fullscreen_on_monitor(&self, monitor: i32)735     fn fullscreen_on_monitor(&self, monitor: i32) {
736         unsafe {
737             gdk_sys::gdk_window_fullscreen_on_monitor(self.as_ref().to_glib_none().0, monitor);
738         }
739     }
740 
geometry_changed(&self)741     fn geometry_changed(&self) {
742         unsafe {
743             gdk_sys::gdk_window_geometry_changed(self.as_ref().to_glib_none().0);
744         }
745     }
746 
get_accept_focus(&self) -> bool747     fn get_accept_focus(&self) -> bool {
748         unsafe {
749             from_glib(gdk_sys::gdk_window_get_accept_focus(
750                 self.as_ref().to_glib_none().0,
751             ))
752         }
753     }
754 
get_children(&self) -> Vec<Window>755     fn get_children(&self) -> Vec<Window> {
756         unsafe {
757             FromGlibPtrContainer::from_glib_container(gdk_sys::gdk_window_get_children(
758                 self.as_ref().to_glib_none().0,
759             ))
760         }
761     }
762 
763     //fn get_children_with_user_data(&self, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Vec<Window> {
764     //    unsafe { TODO: call gdk_sys:gdk_window_get_children_with_user_data() }
765     //}
766 
get_clip_region(&self) -> Option<cairo::Region>767     fn get_clip_region(&self) -> Option<cairo::Region> {
768         unsafe {
769             from_glib_full(gdk_sys::gdk_window_get_clip_region(
770                 self.as_ref().to_glib_none().0,
771             ))
772         }
773     }
774 
get_composited(&self) -> bool775     fn get_composited(&self) -> bool {
776         unsafe {
777             from_glib(gdk_sys::gdk_window_get_composited(
778                 self.as_ref().to_glib_none().0,
779             ))
780         }
781     }
782 
get_cursor(&self) -> Option<Cursor>783     fn get_cursor(&self) -> Option<Cursor> {
784         unsafe {
785             from_glib_none(gdk_sys::gdk_window_get_cursor(
786                 self.as_ref().to_glib_none().0,
787             ))
788         }
789     }
790 
get_decorations(&self) -> Option<WMDecoration>791     fn get_decorations(&self) -> Option<WMDecoration> {
792         unsafe {
793             let mut decorations = mem::uninitialized();
794             let ret = from_glib(gdk_sys::gdk_window_get_decorations(
795                 self.as_ref().to_glib_none().0,
796                 &mut decorations,
797             ));
798             if ret {
799                 Some(from_glib(decorations))
800             } else {
801                 None
802             }
803         }
804     }
805 
get_device_cursor(&self, device: &Device) -> Option<Cursor>806     fn get_device_cursor(&self, device: &Device) -> Option<Cursor> {
807         unsafe {
808             from_glib_none(gdk_sys::gdk_window_get_device_cursor(
809                 self.as_ref().to_glib_none().0,
810                 device.to_glib_none().0,
811             ))
812         }
813     }
814 
get_device_events(&self, device: &Device) -> EventMask815     fn get_device_events(&self, device: &Device) -> EventMask {
816         unsafe {
817             from_glib(gdk_sys::gdk_window_get_device_events(
818                 self.as_ref().to_glib_none().0,
819                 device.to_glib_none().0,
820             ))
821         }
822     }
823 
get_device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType)824     fn get_device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType) {
825         unsafe {
826             let mut x = mem::uninitialized();
827             let mut y = mem::uninitialized();
828             let mut mask = mem::uninitialized();
829             let ret = from_glib_none(gdk_sys::gdk_window_get_device_position(
830                 self.as_ref().to_glib_none().0,
831                 device.to_glib_none().0,
832                 &mut x,
833                 &mut y,
834                 &mut mask,
835             ));
836             (ret, x, y, from_glib(mask))
837         }
838     }
839 
get_device_position_double( &self, device: &Device, ) -> (Option<Window>, f64, f64, ModifierType)840     fn get_device_position_double(
841         &self,
842         device: &Device,
843     ) -> (Option<Window>, f64, f64, ModifierType) {
844         unsafe {
845             let mut x = mem::uninitialized();
846             let mut y = mem::uninitialized();
847             let mut mask = mem::uninitialized();
848             let ret = from_glib_none(gdk_sys::gdk_window_get_device_position_double(
849                 self.as_ref().to_glib_none().0,
850                 device.to_glib_none().0,
851                 &mut x,
852                 &mut y,
853                 &mut mask,
854             ));
855             (ret, x, y, from_glib(mask))
856         }
857     }
858 
get_display(&self) -> Display859     fn get_display(&self) -> Display {
860         unsafe {
861             from_glib_none(gdk_sys::gdk_window_get_display(
862                 self.as_ref().to_glib_none().0,
863             ))
864         }
865     }
866 
get_drag_protocol(&self) -> (DragProtocol, Window)867     fn get_drag_protocol(&self) -> (DragProtocol, Window) {
868         unsafe {
869             let mut target = ptr::null_mut();
870             let ret = from_glib(gdk_sys::gdk_window_get_drag_protocol(
871                 self.as_ref().to_glib_none().0,
872                 &mut target,
873             ));
874             (ret, from_glib_full(target))
875         }
876     }
877 
get_effective_parent(&self) -> Option<Window>878     fn get_effective_parent(&self) -> Option<Window> {
879         unsafe {
880             from_glib_none(gdk_sys::gdk_window_get_effective_parent(
881                 self.as_ref().to_glib_none().0,
882             ))
883         }
884     }
885 
get_effective_toplevel(&self) -> Window886     fn get_effective_toplevel(&self) -> Window {
887         unsafe {
888             from_glib_none(gdk_sys::gdk_window_get_effective_toplevel(
889                 self.as_ref().to_glib_none().0,
890             ))
891         }
892     }
893 
get_event_compression(&self) -> bool894     fn get_event_compression(&self) -> bool {
895         unsafe {
896             from_glib(gdk_sys::gdk_window_get_event_compression(
897                 self.as_ref().to_glib_none().0,
898             ))
899         }
900     }
901 
get_events(&self) -> EventMask902     fn get_events(&self) -> EventMask {
903         unsafe {
904             from_glib(gdk_sys::gdk_window_get_events(
905                 self.as_ref().to_glib_none().0,
906             ))
907         }
908     }
909 
get_focus_on_map(&self) -> bool910     fn get_focus_on_map(&self) -> bool {
911         unsafe {
912             from_glib(gdk_sys::gdk_window_get_focus_on_map(
913                 self.as_ref().to_glib_none().0,
914             ))
915         }
916     }
917 
get_frame_clock(&self) -> Option<FrameClock>918     fn get_frame_clock(&self) -> Option<FrameClock> {
919         unsafe {
920             from_glib_none(gdk_sys::gdk_window_get_frame_clock(
921                 self.as_ref().to_glib_none().0,
922             ))
923         }
924     }
925 
get_frame_extents(&self) -> Rectangle926     fn get_frame_extents(&self) -> Rectangle {
927         unsafe {
928             let mut rect = Rectangle::uninitialized();
929             gdk_sys::gdk_window_get_frame_extents(
930                 self.as_ref().to_glib_none().0,
931                 rect.to_glib_none_mut().0,
932             );
933             rect
934         }
935     }
936 
get_fullscreen_mode(&self) -> FullscreenMode937     fn get_fullscreen_mode(&self) -> FullscreenMode {
938         unsafe {
939             from_glib(gdk_sys::gdk_window_get_fullscreen_mode(
940                 self.as_ref().to_glib_none().0,
941             ))
942         }
943     }
944 
get_geometry(&self) -> (i32, i32, i32, i32)945     fn get_geometry(&self) -> (i32, i32, i32, i32) {
946         unsafe {
947             let mut x = mem::uninitialized();
948             let mut y = mem::uninitialized();
949             let mut width = mem::uninitialized();
950             let mut height = mem::uninitialized();
951             gdk_sys::gdk_window_get_geometry(
952                 self.as_ref().to_glib_none().0,
953                 &mut x,
954                 &mut y,
955                 &mut width,
956                 &mut height,
957             );
958             (x, y, width, height)
959         }
960     }
961 
get_group(&self) -> Option<Window>962     fn get_group(&self) -> Option<Window> {
963         unsafe {
964             from_glib_none(gdk_sys::gdk_window_get_group(
965                 self.as_ref().to_glib_none().0,
966             ))
967         }
968     }
969 
get_height(&self) -> i32970     fn get_height(&self) -> i32 {
971         unsafe { gdk_sys::gdk_window_get_height(self.as_ref().to_glib_none().0) }
972     }
973 
get_modal_hint(&self) -> bool974     fn get_modal_hint(&self) -> bool {
975         unsafe {
976             from_glib(gdk_sys::gdk_window_get_modal_hint(
977                 self.as_ref().to_glib_none().0,
978             ))
979         }
980     }
981 
get_origin(&self) -> (i32, i32, i32)982     fn get_origin(&self) -> (i32, i32, i32) {
983         unsafe {
984             let mut x = mem::uninitialized();
985             let mut y = mem::uninitialized();
986             let ret =
987                 gdk_sys::gdk_window_get_origin(self.as_ref().to_glib_none().0, &mut x, &mut y);
988             (ret, x, y)
989         }
990     }
991 
get_parent(&self) -> Option<Window>992     fn get_parent(&self) -> Option<Window> {
993         unsafe {
994             from_glib_none(gdk_sys::gdk_window_get_parent(
995                 self.as_ref().to_glib_none().0,
996             ))
997         }
998     }
999 
1000     #[cfg(any(feature = "v3_18", feature = "dox"))]
get_pass_through(&self) -> bool1001     fn get_pass_through(&self) -> bool {
1002         unsafe {
1003             from_glib(gdk_sys::gdk_window_get_pass_through(
1004                 self.as_ref().to_glib_none().0,
1005             ))
1006         }
1007     }
1008 
get_position(&self) -> (i32, i32)1009     fn get_position(&self) -> (i32, i32) {
1010         unsafe {
1011             let mut x = mem::uninitialized();
1012             let mut y = mem::uninitialized();
1013             gdk_sys::gdk_window_get_position(self.as_ref().to_glib_none().0, &mut x, &mut y);
1014             (x, y)
1015         }
1016     }
1017 
get_root_coords(&self, x: i32, y: i32) -> (i32, i32)1018     fn get_root_coords(&self, x: i32, y: i32) -> (i32, i32) {
1019         unsafe {
1020             let mut root_x = mem::uninitialized();
1021             let mut root_y = mem::uninitialized();
1022             gdk_sys::gdk_window_get_root_coords(
1023                 self.as_ref().to_glib_none().0,
1024                 x,
1025                 y,
1026                 &mut root_x,
1027                 &mut root_y,
1028             );
1029             (root_x, root_y)
1030         }
1031     }
1032 
get_root_origin(&self) -> (i32, i32)1033     fn get_root_origin(&self) -> (i32, i32) {
1034         unsafe {
1035             let mut x = mem::uninitialized();
1036             let mut y = mem::uninitialized();
1037             gdk_sys::gdk_window_get_root_origin(self.as_ref().to_glib_none().0, &mut x, &mut y);
1038             (x, y)
1039         }
1040     }
1041 
get_scale_factor(&self) -> i321042     fn get_scale_factor(&self) -> i32 {
1043         unsafe { gdk_sys::gdk_window_get_scale_factor(self.as_ref().to_glib_none().0) }
1044     }
1045 
get_screen(&self) -> Screen1046     fn get_screen(&self) -> Screen {
1047         unsafe {
1048             from_glib_none(gdk_sys::gdk_window_get_screen(
1049                 self.as_ref().to_glib_none().0,
1050             ))
1051         }
1052     }
1053 
get_source_events(&self, source: InputSource) -> EventMask1054     fn get_source_events(&self, source: InputSource) -> EventMask {
1055         unsafe {
1056             from_glib(gdk_sys::gdk_window_get_source_events(
1057                 self.as_ref().to_glib_none().0,
1058                 source.to_glib(),
1059             ))
1060         }
1061     }
1062 
get_state(&self) -> WindowState1063     fn get_state(&self) -> WindowState {
1064         unsafe {
1065             from_glib(gdk_sys::gdk_window_get_state(
1066                 self.as_ref().to_glib_none().0,
1067             ))
1068         }
1069     }
1070 
get_support_multidevice(&self) -> bool1071     fn get_support_multidevice(&self) -> bool {
1072         unsafe {
1073             from_glib(gdk_sys::gdk_window_get_support_multidevice(
1074                 self.as_ref().to_glib_none().0,
1075             ))
1076         }
1077     }
1078 
get_toplevel(&self) -> Window1079     fn get_toplevel(&self) -> Window {
1080         unsafe {
1081             from_glib_none(gdk_sys::gdk_window_get_toplevel(
1082                 self.as_ref().to_glib_none().0,
1083             ))
1084         }
1085     }
1086 
get_type_hint(&self) -> WindowTypeHint1087     fn get_type_hint(&self) -> WindowTypeHint {
1088         unsafe {
1089             from_glib(gdk_sys::gdk_window_get_type_hint(
1090                 self.as_ref().to_glib_none().0,
1091             ))
1092         }
1093     }
1094 
get_update_area(&self) -> Option<cairo::Region>1095     fn get_update_area(&self) -> Option<cairo::Region> {
1096         unsafe {
1097             from_glib_full(gdk_sys::gdk_window_get_update_area(
1098                 self.as_ref().to_glib_none().0,
1099             ))
1100         }
1101     }
1102 
1103     //fn get_user_data(&self, data: /*Unimplemented*/&mut Option<Fundamental: Pointer>) {
1104     //    unsafe { TODO: call gdk_sys:gdk_window_get_user_data() }
1105     //}
1106 
get_visible_region(&self) -> Option<cairo::Region>1107     fn get_visible_region(&self) -> Option<cairo::Region> {
1108         unsafe {
1109             from_glib_full(gdk_sys::gdk_window_get_visible_region(
1110                 self.as_ref().to_glib_none().0,
1111             ))
1112         }
1113     }
1114 
get_visual(&self) -> Visual1115     fn get_visual(&self) -> Visual {
1116         unsafe {
1117             from_glib_none(gdk_sys::gdk_window_get_visual(
1118                 self.as_ref().to_glib_none().0,
1119             ))
1120         }
1121     }
1122 
get_width(&self) -> i321123     fn get_width(&self) -> i32 {
1124         unsafe { gdk_sys::gdk_window_get_width(self.as_ref().to_glib_none().0) }
1125     }
1126 
get_window_type(&self) -> WindowType1127     fn get_window_type(&self) -> WindowType {
1128         unsafe {
1129             from_glib(gdk_sys::gdk_window_get_window_type(
1130                 self.as_ref().to_glib_none().0,
1131             ))
1132         }
1133     }
1134 
has_native(&self) -> bool1135     fn has_native(&self) -> bool {
1136         unsafe {
1137             from_glib(gdk_sys::gdk_window_has_native(
1138                 self.as_ref().to_glib_none().0,
1139             ))
1140         }
1141     }
1142 
hide(&self)1143     fn hide(&self) {
1144         unsafe {
1145             gdk_sys::gdk_window_hide(self.as_ref().to_glib_none().0);
1146         }
1147     }
1148 
iconify(&self)1149     fn iconify(&self) {
1150         unsafe {
1151             gdk_sys::gdk_window_iconify(self.as_ref().to_glib_none().0);
1152         }
1153     }
1154 
input_shape_combine_region( &self, shape_region: &cairo::Region, offset_x: i32, offset_y: i32, )1155     fn input_shape_combine_region(
1156         &self,
1157         shape_region: &cairo::Region,
1158         offset_x: i32,
1159         offset_y: i32,
1160     ) {
1161         unsafe {
1162             gdk_sys::gdk_window_input_shape_combine_region(
1163                 self.as_ref().to_glib_none().0,
1164                 shape_region.to_glib_none().0,
1165                 offset_x,
1166                 offset_y,
1167             );
1168         }
1169     }
1170 
invalidate_maybe_recurse( &self, region: &cairo::Region, child_func: Option<&mut dyn (FnMut(&Window) -> bool)>, )1171     fn invalidate_maybe_recurse(
1172         &self,
1173         region: &cairo::Region,
1174         child_func: Option<&mut dyn (FnMut(&Window) -> bool)>,
1175     ) {
1176         let child_func_data: Option<&mut dyn (FnMut(&Window) -> bool)> = child_func;
1177         unsafe extern "C" fn child_func_func(
1178             window: *mut gdk_sys::GdkWindow,
1179             user_data: glib_sys::gpointer,
1180         ) -> glib_sys::gboolean {
1181             let window = from_glib_borrow(window);
1182             let callback: *mut Option<&mut dyn (FnMut(&Window) -> bool)> =
1183                 user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&Window) -> bool)>;
1184             let res = if let Some(ref mut callback) = *callback {
1185                 callback(&window)
1186             } else {
1187                 panic!("cannot get closure...")
1188             };
1189             res.to_glib()
1190         }
1191         let child_func = if child_func_data.is_some() {
1192             Some(child_func_func as _)
1193         } else {
1194             None
1195         };
1196         let super_callback0: &Option<&mut dyn (FnMut(&Window) -> bool)> = &child_func_data;
1197         unsafe {
1198             gdk_sys::gdk_window_invalidate_maybe_recurse(
1199                 self.as_ref().to_glib_none().0,
1200                 region.to_glib_none().0,
1201                 child_func,
1202                 super_callback0 as *const _ as usize as *mut _,
1203             );
1204         }
1205     }
1206 
invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool)1207     fn invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool) {
1208         unsafe {
1209             gdk_sys::gdk_window_invalidate_rect(
1210                 self.as_ref().to_glib_none().0,
1211                 rect.to_glib_none().0,
1212                 invalidate_children.to_glib(),
1213             );
1214         }
1215     }
1216 
invalidate_region(&self, region: &cairo::Region, invalidate_children: bool)1217     fn invalidate_region(&self, region: &cairo::Region, invalidate_children: bool) {
1218         unsafe {
1219             gdk_sys::gdk_window_invalidate_region(
1220                 self.as_ref().to_glib_none().0,
1221                 region.to_glib_none().0,
1222                 invalidate_children.to_glib(),
1223             );
1224         }
1225     }
1226 
is_destroyed(&self) -> bool1227     fn is_destroyed(&self) -> bool {
1228         unsafe {
1229             from_glib(gdk_sys::gdk_window_is_destroyed(
1230                 self.as_ref().to_glib_none().0,
1231             ))
1232         }
1233     }
1234 
is_input_only(&self) -> bool1235     fn is_input_only(&self) -> bool {
1236         unsafe {
1237             from_glib(gdk_sys::gdk_window_is_input_only(
1238                 self.as_ref().to_glib_none().0,
1239             ))
1240         }
1241     }
1242 
is_shaped(&self) -> bool1243     fn is_shaped(&self) -> bool {
1244         unsafe {
1245             from_glib(gdk_sys::gdk_window_is_shaped(
1246                 self.as_ref().to_glib_none().0,
1247             ))
1248         }
1249     }
1250 
is_viewable(&self) -> bool1251     fn is_viewable(&self) -> bool {
1252         unsafe {
1253             from_glib(gdk_sys::gdk_window_is_viewable(
1254                 self.as_ref().to_glib_none().0,
1255             ))
1256         }
1257     }
1258 
is_visible(&self) -> bool1259     fn is_visible(&self) -> bool {
1260         unsafe {
1261             from_glib(gdk_sys::gdk_window_is_visible(
1262                 self.as_ref().to_glib_none().0,
1263             ))
1264         }
1265     }
1266 
lower(&self)1267     fn lower(&self) {
1268         unsafe {
1269             gdk_sys::gdk_window_lower(self.as_ref().to_glib_none().0);
1270         }
1271     }
1272 
1273     #[cfg(any(feature = "v3_16", feature = "dox"))]
mark_paint_from_clip(&self, cr: &cairo::Context)1274     fn mark_paint_from_clip(&self, cr: &cairo::Context) {
1275         unsafe {
1276             gdk_sys::gdk_window_mark_paint_from_clip(
1277                 self.as_ref().to_glib_none().0,
1278                 mut_override(cr.to_glib_none().0),
1279             );
1280         }
1281     }
1282 
maximize(&self)1283     fn maximize(&self) {
1284         unsafe {
1285             gdk_sys::gdk_window_maximize(self.as_ref().to_glib_none().0);
1286         }
1287     }
1288 
merge_child_input_shapes(&self)1289     fn merge_child_input_shapes(&self) {
1290         unsafe {
1291             gdk_sys::gdk_window_merge_child_input_shapes(self.as_ref().to_glib_none().0);
1292         }
1293     }
1294 
merge_child_shapes(&self)1295     fn merge_child_shapes(&self) {
1296         unsafe {
1297             gdk_sys::gdk_window_merge_child_shapes(self.as_ref().to_glib_none().0);
1298         }
1299     }
1300 
move_(&self, x: i32, y: i32)1301     fn move_(&self, x: i32, y: i32) {
1302         unsafe {
1303             gdk_sys::gdk_window_move(self.as_ref().to_glib_none().0, x, y);
1304         }
1305     }
1306 
move_region(&self, region: &cairo::Region, dx: i32, dy: i32)1307     fn move_region(&self, region: &cairo::Region, dx: i32, dy: i32) {
1308         unsafe {
1309             gdk_sys::gdk_window_move_region(
1310                 self.as_ref().to_glib_none().0,
1311                 region.to_glib_none().0,
1312                 dx,
1313                 dy,
1314             );
1315         }
1316     }
1317 
move_resize(&self, x: i32, y: i32, width: i32, height: i32)1318     fn move_resize(&self, x: i32, y: i32, width: i32, height: i32) {
1319         unsafe {
1320             gdk_sys::gdk_window_move_resize(self.as_ref().to_glib_none().0, x, y, width, height);
1321         }
1322     }
1323 
1324     #[cfg(any(feature = "v3_24", feature = "dox"))]
move_to_rect( &self, rect: &Rectangle, rect_anchor: Gravity, window_anchor: Gravity, anchor_hints: AnchorHints, rect_anchor_dx: i32, rect_anchor_dy: i32, )1325     fn move_to_rect(
1326         &self,
1327         rect: &Rectangle,
1328         rect_anchor: Gravity,
1329         window_anchor: Gravity,
1330         anchor_hints: AnchorHints,
1331         rect_anchor_dx: i32,
1332         rect_anchor_dy: i32,
1333     ) {
1334         unsafe {
1335             gdk_sys::gdk_window_move_to_rect(
1336                 self.as_ref().to_glib_none().0,
1337                 rect.to_glib_none().0,
1338                 rect_anchor.to_glib(),
1339                 window_anchor.to_glib(),
1340                 anchor_hints.to_glib(),
1341                 rect_anchor_dx,
1342                 rect_anchor_dy,
1343             );
1344         }
1345     }
1346 
peek_children(&self) -> Vec<Window>1347     fn peek_children(&self) -> Vec<Window> {
1348         unsafe {
1349             FromGlibPtrContainer::from_glib_none(gdk_sys::gdk_window_peek_children(
1350                 self.as_ref().to_glib_none().0,
1351             ))
1352         }
1353     }
1354 
process_updates(&self, update_children: bool)1355     fn process_updates(&self, update_children: bool) {
1356         unsafe {
1357             gdk_sys::gdk_window_process_updates(
1358                 self.as_ref().to_glib_none().0,
1359                 update_children.to_glib(),
1360             );
1361         }
1362     }
1363 
raise(&self)1364     fn raise(&self) {
1365         unsafe {
1366             gdk_sys::gdk_window_raise(self.as_ref().to_glib_none().0);
1367         }
1368     }
1369 
register_dnd(&self)1370     fn register_dnd(&self) {
1371         unsafe {
1372             gdk_sys::gdk_window_register_dnd(self.as_ref().to_glib_none().0);
1373         }
1374     }
1375 
1376     //fn remove_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
1377     //    unsafe { TODO: call gdk_sys:gdk_window_remove_filter() }
1378     //}
1379 
reparent<P: IsA<Window>>(&self, new_parent: &P, x: i32, y: i32)1380     fn reparent<P: IsA<Window>>(&self, new_parent: &P, x: i32, y: i32) {
1381         unsafe {
1382             gdk_sys::gdk_window_reparent(
1383                 self.as_ref().to_glib_none().0,
1384                 new_parent.as_ref().to_glib_none().0,
1385                 x,
1386                 y,
1387             );
1388         }
1389     }
1390 
resize(&self, width: i32, height: i32)1391     fn resize(&self, width: i32, height: i32) {
1392         unsafe {
1393             gdk_sys::gdk_window_resize(self.as_ref().to_glib_none().0, width, height);
1394         }
1395     }
1396 
restack<P: IsA<Window>>(&self, sibling: Option<&P>, above: bool)1397     fn restack<P: IsA<Window>>(&self, sibling: Option<&P>, above: bool) {
1398         unsafe {
1399             gdk_sys::gdk_window_restack(
1400                 self.as_ref().to_glib_none().0,
1401                 sibling.map(|p| p.as_ref()).to_glib_none().0,
1402                 above.to_glib(),
1403             );
1404         }
1405     }
1406 
scroll(&self, dx: i32, dy: i32)1407     fn scroll(&self, dx: i32, dy: i32) {
1408         unsafe {
1409             gdk_sys::gdk_window_scroll(self.as_ref().to_glib_none().0, dx, dy);
1410         }
1411     }
1412 
set_accept_focus(&self, accept_focus: bool)1413     fn set_accept_focus(&self, accept_focus: bool) {
1414         unsafe {
1415             gdk_sys::gdk_window_set_accept_focus(
1416                 self.as_ref().to_glib_none().0,
1417                 accept_focus.to_glib(),
1418             );
1419         }
1420     }
1421 
set_background_rgba(&self, rgba: &RGBA)1422     fn set_background_rgba(&self, rgba: &RGBA) {
1423         unsafe {
1424             gdk_sys::gdk_window_set_background_rgba(
1425                 self.as_ref().to_glib_none().0,
1426                 rgba.to_glib_none().0,
1427             );
1428         }
1429     }
1430 
set_child_input_shapes(&self)1431     fn set_child_input_shapes(&self) {
1432         unsafe {
1433             gdk_sys::gdk_window_set_child_input_shapes(self.as_ref().to_glib_none().0);
1434         }
1435     }
1436 
set_child_shapes(&self)1437     fn set_child_shapes(&self) {
1438         unsafe {
1439             gdk_sys::gdk_window_set_child_shapes(self.as_ref().to_glib_none().0);
1440         }
1441     }
1442 
set_composited(&self, composited: bool)1443     fn set_composited(&self, composited: bool) {
1444         unsafe {
1445             gdk_sys::gdk_window_set_composited(
1446                 self.as_ref().to_glib_none().0,
1447                 composited.to_glib(),
1448             );
1449         }
1450     }
1451 
set_cursor(&self, cursor: Option<&Cursor>)1452     fn set_cursor(&self, cursor: Option<&Cursor>) {
1453         unsafe {
1454             gdk_sys::gdk_window_set_cursor(self.as_ref().to_glib_none().0, cursor.to_glib_none().0);
1455         }
1456     }
1457 
set_decorations(&self, decorations: WMDecoration)1458     fn set_decorations(&self, decorations: WMDecoration) {
1459         unsafe {
1460             gdk_sys::gdk_window_set_decorations(
1461                 self.as_ref().to_glib_none().0,
1462                 decorations.to_glib(),
1463             );
1464         }
1465     }
1466 
set_device_cursor(&self, device: &Device, cursor: &Cursor)1467     fn set_device_cursor(&self, device: &Device, cursor: &Cursor) {
1468         unsafe {
1469             gdk_sys::gdk_window_set_device_cursor(
1470                 self.as_ref().to_glib_none().0,
1471                 device.to_glib_none().0,
1472                 cursor.to_glib_none().0,
1473             );
1474         }
1475     }
1476 
set_device_events(&self, device: &Device, event_mask: EventMask)1477     fn set_device_events(&self, device: &Device, event_mask: EventMask) {
1478         unsafe {
1479             gdk_sys::gdk_window_set_device_events(
1480                 self.as_ref().to_glib_none().0,
1481                 device.to_glib_none().0,
1482                 event_mask.to_glib(),
1483             );
1484         }
1485     }
1486 
set_event_compression(&self, event_compression: bool)1487     fn set_event_compression(&self, event_compression: bool) {
1488         unsafe {
1489             gdk_sys::gdk_window_set_event_compression(
1490                 self.as_ref().to_glib_none().0,
1491                 event_compression.to_glib(),
1492             );
1493         }
1494     }
1495 
set_events(&self, event_mask: EventMask)1496     fn set_events(&self, event_mask: EventMask) {
1497         unsafe {
1498             gdk_sys::gdk_window_set_events(self.as_ref().to_glib_none().0, event_mask.to_glib());
1499         }
1500     }
1501 
set_focus_on_map(&self, focus_on_map: bool)1502     fn set_focus_on_map(&self, focus_on_map: bool) {
1503         unsafe {
1504             gdk_sys::gdk_window_set_focus_on_map(
1505                 self.as_ref().to_glib_none().0,
1506                 focus_on_map.to_glib(),
1507             );
1508         }
1509     }
1510 
set_fullscreen_mode(&self, mode: FullscreenMode)1511     fn set_fullscreen_mode(&self, mode: FullscreenMode) {
1512         unsafe {
1513             gdk_sys::gdk_window_set_fullscreen_mode(self.as_ref().to_glib_none().0, mode.to_glib());
1514         }
1515     }
1516 
set_functions(&self, functions: WMFunction)1517     fn set_functions(&self, functions: WMFunction) {
1518         unsafe {
1519             gdk_sys::gdk_window_set_functions(self.as_ref().to_glib_none().0, functions.to_glib());
1520         }
1521     }
1522 
set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints)1523     fn set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints) {
1524         unsafe {
1525             gdk_sys::gdk_window_set_geometry_hints(
1526                 self.as_ref().to_glib_none().0,
1527                 geometry.to_glib_none().0,
1528                 geom_mask.to_glib(),
1529             );
1530         }
1531     }
1532 
set_group<P: IsA<Window>>(&self, leader: Option<&P>)1533     fn set_group<P: IsA<Window>>(&self, leader: Option<&P>) {
1534         unsafe {
1535             gdk_sys::gdk_window_set_group(
1536                 self.as_ref().to_glib_none().0,
1537                 leader.map(|p| p.as_ref()).to_glib_none().0,
1538             );
1539         }
1540     }
1541 
set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf])1542     fn set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf]) {
1543         unsafe {
1544             gdk_sys::gdk_window_set_icon_list(
1545                 self.as_ref().to_glib_none().0,
1546                 pixbufs.to_glib_none().0,
1547             );
1548         }
1549     }
1550 
set_icon_name(&self, name: Option<&str>)1551     fn set_icon_name(&self, name: Option<&str>) {
1552         unsafe {
1553             gdk_sys::gdk_window_set_icon_name(
1554                 self.as_ref().to_glib_none().0,
1555                 name.to_glib_none().0,
1556             );
1557         }
1558     }
1559 
1560     //fn set_invalidate_handler<P: Fn(&Window, &cairo::Region) + 'static>(&self, handler: P) {
1561     //    unsafe { TODO: call gdk_sys:gdk_window_set_invalidate_handler() }
1562     //}
1563 
set_keep_above(&self, setting: bool)1564     fn set_keep_above(&self, setting: bool) {
1565         unsafe {
1566             gdk_sys::gdk_window_set_keep_above(self.as_ref().to_glib_none().0, setting.to_glib());
1567         }
1568     }
1569 
set_keep_below(&self, setting: bool)1570     fn set_keep_below(&self, setting: bool) {
1571         unsafe {
1572             gdk_sys::gdk_window_set_keep_below(self.as_ref().to_glib_none().0, setting.to_glib());
1573         }
1574     }
1575 
set_modal_hint(&self, modal: bool)1576     fn set_modal_hint(&self, modal: bool) {
1577         unsafe {
1578             gdk_sys::gdk_window_set_modal_hint(self.as_ref().to_glib_none().0, modal.to_glib());
1579         }
1580     }
1581 
set_opacity(&self, opacity: f64)1582     fn set_opacity(&self, opacity: f64) {
1583         unsafe {
1584             gdk_sys::gdk_window_set_opacity(self.as_ref().to_glib_none().0, opacity);
1585         }
1586     }
1587 
set_opaque_region(&self, region: Option<&cairo::Region>)1588     fn set_opaque_region(&self, region: Option<&cairo::Region>) {
1589         unsafe {
1590             gdk_sys::gdk_window_set_opaque_region(
1591                 self.as_ref().to_glib_none().0,
1592                 mut_override(region.to_glib_none().0),
1593             );
1594         }
1595     }
1596 
set_override_redirect(&self, override_redirect: bool)1597     fn set_override_redirect(&self, override_redirect: bool) {
1598         unsafe {
1599             gdk_sys::gdk_window_set_override_redirect(
1600                 self.as_ref().to_glib_none().0,
1601                 override_redirect.to_glib(),
1602             );
1603         }
1604     }
1605 
1606     #[cfg(any(feature = "v3_18", feature = "dox"))]
set_pass_through(&self, pass_through: bool)1607     fn set_pass_through(&self, pass_through: bool) {
1608         unsafe {
1609             gdk_sys::gdk_window_set_pass_through(
1610                 self.as_ref().to_glib_none().0,
1611                 pass_through.to_glib(),
1612             );
1613         }
1614     }
1615 
set_role(&self, role: &str)1616     fn set_role(&self, role: &str) {
1617         unsafe {
1618             gdk_sys::gdk_window_set_role(self.as_ref().to_glib_none().0, role.to_glib_none().0);
1619         }
1620     }
1621 
set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32)1622     fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32) {
1623         unsafe {
1624             gdk_sys::gdk_window_set_shadow_width(
1625                 self.as_ref().to_glib_none().0,
1626                 left,
1627                 right,
1628                 top,
1629                 bottom,
1630             );
1631         }
1632     }
1633 
set_skip_pager_hint(&self, skips_pager: bool)1634     fn set_skip_pager_hint(&self, skips_pager: bool) {
1635         unsafe {
1636             gdk_sys::gdk_window_set_skip_pager_hint(
1637                 self.as_ref().to_glib_none().0,
1638                 skips_pager.to_glib(),
1639             );
1640         }
1641     }
1642 
set_skip_taskbar_hint(&self, skips_taskbar: bool)1643     fn set_skip_taskbar_hint(&self, skips_taskbar: bool) {
1644         unsafe {
1645             gdk_sys::gdk_window_set_skip_taskbar_hint(
1646                 self.as_ref().to_glib_none().0,
1647                 skips_taskbar.to_glib(),
1648             );
1649         }
1650     }
1651 
set_source_events(&self, source: InputSource, event_mask: EventMask)1652     fn set_source_events(&self, source: InputSource, event_mask: EventMask) {
1653         unsafe {
1654             gdk_sys::gdk_window_set_source_events(
1655                 self.as_ref().to_glib_none().0,
1656                 source.to_glib(),
1657                 event_mask.to_glib(),
1658             );
1659         }
1660     }
1661 
set_startup_id(&self, startup_id: &str)1662     fn set_startup_id(&self, startup_id: &str) {
1663         unsafe {
1664             gdk_sys::gdk_window_set_startup_id(
1665                 self.as_ref().to_glib_none().0,
1666                 startup_id.to_glib_none().0,
1667             );
1668         }
1669     }
1670 
set_static_gravities(&self, use_static: bool) -> bool1671     fn set_static_gravities(&self, use_static: bool) -> bool {
1672         unsafe {
1673             from_glib(gdk_sys::gdk_window_set_static_gravities(
1674                 self.as_ref().to_glib_none().0,
1675                 use_static.to_glib(),
1676             ))
1677         }
1678     }
1679 
set_support_multidevice(&self, support_multidevice: bool)1680     fn set_support_multidevice(&self, support_multidevice: bool) {
1681         unsafe {
1682             gdk_sys::gdk_window_set_support_multidevice(
1683                 self.as_ref().to_glib_none().0,
1684                 support_multidevice.to_glib(),
1685             );
1686         }
1687     }
1688 
set_title(&self, title: &str)1689     fn set_title(&self, title: &str) {
1690         unsafe {
1691             gdk_sys::gdk_window_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
1692         }
1693     }
1694 
set_transient_for<P: IsA<Window>>(&self, parent: &P)1695     fn set_transient_for<P: IsA<Window>>(&self, parent: &P) {
1696         unsafe {
1697             gdk_sys::gdk_window_set_transient_for(
1698                 self.as_ref().to_glib_none().0,
1699                 parent.as_ref().to_glib_none().0,
1700             );
1701         }
1702     }
1703 
set_type_hint(&self, hint: WindowTypeHint)1704     fn set_type_hint(&self, hint: WindowTypeHint) {
1705         unsafe {
1706             gdk_sys::gdk_window_set_type_hint(self.as_ref().to_glib_none().0, hint.to_glib());
1707         }
1708     }
1709 
set_urgency_hint(&self, urgent: bool)1710     fn set_urgency_hint(&self, urgent: bool) {
1711         unsafe {
1712             gdk_sys::gdk_window_set_urgency_hint(self.as_ref().to_glib_none().0, urgent.to_glib());
1713         }
1714     }
1715 
1716     //fn set_user_data(&self, user_data: /*Ignored*/Option<&glib::Object>) {
1717     //    unsafe { TODO: call gdk_sys:gdk_window_set_user_data() }
1718     //}
1719 
shape_combine_region( &self, shape_region: Option<&cairo::Region>, offset_x: i32, offset_y: i32, )1720     fn shape_combine_region(
1721         &self,
1722         shape_region: Option<&cairo::Region>,
1723         offset_x: i32,
1724         offset_y: i32,
1725     ) {
1726         unsafe {
1727             gdk_sys::gdk_window_shape_combine_region(
1728                 self.as_ref().to_glib_none().0,
1729                 shape_region.to_glib_none().0,
1730                 offset_x,
1731                 offset_y,
1732             );
1733         }
1734     }
1735 
show(&self)1736     fn show(&self) {
1737         unsafe {
1738             gdk_sys::gdk_window_show(self.as_ref().to_glib_none().0);
1739         }
1740     }
1741 
show_unraised(&self)1742     fn show_unraised(&self) {
1743         unsafe {
1744             gdk_sys::gdk_window_show_unraised(self.as_ref().to_glib_none().0);
1745         }
1746     }
1747 
show_window_menu(&self, event: &mut Event) -> bool1748     fn show_window_menu(&self, event: &mut Event) -> bool {
1749         unsafe {
1750             from_glib(gdk_sys::gdk_window_show_window_menu(
1751                 self.as_ref().to_glib_none().0,
1752                 event.to_glib_none_mut().0,
1753             ))
1754         }
1755     }
1756 
stick(&self)1757     fn stick(&self) {
1758         unsafe {
1759             gdk_sys::gdk_window_stick(self.as_ref().to_glib_none().0);
1760         }
1761     }
1762 
thaw_toplevel_updates_libgtk_only(&self)1763     fn thaw_toplevel_updates_libgtk_only(&self) {
1764         unsafe {
1765             gdk_sys::gdk_window_thaw_toplevel_updates_libgtk_only(self.as_ref().to_glib_none().0);
1766         }
1767     }
1768 
thaw_updates(&self)1769     fn thaw_updates(&self) {
1770         unsafe {
1771             gdk_sys::gdk_window_thaw_updates(self.as_ref().to_glib_none().0);
1772         }
1773     }
1774 
unfullscreen(&self)1775     fn unfullscreen(&self) {
1776         unsafe {
1777             gdk_sys::gdk_window_unfullscreen(self.as_ref().to_glib_none().0);
1778         }
1779     }
1780 
unmaximize(&self)1781     fn unmaximize(&self) {
1782         unsafe {
1783             gdk_sys::gdk_window_unmaximize(self.as_ref().to_glib_none().0);
1784         }
1785     }
1786 
unstick(&self)1787     fn unstick(&self) {
1788         unsafe {
1789             gdk_sys::gdk_window_unstick(self.as_ref().to_glib_none().0);
1790         }
1791     }
1792 
withdraw(&self)1793     fn withdraw(&self) {
1794         unsafe {
1795             gdk_sys::gdk_window_withdraw(self.as_ref().to_glib_none().0);
1796         }
1797     }
1798 
connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>( &self, f: F, ) -> SignalHandlerId1799     fn connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>(
1800         &self,
1801         f: F,
1802     ) -> SignalHandlerId {
1803         unsafe extern "C" fn create_surface_trampoline<
1804             P,
1805             F: Fn(&P, i32, i32) -> cairo::Surface + 'static,
1806         >(
1807             this: *mut gdk_sys::GdkWindow,
1808             width: libc::c_int,
1809             height: libc::c_int,
1810             f: glib_sys::gpointer,
1811         ) -> *mut cairo_sys::cairo_surface_t
1812         where
1813             P: IsA<Window>,
1814         {
1815             let f: &F = &*(f as *const F);
1816             f(&Window::from_glib_borrow(this).unsafe_cast(), width, height).to_glib_full()
1817         }
1818         unsafe {
1819             let f: Box_<F> = Box_::new(f);
1820             connect_raw(
1821                 self.as_ptr() as *mut _,
1822                 b"create-surface\0".as_ptr() as *const _,
1823                 Some(transmute(create_surface_trampoline::<Self, F> as usize)),
1824                 Box_::into_raw(f),
1825             )
1826         }
1827     }
1828 
1829     //fn connect_from_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
1830     //    Out offscreen_x: *.Double
1831     //    Out offscreen_y: *.Double
1832     //}
1833 
1834     //#[cfg(any(feature = "v3_22", feature = "dox"))]
1835     //fn connect_moved_to_rect<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
1836     //    Unimplemented flipped_rect: *.Pointer
1837     //    Unimplemented final_rect: *.Pointer
1838     //}
1839 
connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>( &self, f: F, ) -> SignalHandlerId1840     fn connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>(
1841         &self,
1842         f: F,
1843     ) -> SignalHandlerId {
1844         unsafe extern "C" fn pick_embedded_child_trampoline<
1845             P,
1846             F: Fn(&P, f64, f64) -> Option<Window> + 'static,
1847         >(
1848             this: *mut gdk_sys::GdkWindow,
1849             x: libc::c_double,
1850             y: libc::c_double,
1851             f: glib_sys::gpointer,
1852         ) -> *mut gdk_sys::GdkWindow
1853         where
1854             P: IsA<Window>,
1855         {
1856             let f: &F = &*(f as *const F);
1857             f(&Window::from_glib_borrow(this).unsafe_cast(), x, y) /*Not checked*/
1858                 .to_glib_none()
1859                 .0
1860         }
1861         unsafe {
1862             let f: Box_<F> = Box_::new(f);
1863             connect_raw(
1864                 self.as_ptr() as *mut _,
1865                 b"pick-embedded-child\0".as_ptr() as *const _,
1866                 Some(transmute(
1867                     pick_embedded_child_trampoline::<Self, F> as usize,
1868                 )),
1869                 Box_::into_raw(f),
1870             )
1871         }
1872     }
1873 
1874     //fn connect_to_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
1875     //    Out embedder_x: *.Double
1876     //    Out embedder_y: *.Double
1877     //}
1878 
connect_property_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1879     fn connect_property_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1880         unsafe extern "C" fn notify_cursor_trampoline<P, F: Fn(&P) + 'static>(
1881             this: *mut gdk_sys::GdkWindow,
1882             _param_spec: glib_sys::gpointer,
1883             f: glib_sys::gpointer,
1884         ) where
1885             P: IsA<Window>,
1886         {
1887             let f: &F = &*(f as *const F);
1888             f(&Window::from_glib_borrow(this).unsafe_cast())
1889         }
1890         unsafe {
1891             let f: Box_<F> = Box_::new(f);
1892             connect_raw(
1893                 self.as_ptr() as *mut _,
1894                 b"notify::cursor\0".as_ptr() as *const _,
1895                 Some(transmute(notify_cursor_trampoline::<Self, F> as usize)),
1896                 Box_::into_raw(f),
1897             )
1898         }
1899     }
1900 }
1901 
1902 impl fmt::Display for Window {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1903     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1904         write!(f, "Window")
1905     }
1906 }
1907