1use cairo;
6use cairo_sys;
7use gdk_pixbuf;
8use gdk_sys;
9use glib::object::Cast;
10use glib::object::IsA;
11use glib::signal::connect_raw;
12use glib::signal::SignalHandlerId;
13use glib::translate::*;
14use glib_sys;
15use libc;
16use std::boxed::Box as Box_;
17use std::fmt;
18use std::mem;
19use std::mem::transmute;
20use std::ptr;
21#[cfg(any(feature = "v3_24", feature = "dox"))]
22use AnchorHints;
23use Cursor;
24use Device;
25use Display;
26use DragProtocol;
27#[cfg(any(feature = "v3_22", feature = "dox"))]
28use DrawingContext;
29#[cfg(any(feature = "v3_16", feature = "dox"))]
30use Error;
31use Event;
32use EventMask;
33use FrameClock;
34use FullscreenMode;
35#[cfg(any(feature = "v3_16", feature = "dox"))]
36use GLContext;
37use Geometry;
38#[cfg(any(feature = "v3_24", feature = "dox"))]
39use Gravity;
40use InputSource;
41use ModifierType;
42use Rectangle;
43use Screen;
44use Visual;
45use WMDecoration;
46use WMFunction;
47use WindowEdge;
48use WindowHints;
49use WindowState;
50use WindowType;
51use WindowTypeHint;
52use RGBA;
53
54glib_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
62impl Window {
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)]
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)]
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
102pub const NONE_WINDOW: Option<&Window> = None;
103
104pub trait WindowExt: 'static {
105 fn beep(&self);
108
109 #[cfg(any(feature = "v3_22", feature = "dox"))]
110 fn begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext>;
111
112 fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32);
113
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)]
124 fn begin_paint_rect(&self, rectangle: &Rectangle);
125
126 #[cfg_attr(feature = "v3_22", deprecated)]
127 fn begin_paint_region(&self, region: &cairo::Region);
128
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
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
148 fn coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64);
149
150 fn coords_to_parent(&self, x: f64, y: f64) -> (f64, f64);
151
152 #[cfg(any(feature = "v3_16", feature = "dox"))]
153 fn create_gl_context(&self) -> Result<GLContext, Error>;
154
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
163 fn deiconify(&self);
164
165 fn destroy(&self);
166
167 fn destroy_notify(&self);
168
169 #[cfg(any(feature = "v3_22", feature = "dox"))]
170 fn end_draw_frame(&self, context: &DrawingContext);
171
172 fn end_paint(&self);
173
174 fn ensure_native(&self) -> bool;
175
176 fn focus(&self, timestamp: u32);
177
178 #[cfg_attr(feature = "v3_16", deprecated)]
179 fn freeze_toplevel_updates_libgtk_only(&self);
180
181 fn freeze_updates(&self);
182
183 fn fullscreen(&self);
184
185 #[cfg(any(feature = "v3_18", feature = "dox"))]
186 fn fullscreen_on_monitor(&self, monitor: i32);
187
188 fn geometry_changed(&self);
189
190 fn get_accept_focus(&self) -> bool;
191
192 fn get_children(&self) -> Vec<Window>;
193
194 fn get_clip_region(&self) -> Option<cairo::Region>;
197
198 #[cfg_attr(feature = "v3_16", deprecated)]
199 fn get_composited(&self) -> bool;
200
201 fn get_cursor(&self) -> Option<Cursor>;
202
203 fn get_decorations(&self) -> Option<WMDecoration>;
204
205 fn get_device_cursor(&self, device: &Device) -> Option<Cursor>;
206
207 fn get_device_events(&self, device: &Device) -> EventMask;
208
209 fn get_device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType);
210
211 fn get_device_position_double(
212 &self,
213 device: &Device,
214 ) -> (Option<Window>, f64, f64, ModifierType);
215
216 fn get_display(&self) -> Display;
217
218 fn get_drag_protocol(&self) -> (DragProtocol, Window);
219
220 fn get_effective_parent(&self) -> Option<Window>;
221
222 fn get_effective_toplevel(&self) -> Window;
223
224 fn get_event_compression(&self) -> bool;
225
226 fn get_events(&self) -> EventMask;
227
228 fn get_focus_on_map(&self) -> bool;
229
230 fn get_frame_clock(&self) -> Option<FrameClock>;
231
232 fn get_frame_extents(&self) -> Rectangle;
233
234 fn get_fullscreen_mode(&self) -> FullscreenMode;
235
236 fn get_geometry(&self) -> (i32, i32, i32, i32);
237
238 fn get_group(&self) -> Option<Window>;
239
240 fn get_height(&self) -> i32;
241
242 fn get_modal_hint(&self) -> bool;
243
244 fn get_origin(&self) -> (i32, i32, i32);
245
246 fn get_parent(&self) -> Option<Window>;
247
248 #[cfg(any(feature = "v3_18", feature = "dox"))]
249 fn get_pass_through(&self) -> bool;
250
251 fn get_position(&self) -> (i32, i32);
252
253 fn get_root_coords(&self, x: i32, y: i32) -> (i32, i32);
254
255 fn get_root_origin(&self) -> (i32, i32);
256
257 fn get_scale_factor(&self) -> i32;
258
259 fn get_screen(&self) -> Screen;
260
261 fn get_source_events(&self, source: InputSource) -> EventMask;
262
263 fn get_state(&self) -> WindowState;
264
265 fn get_support_multidevice(&self) -> bool;
266
267 fn get_toplevel(&self) -> Window;
268
269 fn get_type_hint(&self) -> WindowTypeHint;
270
271 fn get_update_area(&self) -> Option<cairo::Region>;
272
273 fn get_visible_region(&self) -> Option<cairo::Region>;
276
277 fn get_visual(&self) -> Visual;
278
279 fn get_width(&self) -> i32;
280
281 fn get_window_type(&self) -> WindowType;
282
283 fn has_native(&self) -> bool;
284
285 fn hide(&self);
286
287 fn iconify(&self);
288
289 fn input_shape_combine_region(
290 &self,
291 shape_region: &cairo::Region,
292 offset_x: i32,
293 offset_y: i32,
294 );
295
296 fn invalidate_maybe_recurse(
297 &self,
298 region: &cairo::Region,
299 child_func: Option<&mut dyn (FnMut(&Window) -> bool)>,
300 );
301
302 fn invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool);
303
304 fn invalidate_region(&self, region: &cairo::Region, invalidate_children: bool);
305
306 fn is_destroyed(&self) -> bool;
307
308 fn is_input_only(&self) -> bool;
309
310 fn is_shaped(&self) -> bool;
311
312 fn is_viewable(&self) -> bool;
313
314 fn is_visible(&self) -> bool;
315
316 fn lower(&self);
317
318 #[cfg(any(feature = "v3_16", feature = "dox"))]
319 fn mark_paint_from_clip(&self, cr: &cairo::Context);
320
321 fn maximize(&self);
322
323 fn merge_child_input_shapes(&self);
324
325 fn merge_child_shapes(&self);
326
327 fn move_(&self, x: i32, y: i32);
328
329 fn move_region(&self, region: &cairo::Region, dx: i32, dy: i32);
330
331 fn move_resize(&self, x: i32, y: i32, width: i32, height: i32);
332
333 #[cfg(any(feature = "v3_24", feature = "dox"))]
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
344 fn peek_children(&self) -> Vec<Window>;
345
346 #[cfg_attr(feature = "v3_22", deprecated)]
347 fn process_updates(&self, update_children: bool);
348
349 fn raise(&self);
350
351 fn register_dnd(&self);
352
353 fn reparent<P: IsA<Window>>(&self, new_parent: &P, x: i32, y: i32);
356
357 fn resize(&self, width: i32, height: i32);
358
359 fn restack<P: IsA<Window>>(&self, sibling: Option<&P>, above: bool);
360
361 fn scroll(&self, dx: i32, dy: i32);
362
363 fn set_accept_focus(&self, accept_focus: bool);
364
365 #[cfg_attr(feature = "v3_22", deprecated)]
366 fn set_background_rgba(&self, rgba: &RGBA);
367
368 fn set_child_input_shapes(&self);
369
370 fn set_child_shapes(&self);
371
372 #[cfg_attr(feature = "v3_16", deprecated)]
373 fn set_composited(&self, composited: bool);
374
375 fn set_cursor(&self, cursor: Option<&Cursor>);
376
377 fn set_decorations(&self, decorations: WMDecoration);
378
379 fn set_device_cursor(&self, device: &Device, cursor: &Cursor);
380
381 fn set_device_events(&self, device: &Device, event_mask: EventMask);
382
383 fn set_event_compression(&self, event_compression: bool);
384
385 fn set_events(&self, event_mask: EventMask);
386
387 fn set_focus_on_map(&self, focus_on_map: bool);
388
389 fn set_fullscreen_mode(&self, mode: FullscreenMode);
390
391 fn set_functions(&self, functions: WMFunction);
392
393 fn set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints);
394
395 fn set_group<P: IsA<Window>>(&self, leader: Option<&P>);
396
397 fn set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf]);
398
399 fn set_icon_name(&self, name: Option<&str>);
400
401 fn set_keep_above(&self, setting: bool);
404
405 fn set_keep_below(&self, setting: bool);
406
407 fn set_modal_hint(&self, modal: bool);
408
409 fn set_opacity(&self, opacity: f64);
410
411 fn set_opaque_region(&self, region: Option<&cairo::Region>);
412
413 fn set_override_redirect(&self, override_redirect: bool);
414
415 #[cfg(any(feature = "v3_18", feature = "dox"))]
416 fn set_pass_through(&self, pass_through: bool);
417
418 fn set_role(&self, role: &str);
419
420 fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32);
421
422 fn set_skip_pager_hint(&self, skips_pager: bool);
423
424 fn set_skip_taskbar_hint(&self, skips_taskbar: bool);
425
426 fn set_source_events(&self, source: InputSource, event_mask: EventMask);
427
428 fn set_startup_id(&self, startup_id: &str);
429
430 #[cfg_attr(feature = "v3_16", deprecated)]
431 fn set_static_gravities(&self, use_static: bool) -> bool;
432
433 fn set_support_multidevice(&self, support_multidevice: bool);
434
435 fn set_title(&self, title: &str);
436
437 fn set_transient_for<P: IsA<Window>>(&self, parent: &P);
438
439 fn set_type_hint(&self, hint: WindowTypeHint);
440
441 fn set_urgency_hint(&self, urgent: bool);
442
443 fn shape_combine_region(
446 &self,
447 shape_region: Option<&cairo::Region>,
448 offset_x: i32,
449 offset_y: i32,
450 );
451
452 fn show(&self);
453
454 fn show_unraised(&self);
455
456 fn show_window_menu(&self, event: &mut Event) -> bool;
457
458 fn stick(&self);
459
460 #[cfg_attr(feature = "v3_16", deprecated)]
461 fn thaw_toplevel_updates_libgtk_only(&self);
462
463 fn thaw_updates(&self);
464
465 fn unfullscreen(&self);
466
467 fn unmaximize(&self);
468
469 fn unstick(&self);
470
471 fn withdraw(&self);
472
473 fn connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>(
474 &self,
475 f: F,
476 ) -> SignalHandlerId;
477
478 fn connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>(
484 &self,
485 f: F,
486 ) -> SignalHandlerId;
487
488 fn connect_property_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
491}
492
493impl<O: IsA<Window>> WindowExt for O {
494 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"))]
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
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
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
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
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
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
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
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
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"))]
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
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
668 fn deiconify(&self) {
669 unsafe {
670 gdk_sys::gdk_window_deiconify(self.as_ref().to_glib_none().0);
671 }
672 }
673
674 fn destroy(&self) {
675 unsafe {
676 gdk_sys::gdk_window_destroy(self.as_ref().to_glib_none().0);
677 }
678 }
679
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"))]
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
696 fn end_paint(&self) {
697 unsafe {
698 gdk_sys::gdk_window_end_paint(self.as_ref().to_glib_none().0);
699 }
700 }
701
702 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
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
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
722 fn freeze_updates(&self) {
723 unsafe {
724 gdk_sys::gdk_window_freeze_updates(self.as_ref().to_glib_none().0);
725 }
726 }
727
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"))]
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
741 fn geometry_changed(&self) {
742 unsafe {
743 gdk_sys::gdk_window_geometry_changed(self.as_ref().to_glib_none().0);
744 }
745 }
746
747 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
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_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
775 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
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
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
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
815 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
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
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
859 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
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
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
886 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
894 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
902 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
910 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
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
926 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
937 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
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
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
970 fn get_height(&self) -> i32 {
971 unsafe { gdk_sys::gdk_window_get_height(self.as_ref().to_glib_none().0) }
972 }
973
974 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
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
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"))]
1001 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
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
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
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
1042 fn get_scale_factor(&self) -> i32 {
1043 unsafe { gdk_sys::gdk_window_get_scale_factor(self.as_ref().to_glib_none().0) }
1044 }
1045
1046 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
1054 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
1063 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
1071 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
1079 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
1087 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
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_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
1115 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
1123 fn get_width(&self) -> i32 {
1124 unsafe { gdk_sys::gdk_window_get_width(self.as_ref().to_glib_none().0) }
1125 }
1126
1127 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
1135 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
1143 fn hide(&self) {
1144 unsafe {
1145 gdk_sys::gdk_window_hide(self.as_ref().to_glib_none().0);
1146 }
1147 }
1148
1149 fn iconify(&self) {
1150 unsafe {
1151 gdk_sys::gdk_window_iconify(self.as_ref().to_glib_none().0);
1152 }
1153 }
1154
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
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
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
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
1227 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
1235 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
1243 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
1251 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
1259 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
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"))]
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
1283 fn maximize(&self) {
1284 unsafe {
1285 gdk_sys::gdk_window_maximize(self.as_ref().to_glib_none().0);
1286 }
1287 }
1288
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
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
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
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
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"))]
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
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
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
1364 fn raise(&self) {
1365 unsafe {
1366 gdk_sys::gdk_window_raise(self.as_ref().to_glib_none().0);
1367 }
1368 }
1369
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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_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
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
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
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
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
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"))]
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
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
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
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
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
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
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
1671 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
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
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
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
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
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 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
1736 fn show(&self) {
1737 unsafe {
1738 gdk_sys::gdk_window_show(self.as_ref().to_glib_none().0);
1739 }
1740 }
1741
1742 fn show_unraised(&self) {
1743 unsafe {
1744 gdk_sys::gdk_window_show_unraised(self.as_ref().to_glib_none().0);
1745 }
1746 }
1747
1748 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
1757 fn stick(&self) {
1758 unsafe {
1759 gdk_sys::gdk_window_stick(self.as_ref().to_glib_none().0);
1760 }
1761 }
1762
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
1769 fn thaw_updates(&self) {
1770 unsafe {
1771 gdk_sys::gdk_window_thaw_updates(self.as_ref().to_glib_none().0);
1772 }
1773 }
1774
1775 fn unfullscreen(&self) {
1776 unsafe {
1777 gdk_sys::gdk_window_unfullscreen(self.as_ref().to_glib_none().0);
1778 }
1779 }
1780
1781 fn unmaximize(&self) {
1782 unsafe {
1783 gdk_sys::gdk_window_unmaximize(self.as_ref().to_glib_none().0);
1784 }
1785 }
1786
1787 fn unstick(&self) {
1788 unsafe {
1789 gdk_sys::gdk_window_unstick(self.as_ref().to_glib_none().0);
1790 }
1791 }
1792
1793 fn withdraw(&self) {
1794 unsafe {
1795 gdk_sys::gdk_window_withdraw(self.as_ref().to_glib_none().0);
1796 }
1797 }
1798
1799 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_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) .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_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
1902impl fmt::Display for Window {
1903 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1904 write!(f, "Window")
1905 }
1906}