1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gdk.Window; 26 27 private import cairo.Pattern; 28 private import cairo.Region; 29 private import cairo.Surface; 30 private import gdk.Color; 31 private import gdk.Cursor; 32 private import gdk.Device; 33 private import gdk.Display; 34 private import gdk.Event; 35 private import gdk.FrameClock; 36 private import gdk.RGBA; 37 private import gdk.Screen; 38 private import gdk.Visual; 39 private import gdkpixbuf.Pixbuf; 40 private import glib.ConstructionException; 41 private import glib.ListG; 42 private import glib.Str; 43 private import gobject.ObjectG; 44 private import gobject.Signals; 45 private import gtkc.gdk; 46 public import gtkc.gdktypes; 47 48 49 public class Window : ObjectG 50 { 51 /** the main Gtk struct */ 52 protected GdkWindow* gdkWindow; 53 54 /** Get the main Gtk struct */ 55 public GdkWindow* getWindowStruct() 56 { 57 return gdkWindow; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)gdkWindow; 64 } 65 66 protected override void setStruct(GObject* obj) 67 { 68 gdkWindow = cast(GdkWindow*)obj; 69 super.setStruct(obj); 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GdkWindow* gdkWindow, bool ownedRef = false) 76 { 77 this.gdkWindow = gdkWindow; 78 super(cast(GObject*)gdkWindow, ownedRef); 79 } 80 81 /** 82 */ 83 84 public static GType getType() 85 { 86 return gdk_window_get_type(); 87 } 88 89 /** 90 * Creates a new #GdkWindow using the attributes from 91 * @attributes. See #GdkWindowAttr and #GdkWindowAttributesType for 92 * more details. Note: to use this on displays other than the default 93 * display, @parent must be specified. 94 * 95 * Params: 96 * parent = a #GdkWindow, or %NULL to create the window as a child of 97 * the default root window for the default display. 98 * attributes = attributes of the new window 99 * attributesMask = mask indicating which 100 * fields in @attributes are valid 101 * 102 * Return: the new #GdkWindow 103 * 104 * Throws: ConstructionException GTK+ fails to create the object. 105 */ 106 public this(Window parent, GdkWindowAttr* attributes, int attributesMask) 107 { 108 auto p = gdk_window_new((parent is null) ? null : parent.getWindowStruct(), attributes, attributesMask); 109 110 if(p is null) 111 { 112 throw new ConstructionException("null returned by new"); 113 } 114 115 this(cast(GdkWindow*) p, true); 116 } 117 118 /** 119 * Obtains the window underneath the mouse pointer, returning the 120 * location of that window in @win_x, @win_y. Returns %NULL if the 121 * window under the mouse pointer is not known to GDK (if the window 122 * belongs to another application and a #GdkWindow hasn’t been created 123 * for it with gdk_window_foreign_new()) 124 * 125 * NOTE: For multihead-aware widgets or applications use 126 * gdk_display_get_window_at_pointer() instead. 127 * 128 * Deprecated: Use gdk_device_get_window_at_position() instead. 129 * 130 * Params: 131 * winX = return location for origin of the window under the pointer 132 * winY = return location for origin of the window under the pointer 133 * 134 * Return: window under the mouse pointer 135 */ 136 public static Window atPointer(out int winX, out int winY) 137 { 138 auto p = gdk_window_at_pointer(&winX, &winY); 139 140 if(p is null) 141 { 142 return null; 143 } 144 145 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 146 } 147 148 /** 149 * Constrains a desired width and height according to a 150 * set of geometry hints (such as minimum and maximum size). 151 * 152 * Params: 153 * geometry = a #GdkGeometry structure 154 * flags = a mask indicating what portions of @geometry are set 155 * width = desired width of window 156 * height = desired height of the window 157 * newWidth = location to store resulting width 158 * newHeight = location to store resulting height 159 */ 160 public static void constrainSize(GdkGeometry* geometry, GdkWindowHints flags, int width, int height, out int newWidth, out int newHeight) 161 { 162 gdk_window_constrain_size(geometry, flags, width, height, &newWidth, &newHeight); 163 } 164 165 /** 166 * Calls gdk_window_process_updates() for all windows (see #GdkWindow) 167 * in the application. 168 */ 169 public static void processAllUpdates() 170 { 171 gdk_window_process_all_updates(); 172 } 173 174 /** 175 * With update debugging enabled, calls to 176 * gdk_window_invalidate_region() clear the invalidated region of the 177 * screen to a noticeable color, and GDK pauses for a short time 178 * before sending exposes to windows during 179 * gdk_window_process_updates(). The net effect is that you can see 180 * the invalid region for each window and watch redraws as they 181 * occur. This allows you to diagnose inefficiencies in your application. 182 * 183 * In essence, because the GDK rendering model prevents all flicker, 184 * if you are redrawing the same region 400 times you may never 185 * notice, aside from noticing a speed problem. Enabling update 186 * debugging causes GTK to flicker slowly and noticeably, so you can 187 * see exactly what’s being redrawn when, in what order. 188 * 189 * The --gtk-debug=updates command line option passed to GTK+ programs 190 * enables this debug option at application startup time. That's 191 * usually more useful than calling gdk_window_set_debug_updates() 192 * yourself, though you might want to use this function to enable 193 * updates sometime after application startup time. 194 * 195 * Params: 196 * setting = %TRUE to turn on update debugging 197 */ 198 public static void setDebugUpdates(bool setting) 199 { 200 gdk_window_set_debug_updates(setting); 201 } 202 203 /** 204 * Adds an event filter to @window, allowing you to intercept events 205 * before they reach GDK. This is a low-level operation and makes it 206 * easy to break GDK and/or GTK+, so you have to know what you're 207 * doing. Pass %NULL for @window to get all events for all windows, 208 * instead of events for a specific window. 209 * 210 * If you are interested in X GenericEvents, bear in mind that 211 * XGetEventData() has been already called on the event, and 212 * XFreeEventData() must not be called within @function. 213 * 214 * Params: 215 * funct = filter callback 216 * data = data to pass to filter callback 217 */ 218 public void addFilter(GdkFilterFunc funct, void* data) 219 { 220 gdk_window_add_filter(gdkWindow, funct, data); 221 } 222 223 /** 224 * Emits a short beep associated to @window in the appropriate 225 * display, if supported. Otherwise, emits a short beep on 226 * the display just as gdk_display_beep(). 227 * 228 * Since: 2.12 229 */ 230 public void beep() 231 { 232 gdk_window_beep(gdkWindow); 233 } 234 235 /** 236 * Begins a window move operation (for a toplevel window). 237 * 238 * This function assumes that the drag is controlled by the 239 * client pointer device, use gdk_window_begin_move_drag_for_device() 240 * to begin a drag with a different device. 241 * 242 * Params: 243 * button = the button being used to drag, or 0 for a keyboard-initiated drag 244 * rootX = root window X coordinate of mouse click that began the drag 245 * rootY = root window Y coordinate of mouse click that began the drag 246 * timestamp = timestamp of mouse click that began the drag 247 */ 248 public void beginMoveDrag(int button, int rootX, int rootY, uint timestamp) 249 { 250 gdk_window_begin_move_drag(gdkWindow, button, rootX, rootY, timestamp); 251 } 252 253 /** 254 * Begins a window move operation (for a toplevel window). 255 * You might use this function to implement a “window move grip,” for 256 * example. The function works best with window managers that support the 257 * [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) 258 * but has a fallback implementation for other window managers. 259 * 260 * Params: 261 * device = the device used for the operation 262 * button = the button being used to drag, or 0 for a keyboard-initiated drag 263 * rootX = root window X coordinate of mouse click that began the drag 264 * rootY = root window Y coordinate of mouse click that began the drag 265 * timestamp = timestamp of mouse click that began the drag 266 * 267 * Since: 3.4 268 */ 269 public void beginMoveDragForDevice(Device device, int button, int rootX, int rootY, uint timestamp) 270 { 271 gdk_window_begin_move_drag_for_device(gdkWindow, (device is null) ? null : device.getDeviceStruct(), button, rootX, rootY, timestamp); 272 } 273 274 /** 275 * A convenience wrapper around gdk_window_begin_paint_region() which 276 * creates a rectangular region for you. See 277 * gdk_window_begin_paint_region() for details. 278 * 279 * Params: 280 * rectangle = rectangle you intend to draw to 281 */ 282 public void beginPaintRect(GdkRectangle* rectangle) 283 { 284 gdk_window_begin_paint_rect(gdkWindow, rectangle); 285 } 286 287 /** 288 * Indicates that you are beginning the process of redrawing @region. 289 * A backing store (offscreen buffer) large enough to contain @region 290 * will be created. The backing store will be initialized with the 291 * background color or background surface for @window. Then, all 292 * drawing operations performed on @window will be diverted to the 293 * backing store. When you call gdk_window_end_paint(), the backing 294 * store will be copied to @window, making it visible onscreen. Only 295 * the part of @window contained in @region will be modified; that is, 296 * drawing operations are clipped to @region. 297 * 298 * The net result of all this is to remove flicker, because the user 299 * sees the finished product appear all at once when you call 300 * gdk_window_end_paint(). If you draw to @window directly without 301 * calling gdk_window_begin_paint_region(), the user may see flicker 302 * as individual drawing operations are performed in sequence. The 303 * clipping and background-initializing features of 304 * gdk_window_begin_paint_region() are conveniences for the 305 * programmer, so you can avoid doing that work yourself. 306 * 307 * When using GTK+, the widget system automatically places calls to 308 * gdk_window_begin_paint_region() and gdk_window_end_paint() around 309 * emissions of the expose_event signal. That is, if you’re writing an 310 * expose event handler, you can assume that the exposed area in 311 * #GdkEventExpose has already been cleared to the window background, 312 * is already set as the clip region, and already has a backing store. 313 * Therefore in most cases, application code need not call 314 * gdk_window_begin_paint_region(). (You can disable the automatic 315 * calls around expose events on a widget-by-widget basis by calling 316 * gtk_widget_set_double_buffered().) 317 * 318 * If you call this function multiple times before calling the 319 * matching gdk_window_end_paint(), the backing stores are pushed onto 320 * a stack. gdk_window_end_paint() copies the topmost backing store 321 * onscreen, subtracts the topmost region from all other regions in 322 * the stack, and pops the stack. All drawing operations affect only 323 * the topmost backing store in the stack. One matching call to 324 * gdk_window_end_paint() is required for each call to 325 * gdk_window_begin_paint_region(). 326 * 327 * Params: 328 * region = region you intend to draw to 329 */ 330 public void beginPaintRegion(Region region) 331 { 332 gdk_window_begin_paint_region(gdkWindow, (region is null) ? null : region.getRegionStruct()); 333 } 334 335 /** 336 * Begins a window resize operation (for a toplevel window). 337 * 338 * This function assumes that the drag is controlled by the 339 * client pointer device, use gdk_window_begin_resize_drag_for_device() 340 * to begin a drag with a different device. 341 * 342 * Params: 343 * edge = the edge or corner from which the drag is started 344 * button = the button being used to drag, or 0 for a keyboard-initiated drag 345 * rootX = root window X coordinate of mouse click that began the drag 346 * rootY = root window Y coordinate of mouse click that began the drag 347 * timestamp = timestamp of mouse click that began the drag (use gdk_event_get_time()) 348 */ 349 public void beginResizeDrag(GdkWindowEdge edge, int button, int rootX, int rootY, uint timestamp) 350 { 351 gdk_window_begin_resize_drag(gdkWindow, edge, button, rootX, rootY, timestamp); 352 } 353 354 /** 355 * Begins a window resize operation (for a toplevel window). 356 * You might use this function to implement a “window resize grip,” for 357 * example; in fact #GtkStatusbar uses it. The function works best 358 * with window managers that support the 359 * [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) 360 * but has a fallback implementation for other window managers. 361 * 362 * Params: 363 * edge = the edge or corner from which the drag is started 364 * device = the device used for the operation 365 * button = the button being used to drag, or 0 for a keyboard-initiated drag 366 * rootX = root window X coordinate of mouse click that began the drag 367 * rootY = root window Y coordinate of mouse click that began the drag 368 * timestamp = timestamp of mouse click that began the drag (use gdk_event_get_time()) 369 * 370 * Since: 3.4 371 */ 372 public void beginResizeDragForDevice(GdkWindowEdge edge, Device device, int button, int rootX, int rootY, uint timestamp) 373 { 374 gdk_window_begin_resize_drag_for_device(gdkWindow, edge, (device is null) ? null : device.getDeviceStruct(), button, rootX, rootY, timestamp); 375 } 376 377 /** 378 * Does nothing, present only for compatiblity. 379 * 380 * Deprecated: this function is no longer needed 381 * 382 * Since: 2.6 383 */ 384 public void configureFinished() 385 { 386 gdk_window_configure_finished(gdkWindow); 387 } 388 389 /** 390 * Transforms window coordinates from a parent window to a child 391 * window, where the parent window is the normal parent as returned by 392 * gdk_window_get_parent() for normal windows, and the window's 393 * embedder as returned by gdk_offscreen_window_get_embedder() for 394 * offscreen windows. 395 * 396 * For normal windows, calling this function is equivalent to subtracting 397 * the return values of gdk_window_get_position() from the parent coordinates. 398 * For offscreen windows however (which can be arbitrarily transformed), 399 * this function calls the GdkWindow::from-embedder: signal to translate 400 * the coordinates. 401 * 402 * You should always use this function when writing generic code that 403 * walks down a window hierarchy. 404 * 405 * See also: gdk_window_coords_to_parent() 406 * 407 * Params: 408 * parentX = X coordinate in parent’s coordinate system 409 * parentY = Y coordinate in parent’s coordinate system 410 * x = return location for X coordinate in child’s coordinate system 411 * y = return location for Y coordinate in child’s coordinate system 412 * 413 * Since: 2.22 414 */ 415 public void coordsFromParent(double parentX, double parentY, out double x, out double y) 416 { 417 gdk_window_coords_from_parent(gdkWindow, parentX, parentY, &x, &y); 418 } 419 420 /** 421 * Transforms window coordinates from a child window to its parent 422 * window, where the parent window is the normal parent as returned by 423 * gdk_window_get_parent() for normal windows, and the window's 424 * embedder as returned by gdk_offscreen_window_get_embedder() for 425 * offscreen windows. 426 * 427 * For normal windows, calling this function is equivalent to adding 428 * the return values of gdk_window_get_position() to the child coordinates. 429 * For offscreen windows however (which can be arbitrarily transformed), 430 * this function calls the GdkWindow::to-embedder: signal to translate 431 * the coordinates. 432 * 433 * You should always use this function when writing generic code that 434 * walks up a window hierarchy. 435 * 436 * See also: gdk_window_coords_from_parent() 437 * 438 * Params: 439 * x = X coordinate in child’s coordinate system 440 * y = Y coordinate in child’s coordinate system 441 * parentX = return location for X coordinate 442 * in parent’s coordinate system, or %NULL 443 * parentY = return location for Y coordinate 444 * in parent’s coordinate system, or %NULL 445 * 446 * Since: 2.22 447 */ 448 public void coordsToParent(double x, double y, out double parentX, out double parentY) 449 { 450 gdk_window_coords_to_parent(gdkWindow, x, y, &parentX, &parentY); 451 } 452 453 /** 454 * Create a new image surface that is efficient to draw on the 455 * given @window. 456 * 457 * Initially the surface contents are all 0 (transparent if contents 458 * have transparency, black otherwise.) 459 * 460 * Params: 461 * format = the format for the new surface 462 * width = width of the new surface 463 * height = height of the new surface 464 * scale = the scale of the new surface, or 0 to use same as @window 465 * 466 * Return: a pointer to the newly allocated surface. The caller 467 * owns the surface and should call cairo_surface_destroy() when done 468 * with it. 469 * 470 * This function always returns a valid pointer, but it will return a 471 * pointer to a “nil” surface if @other is already in an error state 472 * or any other error occurs. 473 * 474 * Since: 3.10 475 */ 476 public Surface createSimilarImageSurface(cairo_format_t format, int width, int height, int scale) 477 { 478 auto p = gdk_window_create_similar_image_surface(gdkWindow, format, width, height, scale); 479 480 if(p is null) 481 { 482 return null; 483 } 484 485 return new Surface(cast(cairo_surface_t*) p); 486 } 487 488 /** 489 * Create a new surface that is as compatible as possible with the 490 * given @window. For example the new surface will have the same 491 * fallback resolution and font options as @window. Generally, the new 492 * surface will also use the same backend as @window, unless that is 493 * not possible for some reason. The type of the returned surface may 494 * be examined with cairo_surface_get_type(). 495 * 496 * Initially the surface contents are all 0 (transparent if contents 497 * have transparency, black otherwise.) 498 * 499 * Params: 500 * content = the content for the new surface 501 * width = width of the new surface 502 * height = height of the new surface 503 * 504 * Return: a pointer to the newly allocated surface. The caller 505 * owns the surface and should call cairo_surface_destroy() when done 506 * with it. 507 * 508 * This function always returns a valid pointer, but it will return a 509 * pointer to a “nil” surface if @other is already in an error state 510 * or any other error occurs. 511 * 512 * Since: 2.22 513 */ 514 public Surface createSimilarSurface(cairo_content_t content, int width, int height) 515 { 516 auto p = gdk_window_create_similar_surface(gdkWindow, content, width, height); 517 518 if(p is null) 519 { 520 return null; 521 } 522 523 return new Surface(cast(cairo_surface_t*) p); 524 } 525 526 /** 527 * Attempt to deiconify (unminimize) @window. On X11 the window manager may 528 * choose to ignore the request to deiconify. When using GTK+, 529 * use gtk_window_deiconify() instead of the #GdkWindow variant. Or better yet, 530 * you probably want to use gtk_window_present(), which raises the window, focuses it, 531 * unminimizes it, and puts it on the current desktop. 532 */ 533 public void deiconify() 534 { 535 gdk_window_deiconify(gdkWindow); 536 } 537 538 /** 539 * Destroys the window system resources associated with @window and decrements @window's 540 * reference count. The window system resources for all children of @window are also 541 * destroyed, but the children’s reference counts are not decremented. 542 * 543 * Note that a window will not be destroyed automatically when its reference count 544 * reaches zero. You must call this function yourself before that happens. 545 */ 546 public void destroy() 547 { 548 gdk_window_destroy(gdkWindow); 549 } 550 551 public void destroyNotify() 552 { 553 gdk_window_destroy_notify(gdkWindow); 554 } 555 556 /** 557 * Does nothing, present only for compatiblity. 558 * 559 * Deprecated: this function is no longer needed 560 * 561 * Since: 2.6 562 */ 563 public void enableSynchronizedConfigure() 564 { 565 gdk_window_enable_synchronized_configure(gdkWindow); 566 } 567 568 /** 569 * Indicates that the backing store created by the most recent call to 570 * gdk_window_begin_paint_region() should be copied onscreen and 571 * deleted, leaving the next-most-recent backing store or no backing 572 * store at all as the active paint region. See 573 * gdk_window_begin_paint_region() for full details. It is an error to 574 * call this function without a matching 575 * gdk_window_begin_paint_region() first. 576 */ 577 public void endPaint() 578 { 579 gdk_window_end_paint(gdkWindow); 580 } 581 582 /** 583 * Tries to ensure that there is a window-system native window for this 584 * GdkWindow. This may fail in some situations, returning %FALSE. 585 * 586 * Offscreen window and children of them can never have native windows. 587 * 588 * Some backends may not support native child windows. 589 * 590 * Return: %TRUE if the window has a native window, %FALSE otherwise 591 * 592 * Since: 2.18 593 */ 594 public bool ensureNative() 595 { 596 return gdk_window_ensure_native(gdkWindow) != 0; 597 } 598 599 /** 600 * This function does nothing. 601 * 602 * Since: 2.18 603 */ 604 public void flush() 605 { 606 gdk_window_flush(gdkWindow); 607 } 608 609 /** 610 * Sets keyboard focus to @window. In most cases, gtk_window_present() 611 * should be used on a #GtkWindow, rather than calling this function. 612 * 613 * Params: 614 * timestamp = timestamp of the event triggering the window focus 615 */ 616 public void focus(uint timestamp) 617 { 618 gdk_window_focus(gdkWindow, timestamp); 619 } 620 621 /** 622 * Temporarily freezes a window and all its descendants such that it won't 623 * receive expose events. The window will begin receiving expose events 624 * again when gdk_window_thaw_toplevel_updates_libgtk_only() is called. If 625 * gdk_window_freeze_toplevel_updates_libgtk_only() 626 * has been called more than once, 627 * gdk_window_thaw_toplevel_updates_libgtk_only() must be called 628 * an equal number of times to begin processing exposes. 629 * 630 * This function is not part of the GDK public API and is only 631 * for use by GTK+. 632 */ 633 public void freezeToplevelUpdatesLibgtkOnly() 634 { 635 gdk_window_freeze_toplevel_updates_libgtk_only(gdkWindow); 636 } 637 638 /** 639 * Temporarily freezes a window such that it won’t receive expose 640 * events. The window will begin receiving expose events again when 641 * gdk_window_thaw_updates() is called. If gdk_window_freeze_updates() 642 * has been called more than once, gdk_window_thaw_updates() must be called 643 * an equal number of times to begin processing exposes. 644 */ 645 public void freezeUpdates() 646 { 647 gdk_window_freeze_updates(gdkWindow); 648 } 649 650 /** 651 * Moves the window into fullscreen mode. This means the 652 * window covers the entire screen and is above any panels 653 * or task bars. 654 * 655 * If the window was already fullscreen, then this function does nothing. 656 * 657 * On X11, asks the window manager to put @window in a fullscreen 658 * state, if the window manager supports this operation. Not all 659 * window managers support this, and some deliberately ignore it or 660 * don’t have a concept of “fullscreen”; so you can’t rely on the 661 * fullscreenification actually happening. But it will happen with 662 * most standard window managers, and GDK makes a best effort to get 663 * it to happen. 664 * 665 * Since: 2.2 666 */ 667 public void fullscreen() 668 { 669 gdk_window_fullscreen(gdkWindow); 670 } 671 672 /** 673 * This function informs GDK that the geometry of an embedded 674 * offscreen window has changed. This is necessary for GDK to keep 675 * track of which offscreen window the pointer is in. 676 * 677 * Since: 2.18 678 */ 679 public void geometryChanged() 680 { 681 gdk_window_geometry_changed(gdkWindow); 682 } 683 684 /** 685 * Determines whether or not the desktop environment shuld be hinted that 686 * the window does not want to receive input focus. 687 * 688 * Return: whether or not the window should receive input focus. 689 * 690 * Since: 2.22 691 */ 692 public bool getAcceptFocus() 693 { 694 return gdk_window_get_accept_focus(gdkWindow) != 0; 695 } 696 697 /** 698 * Gets the pattern used to clear the background on @window. If @window 699 * does not have its own background and reuses the parent's, %NULL is 700 * returned and you’ll have to query it yourself. 701 * 702 * Return: The pattern to use for the 703 * background or %NULL to use the parent’s background. 704 * 705 * Since: 2.22 706 */ 707 public Pattern getBackgroundPattern() 708 { 709 auto p = gdk_window_get_background_pattern(gdkWindow); 710 711 if(p is null) 712 { 713 return null; 714 } 715 716 return new Pattern(cast(cairo_pattern_t*) p); 717 } 718 719 /** 720 * Gets the list of children of @window known to GDK. 721 * This function only returns children created via GDK, 722 * so for example it’s useless when used with the root window; 723 * it only returns windows an application created itself. 724 * 725 * The returned list must be freed, but the elements in the 726 * list need not be. 727 * 728 * Return: list of child windows inside @window 729 */ 730 public ListG getChildren() 731 { 732 auto p = gdk_window_get_children(gdkWindow); 733 734 if(p is null) 735 { 736 return null; 737 } 738 739 return new ListG(cast(GList*) p); 740 } 741 742 /** 743 * Gets the list of children of @window known to GDK with a 744 * particular @user_data set on it. 745 * 746 * The returned list must be freed, but the elements in the 747 * list need not be. 748 * 749 * The list is returned in (relative) stacking order, i.e. the 750 * lowest window is first. 751 * 752 * Params: 753 * userData = user data to look for 754 * 755 * Return: list of child windows inside @window 756 * 757 * Since: 3.10 758 */ 759 public ListG getChildrenWithUserData(void* userData) 760 { 761 auto p = gdk_window_get_children_with_user_data(gdkWindow, userData); 762 763 if(p is null) 764 { 765 return null; 766 } 767 768 return new ListG(cast(GList*) p); 769 } 770 771 /** 772 * Computes the region of a window that potentially can be written 773 * to by drawing primitives. This region may not take into account 774 * other factors such as if the window is obscured by other windows, 775 * but no area outside of this region will be affected by drawing 776 * primitives. 777 * 778 * Return: a #cairo_region_t. This must be freed with cairo_region_destroy() 779 * when you are done. 780 */ 781 public Region getClipRegion() 782 { 783 auto p = gdk_window_get_clip_region(gdkWindow); 784 785 if(p is null) 786 { 787 return null; 788 } 789 790 return new Region(cast(cairo_region_t*) p); 791 } 792 793 /** 794 * Determines whether @window is composited. 795 * 796 * See gdk_window_set_composited(). 797 * 798 * Return: %TRUE if the window is composited. 799 * 800 * Since: 2.22 801 */ 802 public bool getComposited() 803 { 804 return gdk_window_get_composited(gdkWindow) != 0; 805 } 806 807 /** 808 * Retrieves a #GdkCursor pointer for the cursor currently set on the 809 * specified #GdkWindow, or %NULL. If the return value is %NULL then 810 * there is no custom cursor set on the specified window, and it is 811 * using the cursor for its parent window. 812 * 813 * Return: a #GdkCursor, or %NULL. The 814 * returned object is owned by the #GdkWindow and should not be 815 * unreferenced directly. Use gdk_window_set_cursor() to unset the 816 * cursor of the window 817 * 818 * Since: 2.18 819 */ 820 public Cursor getCursor() 821 { 822 auto p = gdk_window_get_cursor(gdkWindow); 823 824 if(p is null) 825 { 826 return null; 827 } 828 829 return ObjectG.getDObject!(Cursor)(cast(GdkCursor*) p); 830 } 831 832 /** 833 * Returns the decorations set on the GdkWindow with 834 * gdk_window_set_decorations(). 835 * 836 * Params: 837 * decorations = The window decorations will be written here 838 * 839 * Return: %TRUE if the window has decorations set, %FALSE otherwise. 840 */ 841 public bool getDecorations(out GdkWMDecoration decorations) 842 { 843 return gdk_window_get_decorations(gdkWindow, &decorations) != 0; 844 } 845 846 /** 847 * Retrieves a #GdkCursor pointer for the @device currently set on the 848 * specified #GdkWindow, or %NULL. If the return value is %NULL then 849 * there is no custom cursor set on the specified window, and it is 850 * using the cursor for its parent window. 851 * 852 * Params: 853 * device = a master, pointer #GdkDevice. 854 * 855 * Return: a #GdkCursor, or %NULL. The 856 * returned object is owned by the #GdkWindow and should not be 857 * unreferenced directly. Use gdk_window_set_cursor() to unset the 858 * cursor of the window 859 * 860 * Since: 3.0 861 */ 862 public Cursor getDeviceCursor(Device device) 863 { 864 auto p = gdk_window_get_device_cursor(gdkWindow, (device is null) ? null : device.getDeviceStruct()); 865 866 if(p is null) 867 { 868 return null; 869 } 870 871 return ObjectG.getDObject!(Cursor)(cast(GdkCursor*) p); 872 } 873 874 /** 875 * Returns the event mask for @window corresponding to an specific device. 876 * 877 * Params: 878 * device = a #GdkDevice. 879 * 880 * Return: device event mask for @window 881 * 882 * Since: 3.0 883 */ 884 public GdkEventMask getDeviceEvents(Device device) 885 { 886 return gdk_window_get_device_events(gdkWindow, (device is null) ? null : device.getDeviceStruct()); 887 } 888 889 /** 890 * Obtains the current device position and modifier state. 891 * The position is given in coordinates relative to the upper left 892 * corner of @window. 893 * 894 * Use gdk_window_get_device_position_double() if you need subpixel precision. 895 * 896 * Params: 897 * device = pointer #GdkDevice to query to. 898 * x = return location for the X coordinate of @device, or %NULL. 899 * y = return location for the Y coordinate of @device, or %NULL. 900 * mask = return location for the modifier mask, or %NULL. 901 * 902 * Return: The window underneath @device 903 * (as with gdk_device_get_window_at_position()), or %NULL if the 904 * window is not known to GDK. 905 * 906 * Since: 3.0 907 */ 908 public Window getDevicePosition(Device device, out int x, out int y, out GdkModifierType mask) 909 { 910 auto p = gdk_window_get_device_position(gdkWindow, (device is null) ? null : device.getDeviceStruct(), &x, &y, &mask); 911 912 if(p is null) 913 { 914 return null; 915 } 916 917 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 918 } 919 920 /** 921 * Obtains the current device position in doubles and modifier state. 922 * The position is given in coordinates relative to the upper left 923 * corner of @window. 924 * 925 * Params: 926 * device = pointer #GdkDevice to query to. 927 * x = return location for the X coordinate of @device, or %NULL. 928 * y = return location for the Y coordinate of @device, or %NULL. 929 * mask = return location for the modifier mask, or %NULL. 930 * 931 * Return: The window underneath @device 932 * (as with gdk_device_get_window_at_position()), or %NULL if the 933 * window is not known to GDK. 934 * 935 * Since: 3.10 936 */ 937 public Window getDevicePositionDouble(Device device, out double x, out double y, out GdkModifierType mask) 938 { 939 auto p = gdk_window_get_device_position_double(gdkWindow, (device is null) ? null : device.getDeviceStruct(), &x, &y, &mask); 940 941 if(p is null) 942 { 943 return null; 944 } 945 946 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 947 } 948 949 /** 950 * Gets the #GdkDisplay associated with a #GdkWindow. 951 * 952 * Return: the #GdkDisplay associated with @window 953 * 954 * Since: 2.24 955 */ 956 public Display getDisplay() 957 { 958 auto p = gdk_window_get_display(gdkWindow); 959 960 if(p is null) 961 { 962 return null; 963 } 964 965 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 966 } 967 968 /** 969 * Finds out the DND protocol supported by a window. 970 * 971 * Params: 972 * target = location of the window 973 * where the drop should happen. This may be @window or a proxy window, 974 * or %NULL if @window does not support Drag and Drop. 975 * 976 * Return: the supported DND protocol. 977 * 978 * Since: 3.0 979 */ 980 public GdkDragProtocol getDragProtocol(out Window target) 981 { 982 GdkWindow* outtarget = null; 983 984 auto p = gdk_window_get_drag_protocol(gdkWindow, &outtarget); 985 986 target = ObjectG.getDObject!(Window)(outtarget); 987 988 return p; 989 } 990 991 /** 992 * Obtains the parent of @window, as known to GDK. Works like 993 * gdk_window_get_parent() for normal windows, but returns the 994 * window’s embedder for offscreen windows. 995 * 996 * See also: gdk_offscreen_window_get_embedder() 997 * 998 * Return: effective parent of @window 999 * 1000 * Since: 2.22 1001 */ 1002 public Window getEffectiveParent() 1003 { 1004 auto p = gdk_window_get_effective_parent(gdkWindow); 1005 1006 if(p is null) 1007 { 1008 return null; 1009 } 1010 1011 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1012 } 1013 1014 /** 1015 * Gets the toplevel window that’s an ancestor of @window. 1016 * 1017 * Works like gdk_window_get_toplevel(), but treats an offscreen window's 1018 * embedder as its parent, using gdk_window_get_effective_parent(). 1019 * 1020 * See also: gdk_offscreen_window_get_embedder() 1021 * 1022 * Return: the effective toplevel window containing @window 1023 * 1024 * Since: 2.22 1025 */ 1026 public Window getEffectiveToplevel() 1027 { 1028 auto p = gdk_window_get_effective_toplevel(gdkWindow); 1029 1030 if(p is null) 1031 { 1032 return null; 1033 } 1034 1035 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1036 } 1037 1038 /** 1039 * Get the current event compression setting for this window. 1040 * 1041 * Return: %TRUE if motion events will be compressed 1042 * 1043 * Since: 3.12 1044 */ 1045 public bool getEventCompression() 1046 { 1047 return gdk_window_get_event_compression(gdkWindow) != 0; 1048 } 1049 1050 /** 1051 * Gets the event mask for @window for all master input devices. See 1052 * gdk_window_set_events(). 1053 * 1054 * Return: event mask for @window 1055 */ 1056 public GdkEventMask getEvents() 1057 { 1058 return gdk_window_get_events(gdkWindow); 1059 } 1060 1061 /** 1062 * Determines whether or not the desktop environment should be hinted that the 1063 * window does not want to receive input focus when it is mapped. 1064 * 1065 * Return: whether or not the window wants to receive input focus when 1066 * it is mapped. 1067 * 1068 * Since: 2.22 1069 */ 1070 public bool getFocusOnMap() 1071 { 1072 return gdk_window_get_focus_on_map(gdkWindow) != 0; 1073 } 1074 1075 /** 1076 * Gets the frame clock for the window. The frame clock for a window 1077 * never changes unless the window is reparented to a new toplevel 1078 * window. 1079 * 1080 * Return: the frame clock 1081 * 1082 * Since: 3.8 1083 */ 1084 public FrameClock getFrameClock() 1085 { 1086 auto p = gdk_window_get_frame_clock(gdkWindow); 1087 1088 if(p is null) 1089 { 1090 return null; 1091 } 1092 1093 return ObjectG.getDObject!(FrameClock)(cast(GdkFrameClock*) p); 1094 } 1095 1096 /** 1097 * Obtains the bounding box of the window, including window manager 1098 * titlebar/borders if any. The frame position is given in root window 1099 * coordinates. To get the position of the window itself (rather than 1100 * the frame) in root window coordinates, use gdk_window_get_origin(). 1101 * 1102 * Params: 1103 * rect = rectangle to fill with bounding box of the window frame 1104 */ 1105 public void getFrameExtents(out GdkRectangle rect) 1106 { 1107 gdk_window_get_frame_extents(gdkWindow, &rect); 1108 } 1109 1110 /** 1111 * Obtains the #GdkFullscreenMode of the @window. 1112 * 1113 * Return: The #GdkFullscreenMode applied to the window when fullscreen. 1114 * 1115 * Since: 3.8 1116 */ 1117 public GdkFullscreenMode getFullscreenMode() 1118 { 1119 return gdk_window_get_fullscreen_mode(gdkWindow); 1120 } 1121 1122 /** 1123 * Any of the return location arguments to this function may be %NULL, 1124 * if you aren’t interested in getting the value of that field. 1125 * 1126 * The X and Y coordinates returned are relative to the parent window 1127 * of @window, which for toplevels usually means relative to the 1128 * window decorations (titlebar, etc.) rather than relative to the 1129 * root window (screen-size background window). 1130 * 1131 * On the X11 platform, the geometry is obtained from the X server, 1132 * so reflects the latest position of @window; this may be out-of-sync 1133 * with the position of @window delivered in the most-recently-processed 1134 * #GdkEventConfigure. gdk_window_get_position() in contrast gets the 1135 * position from the most recent configure event. 1136 * 1137 * Note: If @window is not a toplevel, it is much better 1138 * to call gdk_window_get_position(), gdk_window_get_width() and 1139 * gdk_window_get_height() instead, because it avoids the roundtrip to 1140 * the X server and because these functions support the full 32-bit 1141 * coordinate space, whereas gdk_window_get_geometry() is restricted to 1142 * the 16-bit coordinates of X11. 1143 * 1144 * Params: 1145 * x = return location for X coordinate of window (relative to its parent) 1146 * y = return location for Y coordinate of window (relative to its parent) 1147 * width = return location for width of window 1148 * height = return location for height of window 1149 */ 1150 public void getGeometry(out int x, out int y, out int width, out int height) 1151 { 1152 gdk_window_get_geometry(gdkWindow, &x, &y, &width, &height); 1153 } 1154 1155 /** 1156 * Returns the group leader window for @window. See gdk_window_set_group(). 1157 * 1158 * Return: the group leader window for @window 1159 * 1160 * Since: 2.4 1161 */ 1162 public Window getGroup() 1163 { 1164 auto p = gdk_window_get_group(gdkWindow); 1165 1166 if(p is null) 1167 { 1168 return null; 1169 } 1170 1171 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1172 } 1173 1174 /** 1175 * Returns the height of the given @window. 1176 * 1177 * On the X11 platform the returned size is the size reported in the 1178 * most-recently-processed configure event, rather than the current 1179 * size on the X server. 1180 * 1181 * Return: The height of @window 1182 * 1183 * Since: 2.24 1184 */ 1185 public int getHeight() 1186 { 1187 return gdk_window_get_height(gdkWindow); 1188 } 1189 1190 /** 1191 * Determines whether or not the window manager is hinted that @window 1192 * has modal behaviour. 1193 * 1194 * Return: whether or not the window has the modal hint set. 1195 * 1196 * Since: 2.22 1197 */ 1198 public bool getModalHint() 1199 { 1200 return gdk_window_get_modal_hint(gdkWindow) != 0; 1201 } 1202 1203 /** 1204 * Obtains the position of a window in root window coordinates. 1205 * (Compare with gdk_window_get_position() and 1206 * gdk_window_get_geometry() which return the position of a window 1207 * relative to its parent window.) 1208 * 1209 * Params: 1210 * x = return location for X coordinate 1211 * y = return location for Y coordinate 1212 * 1213 * Return: not meaningful, ignore 1214 */ 1215 public int getOrigin(out int x, out int y) 1216 { 1217 return gdk_window_get_origin(gdkWindow, &x, &y); 1218 } 1219 1220 /** 1221 * Obtains the parent of @window, as known to GDK. Does not query the 1222 * X server; thus this returns the parent as passed to gdk_window_new(), 1223 * not the actual parent. This should never matter unless you’re using 1224 * Xlib calls mixed with GDK calls on the X11 platform. It may also 1225 * matter for toplevel windows, because the window manager may choose 1226 * to reparent them. 1227 * 1228 * Note that you should use gdk_window_get_effective_parent() when 1229 * writing generic code that walks up a window hierarchy, because 1230 * gdk_window_get_parent() will most likely not do what you expect if 1231 * there are offscreen windows in the hierarchy. 1232 * 1233 * Return: parent of @window 1234 */ 1235 public Window getParent() 1236 { 1237 auto p = gdk_window_get_parent(gdkWindow); 1238 1239 if(p is null) 1240 { 1241 return null; 1242 } 1243 1244 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1245 } 1246 1247 /** 1248 * Obtains the current pointer position and modifier state. 1249 * The position is given in coordinates relative to the upper left 1250 * corner of @window. 1251 * 1252 * Deprecated: Use gdk_window_get_device_position() instead. 1253 * 1254 * Params: 1255 * x = return location for X coordinate of pointer or %NULL to not 1256 * return the X coordinate 1257 * y = return location for Y coordinate of pointer or %NULL to not 1258 * return the Y coordinate 1259 * mask = return location for modifier mask or %NULL to not return the 1260 * modifier mask 1261 * 1262 * Return: the window containing the 1263 * pointer (as with gdk_window_at_pointer()), or %NULL if the window 1264 * containing the pointer isn’t known to GDK 1265 */ 1266 public Window getPointer(out int x, out int y, out GdkModifierType mask) 1267 { 1268 auto p = gdk_window_get_pointer(gdkWindow, &x, &y, &mask); 1269 1270 if(p is null) 1271 { 1272 return null; 1273 } 1274 1275 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1276 } 1277 1278 /** 1279 * Obtains the position of the window as reported in the 1280 * most-recently-processed #GdkEventConfigure. Contrast with 1281 * gdk_window_get_geometry() which queries the X server for the 1282 * current window position, regardless of which events have been 1283 * received or processed. 1284 * 1285 * The position coordinates are relative to the window’s parent window. 1286 * 1287 * Params: 1288 * x = X coordinate of window 1289 * y = Y coordinate of window 1290 */ 1291 public void getPosition(out int x, out int y) 1292 { 1293 gdk_window_get_position(gdkWindow, &x, &y); 1294 } 1295 1296 /** 1297 * Obtains the position of a window position in root 1298 * window coordinates. This is similar to 1299 * gdk_window_get_origin() but allows you go pass 1300 * in any position in the window, not just the origin. 1301 * 1302 * Params: 1303 * x = X coordinate in window 1304 * y = Y coordinate in window 1305 * rootX = return location for X coordinate 1306 * rootY = return location for Y coordinate 1307 * 1308 * Since: 2.18 1309 */ 1310 public void getRootCoords(int x, int y, out int rootX, out int rootY) 1311 { 1312 gdk_window_get_root_coords(gdkWindow, x, y, &rootX, &rootY); 1313 } 1314 1315 /** 1316 * Obtains the top-left corner of the window manager frame in root 1317 * window coordinates. 1318 * 1319 * Params: 1320 * x = return location for X position of window frame 1321 * y = return location for Y position of window frame 1322 */ 1323 public void getRootOrigin(out int x, out int y) 1324 { 1325 gdk_window_get_root_origin(gdkWindow, &x, &y); 1326 } 1327 1328 /** 1329 * Returns the internal scale factor that maps from window coordiantes 1330 * to the actual device pixels. On traditional systems this is 1, but 1331 * on very high density outputs this can be a higher value (often 2). 1332 * 1333 * A higher value means that drawing is automatically scaled up to 1334 * a higher resolution, so any code doing drawing will automatically look 1335 * nicer. However, if you are supplying pixel-based data the scale 1336 * value can be used to determine whether to use a pixel resource 1337 * with higher resolution data. 1338 * 1339 * The scale of a window may change during runtime, if this happens 1340 * a configure event will be sent to the toplevel window. 1341 * 1342 * Return: the scale factor 1343 * 1344 * Since: 3.10 1345 */ 1346 public int getScaleFactor() 1347 { 1348 return gdk_window_get_scale_factor(gdkWindow); 1349 } 1350 1351 /** 1352 * Gets the #GdkScreen associated with a #GdkWindow. 1353 * 1354 * Return: the #GdkScreen associated with @window 1355 * 1356 * Since: 2.24 1357 */ 1358 public Screen getScreen() 1359 { 1360 auto p = gdk_window_get_screen(gdkWindow); 1361 1362 if(p is null) 1363 { 1364 return null; 1365 } 1366 1367 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 1368 } 1369 1370 /** 1371 * Returns the event mask for @window corresponding to the device class specified 1372 * by @source. 1373 * 1374 * Params: 1375 * source = a #GdkInputSource to define the source class. 1376 * 1377 * Return: source event mask for @window 1378 */ 1379 public GdkEventMask getSourceEvents(GdkInputSource source) 1380 { 1381 return gdk_window_get_source_events(gdkWindow, source); 1382 } 1383 1384 /** 1385 * Gets the bitwise OR of the currently active window state flags, 1386 * from the #GdkWindowState enumeration. 1387 * 1388 * Return: window state bitfield 1389 */ 1390 public GdkWindowState getState() 1391 { 1392 return gdk_window_get_state(gdkWindow); 1393 } 1394 1395 /** 1396 * Returns %TRUE if the window is aware of the existence of multiple 1397 * devices. 1398 * 1399 * Return: %TRUE if the window handles multidevice features. 1400 * 1401 * Since: 3.0 1402 */ 1403 public bool getSupportMultidevice() 1404 { 1405 return gdk_window_get_support_multidevice(gdkWindow) != 0; 1406 } 1407 1408 /** 1409 * Gets the toplevel window that’s an ancestor of @window. 1410 * 1411 * Any window type but %GDK_WINDOW_CHILD is considered a 1412 * toplevel window, as is a %GDK_WINDOW_CHILD window that 1413 * has a root window as parent. 1414 * 1415 * Note that you should use gdk_window_get_effective_toplevel() when 1416 * you want to get to a window’s toplevel as seen on screen, because 1417 * gdk_window_get_toplevel() will most likely not do what you expect 1418 * if there are offscreen windows in the hierarchy. 1419 * 1420 * Return: the toplevel window containing @window 1421 */ 1422 public Window getToplevel() 1423 { 1424 auto p = gdk_window_get_toplevel(gdkWindow); 1425 1426 if(p is null) 1427 { 1428 return null; 1429 } 1430 1431 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1432 } 1433 1434 /** 1435 * This function returns the type hint set for a window. 1436 * 1437 * Return: The type hint set for @window 1438 * 1439 * Since: 2.10 1440 */ 1441 public GdkWindowTypeHint getTypeHint() 1442 { 1443 return gdk_window_get_type_hint(gdkWindow); 1444 } 1445 1446 /** 1447 * Transfers ownership of the update area from @window to the caller 1448 * of the function. That is, after calling this function, @window will 1449 * no longer have an invalid/dirty region; the update area is removed 1450 * from @window and handed to you. If a window has no update area, 1451 * gdk_window_get_update_area() returns %NULL. You are responsible for 1452 * calling cairo_region_destroy() on the returned region if it’s non-%NULL. 1453 * 1454 * Return: the update area for @window 1455 */ 1456 public Region getUpdateArea() 1457 { 1458 auto p = gdk_window_get_update_area(gdkWindow); 1459 1460 if(p is null) 1461 { 1462 return null; 1463 } 1464 1465 return new Region(cast(cairo_region_t*) p); 1466 } 1467 1468 /** 1469 * Retrieves the user data for @window, which is normally the widget 1470 * that @window belongs to. See gdk_window_set_user_data(). 1471 * 1472 * Params: 1473 * data = return location for user data 1474 */ 1475 public void getUserData(out void* data) 1476 { 1477 gdk_window_get_user_data(gdkWindow, &data); 1478 } 1479 1480 /** 1481 * Computes the region of the @window that is potentially visible. 1482 * This does not necessarily take into account if the window is 1483 * obscured by other windows, but no area outside of this region 1484 * is visible. 1485 * 1486 * Return: a #cairo_region_t. This must be freed with cairo_region_destroy() 1487 * when you are done. 1488 */ 1489 public Region getVisibleRegion() 1490 { 1491 auto p = gdk_window_get_visible_region(gdkWindow); 1492 1493 if(p is null) 1494 { 1495 return null; 1496 } 1497 1498 return new Region(cast(cairo_region_t*) p); 1499 } 1500 1501 /** 1502 * Gets the #GdkVisual describing the pixel format of @window. 1503 * 1504 * Return: a #GdkVisual 1505 * 1506 * Since: 2.24 1507 */ 1508 public Visual getVisual() 1509 { 1510 auto p = gdk_window_get_visual(gdkWindow); 1511 1512 if(p is null) 1513 { 1514 return null; 1515 } 1516 1517 return ObjectG.getDObject!(Visual)(cast(GdkVisual*) p); 1518 } 1519 1520 /** 1521 * Returns the width of the given @window. 1522 * 1523 * On the X11 platform the returned size is the size reported in the 1524 * most-recently-processed configure event, rather than the current 1525 * size on the X server. 1526 * 1527 * Return: The width of @window 1528 * 1529 * Since: 2.24 1530 */ 1531 public int getWidth() 1532 { 1533 return gdk_window_get_width(gdkWindow); 1534 } 1535 1536 /** 1537 * Gets the type of the window. See #GdkWindowType. 1538 * 1539 * Return: type of window 1540 */ 1541 public GdkWindowType getWindowType() 1542 { 1543 return gdk_window_get_window_type(gdkWindow); 1544 } 1545 1546 /** 1547 * Checks whether the window has a native window or not. Note that 1548 * you can use gdk_window_ensure_native() if a native window is needed. 1549 * 1550 * Return: %TRUE if the @window has a native window, %FALSE otherwise. 1551 * 1552 * Since: 2.22 1553 */ 1554 public bool hasNative() 1555 { 1556 return gdk_window_has_native(gdkWindow) != 0; 1557 } 1558 1559 /** 1560 * For toplevel windows, withdraws them, so they will no longer be 1561 * known to the window manager; for all windows, unmaps them, so 1562 * they won’t be displayed. Normally done automatically as 1563 * part of gtk_widget_hide(). 1564 */ 1565 public void hide() 1566 { 1567 gdk_window_hide(gdkWindow); 1568 } 1569 1570 /** 1571 * Asks to iconify (minimize) @window. The window manager may choose 1572 * to ignore the request, but normally will honor it. Using 1573 * gtk_window_iconify() is preferred, if you have a #GtkWindow widget. 1574 * 1575 * This function only makes sense when @window is a toplevel window. 1576 */ 1577 public void iconify() 1578 { 1579 gdk_window_iconify(gdkWindow); 1580 } 1581 1582 /** 1583 * Like gdk_window_shape_combine_region(), but the shape applies 1584 * only to event handling. Mouse events which happen while 1585 * the pointer position corresponds to an unset bit in the 1586 * mask will be passed on the window below @window. 1587 * 1588 * An input shape is typically used with RGBA windows. 1589 * The alpha channel of the window defines which pixels are 1590 * invisible and allows for nicely antialiased borders, 1591 * and the input shape controls where the window is 1592 * “clickable”. 1593 * 1594 * On the X11 platform, this requires version 1.1 of the 1595 * shape extension. 1596 * 1597 * On the Win32 platform, this functionality is not present and the 1598 * function does nothing. 1599 * 1600 * Params: 1601 * shapeRegion = region of window to be non-transparent 1602 * offsetX = X position of @shape_region in @window coordinates 1603 * offsetY = Y position of @shape_region in @window coordinates 1604 * 1605 * Since: 2.10 1606 */ 1607 public void inputShapeCombineRegion(Region shapeRegion, int offsetX, int offsetY) 1608 { 1609 gdk_window_input_shape_combine_region(gdkWindow, (shapeRegion is null) ? null : shapeRegion.getRegionStruct(), offsetX, offsetY); 1610 } 1611 1612 /** 1613 * Adds @region to the update area for @window. The update area is the 1614 * region that needs to be redrawn, or “dirty region.” The call 1615 * gdk_window_process_updates() sends one or more expose events to the 1616 * window, which together cover the entire update area. An 1617 * application would normally redraw the contents of @window in 1618 * response to those expose events. 1619 * 1620 * GDK will call gdk_window_process_all_updates() on your behalf 1621 * whenever your program returns to the main loop and becomes idle, so 1622 * normally there’s no need to do that manually, you just need to 1623 * invalidate regions that you know should be redrawn. 1624 * 1625 * The @child_func parameter controls whether the region of 1626 * each child window that intersects @region will also be invalidated. 1627 * Only children for which @child_func returns #TRUE will have the area 1628 * invalidated. 1629 * 1630 * Params: 1631 * region = a #cairo_region_t 1632 * childFunc = function to use to decide if to 1633 * recurse to a child, %NULL means never recurse. 1634 * userData = data passed to @child_func 1635 */ 1636 public void invalidateMaybeRecurse(Region region, GdkWindowChildFunc childFunc, void* userData) 1637 { 1638 gdk_window_invalidate_maybe_recurse(gdkWindow, (region is null) ? null : region.getRegionStruct(), childFunc, userData); 1639 } 1640 1641 /** 1642 * A convenience wrapper around gdk_window_invalidate_region() which 1643 * invalidates a rectangular region. See 1644 * gdk_window_invalidate_region() for details. 1645 * 1646 * Params: 1647 * rect = rectangle to invalidate or %NULL to invalidate the whole 1648 * window 1649 * invalidateChildren = whether to also invalidate child windows 1650 */ 1651 public void invalidateRect(GdkRectangle* rect, bool invalidateChildren) 1652 { 1653 gdk_window_invalidate_rect(gdkWindow, rect, invalidateChildren); 1654 } 1655 1656 /** 1657 * Adds @region to the update area for @window. The update area is the 1658 * region that needs to be redrawn, or “dirty region.” The call 1659 * gdk_window_process_updates() sends one or more expose events to the 1660 * window, which together cover the entire update area. An 1661 * application would normally redraw the contents of @window in 1662 * response to those expose events. 1663 * 1664 * GDK will call gdk_window_process_all_updates() on your behalf 1665 * whenever your program returns to the main loop and becomes idle, so 1666 * normally there’s no need to do that manually, you just need to 1667 * invalidate regions that you know should be redrawn. 1668 * 1669 * The @invalidate_children parameter controls whether the region of 1670 * each child window that intersects @region will also be invalidated. 1671 * If %FALSE, then the update area for child windows will remain 1672 * unaffected. See gdk_window_invalidate_maybe_recurse if you need 1673 * fine grained control over which children are invalidated. 1674 * 1675 * Params: 1676 * region = a #cairo_region_t 1677 * invalidateChildren = %TRUE to also invalidate child windows 1678 */ 1679 public void invalidateRegion(Region region, bool invalidateChildren) 1680 { 1681 gdk_window_invalidate_region(gdkWindow, (region is null) ? null : region.getRegionStruct(), invalidateChildren); 1682 } 1683 1684 /** 1685 * Check to see if a window is destroyed.. 1686 * 1687 * Return: %TRUE if the window is destroyed 1688 * 1689 * Since: 2.18 1690 */ 1691 public bool isDestroyed() 1692 { 1693 return gdk_window_is_destroyed(gdkWindow) != 0; 1694 } 1695 1696 /** 1697 * Determines whether or not the window is an input only window. 1698 * 1699 * Return: %TRUE if @window is input only 1700 * 1701 * Since: 2.22 1702 */ 1703 public bool isInputOnly() 1704 { 1705 return gdk_window_is_input_only(gdkWindow) != 0; 1706 } 1707 1708 /** 1709 * Determines whether or not the window is shaped. 1710 * 1711 * Return: %TRUE if @window is shaped 1712 * 1713 * Since: 2.22 1714 */ 1715 public bool isShaped() 1716 { 1717 return gdk_window_is_shaped(gdkWindow) != 0; 1718 } 1719 1720 /** 1721 * Check if the window and all ancestors of the window are 1722 * mapped. (This is not necessarily "viewable" in the X sense, since 1723 * we only check as far as we have GDK window parents, not to the root 1724 * window.) 1725 * 1726 * Return: %TRUE if the window is viewable 1727 */ 1728 public bool isViewable() 1729 { 1730 return gdk_window_is_viewable(gdkWindow) != 0; 1731 } 1732 1733 /** 1734 * Checks whether the window has been mapped (with gdk_window_show() or 1735 * gdk_window_show_unraised()). 1736 * 1737 * Return: %TRUE if the window is mapped 1738 */ 1739 public bool isVisible() 1740 { 1741 return gdk_window_is_visible(gdkWindow) != 0; 1742 } 1743 1744 /** 1745 * Lowers @window to the bottom of the Z-order (stacking order), so that 1746 * other windows with the same parent window appear above @window. 1747 * This is true whether or not the other windows are visible. 1748 * 1749 * If @window is a toplevel, the window manager may choose to deny the 1750 * request to move the window in the Z-order, gdk_window_lower() only 1751 * requests the restack, does not guarantee it. 1752 * 1753 * Note that gdk_window_show() raises the window again, so don’t call this 1754 * function before gdk_window_show(). (Try gdk_window_show_unraised().) 1755 */ 1756 public void lower() 1757 { 1758 gdk_window_lower(gdkWindow); 1759 } 1760 1761 /** 1762 * Maximizes the window. If the window was already maximized, then 1763 * this function does nothing. 1764 * 1765 * On X11, asks the window manager to maximize @window, if the window 1766 * manager supports this operation. Not all window managers support 1767 * this, and some deliberately ignore it or don’t have a concept of 1768 * “maximized”; so you can’t rely on the maximization actually 1769 * happening. But it will happen with most standard window managers, 1770 * and GDK makes a best effort to get it to happen. 1771 * 1772 * On Windows, reliably maximizes the window. 1773 */ 1774 public void maximize() 1775 { 1776 gdk_window_maximize(gdkWindow); 1777 } 1778 1779 /** 1780 * Merges the input shape masks for any child windows into the 1781 * input shape mask for @window. i.e. the union of all input masks 1782 * for @window and its children will become the new input mask 1783 * for @window. See gdk_window_input_shape_combine_region(). 1784 * 1785 * This function is distinct from gdk_window_set_child_input_shapes() 1786 * because it includes @window’s input shape mask in the set of 1787 * shapes to be merged. 1788 * 1789 * Since: 2.10 1790 */ 1791 public void mergeChildInputShapes() 1792 { 1793 gdk_window_merge_child_input_shapes(gdkWindow); 1794 } 1795 1796 /** 1797 * Merges the shape masks for any child windows into the 1798 * shape mask for @window. i.e. the union of all masks 1799 * for @window and its children will become the new mask 1800 * for @window. See gdk_window_shape_combine_region(). 1801 * 1802 * This function is distinct from gdk_window_set_child_shapes() 1803 * because it includes @window’s shape mask in the set of shapes to 1804 * be merged. 1805 */ 1806 public void mergeChildShapes() 1807 { 1808 gdk_window_merge_child_shapes(gdkWindow); 1809 } 1810 1811 /** 1812 * Repositions a window relative to its parent window. 1813 * For toplevel windows, window managers may ignore or modify the move; 1814 * you should probably use gtk_window_move() on a #GtkWindow widget 1815 * anyway, instead of using GDK functions. For child windows, 1816 * the move will reliably succeed. 1817 * 1818 * If you’re also planning to resize the window, use gdk_window_move_resize() 1819 * to both move and resize simultaneously, for a nicer visual effect. 1820 * 1821 * Params: 1822 * x = X coordinate relative to window’s parent 1823 * y = Y coordinate relative to window’s parent 1824 */ 1825 public void move(int x, int y) 1826 { 1827 gdk_window_move(gdkWindow, x, y); 1828 } 1829 1830 /** 1831 * Move the part of @window indicated by @region by @dy pixels in the Y 1832 * direction and @dx pixels in the X direction. The portions of @region 1833 * that not covered by the new position of @region are invalidated. 1834 * 1835 * Child windows are not moved. 1836 * 1837 * Params: 1838 * region = The #cairo_region_t to move 1839 * dx = Amount to move in the X direction 1840 * dy = Amount to move in the Y direction 1841 * 1842 * Since: 2.8 1843 */ 1844 public void moveRegion(Region region, int dx, int dy) 1845 { 1846 gdk_window_move_region(gdkWindow, (region is null) ? null : region.getRegionStruct(), dx, dy); 1847 } 1848 1849 /** 1850 * Equivalent to calling gdk_window_move() and gdk_window_resize(), 1851 * except that both operations are performed at once, avoiding strange 1852 * visual effects. (i.e. the user may be able to see the window first 1853 * move, then resize, if you don’t use gdk_window_move_resize().) 1854 * 1855 * Params: 1856 * x = new X position relative to window’s parent 1857 * y = new Y position relative to window’s parent 1858 * width = new width 1859 * height = new height 1860 */ 1861 public void moveResize(int x, int y, int width, int height) 1862 { 1863 gdk_window_move_resize(gdkWindow, x, y, width, height); 1864 } 1865 1866 /** 1867 * Like gdk_window_get_children(), but does not copy the list of 1868 * children, so the list does not need to be freed. 1869 * 1870 * Return: a reference to the list of child windows in @window 1871 */ 1872 public ListG peekChildren() 1873 { 1874 auto p = gdk_window_peek_children(gdkWindow); 1875 1876 if(p is null) 1877 { 1878 return null; 1879 } 1880 1881 return new ListG(cast(GList*) p); 1882 } 1883 1884 /** 1885 * Sends one or more expose events to @window. The areas in each 1886 * expose event will cover the entire update area for the window (see 1887 * gdk_window_invalidate_region() for details). Normally GDK calls 1888 * gdk_window_process_all_updates() on your behalf, so there’s no 1889 * need to call this function unless you want to force expose events 1890 * to be delivered immediately and synchronously (vs. the usual 1891 * case, where GDK delivers them in an idle handler). Occasionally 1892 * this is useful to produce nicer scrolling behavior, for example. 1893 * 1894 * Params: 1895 * updateChildren = whether to also process updates for child windows 1896 */ 1897 public void processUpdates(bool updateChildren) 1898 { 1899 gdk_window_process_updates(gdkWindow, updateChildren); 1900 } 1901 1902 /** 1903 * Raises @window to the top of the Z-order (stacking order), so that 1904 * other windows with the same parent window appear below @window. 1905 * This is true whether or not the windows are visible. 1906 * 1907 * If @window is a toplevel, the window manager may choose to deny the 1908 * request to move the window in the Z-order, gdk_window_raise() only 1909 * requests the restack, does not guarantee it. 1910 */ 1911 public void raise() 1912 { 1913 gdk_window_raise(gdkWindow); 1914 } 1915 1916 /** 1917 * Registers a window as a potential drop destination. 1918 */ 1919 public void registerDnd() 1920 { 1921 gdk_window_register_dnd(gdkWindow); 1922 } 1923 1924 /** 1925 * Remove a filter previously added with gdk_window_add_filter(). 1926 * 1927 * Params: 1928 * funct = previously-added filter function 1929 * data = user data for previously-added filter function 1930 */ 1931 public void removeFilter(GdkFilterFunc funct, void* data) 1932 { 1933 gdk_window_remove_filter(gdkWindow, funct, data); 1934 } 1935 1936 /** 1937 * Reparents @window into the given @new_parent. The window being 1938 * reparented will be unmapped as a side effect. 1939 * 1940 * Params: 1941 * newParent = new parent to move @window into 1942 * x = X location inside the new parent 1943 * y = Y location inside the new parent 1944 */ 1945 public void reparent(Window newParent, int x, int y) 1946 { 1947 gdk_window_reparent(gdkWindow, (newParent is null) ? null : newParent.getWindowStruct(), x, y); 1948 } 1949 1950 /** 1951 * Resizes @window; for toplevel windows, asks the window manager to resize 1952 * the window. The window manager may not allow the resize. When using GTK+, 1953 * use gtk_window_resize() instead of this low-level GDK function. 1954 * 1955 * Windows may not be resized below 1x1. 1956 * 1957 * If you’re also planning to move the window, use gdk_window_move_resize() 1958 * to both move and resize simultaneously, for a nicer visual effect. 1959 * 1960 * Params: 1961 * width = new width of the window 1962 * height = new height of the window 1963 */ 1964 public void resize(int width, int height) 1965 { 1966 gdk_window_resize(gdkWindow, width, height); 1967 } 1968 1969 /** 1970 * Changes the position of @window in the Z-order (stacking order), so that 1971 * it is above @sibling (if @above is %TRUE) or below @sibling (if @above is 1972 * %FALSE). 1973 * 1974 * If @sibling is %NULL, then this either raises (if @above is %TRUE) or 1975 * lowers the window. 1976 * 1977 * If @window is a toplevel, the window manager may choose to deny the 1978 * request to move the window in the Z-order, gdk_window_restack() only 1979 * requests the restack, does not guarantee it. 1980 * 1981 * Params: 1982 * sibling = a #GdkWindow that is a sibling of @window, or %NULL 1983 * above = a boolean 1984 * 1985 * Since: 2.18 1986 */ 1987 public void restack(Window sibling, bool above) 1988 { 1989 gdk_window_restack(gdkWindow, (sibling is null) ? null : sibling.getWindowStruct(), above); 1990 } 1991 1992 /** 1993 * Scroll the contents of @window, both pixels and children, by the 1994 * given amount. @window itself does not move. Portions of the window 1995 * that the scroll operation brings in from offscreen areas are 1996 * invalidated. The invalidated region may be bigger than what would 1997 * strictly be necessary. 1998 * 1999 * For X11, a minimum area will be invalidated if the window has no 2000 * subwindows, or if the edges of the window’s parent do not extend 2001 * beyond the edges of the window. In other cases, a multi-step process 2002 * is used to scroll the window which may produce temporary visual 2003 * artifacts and unnecessary invalidations. 2004 * 2005 * Params: 2006 * dx = Amount to scroll in the X direction 2007 * dy = Amount to scroll in the Y direction 2008 */ 2009 public void scroll(int dx, int dy) 2010 { 2011 gdk_window_scroll(gdkWindow, dx, dy); 2012 } 2013 2014 /** 2015 * Setting @accept_focus to %FALSE hints the desktop environment that the 2016 * window doesn’t want to receive input focus. 2017 * 2018 * On X, it is the responsibility of the window manager to interpret this 2019 * hint. ICCCM-compliant window manager usually respect it. 2020 * 2021 * Params: 2022 * acceptFocus = %TRUE if the window should receive input focus 2023 * 2024 * Since: 2.4 2025 */ 2026 public void setAcceptFocus(bool acceptFocus) 2027 { 2028 gdk_window_set_accept_focus(gdkWindow, acceptFocus); 2029 } 2030 2031 /** 2032 * Sets the background color of @window. (However, when using GTK+, 2033 * set the background of a widget with gtk_widget_modify_bg() - if 2034 * you’re an application - or gtk_style_set_background() - if you're 2035 * implementing a custom widget.) 2036 * 2037 * See also gdk_window_set_background_pattern(). 2038 * 2039 * Deprecated: Use gdk_window_set_background_rgba() instead. 2040 * 2041 * Params: 2042 * color = a #GdkColor 2043 */ 2044 public void setBackground(Color color) 2045 { 2046 gdk_window_set_background(gdkWindow, (color is null) ? null : color.getColorStruct()); 2047 } 2048 2049 /** 2050 * Sets the background of @window. 2051 * 2052 * A background of %NULL means that the window will inherit its 2053 * background from its parent window. 2054 * 2055 * The windowing system will normally fill a window with its background 2056 * when the window is obscured then exposed. 2057 * 2058 * Params: 2059 * pattern = a pattern to use, or %NULL 2060 */ 2061 public void setBackgroundPattern(Pattern pattern) 2062 { 2063 gdk_window_set_background_pattern(gdkWindow, (pattern is null) ? null : pattern.getPatternStruct()); 2064 } 2065 2066 /** 2067 * Sets the background color of @window. 2068 * 2069 * See also gdk_window_set_background_pattern(). 2070 * 2071 * Params: 2072 * rgba = a #GdkRGBA color 2073 */ 2074 public void setBackgroundRgba(RGBA rgba) 2075 { 2076 gdk_window_set_background_rgba(gdkWindow, (rgba is null) ? null : rgba.getRGBAStruct()); 2077 } 2078 2079 /** 2080 * Sets the input shape mask of @window to the union of input shape masks 2081 * for all children of @window, ignoring the input shape mask of @window 2082 * itself. Contrast with gdk_window_merge_child_input_shapes() which includes 2083 * the input shape mask of @window in the masks to be merged. 2084 * 2085 * Since: 2.10 2086 */ 2087 public void setChildInputShapes() 2088 { 2089 gdk_window_set_child_input_shapes(gdkWindow); 2090 } 2091 2092 /** 2093 * Sets the shape mask of @window to the union of shape masks 2094 * for all children of @window, ignoring the shape mask of @window 2095 * itself. Contrast with gdk_window_merge_child_shapes() which includes 2096 * the shape mask of @window in the masks to be merged. 2097 */ 2098 public void setChildShapes() 2099 { 2100 gdk_window_set_child_shapes(gdkWindow); 2101 } 2102 2103 /** 2104 * Sets a #GdkWindow as composited, or unsets it. Composited 2105 * windows do not automatically have their contents drawn to 2106 * the screen. Drawing is redirected to an offscreen buffer 2107 * and an expose event is emitted on the parent of the composited 2108 * window. It is the responsibility of the parent’s expose handler 2109 * to manually merge the off-screen content onto the screen in 2110 * whatever way it sees fit. 2111 * 2112 * It only makes sense for child windows to be composited; see 2113 * gdk_window_set_opacity() if you need translucent toplevel 2114 * windows. 2115 * 2116 * An additional effect of this call is that the area of this 2117 * window is no longer clipped from regions marked for 2118 * invalidation on its parent. Draws done on the parent 2119 * window are also no longer clipped by the child. 2120 * 2121 * This call is only supported on some systems (currently, 2122 * only X11 with new enough Xcomposite and Xdamage extensions). 2123 * You must call gdk_display_supports_composite() to check if 2124 * setting a window as composited is supported before 2125 * attempting to do so. 2126 * 2127 * Params: 2128 * composited = %TRUE to set the window as composited 2129 * 2130 * Since: 2.12 2131 */ 2132 public void setComposited(bool composited) 2133 { 2134 gdk_window_set_composited(gdkWindow, composited); 2135 } 2136 2137 /** 2138 * Sets the default mouse pointer for a #GdkWindow. Use gdk_cursor_new_for_display() 2139 * or gdk_cursor_new_from_pixbuf() to create the cursor. To make the cursor 2140 * invisible, use %GDK_BLANK_CURSOR. Passing %NULL for the @cursor argument 2141 * to gdk_window_set_cursor() means that @window will use the cursor of its 2142 * parent window. Most windows should use this default. 2143 * 2144 * Params: 2145 * cursor = a cursor 2146 */ 2147 public void setCursor(Cursor cursor) 2148 { 2149 gdk_window_set_cursor(gdkWindow, (cursor is null) ? null : cursor.getCursorStruct()); 2150 } 2151 2152 /** 2153 * “Decorations” are the features the window manager adds to a toplevel #GdkWindow. 2154 * This function sets the traditional Motif window manager hints that tell the 2155 * window manager which decorations you would like your window to have. 2156 * Usually you should use gtk_window_set_decorated() on a #GtkWindow instead of 2157 * using the GDK function directly. 2158 * 2159 * The @decorations argument is the logical OR of the fields in 2160 * the #GdkWMDecoration enumeration. If #GDK_DECOR_ALL is included in the 2161 * mask, the other bits indicate which decorations should be turned off. 2162 * If #GDK_DECOR_ALL is not included, then the other bits indicate 2163 * which decorations should be turned on. 2164 * 2165 * Most window managers honor a decorations hint of 0 to disable all decorations, 2166 * but very few honor all possible combinations of bits. 2167 * 2168 * Params: 2169 * decorations = decoration hint mask 2170 */ 2171 public void setDecorations(GdkWMDecoration decorations) 2172 { 2173 gdk_window_set_decorations(gdkWindow, decorations); 2174 } 2175 2176 /** 2177 * Sets a specific #GdkCursor for a given device when it gets inside @window. 2178 * Use gdk_cursor_new_for_display() or gdk_cursor_new_from_pixbuf() to create 2179 * the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR. Passing 2180 * %NULL for the @cursor argument to gdk_window_set_cursor() means that 2181 * @window will use the cursor of its parent window. Most windows should 2182 * use this default. 2183 * 2184 * Params: 2185 * device = a master, pointer #GdkDevice 2186 * cursor = a #GdkCursor 2187 * 2188 * Since: 3.0 2189 */ 2190 public void setDeviceCursor(Device device, Cursor cursor) 2191 { 2192 gdk_window_set_device_cursor(gdkWindow, (device is null) ? null : device.getDeviceStruct(), (cursor is null) ? null : cursor.getCursorStruct()); 2193 } 2194 2195 /** 2196 * Sets the event mask for a given device (Normally a floating device, not 2197 * attached to any visible pointer) to @window. For example, an event mask 2198 * including #GDK_BUTTON_PRESS_MASK means the window should report button 2199 * press events. The event mask is the bitwise OR of values from the 2200 * #GdkEventMask enumeration. 2201 * 2202 * Params: 2203 * device = #GdkDevice to enable events for. 2204 * eventMask = event mask for @window 2205 * 2206 * Since: 3.0 2207 */ 2208 public void setDeviceEvents(Device device, GdkEventMask eventMask) 2209 { 2210 gdk_window_set_device_events(gdkWindow, (device is null) ? null : device.getDeviceStruct(), eventMask); 2211 } 2212 2213 /** 2214 * Determines whether or not extra unprocessed motion events in 2215 * the event queue can be discarded. If %TRUE only the most recent 2216 * event will be delivered. 2217 * 2218 * Some types of applications, e.g. paint programs, need to see all 2219 * motion events and will benefit from turning off event compression. 2220 * 2221 * By default, event compression is enabled. 2222 * 2223 * Params: 2224 * eventCompression = %TRUE if motion events should be compressed 2225 * 2226 * Since: 3.12 2227 */ 2228 public void setEventCompression(bool eventCompression) 2229 { 2230 gdk_window_set_event_compression(gdkWindow, eventCompression); 2231 } 2232 2233 /** 2234 * The event mask for a window determines which events will be reported 2235 * for that window from all master input devices. For example, an event mask 2236 * including #GDK_BUTTON_PRESS_MASK means the window should report button 2237 * press events. The event mask is the bitwise OR of values from the 2238 * #GdkEventMask enumeration. 2239 * 2240 * Params: 2241 * eventMask = event mask for @window 2242 */ 2243 public void setEvents(GdkEventMask eventMask) 2244 { 2245 gdk_window_set_events(gdkWindow, eventMask); 2246 } 2247 2248 /** 2249 * Setting @focus_on_map to %FALSE hints the desktop environment that the 2250 * window doesn’t want to receive input focus when it is mapped. 2251 * focus_on_map should be turned off for windows that aren’t triggered 2252 * interactively (such as popups from network activity). 2253 * 2254 * On X, it is the responsibility of the window manager to interpret 2255 * this hint. Window managers following the freedesktop.org window 2256 * manager extension specification should respect it. 2257 * 2258 * Params: 2259 * focusOnMap = %TRUE if the window should receive input focus when mapped 2260 * 2261 * Since: 2.6 2262 */ 2263 public void setFocusOnMap(bool focusOnMap) 2264 { 2265 gdk_window_set_focus_on_map(gdkWindow, focusOnMap); 2266 } 2267 2268 /** 2269 * Specifies whether the @window should span over all monitors (in a multi-head 2270 * setup) or only the current monitor when in fullscreen mode. 2271 * 2272 * The @mode argument is from the #GdkFullscreenMode enumeration. 2273 * If #GDK_FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen @window will 2274 * span over all monitors from the #GdkScreen. 2275 * 2276 * On X11, searches through the list of monitors from the #GdkScreen the ones 2277 * which delimit the 4 edges of the entire #GdkScreen and will ask the window 2278 * manager to span the @window over these monitors. 2279 * 2280 * If the XINERAMA extension is not available or not usable, this function 2281 * has no effect. 2282 * 2283 * Not all window managers support this, so you can’t rely on the fullscreen 2284 * window to span over the multiple monitors when #GDK_FULLSCREEN_ON_ALL_MONITORS 2285 * is specified. 2286 * 2287 * Params: 2288 * mode = fullscreen mode 2289 * 2290 * Since: 3.8 2291 */ 2292 public void setFullscreenMode(GdkFullscreenMode mode) 2293 { 2294 gdk_window_set_fullscreen_mode(gdkWindow, mode); 2295 } 2296 2297 /** 2298 * Sets hints about the window management functions to make available 2299 * via buttons on the window frame. 2300 * 2301 * On the X backend, this function sets the traditional Motif window 2302 * manager hint for this purpose. However, few window managers do 2303 * anything reliable or interesting with this hint. Many ignore it 2304 * entirely. 2305 * 2306 * The @functions argument is the logical OR of values from the 2307 * #GdkWMFunction enumeration. If the bitmask includes #GDK_FUNC_ALL, 2308 * then the other bits indicate which functions to disable; if 2309 * it doesn’t include #GDK_FUNC_ALL, it indicates which functions to 2310 * enable. 2311 * 2312 * Params: 2313 * functions = bitmask of operations to allow on @window 2314 */ 2315 public void setFunctions(GdkWMFunction functions) 2316 { 2317 gdk_window_set_functions(gdkWindow, functions); 2318 } 2319 2320 /** 2321 * Sets the geometry hints for @window. Hints flagged in @geom_mask 2322 * are set, hints not flagged in @geom_mask are unset. 2323 * To unset all hints, use a @geom_mask of 0 and a @geometry of %NULL. 2324 * 2325 * This function provides hints to the windowing system about 2326 * acceptable sizes for a toplevel window. The purpose of 2327 * this is to constrain user resizing, but the windowing system 2328 * will typically (but is not required to) also constrain the 2329 * current size of the window to the provided values and 2330 * constrain programatic resizing via gdk_window_resize() or 2331 * gdk_window_move_resize(). 2332 * 2333 * Note that on X11, this effect has no effect on windows 2334 * of type %GDK_WINDOW_TEMP or windows where override redirect 2335 * has been turned on via gdk_window_set_override_redirect() 2336 * since these windows are not resizable by the user. 2337 * 2338 * Since you can’t count on the windowing system doing the 2339 * constraints for programmatic resizes, you should generally 2340 * call gdk_window_constrain_size() yourself to determine 2341 * appropriate sizes. 2342 * 2343 * Params: 2344 * geometry = geometry hints 2345 * geomMask = bitmask indicating fields of @geometry to pay attention to 2346 */ 2347 public void setGeometryHints(GdkGeometry* geometry, GdkWindowHints geomMask) 2348 { 2349 gdk_window_set_geometry_hints(gdkWindow, geometry, geomMask); 2350 } 2351 2352 /** 2353 * Sets the group leader window for @window. By default, 2354 * GDK sets the group leader for all toplevel windows 2355 * to a global window implicitly created by GDK. With this function 2356 * you can override this default. 2357 * 2358 * The group leader window allows the window manager to distinguish 2359 * all windows that belong to a single application. It may for example 2360 * allow users to minimize/unminimize all windows belonging to an 2361 * application at once. You should only set a non-default group window 2362 * if your application pretends to be multiple applications. 2363 * 2364 * Params: 2365 * leader = group leader window, or %NULL to restore the default group leader window 2366 */ 2367 public void setGroup(Window leader) 2368 { 2369 gdk_window_set_group(gdkWindow, (leader is null) ? null : leader.getWindowStruct()); 2370 } 2371 2372 /** 2373 * Sets a list of icons for the window. One of these will be used 2374 * to represent the window when it has been iconified. The icon is 2375 * usually shown in an icon box or some sort of task bar. Which icon 2376 * size is shown depends on the window manager. The window manager 2377 * can scale the icon but setting several size icons can give better 2378 * image quality since the window manager may only need to scale the 2379 * icon by a small amount or not at all. 2380 * 2381 * Params: 2382 * pixbufs = A list of pixbufs, of different sizes. 2383 */ 2384 public void setIconList(ListG pixbufs) 2385 { 2386 gdk_window_set_icon_list(gdkWindow, (pixbufs is null) ? null : pixbufs.getListGStruct()); 2387 } 2388 2389 /** 2390 * Windows may have a name used while minimized, distinct from the 2391 * name they display in their titlebar. Most of the time this is a bad 2392 * idea from a user interface standpoint. But you can set such a name 2393 * with this function, if you like. 2394 * 2395 * After calling this with a non-%NULL @name, calls to gdk_window_set_title() 2396 * will not update the icon title. 2397 * 2398 * Using %NULL for @name unsets the icon title; further calls to 2399 * gdk_window_set_title() will again update the icon title as well. 2400 * 2401 * Params: 2402 * name = name of window while iconified (minimized) 2403 */ 2404 public void setIconName(string name) 2405 { 2406 gdk_window_set_icon_name(gdkWindow, Str.toStringz(name)); 2407 } 2408 2409 /** 2410 * Registers an invalidate handler for a specific window. This 2411 * will get called whenever a region in the window or its children 2412 * is invalidated. 2413 * 2414 * This can be used to record the invalidated region, which is 2415 * useful if you are keeping an offscreen copy of some region 2416 * and want to keep it up to date. You can also modify the 2417 * invalidated region in case you’re doing some effect where 2418 * e.g. a child widget appears in multiple places. 2419 * 2420 * Params: 2421 * handler = a #GdkWindowInvalidateHandlerFunc callback function 2422 * 2423 * Since: 3.10 2424 */ 2425 public void setInvalidateHandler(GdkWindowInvalidateHandlerFunc handler) 2426 { 2427 gdk_window_set_invalidate_handler(gdkWindow, handler); 2428 } 2429 2430 /** 2431 * Set if @window must be kept above other windows. If the 2432 * window was already above, then this function does nothing. 2433 * 2434 * On X11, asks the window manager to keep @window above, if the window 2435 * manager supports this operation. Not all window managers support 2436 * this, and some deliberately ignore it or don’t have a concept of 2437 * “keep above”; so you can’t rely on the window being kept above. 2438 * But it will happen with most standard window managers, 2439 * and GDK makes a best effort to get it to happen. 2440 * 2441 * Params: 2442 * setting = whether to keep @window above other windows 2443 * 2444 * Since: 2.4 2445 */ 2446 public void setKeepAbove(bool setting) 2447 { 2448 gdk_window_set_keep_above(gdkWindow, setting); 2449 } 2450 2451 /** 2452 * Set if @window must be kept below other windows. If the 2453 * window was already below, then this function does nothing. 2454 * 2455 * On X11, asks the window manager to keep @window below, if the window 2456 * manager supports this operation. Not all window managers support 2457 * this, and some deliberately ignore it or don’t have a concept of 2458 * “keep below”; so you can’t rely on the window being kept below. 2459 * But it will happen with most standard window managers, 2460 * and GDK makes a best effort to get it to happen. 2461 * 2462 * Params: 2463 * setting = whether to keep @window below other windows 2464 * 2465 * Since: 2.4 2466 */ 2467 public void setKeepBelow(bool setting) 2468 { 2469 gdk_window_set_keep_below(gdkWindow, setting); 2470 } 2471 2472 /** 2473 * The application can use this hint to tell the window manager 2474 * that a certain window has modal behaviour. The window manager 2475 * can use this information to handle modal windows in a special 2476 * way. 2477 * 2478 * You should only use this on windows for which you have 2479 * previously called gdk_window_set_transient_for() 2480 * 2481 * Params: 2482 * modal = %TRUE if the window is modal, %FALSE otherwise. 2483 */ 2484 public void setModalHint(bool modal) 2485 { 2486 gdk_window_set_modal_hint(gdkWindow, modal); 2487 } 2488 2489 /** 2490 * Set @window to render as partially transparent, 2491 * with opacity 0 being fully transparent and 1 fully opaque. (Values 2492 * of the opacity parameter are clamped to the [0,1] range.) 2493 * 2494 * For toplevel windows this depends on support from the windowing system 2495 * that may not always be there. For instance, On X11, this works only on 2496 * X screens with a compositing manager running. 2497 * 2498 * For child windows this function only works for non-native windows. 2499 * 2500 * For setting up per-pixel alpha topelevels, see gdk_screen_get_rgba_visual(), 2501 * and for non-toplevels, see gdk_window_set_composited(). 2502 * 2503 * Support for non-toplevel windows was added in 3.8. 2504 * 2505 * Params: 2506 * opacity = opacity 2507 * 2508 * Since: 2.12 2509 */ 2510 public void setOpacity(double opacity) 2511 { 2512 gdk_window_set_opacity(gdkWindow, opacity); 2513 } 2514 2515 /** 2516 * For optimizization purposes, compositing window managers may 2517 * like to not draw obscured regions of windows, or turn off blending 2518 * during for these regions. With RGB windows with no transparency, 2519 * this is just the shape of the window, but with ARGB32 windows, the 2520 * compositor does not know what regions of the window are transparent 2521 * or not. 2522 * 2523 * This function only works for toplevel windows. 2524 * 2525 * GTK+ will automatically update this property automatically if 2526 * the @window background is opaque, as we know where the opaque regions 2527 * are. If your window background is not opaque, please update this 2528 * property in your #GtkWidget::style-updated handler. 2529 * 2530 * Params: 2531 * region = a region 2532 * 2533 * Since: 3.10 2534 */ 2535 public void setOpaqueRegion(Region region) 2536 { 2537 gdk_window_set_opaque_region(gdkWindow, (region is null) ? null : region.getRegionStruct()); 2538 } 2539 2540 /** 2541 * An override redirect window is not under the control of the window manager. 2542 * This means it won’t have a titlebar, won’t be minimizable, etc. - it will 2543 * be entirely under the control of the application. The window manager 2544 * can’t see the override redirect window at all. 2545 * 2546 * Override redirect should only be used for short-lived temporary 2547 * windows, such as popup menus. #GtkMenu uses an override redirect 2548 * window in its implementation, for example. 2549 * 2550 * Params: 2551 * overrideRedirect = %TRUE if window should be override redirect 2552 */ 2553 public void setOverrideRedirect(bool overrideRedirect) 2554 { 2555 gdk_window_set_override_redirect(gdkWindow, overrideRedirect); 2556 } 2557 2558 /** 2559 * When using GTK+, typically you should use gtk_window_set_role() instead 2560 * of this low-level function. 2561 * 2562 * The window manager and session manager use a window’s role to 2563 * distinguish it from other kinds of window in the same application. 2564 * When an application is restarted after being saved in a previous 2565 * session, all windows with the same title and role are treated as 2566 * interchangeable. So if you have two windows with the same title 2567 * that should be distinguished for session management purposes, you 2568 * should set the role on those windows. It doesn’t matter what string 2569 * you use for the role, as long as you have a different role for each 2570 * non-interchangeable kind of window. 2571 * 2572 * Params: 2573 * role = a string indicating its role 2574 */ 2575 public void setRole(string role) 2576 { 2577 gdk_window_set_role(gdkWindow, Str.toStringz(role)); 2578 } 2579 2580 /** 2581 * Newer GTK+ windows using client-side decorations use extra geometry 2582 * around their frames for effects like shadows and invisible borders. 2583 * Window managers that want to maximize windows or snap to edges need 2584 * to know where the extents of the actual frame lie, so that users 2585 * don’t feel like windows are snapping against random invisible edges. 2586 * 2587 * Note that this property is automatically updated by GTK+, so this 2588 * function should only be used by applications which do not use GTK+ 2589 * to create toplevel windows. 2590 * 2591 * Params: 2592 * left = The left extent 2593 * right = The right extent 2594 * top = The top extent 2595 * bottom = The bottom extent 2596 * 2597 * Since: 3.12 2598 */ 2599 public void setShadowWidth(int left, int right, int top, int bottom) 2600 { 2601 gdk_window_set_shadow_width(gdkWindow, left, right, top, bottom); 2602 } 2603 2604 /** 2605 * Toggles whether a window should appear in a pager (workspace 2606 * switcher, or other desktop utility program that displays a small 2607 * thumbnail representation of the windows on the desktop). If a 2608 * window’s semantic type as specified with gdk_window_set_type_hint() 2609 * already fully describes the window, this function should 2610 * not be called in addition, instead you should 2611 * allow the window to be treated according to standard policy for 2612 * its semantic type. 2613 * 2614 * Params: 2615 * skipsPager = %TRUE to skip the pager 2616 * 2617 * Since: 2.2 2618 */ 2619 public void setSkipPagerHint(bool skipsPager) 2620 { 2621 gdk_window_set_skip_pager_hint(gdkWindow, skipsPager); 2622 } 2623 2624 /** 2625 * Toggles whether a window should appear in a task list or window 2626 * list. If a window’s semantic type as specified with 2627 * gdk_window_set_type_hint() already fully describes the window, this 2628 * function should not be called in addition, 2629 * instead you should allow the window to be treated according to 2630 * standard policy for its semantic type. 2631 * 2632 * Params: 2633 * skipsTaskbar = %TRUE to skip the taskbar 2634 * 2635 * Since: 2.2 2636 */ 2637 public void setSkipTaskbarHint(bool skipsTaskbar) 2638 { 2639 gdk_window_set_skip_taskbar_hint(gdkWindow, skipsTaskbar); 2640 } 2641 2642 /** 2643 * Sets the event mask for any floating device (i.e. not attached to any 2644 * visible pointer) that has the source defined as @source. This event 2645 * mask will be applied both to currently existing, newly added devices 2646 * after this call, and devices being attached/detached. 2647 * 2648 * Params: 2649 * source = a #GdkInputSource to define the source class. 2650 * eventMask = event mask for @window 2651 * 2652 * Since: 3.0 2653 */ 2654 public void setSourceEvents(GdkInputSource source, GdkEventMask eventMask) 2655 { 2656 gdk_window_set_source_events(gdkWindow, source, eventMask); 2657 } 2658 2659 /** 2660 * When using GTK+, typically you should use gtk_window_set_startup_id() 2661 * instead of this low-level function. 2662 * 2663 * Params: 2664 * startupId = a string with startup-notification identifier 2665 * 2666 * Since: 2.12 2667 */ 2668 public void setStartupId(string startupId) 2669 { 2670 gdk_window_set_startup_id(gdkWindow, Str.toStringz(startupId)); 2671 } 2672 2673 /** 2674 * Set the bit gravity of the given window to static, and flag it so 2675 * all children get static subwindow gravity. This is used if you are 2676 * implementing scary features that involve deep knowledge of the 2677 * windowing system. Don’t worry about it unless you have to. 2678 * 2679 * Params: 2680 * useStatic = %TRUE to turn on static gravity 2681 * 2682 * Return: %TRUE if the server supports static gravity 2683 */ 2684 public bool setStaticGravities(bool useStatic) 2685 { 2686 return gdk_window_set_static_gravities(gdkWindow, useStatic) != 0; 2687 } 2688 2689 /** 2690 * This function will enable multidevice features in @window. 2691 * 2692 * Multidevice aware windows will need to handle properly multiple, 2693 * per device enter/leave events, device grabs and grab ownerships. 2694 * 2695 * Params: 2696 * supportMultidevice = %TRUE to enable multidevice support in @window. 2697 * 2698 * Since: 3.0 2699 */ 2700 public void setSupportMultidevice(bool supportMultidevice) 2701 { 2702 gdk_window_set_support_multidevice(gdkWindow, supportMultidevice); 2703 } 2704 2705 /** 2706 * Sets the title of a toplevel window, to be displayed in the titlebar. 2707 * If you haven’t explicitly set the icon name for the window 2708 * (using gdk_window_set_icon_name()), the icon name will be set to 2709 * @title as well. @title must be in UTF-8 encoding (as with all 2710 * user-readable strings in GDK/GTK+). @title may not be %NULL. 2711 * 2712 * Params: 2713 * title = title of @window 2714 */ 2715 public void setTitle(string title) 2716 { 2717 gdk_window_set_title(gdkWindow, Str.toStringz(title)); 2718 } 2719 2720 /** 2721 * Indicates to the window manager that @window is a transient dialog 2722 * associated with the application window @parent. This allows the 2723 * window manager to do things like center @window on @parent and 2724 * keep @window above @parent. 2725 * 2726 * See gtk_window_set_transient_for() if you’re using #GtkWindow or 2727 * #GtkDialog. 2728 * 2729 * Params: 2730 * parent = another toplevel #GdkWindow 2731 */ 2732 public void setTransientFor(Window parent) 2733 { 2734 gdk_window_set_transient_for(gdkWindow, (parent is null) ? null : parent.getWindowStruct()); 2735 } 2736 2737 /** 2738 * The application can use this call to provide a hint to the window 2739 * manager about the functionality of a window. The window manager 2740 * can use this information when determining the decoration and behaviour 2741 * of the window. 2742 * 2743 * The hint must be set before the window is mapped. 2744 * 2745 * Params: 2746 * hint = A hint of the function this window will have 2747 */ 2748 public void setTypeHint(GdkWindowTypeHint hint) 2749 { 2750 gdk_window_set_type_hint(gdkWindow, hint); 2751 } 2752 2753 /** 2754 * Toggles whether a window needs the user's 2755 * urgent attention. 2756 * 2757 * Params: 2758 * urgent = %TRUE if the window is urgent 2759 * 2760 * Since: 2.8 2761 */ 2762 public void setUrgencyHint(bool urgent) 2763 { 2764 gdk_window_set_urgency_hint(gdkWindow, urgent); 2765 } 2766 2767 /** 2768 * For most purposes this function is deprecated in favor of 2769 * g_object_set_data(). However, for historical reasons GTK+ stores 2770 * the #GtkWidget that owns a #GdkWindow as user data on the 2771 * #GdkWindow. So, custom widget implementations should use 2772 * this function for that. If GTK+ receives an event for a #GdkWindow, 2773 * and the user data for the window is non-%NULL, GTK+ will assume the 2774 * user data is a #GtkWidget, and forward the event to that widget. 2775 * 2776 * Params: 2777 * userData = user data 2778 */ 2779 public void setUserData(ObjectG userData) 2780 { 2781 gdk_window_set_user_data(gdkWindow, (userData is null) ? null : userData.getObjectGStruct()); 2782 } 2783 2784 /** 2785 * Makes pixels in @window outside @shape_region be transparent, 2786 * so that the window may be nonrectangular. 2787 * 2788 * If @shape_region is %NULL, the shape will be unset, so the whole 2789 * window will be opaque again. @offset_x and @offset_y are ignored 2790 * if @shape_region is %NULL. 2791 * 2792 * On the X11 platform, this uses an X server extension which is 2793 * widely available on most common platforms, but not available on 2794 * very old X servers, and occasionally the implementation will be 2795 * buggy. On servers without the shape extension, this function 2796 * will do nothing. 2797 * 2798 * This function works on both toplevel and child windows. 2799 * 2800 * Params: 2801 * shapeRegion = region of window to be non-transparent 2802 * offsetX = X position of @shape_region in @window coordinates 2803 * offsetY = Y position of @shape_region in @window coordinates 2804 */ 2805 public void shapeCombineRegion(Region shapeRegion, int offsetX, int offsetY) 2806 { 2807 gdk_window_shape_combine_region(gdkWindow, (shapeRegion is null) ? null : shapeRegion.getRegionStruct(), offsetX, offsetY); 2808 } 2809 2810 /** 2811 * Like gdk_window_show_unraised(), but also raises the window to the 2812 * top of the window stack (moves the window to the front of the 2813 * Z-order). 2814 * 2815 * This function maps a window so it’s visible onscreen. Its opposite 2816 * is gdk_window_hide(). 2817 * 2818 * When implementing a #GtkWidget, you should call this function on the widget's 2819 * #GdkWindow as part of the “map” method. 2820 */ 2821 public void show() 2822 { 2823 gdk_window_show(gdkWindow); 2824 } 2825 2826 /** 2827 * Shows a #GdkWindow onscreen, but does not modify its stacking 2828 * order. In contrast, gdk_window_show() will raise the window 2829 * to the top of the window stack. 2830 * 2831 * On the X11 platform, in Xlib terms, this function calls 2832 * XMapWindow() (it also updates some internal GDK state, which means 2833 * that you can’t really use XMapWindow() directly on a GDK window). 2834 */ 2835 public void showUnraised() 2836 { 2837 gdk_window_show_unraised(gdkWindow); 2838 } 2839 2840 /** 2841 * Asks the windowing system to show the window menu. The window menu 2842 * is the menu shown when right-clicking the titlebar on traditional 2843 * windows managed by the window manager. This is useful for windows 2844 * using client-side decorations, activating it with a right-click 2845 * on the window decorations. 2846 * 2847 * Params: 2848 * event = a #GdkEvent to show the menu for 2849 * 2850 * Return: %TRUE if the window menu was shown and %FALSE otherwise. 2851 * 2852 * Since: 3.14 2853 */ 2854 public bool showWindowMenu(Event event) 2855 { 2856 return gdk_window_show_window_menu(gdkWindow, (event is null) ? null : event.getEventStruct()) != 0; 2857 } 2858 2859 /** 2860 * “Pins” a window such that it’s on all workspaces and does not scroll 2861 * with viewports, for window managers that have scrollable viewports. 2862 * (When using #GtkWindow, gtk_window_stick() may be more useful.) 2863 * 2864 * On the X11 platform, this function depends on window manager 2865 * support, so may have no effect with many window managers. However, 2866 * GDK will do the best it can to convince the window manager to stick 2867 * the window. For window managers that don’t support this operation, 2868 * there’s nothing you can do to force it to happen. 2869 */ 2870 public void stick() 2871 { 2872 gdk_window_stick(gdkWindow); 2873 } 2874 2875 /** 2876 * Thaws a window frozen with 2877 * gdk_window_freeze_toplevel_updates_libgtk_only(). 2878 * 2879 * This function is not part of the GDK public API and is only 2880 * for use by GTK+. 2881 */ 2882 public void thawToplevelUpdatesLibgtkOnly() 2883 { 2884 gdk_window_thaw_toplevel_updates_libgtk_only(gdkWindow); 2885 } 2886 2887 /** 2888 * Thaws a window frozen with gdk_window_freeze_updates(). 2889 */ 2890 public void thawUpdates() 2891 { 2892 gdk_window_thaw_updates(gdkWindow); 2893 } 2894 2895 /** 2896 * Moves the window out of fullscreen mode. If the window was not 2897 * fullscreen, does nothing. 2898 * 2899 * On X11, asks the window manager to move @window out of the fullscreen 2900 * state, if the window manager supports this operation. Not all 2901 * window managers support this, and some deliberately ignore it or 2902 * don’t have a concept of “fullscreen”; so you can’t rely on the 2903 * unfullscreenification actually happening. But it will happen with 2904 * most standard window managers, and GDK makes a best effort to get 2905 * it to happen. 2906 * 2907 * Since: 2.2 2908 */ 2909 public void unfullscreen() 2910 { 2911 gdk_window_unfullscreen(gdkWindow); 2912 } 2913 2914 /** 2915 * Unmaximizes the window. If the window wasn’t maximized, then this 2916 * function does nothing. 2917 * 2918 * On X11, asks the window manager to unmaximize @window, if the 2919 * window manager supports this operation. Not all window managers 2920 * support this, and some deliberately ignore it or don’t have a 2921 * concept of “maximized”; so you can’t rely on the unmaximization 2922 * actually happening. But it will happen with most standard window 2923 * managers, and GDK makes a best effort to get it to happen. 2924 * 2925 * On Windows, reliably unmaximizes the window. 2926 */ 2927 public void unmaximize() 2928 { 2929 gdk_window_unmaximize(gdkWindow); 2930 } 2931 2932 /** 2933 * Reverse operation for gdk_window_stick(); see gdk_window_stick(), 2934 * and gtk_window_unstick(). 2935 */ 2936 public void unstick() 2937 { 2938 gdk_window_unstick(gdkWindow); 2939 } 2940 2941 /** 2942 * Withdraws a window (unmaps it and asks the window manager to forget about it). 2943 * This function is not really useful as gdk_window_hide() automatically 2944 * withdraws toplevel windows before hiding them. 2945 */ 2946 public void withdraw() 2947 { 2948 gdk_window_withdraw(gdkWindow); 2949 } 2950 2951 int[string] connectedSignals; 2952 2953 Surface delegate(int, int, Window)[] onCreateSurfaceListeners; 2954 /** 2955 * The ::create-surface signal is emitted when an offscreen window 2956 * needs its surface (re)created, which happens either when the 2957 * window is first drawn to, or when the window is being 2958 * resized. The first signal handler that returns a non-%NULL 2959 * surface will stop any further signal emission, and its surface 2960 * will be used. 2961 * 2962 * Note that it is not possible to access the window's previous 2963 * surface from within any callback of this signal. Calling 2964 * gdk_offscreen_window_get_surface() will lead to a crash. 2965 * 2966 * Params: 2967 * width = the width of the offscreen surface to create 2968 * height = the height of the offscreen surface to create 2969 * 2970 * Return: the newly created #cairo_surface_t for the offscreen window 2971 * 2972 * Since: 3.0 2973 */ 2974 void addOnCreateSurface(Surface delegate(int, int, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2975 { 2976 if ( "create-surface" !in connectedSignals ) 2977 { 2978 Signals.connectData( 2979 this, 2980 "create-surface", 2981 cast(GCallback)&callBackCreateSurface, 2982 cast(void*)this, 2983 null, 2984 connectFlags); 2985 connectedSignals["create-surface"] = 1; 2986 } 2987 onCreateSurfaceListeners ~= dlg; 2988 } 2989 extern(C) static cairo_surface_t* callBackCreateSurface(GdkWindow* windowStruct, int width, int height, Window _window) 2990 { 2991 foreach ( Surface delegate(int, int, Window) dlg; _window.onCreateSurfaceListeners ) 2992 { 2993 if ( auto r = dlg(width, height, _window) ) 2994 return r.getSurfaceStruct(); 2995 } 2996 2997 return null; 2998 } 2999 3000 void delegate(double, double, void*, void*, Window)[] onFromEmbedderListeners; 3001 /** 3002 * The ::from-embedder signal is emitted to translate coordinates 3003 * in the embedder of an offscreen window to the offscreen window. 3004 * 3005 * See also #GdkWindow::to-embedder. 3006 * 3007 * Params: 3008 * embedderX = x coordinate in the embedder window 3009 * embedderY = y coordinate in the embedder window 3010 * offscreenX = return location for the x 3011 * coordinate in the offscreen window 3012 * offscreenY = return location for the y 3013 * coordinate in the offscreen window 3014 * 3015 * Since: 2.18 3016 */ 3017 void addOnFromEmbedder(void delegate(double, double, void*, void*, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3018 { 3019 if ( "from-embedder" !in connectedSignals ) 3020 { 3021 Signals.connectData( 3022 this, 3023 "from-embedder", 3024 cast(GCallback)&callBackFromEmbedder, 3025 cast(void*)this, 3026 null, 3027 connectFlags); 3028 connectedSignals["from-embedder"] = 1; 3029 } 3030 onFromEmbedderListeners ~= dlg; 3031 } 3032 extern(C) static void callBackFromEmbedder(GdkWindow* windowStruct, double embedderX, double embedderY, void* offscreenX, void* offscreenY, Window _window) 3033 { 3034 foreach ( void delegate(double, double, void*, void*, Window) dlg; _window.onFromEmbedderListeners ) 3035 { 3036 dlg(embedderX, embedderY, offscreenX, offscreenY, _window); 3037 } 3038 } 3039 3040 Window delegate(double, double, Window)[] onPickEmbeddedChildListeners; 3041 /** 3042 * The ::pick-embedded-child signal is emitted to find an embedded 3043 * child at the given position. 3044 * 3045 * Params: 3046 * x = x coordinate in the window 3047 * y = y coordinate in the window 3048 * 3049 * Return: the #GdkWindow of the 3050 * embedded child at @x, @y, or %NULL 3051 * 3052 * Since: 2.18 3053 */ 3054 void addOnPickEmbeddedChild(Window delegate(double, double, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3055 { 3056 if ( "pick-embedded-child" !in connectedSignals ) 3057 { 3058 Signals.connectData( 3059 this, 3060 "pick-embedded-child", 3061 cast(GCallback)&callBackPickEmbeddedChild, 3062 cast(void*)this, 3063 null, 3064 connectFlags); 3065 connectedSignals["pick-embedded-child"] = 1; 3066 } 3067 onPickEmbeddedChildListeners ~= dlg; 3068 } 3069 extern(C) static GdkWindow* callBackPickEmbeddedChild(GdkWindow* windowStruct, double x, double y, Window _window) 3070 { 3071 foreach ( Window delegate(double, double, Window) dlg; _window.onPickEmbeddedChildListeners ) 3072 { 3073 if ( auto r = dlg(x, y, _window) ) 3074 return r.getWindowStruct(); 3075 } 3076 3077 return null; 3078 } 3079 3080 void delegate(double, double, void*, void*, Window)[] onToEmbedderListeners; 3081 /** 3082 * The ::to-embedder signal is emitted to translate coordinates 3083 * in an offscreen window to its embedder. 3084 * 3085 * See also #GdkWindow::from-embedder. 3086 * 3087 * Params: 3088 * offscreenX = x coordinate in the offscreen window 3089 * offscreenY = y coordinate in the offscreen window 3090 * embedderX = return location for the x 3091 * coordinate in the embedder window 3092 * embedderY = return location for the y 3093 * coordinate in the embedder window 3094 * 3095 * Since: 2.18 3096 */ 3097 void addOnToEmbedder(void delegate(double, double, void*, void*, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3098 { 3099 if ( "to-embedder" !in connectedSignals ) 3100 { 3101 Signals.connectData( 3102 this, 3103 "to-embedder", 3104 cast(GCallback)&callBackToEmbedder, 3105 cast(void*)this, 3106 null, 3107 connectFlags); 3108 connectedSignals["to-embedder"] = 1; 3109 } 3110 onToEmbedderListeners ~= dlg; 3111 } 3112 extern(C) static void callBackToEmbedder(GdkWindow* windowStruct, double offscreenX, double offscreenY, void* embedderX, void* embedderY, Window _window) 3113 { 3114 foreach ( void delegate(double, double, void*, void*, Window) dlg; _window.onToEmbedderListeners ) 3115 { 3116 dlg(offscreenX, offscreenY, embedderX, embedderY, _window); 3117 } 3118 } 3119 3120 /** 3121 * Obtains the root window (parent all other windows are inside) 3122 * for the default display and screen. 3123 * 3124 * Return: the default root window 3125 */ 3126 public static Window getDefaultRootWindow() 3127 { 3128 auto p = gdk_get_default_root_window(); 3129 3130 if(p is null) 3131 { 3132 return null; 3133 } 3134 3135 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 3136 } 3137 3138 /** 3139 * Gets the window that @window is embedded in. 3140 * 3141 * Params: 3142 * window = a #GdkWindow 3143 * 3144 * Return: the embedding #GdkWindow, or 3145 * %NULL if @window is not an mbedded offscreen window 3146 * 3147 * Since: 2.18 3148 */ 3149 public static Window offscreenWindowGetEmbedder(Window window) 3150 { 3151 auto p = gdk_offscreen_window_get_embedder((window is null) ? null : window.getWindowStruct()); 3152 3153 if(p is null) 3154 { 3155 return null; 3156 } 3157 3158 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 3159 } 3160 3161 /** 3162 * Gets the offscreen surface that an offscreen window renders into. 3163 * If you need to keep this around over window resizes, you need to 3164 * add a reference to it. 3165 * 3166 * Params: 3167 * window = a #GdkWindow 3168 * 3169 * Return: The offscreen surface, or 3170 * %NULL if not offscreen 3171 */ 3172 public static Surface offscreenWindowGetSurface(Window window) 3173 { 3174 auto p = gdk_offscreen_window_get_surface((window is null) ? null : window.getWindowStruct()); 3175 3176 if(p is null) 3177 { 3178 return null; 3179 } 3180 3181 return new Surface(cast(cairo_surface_t*) p); 3182 } 3183 3184 /** 3185 * Sets @window to be embedded in @embedder. 3186 * 3187 * To fully embed an offscreen window, in addition to calling this 3188 * function, it is also necessary to handle the #GdkWindow::pick-embedded-child 3189 * signal on the @embedder and the #GdkWindow::to-embedder and 3190 * #GdkWindow::from-embedder signals on @window. 3191 * 3192 * Params: 3193 * window = a #GdkWindow 3194 * embedder = the #GdkWindow that @window gets embedded in 3195 * 3196 * Since: 2.18 3197 */ 3198 public static void offscreenWindowSetEmbedder(Window window, Window embedder) 3199 { 3200 gdk_offscreen_window_set_embedder((window is null) ? null : window.getWindowStruct(), (embedder is null) ? null : embedder.getWindowStruct()); 3201 } 3202 }