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 #[cfg(any(feature = "v3_24", feature = "dox"))] 6 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 7 use crate::AnchorHints; 8 use crate::Cursor; 9 use crate::Device; 10 use crate::Display; 11 use crate::DragProtocol; 12 #[cfg(any(feature = "v3_22", feature = "dox"))] 13 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 14 use crate::DrawingContext; 15 use crate::Event; 16 use crate::EventMask; 17 use crate::FrameClock; 18 use crate::FullscreenMode; 19 use crate::GLContext; 20 use crate::Geometry; 21 #[cfg(any(feature = "v3_24", feature = "dox"))] 22 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 23 use crate::Gravity; 24 use crate::InputSource; 25 use crate::ModifierType; 26 use crate::Rectangle; 27 use crate::Screen; 28 use crate::Visual; 29 use crate::WMDecoration; 30 use crate::WMFunction; 31 use crate::WindowEdge; 32 use crate::WindowHints; 33 use crate::WindowState; 34 use crate::WindowType; 35 use crate::WindowTypeHint; 36 use crate::RGBA; 37 use glib::object::ObjectType as ObjectType_; 38 use glib::signal::connect_raw; 39 use glib::signal::SignalHandlerId; 40 use glib::translate::*; 41 use std::boxed::Box as Box_; 42 use std::fmt; 43 use std::mem; 44 use std::mem::transmute; 45 use std::ptr; 46 47 glib::wrapper! { 48 #[doc(alias = "GdkWindow")] 49 pub struct Window(Object<ffi::GdkWindow, ffi::GdkWindowClass>); 50 51 match fn { 52 type_ => || ffi::gdk_window_get_type(), 53 } 54 } 55 56 impl Window { 57 //#[doc(alias = "gdk_window_add_filter")] 58 //pub fn add_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>) { 59 // unsafe { TODO: call ffi:gdk_window_add_filter() } 60 //} 61 62 #[doc(alias = "gdk_window_beep")] beep(&self)63 pub fn beep(&self) { 64 unsafe { 65 ffi::gdk_window_beep(self.to_glib_none().0); 66 } 67 } 68 69 #[cfg(any(feature = "v3_22", feature = "dox"))] 70 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 71 #[doc(alias = "gdk_window_begin_draw_frame")] begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext>72 pub fn begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext> { 73 unsafe { 74 from_glib_none(ffi::gdk_window_begin_draw_frame( 75 self.to_glib_none().0, 76 region.to_glib_none().0, 77 )) 78 } 79 } 80 81 #[doc(alias = "gdk_window_begin_move_drag")] begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32)82 pub fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32) { 83 unsafe { 84 ffi::gdk_window_begin_move_drag( 85 self.to_glib_none().0, 86 button, 87 root_x, 88 root_y, 89 timestamp, 90 ); 91 } 92 } 93 94 #[doc(alias = "gdk_window_begin_move_drag_for_device")] begin_move_drag_for_device( &self, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, )95 pub fn begin_move_drag_for_device( 96 &self, 97 device: &Device, 98 button: i32, 99 root_x: i32, 100 root_y: i32, 101 timestamp: u32, 102 ) { 103 unsafe { 104 ffi::gdk_window_begin_move_drag_for_device( 105 self.to_glib_none().0, 106 device.to_glib_none().0, 107 button, 108 root_x, 109 root_y, 110 timestamp, 111 ); 112 } 113 } 114 115 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 116 #[doc(alias = "gdk_window_begin_paint_rect")] begin_paint_rect(&self, rectangle: &Rectangle)117 pub fn begin_paint_rect(&self, rectangle: &Rectangle) { 118 unsafe { 119 ffi::gdk_window_begin_paint_rect(self.to_glib_none().0, rectangle.to_glib_none().0); 120 } 121 } 122 123 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 124 #[doc(alias = "gdk_window_begin_paint_region")] begin_paint_region(&self, region: &cairo::Region)125 pub fn begin_paint_region(&self, region: &cairo::Region) { 126 unsafe { 127 ffi::gdk_window_begin_paint_region(self.to_glib_none().0, region.to_glib_none().0); 128 } 129 } 130 131 #[doc(alias = "gdk_window_begin_resize_drag")] begin_resize_drag( &self, edge: WindowEdge, button: i32, root_x: i32, root_y: i32, timestamp: u32, )132 pub fn begin_resize_drag( 133 &self, 134 edge: WindowEdge, 135 button: i32, 136 root_x: i32, 137 root_y: i32, 138 timestamp: u32, 139 ) { 140 unsafe { 141 ffi::gdk_window_begin_resize_drag( 142 self.to_glib_none().0, 143 edge.into_glib(), 144 button, 145 root_x, 146 root_y, 147 timestamp, 148 ); 149 } 150 } 151 152 #[doc(alias = "gdk_window_begin_resize_drag_for_device")] begin_resize_drag_for_device( &self, edge: WindowEdge, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, )153 pub fn begin_resize_drag_for_device( 154 &self, 155 edge: WindowEdge, 156 device: &Device, 157 button: i32, 158 root_x: i32, 159 root_y: i32, 160 timestamp: u32, 161 ) { 162 unsafe { 163 ffi::gdk_window_begin_resize_drag_for_device( 164 self.to_glib_none().0, 165 edge.into_glib(), 166 device.to_glib_none().0, 167 button, 168 root_x, 169 root_y, 170 timestamp, 171 ); 172 } 173 } 174 175 #[doc(alias = "gdk_window_coords_from_parent")] coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64)176 pub fn coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64) { 177 unsafe { 178 let mut x = mem::MaybeUninit::uninit(); 179 let mut y = mem::MaybeUninit::uninit(); 180 ffi::gdk_window_coords_from_parent( 181 self.to_glib_none().0, 182 parent_x, 183 parent_y, 184 x.as_mut_ptr(), 185 y.as_mut_ptr(), 186 ); 187 let x = x.assume_init(); 188 let y = y.assume_init(); 189 (x, y) 190 } 191 } 192 193 #[doc(alias = "gdk_window_coords_to_parent")] coords_to_parent(&self, x: f64, y: f64) -> (f64, f64)194 pub fn coords_to_parent(&self, x: f64, y: f64) -> (f64, f64) { 195 unsafe { 196 let mut parent_x = mem::MaybeUninit::uninit(); 197 let mut parent_y = mem::MaybeUninit::uninit(); 198 ffi::gdk_window_coords_to_parent( 199 self.to_glib_none().0, 200 x, 201 y, 202 parent_x.as_mut_ptr(), 203 parent_y.as_mut_ptr(), 204 ); 205 let parent_x = parent_x.assume_init(); 206 let parent_y = parent_y.assume_init(); 207 (parent_x, parent_y) 208 } 209 } 210 211 #[doc(alias = "gdk_window_create_gl_context")] create_gl_context(&self) -> Result<GLContext, glib::Error>212 pub fn create_gl_context(&self) -> Result<GLContext, glib::Error> { 213 unsafe { 214 let mut error = ptr::null_mut(); 215 let ret = ffi::gdk_window_create_gl_context(self.to_glib_none().0, &mut error); 216 if error.is_null() { 217 Ok(from_glib_full(ret)) 218 } else { 219 Err(from_glib_full(error)) 220 } 221 } 222 } 223 224 #[doc(alias = "gdk_window_deiconify")] deiconify(&self)225 pub fn deiconify(&self) { 226 unsafe { 227 ffi::gdk_window_deiconify(self.to_glib_none().0); 228 } 229 } 230 231 #[doc(alias = "gdk_window_destroy")] destroy(&self)232 pub fn destroy(&self) { 233 unsafe { 234 ffi::gdk_window_destroy(self.to_glib_none().0); 235 } 236 } 237 238 #[doc(alias = "gdk_window_destroy_notify")] destroy_notify(&self)239 pub fn destroy_notify(&self) { 240 unsafe { 241 ffi::gdk_window_destroy_notify(self.to_glib_none().0); 242 } 243 } 244 245 #[cfg(any(feature = "v3_22", feature = "dox"))] 246 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 247 #[doc(alias = "gdk_window_end_draw_frame")] end_draw_frame(&self, context: &DrawingContext)248 pub fn end_draw_frame(&self, context: &DrawingContext) { 249 unsafe { 250 ffi::gdk_window_end_draw_frame(self.to_glib_none().0, context.to_glib_none().0); 251 } 252 } 253 254 #[doc(alias = "gdk_window_end_paint")] end_paint(&self)255 pub fn end_paint(&self) { 256 unsafe { 257 ffi::gdk_window_end_paint(self.to_glib_none().0); 258 } 259 } 260 261 #[doc(alias = "gdk_window_ensure_native")] ensure_native(&self) -> bool262 pub fn ensure_native(&self) -> bool { 263 unsafe { from_glib(ffi::gdk_window_ensure_native(self.to_glib_none().0)) } 264 } 265 266 #[doc(alias = "gdk_window_focus")] focus(&self, timestamp: u32)267 pub fn focus(&self, timestamp: u32) { 268 unsafe { 269 ffi::gdk_window_focus(self.to_glib_none().0, timestamp); 270 } 271 } 272 273 #[doc(alias = "gdk_window_freeze_updates")] freeze_updates(&self)274 pub fn freeze_updates(&self) { 275 unsafe { 276 ffi::gdk_window_freeze_updates(self.to_glib_none().0); 277 } 278 } 279 280 #[doc(alias = "gdk_window_fullscreen")] fullscreen(&self)281 pub fn fullscreen(&self) { 282 unsafe { 283 ffi::gdk_window_fullscreen(self.to_glib_none().0); 284 } 285 } 286 287 #[doc(alias = "gdk_window_fullscreen_on_monitor")] fullscreen_on_monitor(&self, monitor: i32)288 pub fn fullscreen_on_monitor(&self, monitor: i32) { 289 unsafe { 290 ffi::gdk_window_fullscreen_on_monitor(self.to_glib_none().0, monitor); 291 } 292 } 293 294 #[doc(alias = "gdk_window_geometry_changed")] geometry_changed(&self)295 pub fn geometry_changed(&self) { 296 unsafe { 297 ffi::gdk_window_geometry_changed(self.to_glib_none().0); 298 } 299 } 300 301 #[doc(alias = "gdk_window_get_accept_focus")] 302 #[doc(alias = "get_accept_focus")] accepts_focus(&self) -> bool303 pub fn accepts_focus(&self) -> bool { 304 unsafe { from_glib(ffi::gdk_window_get_accept_focus(self.to_glib_none().0)) } 305 } 306 307 #[doc(alias = "gdk_window_get_children")] 308 #[doc(alias = "get_children")] children(&self) -> Vec<Window>309 pub fn children(&self) -> Vec<Window> { 310 unsafe { 311 FromGlibPtrContainer::from_glib_container(ffi::gdk_window_get_children( 312 self.to_glib_none().0, 313 )) 314 } 315 } 316 317 //#[doc(alias = "gdk_window_get_children_with_user_data")] 318 //#[doc(alias = "get_children_with_user_data")] 319 //pub fn children_with_user_data(&self, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Vec<Window> { 320 // unsafe { TODO: call ffi:gdk_window_get_children_with_user_data() } 321 //} 322 323 #[doc(alias = "gdk_window_get_clip_region")] 324 #[doc(alias = "get_clip_region")] clip_region(&self) -> Option<cairo::Region>325 pub fn clip_region(&self) -> Option<cairo::Region> { 326 unsafe { from_glib_full(ffi::gdk_window_get_clip_region(self.to_glib_none().0)) } 327 } 328 329 #[doc(alias = "gdk_window_get_cursor")] 330 #[doc(alias = "get_cursor")] cursor(&self) -> Option<Cursor>331 pub fn cursor(&self) -> Option<Cursor> { 332 unsafe { from_glib_none(ffi::gdk_window_get_cursor(self.to_glib_none().0)) } 333 } 334 335 #[doc(alias = "gdk_window_get_decorations")] 336 #[doc(alias = "get_decorations")] decorations(&self) -> Option<WMDecoration>337 pub fn decorations(&self) -> Option<WMDecoration> { 338 unsafe { 339 let mut decorations = mem::MaybeUninit::uninit(); 340 let ret = from_glib(ffi::gdk_window_get_decorations( 341 self.to_glib_none().0, 342 decorations.as_mut_ptr(), 343 )); 344 let decorations = decorations.assume_init(); 345 if ret { 346 Some(from_glib(decorations)) 347 } else { 348 None 349 } 350 } 351 } 352 353 #[doc(alias = "gdk_window_get_device_cursor")] 354 #[doc(alias = "get_device_cursor")] device_cursor(&self, device: &Device) -> Option<Cursor>355 pub fn device_cursor(&self, device: &Device) -> Option<Cursor> { 356 unsafe { 357 from_glib_none(ffi::gdk_window_get_device_cursor( 358 self.to_glib_none().0, 359 device.to_glib_none().0, 360 )) 361 } 362 } 363 364 #[doc(alias = "gdk_window_get_device_events")] 365 #[doc(alias = "get_device_events")] device_events(&self, device: &Device) -> EventMask366 pub fn device_events(&self, device: &Device) -> EventMask { 367 unsafe { 368 from_glib(ffi::gdk_window_get_device_events( 369 self.to_glib_none().0, 370 device.to_glib_none().0, 371 )) 372 } 373 } 374 375 #[doc(alias = "gdk_window_get_device_position")] 376 #[doc(alias = "get_device_position")] device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType)377 pub fn device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType) { 378 unsafe { 379 let mut x = mem::MaybeUninit::uninit(); 380 let mut y = mem::MaybeUninit::uninit(); 381 let mut mask = mem::MaybeUninit::uninit(); 382 let ret = from_glib_none(ffi::gdk_window_get_device_position( 383 self.to_glib_none().0, 384 device.to_glib_none().0, 385 x.as_mut_ptr(), 386 y.as_mut_ptr(), 387 mask.as_mut_ptr(), 388 )); 389 let x = x.assume_init(); 390 let y = y.assume_init(); 391 let mask = mask.assume_init(); 392 (ret, x, y, from_glib(mask)) 393 } 394 } 395 396 #[doc(alias = "gdk_window_get_device_position_double")] 397 #[doc(alias = "get_device_position_double")] device_position_double( &self, device: &Device, ) -> (Option<Window>, f64, f64, ModifierType)398 pub fn device_position_double( 399 &self, 400 device: &Device, 401 ) -> (Option<Window>, f64, f64, ModifierType) { 402 unsafe { 403 let mut x = mem::MaybeUninit::uninit(); 404 let mut y = mem::MaybeUninit::uninit(); 405 let mut mask = mem::MaybeUninit::uninit(); 406 let ret = from_glib_none(ffi::gdk_window_get_device_position_double( 407 self.to_glib_none().0, 408 device.to_glib_none().0, 409 x.as_mut_ptr(), 410 y.as_mut_ptr(), 411 mask.as_mut_ptr(), 412 )); 413 let x = x.assume_init(); 414 let y = y.assume_init(); 415 let mask = mask.assume_init(); 416 (ret, x, y, from_glib(mask)) 417 } 418 } 419 420 #[doc(alias = "gdk_window_get_display")] 421 #[doc(alias = "get_display")] display(&self) -> Display422 pub fn display(&self) -> Display { 423 unsafe { from_glib_none(ffi::gdk_window_get_display(self.to_glib_none().0)) } 424 } 425 426 #[doc(alias = "gdk_window_get_drag_protocol")] 427 #[doc(alias = "get_drag_protocol")] drag_protocol(&self) -> (DragProtocol, Window)428 pub fn drag_protocol(&self) -> (DragProtocol, Window) { 429 unsafe { 430 let mut target = ptr::null_mut(); 431 let ret = from_glib(ffi::gdk_window_get_drag_protocol( 432 self.to_glib_none().0, 433 &mut target, 434 )); 435 (ret, from_glib_full(target)) 436 } 437 } 438 439 #[doc(alias = "gdk_window_get_effective_parent")] 440 #[doc(alias = "get_effective_parent")] effective_parent(&self) -> Option<Window>441 pub fn effective_parent(&self) -> Option<Window> { 442 unsafe { from_glib_none(ffi::gdk_window_get_effective_parent(self.to_glib_none().0)) } 443 } 444 445 #[doc(alias = "gdk_window_get_effective_toplevel")] 446 #[doc(alias = "get_effective_toplevel")] effective_toplevel(&self) -> Window447 pub fn effective_toplevel(&self) -> Window { 448 unsafe { 449 from_glib_none(ffi::gdk_window_get_effective_toplevel( 450 self.to_glib_none().0, 451 )) 452 } 453 } 454 455 #[doc(alias = "gdk_window_get_event_compression")] 456 #[doc(alias = "get_event_compression")] does_event_compression(&self) -> bool457 pub fn does_event_compression(&self) -> bool { 458 unsafe { from_glib(ffi::gdk_window_get_event_compression(self.to_glib_none().0)) } 459 } 460 461 #[doc(alias = "gdk_window_get_events")] 462 #[doc(alias = "get_events")] events(&self) -> EventMask463 pub fn events(&self) -> EventMask { 464 unsafe { from_glib(ffi::gdk_window_get_events(self.to_glib_none().0)) } 465 } 466 467 #[doc(alias = "gdk_window_get_focus_on_map")] 468 #[doc(alias = "get_focus_on_map")] gets_focus_on_map(&self) -> bool469 pub fn gets_focus_on_map(&self) -> bool { 470 unsafe { from_glib(ffi::gdk_window_get_focus_on_map(self.to_glib_none().0)) } 471 } 472 473 #[doc(alias = "gdk_window_get_frame_clock")] 474 #[doc(alias = "get_frame_clock")] frame_clock(&self) -> Option<FrameClock>475 pub fn frame_clock(&self) -> Option<FrameClock> { 476 unsafe { from_glib_none(ffi::gdk_window_get_frame_clock(self.to_glib_none().0)) } 477 } 478 479 #[doc(alias = "gdk_window_get_frame_extents")] 480 #[doc(alias = "get_frame_extents")] frame_extents(&self) -> Rectangle481 pub fn frame_extents(&self) -> Rectangle { 482 unsafe { 483 let mut rect = Rectangle::uninitialized(); 484 ffi::gdk_window_get_frame_extents(self.to_glib_none().0, rect.to_glib_none_mut().0); 485 rect 486 } 487 } 488 489 #[doc(alias = "gdk_window_get_fullscreen_mode")] 490 #[doc(alias = "get_fullscreen_mode")] fullscreen_mode(&self) -> FullscreenMode491 pub fn fullscreen_mode(&self) -> FullscreenMode { 492 unsafe { from_glib(ffi::gdk_window_get_fullscreen_mode(self.to_glib_none().0)) } 493 } 494 495 #[doc(alias = "gdk_window_get_geometry")] 496 #[doc(alias = "get_geometry")] geometry(&self) -> (i32, i32, i32, i32)497 pub fn geometry(&self) -> (i32, i32, i32, i32) { 498 unsafe { 499 let mut x = mem::MaybeUninit::uninit(); 500 let mut y = mem::MaybeUninit::uninit(); 501 let mut width = mem::MaybeUninit::uninit(); 502 let mut height = mem::MaybeUninit::uninit(); 503 ffi::gdk_window_get_geometry( 504 self.to_glib_none().0, 505 x.as_mut_ptr(), 506 y.as_mut_ptr(), 507 width.as_mut_ptr(), 508 height.as_mut_ptr(), 509 ); 510 let x = x.assume_init(); 511 let y = y.assume_init(); 512 let width = width.assume_init(); 513 let height = height.assume_init(); 514 (x, y, width, height) 515 } 516 } 517 518 #[doc(alias = "gdk_window_get_group")] 519 #[doc(alias = "get_group")] group(&self) -> Option<Window>520 pub fn group(&self) -> Option<Window> { 521 unsafe { from_glib_none(ffi::gdk_window_get_group(self.to_glib_none().0)) } 522 } 523 524 #[doc(alias = "gdk_window_get_height")] 525 #[doc(alias = "get_height")] height(&self) -> i32526 pub fn height(&self) -> i32 { 527 unsafe { ffi::gdk_window_get_height(self.to_glib_none().0) } 528 } 529 530 #[doc(alias = "gdk_window_get_modal_hint")] 531 #[doc(alias = "get_modal_hint")] is_modal_hint(&self) -> bool532 pub fn is_modal_hint(&self) -> bool { 533 unsafe { from_glib(ffi::gdk_window_get_modal_hint(self.to_glib_none().0)) } 534 } 535 536 #[doc(alias = "gdk_window_get_origin")] 537 #[doc(alias = "get_origin")] origin(&self) -> (i32, i32, i32)538 pub fn origin(&self) -> (i32, i32, i32) { 539 unsafe { 540 let mut x = mem::MaybeUninit::uninit(); 541 let mut y = mem::MaybeUninit::uninit(); 542 let ret = 543 ffi::gdk_window_get_origin(self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr()); 544 let x = x.assume_init(); 545 let y = y.assume_init(); 546 (ret, x, y) 547 } 548 } 549 550 #[doc(alias = "gdk_window_get_parent")] 551 #[doc(alias = "get_parent")] parent(&self) -> Option<Window>552 pub fn parent(&self) -> Option<Window> { 553 unsafe { from_glib_none(ffi::gdk_window_get_parent(self.to_glib_none().0)) } 554 } 555 556 #[doc(alias = "gdk_window_get_pass_through")] 557 #[doc(alias = "get_pass_through")] is_pass_through(&self) -> bool558 pub fn is_pass_through(&self) -> bool { 559 unsafe { from_glib(ffi::gdk_window_get_pass_through(self.to_glib_none().0)) } 560 } 561 562 #[doc(alias = "gdk_window_get_position")] 563 #[doc(alias = "get_position")] position(&self) -> (i32, i32)564 pub fn position(&self) -> (i32, i32) { 565 unsafe { 566 let mut x = mem::MaybeUninit::uninit(); 567 let mut y = mem::MaybeUninit::uninit(); 568 ffi::gdk_window_get_position(self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr()); 569 let x = x.assume_init(); 570 let y = y.assume_init(); 571 (x, y) 572 } 573 } 574 575 #[doc(alias = "gdk_window_get_root_coords")] 576 #[doc(alias = "get_root_coords")] root_coords(&self, x: i32, y: i32) -> (i32, i32)577 pub fn root_coords(&self, x: i32, y: i32) -> (i32, i32) { 578 unsafe { 579 let mut root_x = mem::MaybeUninit::uninit(); 580 let mut root_y = mem::MaybeUninit::uninit(); 581 ffi::gdk_window_get_root_coords( 582 self.to_glib_none().0, 583 x, 584 y, 585 root_x.as_mut_ptr(), 586 root_y.as_mut_ptr(), 587 ); 588 let root_x = root_x.assume_init(); 589 let root_y = root_y.assume_init(); 590 (root_x, root_y) 591 } 592 } 593 594 #[doc(alias = "gdk_window_get_root_origin")] 595 #[doc(alias = "get_root_origin")] root_origin(&self) -> (i32, i32)596 pub fn root_origin(&self) -> (i32, i32) { 597 unsafe { 598 let mut x = mem::MaybeUninit::uninit(); 599 let mut y = mem::MaybeUninit::uninit(); 600 ffi::gdk_window_get_root_origin(self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr()); 601 let x = x.assume_init(); 602 let y = y.assume_init(); 603 (x, y) 604 } 605 } 606 607 #[doc(alias = "gdk_window_get_scale_factor")] 608 #[doc(alias = "get_scale_factor")] scale_factor(&self) -> i32609 pub fn scale_factor(&self) -> i32 { 610 unsafe { ffi::gdk_window_get_scale_factor(self.to_glib_none().0) } 611 } 612 613 #[doc(alias = "gdk_window_get_screen")] 614 #[doc(alias = "get_screen")] screen(&self) -> Screen615 pub fn screen(&self) -> Screen { 616 unsafe { from_glib_none(ffi::gdk_window_get_screen(self.to_glib_none().0)) } 617 } 618 619 #[doc(alias = "gdk_window_get_source_events")] 620 #[doc(alias = "get_source_events")] source_events(&self, source: InputSource) -> EventMask621 pub fn source_events(&self, source: InputSource) -> EventMask { 622 unsafe { 623 from_glib(ffi::gdk_window_get_source_events( 624 self.to_glib_none().0, 625 source.into_glib(), 626 )) 627 } 628 } 629 630 #[doc(alias = "gdk_window_get_state")] 631 #[doc(alias = "get_state")] state(&self) -> WindowState632 pub fn state(&self) -> WindowState { 633 unsafe { from_glib(ffi::gdk_window_get_state(self.to_glib_none().0)) } 634 } 635 636 #[doc(alias = "gdk_window_get_support_multidevice")] 637 #[doc(alias = "get_support_multidevice")] supports_multidevice(&self) -> bool638 pub fn supports_multidevice(&self) -> bool { 639 unsafe { 640 from_glib(ffi::gdk_window_get_support_multidevice( 641 self.to_glib_none().0, 642 )) 643 } 644 } 645 646 #[doc(alias = "gdk_window_get_toplevel")] 647 #[doc(alias = "get_toplevel")] toplevel(&self) -> Window648 pub fn toplevel(&self) -> Window { 649 unsafe { from_glib_none(ffi::gdk_window_get_toplevel(self.to_glib_none().0)) } 650 } 651 652 #[doc(alias = "gdk_window_get_type_hint")] 653 #[doc(alias = "get_type_hint")] type_hint(&self) -> WindowTypeHint654 pub fn type_hint(&self) -> WindowTypeHint { 655 unsafe { from_glib(ffi::gdk_window_get_type_hint(self.to_glib_none().0)) } 656 } 657 658 #[doc(alias = "gdk_window_get_update_area")] 659 #[doc(alias = "get_update_area")] update_area(&self) -> Option<cairo::Region>660 pub fn update_area(&self) -> Option<cairo::Region> { 661 unsafe { from_glib_full(ffi::gdk_window_get_update_area(self.to_glib_none().0)) } 662 } 663 664 #[doc(alias = "gdk_window_get_visible_region")] 665 #[doc(alias = "get_visible_region")] visible_region(&self) -> Option<cairo::Region>666 pub fn visible_region(&self) -> Option<cairo::Region> { 667 unsafe { from_glib_full(ffi::gdk_window_get_visible_region(self.to_glib_none().0)) } 668 } 669 670 #[doc(alias = "gdk_window_get_visual")] 671 #[doc(alias = "get_visual")] visual(&self) -> Visual672 pub fn visual(&self) -> Visual { 673 unsafe { from_glib_none(ffi::gdk_window_get_visual(self.to_glib_none().0)) } 674 } 675 676 #[doc(alias = "gdk_window_get_width")] 677 #[doc(alias = "get_width")] width(&self) -> i32678 pub fn width(&self) -> i32 { 679 unsafe { ffi::gdk_window_get_width(self.to_glib_none().0) } 680 } 681 682 #[doc(alias = "gdk_window_get_window_type")] 683 #[doc(alias = "get_window_type")] window_type(&self) -> WindowType684 pub fn window_type(&self) -> WindowType { 685 unsafe { from_glib(ffi::gdk_window_get_window_type(self.to_glib_none().0)) } 686 } 687 688 #[doc(alias = "gdk_window_has_native")] has_native(&self) -> bool689 pub fn has_native(&self) -> bool { 690 unsafe { from_glib(ffi::gdk_window_has_native(self.to_glib_none().0)) } 691 } 692 693 #[doc(alias = "gdk_window_hide")] hide(&self)694 pub fn hide(&self) { 695 unsafe { 696 ffi::gdk_window_hide(self.to_glib_none().0); 697 } 698 } 699 700 #[doc(alias = "gdk_window_iconify")] iconify(&self)701 pub fn iconify(&self) { 702 unsafe { 703 ffi::gdk_window_iconify(self.to_glib_none().0); 704 } 705 } 706 707 #[doc(alias = "gdk_window_input_shape_combine_region")] input_shape_combine_region( &self, shape_region: &cairo::Region, offset_x: i32, offset_y: i32, )708 pub fn input_shape_combine_region( 709 &self, 710 shape_region: &cairo::Region, 711 offset_x: i32, 712 offset_y: i32, 713 ) { 714 unsafe { 715 ffi::gdk_window_input_shape_combine_region( 716 self.to_glib_none().0, 717 shape_region.to_glib_none().0, 718 offset_x, 719 offset_y, 720 ); 721 } 722 } 723 724 #[doc(alias = "gdk_window_invalidate_maybe_recurse")] invalidate_maybe_recurse( &self, region: &cairo::Region, child_func: Option<&mut dyn (FnMut(&Window) -> bool)>, )725 pub fn invalidate_maybe_recurse( 726 &self, 727 region: &cairo::Region, 728 child_func: Option<&mut dyn (FnMut(&Window) -> bool)>, 729 ) { 730 let child_func_data: Option<&mut dyn (FnMut(&Window) -> bool)> = child_func; 731 unsafe extern "C" fn child_func_func( 732 window: *mut ffi::GdkWindow, 733 user_data: glib::ffi::gpointer, 734 ) -> glib::ffi::gboolean { 735 let window = from_glib_borrow(window); 736 let callback: *mut Option<&mut dyn (FnMut(&Window) -> bool)> = 737 user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&Window) -> bool)>; 738 let res = if let Some(ref mut callback) = *callback { 739 callback(&window) 740 } else { 741 panic!("cannot get closure...") 742 }; 743 res.into_glib() 744 } 745 let child_func = if child_func_data.is_some() { 746 Some(child_func_func as _) 747 } else { 748 None 749 }; 750 let super_callback0: &Option<&mut dyn (FnMut(&Window) -> bool)> = &child_func_data; 751 unsafe { 752 ffi::gdk_window_invalidate_maybe_recurse( 753 self.to_glib_none().0, 754 region.to_glib_none().0, 755 child_func, 756 super_callback0 as *const _ as usize as *mut _, 757 ); 758 } 759 } 760 761 #[doc(alias = "gdk_window_invalidate_rect")] invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool)762 pub fn invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool) { 763 unsafe { 764 ffi::gdk_window_invalidate_rect( 765 self.to_glib_none().0, 766 rect.to_glib_none().0, 767 invalidate_children.into_glib(), 768 ); 769 } 770 } 771 772 #[doc(alias = "gdk_window_invalidate_region")] invalidate_region(&self, region: &cairo::Region, invalidate_children: bool)773 pub fn invalidate_region(&self, region: &cairo::Region, invalidate_children: bool) { 774 unsafe { 775 ffi::gdk_window_invalidate_region( 776 self.to_glib_none().0, 777 region.to_glib_none().0, 778 invalidate_children.into_glib(), 779 ); 780 } 781 } 782 783 #[doc(alias = "gdk_window_is_destroyed")] is_destroyed(&self) -> bool784 pub fn is_destroyed(&self) -> bool { 785 unsafe { from_glib(ffi::gdk_window_is_destroyed(self.to_glib_none().0)) } 786 } 787 788 #[doc(alias = "gdk_window_is_input_only")] is_input_only(&self) -> bool789 pub fn is_input_only(&self) -> bool { 790 unsafe { from_glib(ffi::gdk_window_is_input_only(self.to_glib_none().0)) } 791 } 792 793 #[doc(alias = "gdk_window_is_shaped")] is_shaped(&self) -> bool794 pub fn is_shaped(&self) -> bool { 795 unsafe { from_glib(ffi::gdk_window_is_shaped(self.to_glib_none().0)) } 796 } 797 798 #[doc(alias = "gdk_window_is_viewable")] is_viewable(&self) -> bool799 pub fn is_viewable(&self) -> bool { 800 unsafe { from_glib(ffi::gdk_window_is_viewable(self.to_glib_none().0)) } 801 } 802 803 #[doc(alias = "gdk_window_is_visible")] is_visible(&self) -> bool804 pub fn is_visible(&self) -> bool { 805 unsafe { from_glib(ffi::gdk_window_is_visible(self.to_glib_none().0)) } 806 } 807 808 #[doc(alias = "gdk_window_lower")] lower(&self)809 pub fn lower(&self) { 810 unsafe { 811 ffi::gdk_window_lower(self.to_glib_none().0); 812 } 813 } 814 815 #[doc(alias = "gdk_window_mark_paint_from_clip")] mark_paint_from_clip(&self, cr: &cairo::Context)816 pub fn mark_paint_from_clip(&self, cr: &cairo::Context) { 817 unsafe { 818 ffi::gdk_window_mark_paint_from_clip( 819 self.to_glib_none().0, 820 mut_override(cr.to_glib_none().0), 821 ); 822 } 823 } 824 825 #[doc(alias = "gdk_window_maximize")] maximize(&self)826 pub fn maximize(&self) { 827 unsafe { 828 ffi::gdk_window_maximize(self.to_glib_none().0); 829 } 830 } 831 832 #[doc(alias = "gdk_window_merge_child_input_shapes")] merge_child_input_shapes(&self)833 pub fn merge_child_input_shapes(&self) { 834 unsafe { 835 ffi::gdk_window_merge_child_input_shapes(self.to_glib_none().0); 836 } 837 } 838 839 #[doc(alias = "gdk_window_merge_child_shapes")] merge_child_shapes(&self)840 pub fn merge_child_shapes(&self) { 841 unsafe { 842 ffi::gdk_window_merge_child_shapes(self.to_glib_none().0); 843 } 844 } 845 846 #[doc(alias = "gdk_window_move")] 847 #[doc(alias = "move")] move_(&self, x: i32, y: i32)848 pub fn move_(&self, x: i32, y: i32) { 849 unsafe { 850 ffi::gdk_window_move(self.to_glib_none().0, x, y); 851 } 852 } 853 854 #[doc(alias = "gdk_window_move_region")] move_region(&self, region: &cairo::Region, dx: i32, dy: i32)855 pub fn move_region(&self, region: &cairo::Region, dx: i32, dy: i32) { 856 unsafe { 857 ffi::gdk_window_move_region(self.to_glib_none().0, region.to_glib_none().0, dx, dy); 858 } 859 } 860 861 #[doc(alias = "gdk_window_move_resize")] move_resize(&self, x: i32, y: i32, width: i32, height: i32)862 pub fn move_resize(&self, x: i32, y: i32, width: i32, height: i32) { 863 unsafe { 864 ffi::gdk_window_move_resize(self.to_glib_none().0, x, y, width, height); 865 } 866 } 867 868 #[cfg(any(feature = "v3_24", feature = "dox"))] 869 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] 870 #[doc(alias = "gdk_window_move_to_rect")] move_to_rect( &self, rect: &Rectangle, rect_anchor: Gravity, window_anchor: Gravity, anchor_hints: AnchorHints, rect_anchor_dx: i32, rect_anchor_dy: i32, )871 pub fn move_to_rect( 872 &self, 873 rect: &Rectangle, 874 rect_anchor: Gravity, 875 window_anchor: Gravity, 876 anchor_hints: AnchorHints, 877 rect_anchor_dx: i32, 878 rect_anchor_dy: i32, 879 ) { 880 unsafe { 881 ffi::gdk_window_move_to_rect( 882 self.to_glib_none().0, 883 rect.to_glib_none().0, 884 rect_anchor.into_glib(), 885 window_anchor.into_glib(), 886 anchor_hints.into_glib(), 887 rect_anchor_dx, 888 rect_anchor_dy, 889 ); 890 } 891 } 892 893 #[doc(alias = "gdk_window_peek_children")] peek_children(&self) -> Vec<Window>894 pub fn peek_children(&self) -> Vec<Window> { 895 unsafe { 896 FromGlibPtrContainer::from_glib_none(ffi::gdk_window_peek_children( 897 self.to_glib_none().0, 898 )) 899 } 900 } 901 902 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 903 #[doc(alias = "gdk_window_process_updates")] process_updates(&self, update_children: bool)904 pub fn process_updates(&self, update_children: bool) { 905 unsafe { 906 ffi::gdk_window_process_updates(self.to_glib_none().0, update_children.into_glib()); 907 } 908 } 909 910 #[doc(alias = "gdk_window_raise")] raise(&self)911 pub fn raise(&self) { 912 unsafe { 913 ffi::gdk_window_raise(self.to_glib_none().0); 914 } 915 } 916 917 #[doc(alias = "gdk_window_register_dnd")] register_dnd(&self)918 pub fn register_dnd(&self) { 919 unsafe { 920 ffi::gdk_window_register_dnd(self.to_glib_none().0); 921 } 922 } 923 924 //#[doc(alias = "gdk_window_remove_filter")] 925 //pub fn remove_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>) { 926 // unsafe { TODO: call ffi:gdk_window_remove_filter() } 927 //} 928 929 #[doc(alias = "gdk_window_reparent")] reparent(&self, new_parent: &Window, x: i32, y: i32)930 pub fn reparent(&self, new_parent: &Window, x: i32, y: i32) { 931 unsafe { 932 ffi::gdk_window_reparent(self.to_glib_none().0, new_parent.to_glib_none().0, x, y); 933 } 934 } 935 936 #[doc(alias = "gdk_window_resize")] resize(&self, width: i32, height: i32)937 pub fn resize(&self, width: i32, height: i32) { 938 unsafe { 939 ffi::gdk_window_resize(self.to_glib_none().0, width, height); 940 } 941 } 942 943 #[doc(alias = "gdk_window_restack")] restack(&self, sibling: Option<&Window>, above: bool)944 pub fn restack(&self, sibling: Option<&Window>, above: bool) { 945 unsafe { 946 ffi::gdk_window_restack( 947 self.to_glib_none().0, 948 sibling.to_glib_none().0, 949 above.into_glib(), 950 ); 951 } 952 } 953 954 #[doc(alias = "gdk_window_scroll")] scroll(&self, dx: i32, dy: i32)955 pub fn scroll(&self, dx: i32, dy: i32) { 956 unsafe { 957 ffi::gdk_window_scroll(self.to_glib_none().0, dx, dy); 958 } 959 } 960 961 #[doc(alias = "gdk_window_set_accept_focus")] set_accept_focus(&self, accept_focus: bool)962 pub fn set_accept_focus(&self, accept_focus: bool) { 963 unsafe { 964 ffi::gdk_window_set_accept_focus(self.to_glib_none().0, accept_focus.into_glib()); 965 } 966 } 967 968 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 969 #[doc(alias = "gdk_window_set_background_rgba")] set_background_rgba(&self, rgba: &RGBA)970 pub fn set_background_rgba(&self, rgba: &RGBA) { 971 unsafe { 972 ffi::gdk_window_set_background_rgba(self.to_glib_none().0, rgba.to_glib_none().0); 973 } 974 } 975 976 #[doc(alias = "gdk_window_set_child_input_shapes")] set_child_input_shapes(&self)977 pub fn set_child_input_shapes(&self) { 978 unsafe { 979 ffi::gdk_window_set_child_input_shapes(self.to_glib_none().0); 980 } 981 } 982 983 #[doc(alias = "gdk_window_set_child_shapes")] set_child_shapes(&self)984 pub fn set_child_shapes(&self) { 985 unsafe { 986 ffi::gdk_window_set_child_shapes(self.to_glib_none().0); 987 } 988 } 989 990 #[doc(alias = "gdk_window_set_cursor")] set_cursor(&self, cursor: Option<&Cursor>)991 pub fn set_cursor(&self, cursor: Option<&Cursor>) { 992 unsafe { 993 ffi::gdk_window_set_cursor(self.to_glib_none().0, cursor.to_glib_none().0); 994 } 995 } 996 997 #[doc(alias = "gdk_window_set_decorations")] set_decorations(&self, decorations: WMDecoration)998 pub fn set_decorations(&self, decorations: WMDecoration) { 999 unsafe { 1000 ffi::gdk_window_set_decorations(self.to_glib_none().0, decorations.into_glib()); 1001 } 1002 } 1003 1004 #[doc(alias = "gdk_window_set_device_cursor")] set_device_cursor(&self, device: &Device, cursor: &Cursor)1005 pub fn set_device_cursor(&self, device: &Device, cursor: &Cursor) { 1006 unsafe { 1007 ffi::gdk_window_set_device_cursor( 1008 self.to_glib_none().0, 1009 device.to_glib_none().0, 1010 cursor.to_glib_none().0, 1011 ); 1012 } 1013 } 1014 1015 #[doc(alias = "gdk_window_set_device_events")] set_device_events(&self, device: &Device, event_mask: EventMask)1016 pub fn set_device_events(&self, device: &Device, event_mask: EventMask) { 1017 unsafe { 1018 ffi::gdk_window_set_device_events( 1019 self.to_glib_none().0, 1020 device.to_glib_none().0, 1021 event_mask.into_glib(), 1022 ); 1023 } 1024 } 1025 1026 #[doc(alias = "gdk_window_set_event_compression")] set_event_compression(&self, event_compression: bool)1027 pub fn set_event_compression(&self, event_compression: bool) { 1028 unsafe { 1029 ffi::gdk_window_set_event_compression( 1030 self.to_glib_none().0, 1031 event_compression.into_glib(), 1032 ); 1033 } 1034 } 1035 1036 #[doc(alias = "gdk_window_set_events")] set_events(&self, event_mask: EventMask)1037 pub fn set_events(&self, event_mask: EventMask) { 1038 unsafe { 1039 ffi::gdk_window_set_events(self.to_glib_none().0, event_mask.into_glib()); 1040 } 1041 } 1042 1043 #[doc(alias = "gdk_window_set_focus_on_map")] set_focus_on_map(&self, focus_on_map: bool)1044 pub fn set_focus_on_map(&self, focus_on_map: bool) { 1045 unsafe { 1046 ffi::gdk_window_set_focus_on_map(self.to_glib_none().0, focus_on_map.into_glib()); 1047 } 1048 } 1049 1050 #[doc(alias = "gdk_window_set_fullscreen_mode")] set_fullscreen_mode(&self, mode: FullscreenMode)1051 pub fn set_fullscreen_mode(&self, mode: FullscreenMode) { 1052 unsafe { 1053 ffi::gdk_window_set_fullscreen_mode(self.to_glib_none().0, mode.into_glib()); 1054 } 1055 } 1056 1057 #[doc(alias = "gdk_window_set_functions")] set_functions(&self, functions: WMFunction)1058 pub fn set_functions(&self, functions: WMFunction) { 1059 unsafe { 1060 ffi::gdk_window_set_functions(self.to_glib_none().0, functions.into_glib()); 1061 } 1062 } 1063 1064 #[doc(alias = "gdk_window_set_geometry_hints")] set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints)1065 pub fn set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints) { 1066 unsafe { 1067 ffi::gdk_window_set_geometry_hints( 1068 self.to_glib_none().0, 1069 geometry.to_glib_none().0, 1070 geom_mask.into_glib(), 1071 ); 1072 } 1073 } 1074 1075 #[doc(alias = "gdk_window_set_group")] set_group(&self, leader: Option<&Window>)1076 pub fn set_group(&self, leader: Option<&Window>) { 1077 unsafe { 1078 ffi::gdk_window_set_group(self.to_glib_none().0, leader.to_glib_none().0); 1079 } 1080 } 1081 1082 #[doc(alias = "gdk_window_set_icon_list")] set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf])1083 pub fn set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf]) { 1084 unsafe { 1085 ffi::gdk_window_set_icon_list(self.to_glib_none().0, pixbufs.to_glib_none().0); 1086 } 1087 } 1088 1089 #[doc(alias = "gdk_window_set_icon_name")] set_icon_name(&self, name: Option<&str>)1090 pub fn set_icon_name(&self, name: Option<&str>) { 1091 unsafe { 1092 ffi::gdk_window_set_icon_name(self.to_glib_none().0, name.to_glib_none().0); 1093 } 1094 } 1095 1096 //#[doc(alias = "gdk_window_set_invalidate_handler")] 1097 //pub fn set_invalidate_handler<P: Fn(&Window, &cairo::Region) + 'static>(&self, handler: P) { 1098 // unsafe { TODO: call ffi:gdk_window_set_invalidate_handler() } 1099 //} 1100 1101 #[doc(alias = "gdk_window_set_keep_above")] set_keep_above(&self, setting: bool)1102 pub fn set_keep_above(&self, setting: bool) { 1103 unsafe { 1104 ffi::gdk_window_set_keep_above(self.to_glib_none().0, setting.into_glib()); 1105 } 1106 } 1107 1108 #[doc(alias = "gdk_window_set_keep_below")] set_keep_below(&self, setting: bool)1109 pub fn set_keep_below(&self, setting: bool) { 1110 unsafe { 1111 ffi::gdk_window_set_keep_below(self.to_glib_none().0, setting.into_glib()); 1112 } 1113 } 1114 1115 #[doc(alias = "gdk_window_set_modal_hint")] set_modal_hint(&self, modal: bool)1116 pub fn set_modal_hint(&self, modal: bool) { 1117 unsafe { 1118 ffi::gdk_window_set_modal_hint(self.to_glib_none().0, modal.into_glib()); 1119 } 1120 } 1121 1122 #[doc(alias = "gdk_window_set_opacity")] set_opacity(&self, opacity: f64)1123 pub fn set_opacity(&self, opacity: f64) { 1124 unsafe { 1125 ffi::gdk_window_set_opacity(self.to_glib_none().0, opacity); 1126 } 1127 } 1128 1129 #[doc(alias = "gdk_window_set_opaque_region")] set_opaque_region(&self, region: Option<&cairo::Region>)1130 pub fn set_opaque_region(&self, region: Option<&cairo::Region>) { 1131 unsafe { 1132 ffi::gdk_window_set_opaque_region( 1133 self.to_glib_none().0, 1134 mut_override(region.to_glib_none().0), 1135 ); 1136 } 1137 } 1138 1139 #[doc(alias = "gdk_window_set_override_redirect")] set_override_redirect(&self, override_redirect: bool)1140 pub fn set_override_redirect(&self, override_redirect: bool) { 1141 unsafe { 1142 ffi::gdk_window_set_override_redirect( 1143 self.to_glib_none().0, 1144 override_redirect.into_glib(), 1145 ); 1146 } 1147 } 1148 1149 #[doc(alias = "gdk_window_set_pass_through")] set_pass_through(&self, pass_through: bool)1150 pub fn set_pass_through(&self, pass_through: bool) { 1151 unsafe { 1152 ffi::gdk_window_set_pass_through(self.to_glib_none().0, pass_through.into_glib()); 1153 } 1154 } 1155 1156 #[doc(alias = "gdk_window_set_role")] set_role(&self, role: &str)1157 pub fn set_role(&self, role: &str) { 1158 unsafe { 1159 ffi::gdk_window_set_role(self.to_glib_none().0, role.to_glib_none().0); 1160 } 1161 } 1162 1163 #[doc(alias = "gdk_window_set_shadow_width")] set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32)1164 pub fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32) { 1165 unsafe { 1166 ffi::gdk_window_set_shadow_width(self.to_glib_none().0, left, right, top, bottom); 1167 } 1168 } 1169 1170 #[doc(alias = "gdk_window_set_skip_pager_hint")] set_skip_pager_hint(&self, skips_pager: bool)1171 pub fn set_skip_pager_hint(&self, skips_pager: bool) { 1172 unsafe { 1173 ffi::gdk_window_set_skip_pager_hint(self.to_glib_none().0, skips_pager.into_glib()); 1174 } 1175 } 1176 1177 #[doc(alias = "gdk_window_set_skip_taskbar_hint")] set_skip_taskbar_hint(&self, skips_taskbar: bool)1178 pub fn set_skip_taskbar_hint(&self, skips_taskbar: bool) { 1179 unsafe { 1180 ffi::gdk_window_set_skip_taskbar_hint(self.to_glib_none().0, skips_taskbar.into_glib()); 1181 } 1182 } 1183 1184 #[doc(alias = "gdk_window_set_source_events")] set_source_events(&self, source: InputSource, event_mask: EventMask)1185 pub fn set_source_events(&self, source: InputSource, event_mask: EventMask) { 1186 unsafe { 1187 ffi::gdk_window_set_source_events( 1188 self.to_glib_none().0, 1189 source.into_glib(), 1190 event_mask.into_glib(), 1191 ); 1192 } 1193 } 1194 1195 #[doc(alias = "gdk_window_set_startup_id")] set_startup_id(&self, startup_id: &str)1196 pub fn set_startup_id(&self, startup_id: &str) { 1197 unsafe { 1198 ffi::gdk_window_set_startup_id(self.to_glib_none().0, startup_id.to_glib_none().0); 1199 } 1200 } 1201 1202 #[doc(alias = "gdk_window_set_support_multidevice")] set_support_multidevice(&self, support_multidevice: bool)1203 pub fn set_support_multidevice(&self, support_multidevice: bool) { 1204 unsafe { 1205 ffi::gdk_window_set_support_multidevice( 1206 self.to_glib_none().0, 1207 support_multidevice.into_glib(), 1208 ); 1209 } 1210 } 1211 1212 #[doc(alias = "gdk_window_set_title")] set_title(&self, title: &str)1213 pub fn set_title(&self, title: &str) { 1214 unsafe { 1215 ffi::gdk_window_set_title(self.to_glib_none().0, title.to_glib_none().0); 1216 } 1217 } 1218 1219 #[doc(alias = "gdk_window_set_transient_for")] set_transient_for(&self, parent: &Window)1220 pub fn set_transient_for(&self, parent: &Window) { 1221 unsafe { 1222 ffi::gdk_window_set_transient_for(self.to_glib_none().0, parent.to_glib_none().0); 1223 } 1224 } 1225 1226 #[doc(alias = "gdk_window_set_type_hint")] set_type_hint(&self, hint: WindowTypeHint)1227 pub fn set_type_hint(&self, hint: WindowTypeHint) { 1228 unsafe { 1229 ffi::gdk_window_set_type_hint(self.to_glib_none().0, hint.into_glib()); 1230 } 1231 } 1232 1233 #[doc(alias = "gdk_window_set_urgency_hint")] set_urgency_hint(&self, urgent: bool)1234 pub fn set_urgency_hint(&self, urgent: bool) { 1235 unsafe { 1236 ffi::gdk_window_set_urgency_hint(self.to_glib_none().0, urgent.into_glib()); 1237 } 1238 } 1239 1240 #[doc(alias = "gdk_window_shape_combine_region")] shape_combine_region( &self, shape_region: Option<&cairo::Region>, offset_x: i32, offset_y: i32, )1241 pub fn shape_combine_region( 1242 &self, 1243 shape_region: Option<&cairo::Region>, 1244 offset_x: i32, 1245 offset_y: i32, 1246 ) { 1247 unsafe { 1248 ffi::gdk_window_shape_combine_region( 1249 self.to_glib_none().0, 1250 shape_region.to_glib_none().0, 1251 offset_x, 1252 offset_y, 1253 ); 1254 } 1255 } 1256 1257 #[doc(alias = "gdk_window_show")] show(&self)1258 pub fn show(&self) { 1259 unsafe { 1260 ffi::gdk_window_show(self.to_glib_none().0); 1261 } 1262 } 1263 1264 #[doc(alias = "gdk_window_show_unraised")] show_unraised(&self)1265 pub fn show_unraised(&self) { 1266 unsafe { 1267 ffi::gdk_window_show_unraised(self.to_glib_none().0); 1268 } 1269 } 1270 1271 #[doc(alias = "gdk_window_show_window_menu")] show_window_menu(&self, event: &mut Event) -> bool1272 pub fn show_window_menu(&self, event: &mut Event) -> bool { 1273 unsafe { 1274 from_glib(ffi::gdk_window_show_window_menu( 1275 self.to_glib_none().0, 1276 event.to_glib_none_mut().0, 1277 )) 1278 } 1279 } 1280 1281 #[doc(alias = "gdk_window_stick")] stick(&self)1282 pub fn stick(&self) { 1283 unsafe { 1284 ffi::gdk_window_stick(self.to_glib_none().0); 1285 } 1286 } 1287 1288 #[doc(alias = "gdk_window_thaw_updates")] thaw_updates(&self)1289 pub fn thaw_updates(&self) { 1290 unsafe { 1291 ffi::gdk_window_thaw_updates(self.to_glib_none().0); 1292 } 1293 } 1294 1295 #[doc(alias = "gdk_window_unfullscreen")] unfullscreen(&self)1296 pub fn unfullscreen(&self) { 1297 unsafe { 1298 ffi::gdk_window_unfullscreen(self.to_glib_none().0); 1299 } 1300 } 1301 1302 #[doc(alias = "gdk_window_unmaximize")] unmaximize(&self)1303 pub fn unmaximize(&self) { 1304 unsafe { 1305 ffi::gdk_window_unmaximize(self.to_glib_none().0); 1306 } 1307 } 1308 1309 #[doc(alias = "gdk_window_unstick")] unstick(&self)1310 pub fn unstick(&self) { 1311 unsafe { 1312 ffi::gdk_window_unstick(self.to_glib_none().0); 1313 } 1314 } 1315 1316 #[doc(alias = "gdk_window_withdraw")] withdraw(&self)1317 pub fn withdraw(&self) { 1318 unsafe { 1319 ffi::gdk_window_withdraw(self.to_glib_none().0); 1320 } 1321 } 1322 1323 #[doc(alias = "gdk_window_constrain_size")] constrain_size( geometry: &mut Geometry, flags: WindowHints, width: i32, height: i32, ) -> (i32, i32)1324 pub fn constrain_size( 1325 geometry: &mut Geometry, 1326 flags: WindowHints, 1327 width: i32, 1328 height: i32, 1329 ) -> (i32, i32) { 1330 assert_initialized_main_thread!(); 1331 unsafe { 1332 let mut new_width = mem::MaybeUninit::uninit(); 1333 let mut new_height = mem::MaybeUninit::uninit(); 1334 ffi::gdk_window_constrain_size( 1335 geometry.to_glib_none_mut().0, 1336 flags.into_glib(), 1337 width, 1338 height, 1339 new_width.as_mut_ptr(), 1340 new_height.as_mut_ptr(), 1341 ); 1342 let new_width = new_width.assume_init(); 1343 let new_height = new_height.assume_init(); 1344 (new_width, new_height) 1345 } 1346 } 1347 1348 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 1349 #[doc(alias = "gdk_window_process_all_updates")] process_all_updates()1350 pub fn process_all_updates() { 1351 assert_initialized_main_thread!(); 1352 unsafe { 1353 ffi::gdk_window_process_all_updates(); 1354 } 1355 } 1356 1357 #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] 1358 #[doc(alias = "gdk_window_set_debug_updates")] set_debug_updates(setting: bool)1359 pub fn set_debug_updates(setting: bool) { 1360 assert_initialized_main_thread!(); 1361 unsafe { 1362 ffi::gdk_window_set_debug_updates(setting.into_glib()); 1363 } 1364 } 1365 1366 #[doc(alias = "create-surface")] connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>( &self, f: F, ) -> SignalHandlerId1367 pub fn connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>( 1368 &self, 1369 f: F, 1370 ) -> SignalHandlerId { 1371 unsafe extern "C" fn create_surface_trampoline< 1372 F: Fn(&Window, i32, i32) -> cairo::Surface + 'static, 1373 >( 1374 this: *mut ffi::GdkWindow, 1375 width: libc::c_int, 1376 height: libc::c_int, 1377 f: glib::ffi::gpointer, 1378 ) -> *mut cairo::ffi::cairo_surface_t { 1379 let f: &F = &*(f as *const F); 1380 f(&from_glib_borrow(this), width, height).to_glib_full() 1381 } 1382 unsafe { 1383 let f: Box_<F> = Box_::new(f); 1384 connect_raw( 1385 self.as_ptr() as *mut _, 1386 b"create-surface\0".as_ptr() as *const _, 1387 Some(transmute::<_, unsafe extern "C" fn()>( 1388 create_surface_trampoline::<F> as *const (), 1389 )), 1390 Box_::into_raw(f), 1391 ) 1392 } 1393 } 1394 1395 //#[doc(alias = "from-embedder")] 1396 //pub fn connect_from_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId { 1397 // Out offscreen_x: *.Double 1398 // Out offscreen_y: *.Double 1399 //} 1400 1401 //#[cfg(any(feature = "v3_22", feature = "dox"))] 1402 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 1403 //#[doc(alias = "moved-to-rect")] 1404 //pub fn connect_moved_to_rect<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId { 1405 // Unimplemented flipped_rect: *.Pointer 1406 // Unimplemented final_rect: *.Pointer 1407 //} 1408 1409 #[doc(alias = "pick-embedded-child")] connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>( &self, f: F, ) -> SignalHandlerId1410 pub fn connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>( 1411 &self, 1412 f: F, 1413 ) -> SignalHandlerId { 1414 unsafe extern "C" fn pick_embedded_child_trampoline< 1415 F: Fn(&Window, f64, f64) -> Option<Window> + 'static, 1416 >( 1417 this: *mut ffi::GdkWindow, 1418 x: libc::c_double, 1419 y: libc::c_double, 1420 f: glib::ffi::gpointer, 1421 ) -> *mut ffi::GdkWindow { 1422 let f: &F = &*(f as *const F); 1423 f(&from_glib_borrow(this), x, y) /*Not checked*/ 1424 .to_glib_none() 1425 .0 1426 } 1427 unsafe { 1428 let f: Box_<F> = Box_::new(f); 1429 connect_raw( 1430 self.as_ptr() as *mut _, 1431 b"pick-embedded-child\0".as_ptr() as *const _, 1432 Some(transmute::<_, unsafe extern "C" fn()>( 1433 pick_embedded_child_trampoline::<F> as *const (), 1434 )), 1435 Box_::into_raw(f), 1436 ) 1437 } 1438 } 1439 1440 //#[doc(alias = "to-embedder")] 1441 //pub fn connect_to_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId { 1442 // Out embedder_x: *.Double 1443 // Out embedder_y: *.Double 1444 //} 1445 1446 #[doc(alias = "cursor")] connect_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1447 pub fn connect_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1448 unsafe extern "C" fn notify_cursor_trampoline<F: Fn(&Window) + 'static>( 1449 this: *mut ffi::GdkWindow, 1450 _param_spec: glib::ffi::gpointer, 1451 f: glib::ffi::gpointer, 1452 ) { 1453 let f: &F = &*(f as *const F); 1454 f(&from_glib_borrow(this)) 1455 } 1456 unsafe { 1457 let f: Box_<F> = Box_::new(f); 1458 connect_raw( 1459 self.as_ptr() as *mut _, 1460 b"notify::cursor\0".as_ptr() as *const _, 1461 Some(transmute::<_, unsafe extern "C" fn()>( 1462 notify_cursor_trampoline::<F> as *const (), 1463 )), 1464 Box_::into_raw(f), 1465 ) 1466 } 1467 } 1468 } 1469 1470 impl fmt::Display for Window { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1471 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1472 f.write_str("Window") 1473 } 1474 } 1475