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