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 * funct = filter callback 219 * data = data to pass to filter callback 220 */ 221 public void addFilter(GdkFilterFunc funct, void* data) 222 { 223 gdk_window_add_filter(gdkWindow, funct, 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(), 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() 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. If @window 852 * does not have its own background and reuses the parent's, %NULL is 853 * returned and you’ll have to query it yourself. 854 * 855 * Deprecated: Don't use this function 856 * 857 * Returns: The pattern to use for the 858 * background or %NULL to use the parent’s background. 859 * 860 * Since: 2.22 861 */ 862 public Pattern getBackgroundPattern() 863 { 864 auto p = gdk_window_get_background_pattern(gdkWindow); 865 866 if(p is null) 867 { 868 return null; 869 } 870 871 return new Pattern(cast(cairo_pattern_t*) p); 872 } 873 874 /** 875 * Gets the list of children of @window known to GDK. 876 * This function only returns children created via GDK, 877 * so for example it’s useless when used with the root window; 878 * it only returns windows an application created itself. 879 * 880 * The returned list must be freed, but the elements in the 881 * list need not be. 882 * 883 * Returns: list of child windows inside @window 884 */ 885 public ListG getChildren() 886 { 887 auto p = gdk_window_get_children(gdkWindow); 888 889 if(p is null) 890 { 891 return null; 892 } 893 894 return new ListG(cast(GList*) p); 895 } 896 897 /** 898 * Gets the list of children of @window known to GDK with a 899 * particular @user_data set on it. 900 * 901 * The returned list must be freed, but the elements in the 902 * list need not be. 903 * 904 * The list is returned in (relative) stacking order, i.e. the 905 * lowest window is first. 906 * 907 * Params: 908 * userData = user data to look for 909 * 910 * Returns: list of child windows inside @window 911 * 912 * Since: 3.10 913 */ 914 public ListG getChildrenWithUserData(void* userData) 915 { 916 auto p = gdk_window_get_children_with_user_data(gdkWindow, userData); 917 918 if(p is null) 919 { 920 return null; 921 } 922 923 return new ListG(cast(GList*) p); 924 } 925 926 /** 927 * Computes the region of a window that potentially can be written 928 * to by drawing primitives. This region may not take into account 929 * other factors such as if the window is obscured by other windows, 930 * but no area outside of this region will be affected by drawing 931 * primitives. 932 * 933 * Returns: a #cairo_region_t. This must be freed with cairo_region_destroy() 934 * when you are done. 935 */ 936 public Region getClipRegion() 937 { 938 auto p = gdk_window_get_clip_region(gdkWindow); 939 940 if(p is null) 941 { 942 return null; 943 } 944 945 return new Region(cast(cairo_region_t*) p); 946 } 947 948 /** 949 * Determines whether @window is composited. 950 * 951 * See gdk_window_set_composited(). 952 * 953 * Deprecated: Compositing is an outdated technology that 954 * only ever worked on X11. 955 * 956 * Returns: %TRUE if the window is composited. 957 * 958 * Since: 2.22 959 */ 960 public bool getComposited() 961 { 962 return gdk_window_get_composited(gdkWindow) != 0; 963 } 964 965 /** 966 * Retrieves a #GdkCursor pointer for the cursor currently set on the 967 * specified #GdkWindow, or %NULL. If the return value is %NULL then 968 * there is no custom cursor set on the specified window, and it is 969 * using the cursor for its parent window. 970 * 971 * Returns: a #GdkCursor, or %NULL. The 972 * returned object is owned by the #GdkWindow and should not be 973 * unreferenced directly. Use gdk_window_set_cursor() to unset the 974 * cursor of the window 975 * 976 * Since: 2.18 977 */ 978 public Cursor getCursor() 979 { 980 auto p = gdk_window_get_cursor(gdkWindow); 981 982 if(p is null) 983 { 984 return null; 985 } 986 987 return ObjectG.getDObject!(Cursor)(cast(GdkCursor*) p); 988 } 989 990 /** 991 * Returns the decorations set on the GdkWindow with 992 * gdk_window_set_decorations(). 993 * 994 * Params: 995 * decorations = The window decorations will be written here 996 * 997 * Returns: %TRUE if the window has decorations set, %FALSE otherwise. 998 */ 999 public bool getDecorations(out GdkWMDecoration decorations) 1000 { 1001 return gdk_window_get_decorations(gdkWindow, &decorations) != 0; 1002 } 1003 1004 /** 1005 * Retrieves a #GdkCursor pointer for the @device currently set on the 1006 * specified #GdkWindow, or %NULL. If the return value is %NULL then 1007 * there is no custom cursor set on the specified window, and it is 1008 * using the cursor for its parent window. 1009 * 1010 * Params: 1011 * device = a master, pointer #GdkDevice. 1012 * 1013 * Returns: a #GdkCursor, or %NULL. The 1014 * returned object is owned by the #GdkWindow and should not be 1015 * unreferenced directly. Use gdk_window_set_cursor() to unset the 1016 * cursor of the window 1017 * 1018 * Since: 3.0 1019 */ 1020 public Cursor getDeviceCursor(Device device) 1021 { 1022 auto p = gdk_window_get_device_cursor(gdkWindow, (device is null) ? null : device.getDeviceStruct()); 1023 1024 if(p is null) 1025 { 1026 return null; 1027 } 1028 1029 return ObjectG.getDObject!(Cursor)(cast(GdkCursor*) p); 1030 } 1031 1032 /** 1033 * Returns the event mask for @window corresponding to an specific device. 1034 * 1035 * Params: 1036 * device = a #GdkDevice. 1037 * 1038 * Returns: device event mask for @window 1039 * 1040 * Since: 3.0 1041 */ 1042 public GdkEventMask getDeviceEvents(Device device) 1043 { 1044 return gdk_window_get_device_events(gdkWindow, (device is null) ? null : device.getDeviceStruct()); 1045 } 1046 1047 /** 1048 * Obtains the current device position and modifier state. 1049 * The position is given in coordinates relative to the upper left 1050 * corner of @window. 1051 * 1052 * Use gdk_window_get_device_position_double() if you need subpixel precision. 1053 * 1054 * Params: 1055 * device = pointer #GdkDevice to query to. 1056 * x = return location for the X coordinate of @device, or %NULL. 1057 * y = return location for the Y coordinate of @device, or %NULL. 1058 * mask = return location for the modifier mask, or %NULL. 1059 * 1060 * Returns: The window underneath @device 1061 * (as with gdk_device_get_window_at_position()), or %NULL if the 1062 * window is not known to GDK. 1063 * 1064 * Since: 3.0 1065 */ 1066 public Window getDevicePosition(Device device, out int x, out int y, out GdkModifierType mask) 1067 { 1068 auto p = gdk_window_get_device_position(gdkWindow, (device is null) ? null : device.getDeviceStruct(), &x, &y, &mask); 1069 1070 if(p is null) 1071 { 1072 return null; 1073 } 1074 1075 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1076 } 1077 1078 /** 1079 * Obtains the current device position in doubles and modifier state. 1080 * The position is given in coordinates relative to the upper left 1081 * corner of @window. 1082 * 1083 * Params: 1084 * device = pointer #GdkDevice to query to. 1085 * x = return location for the X coordinate of @device, or %NULL. 1086 * y = return location for the Y coordinate of @device, or %NULL. 1087 * mask = return location for the modifier mask, or %NULL. 1088 * 1089 * Returns: The window underneath @device 1090 * (as with gdk_device_get_window_at_position()), or %NULL if the 1091 * window is not known to GDK. 1092 * 1093 * Since: 3.10 1094 */ 1095 public Window getDevicePositionDouble(Device device, out double x, out double y, out GdkModifierType mask) 1096 { 1097 auto p = gdk_window_get_device_position_double(gdkWindow, (device is null) ? null : device.getDeviceStruct(), &x, &y, &mask); 1098 1099 if(p is null) 1100 { 1101 return null; 1102 } 1103 1104 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1105 } 1106 1107 /** 1108 * Gets the #GdkDisplay associated with a #GdkWindow. 1109 * 1110 * Returns: the #GdkDisplay associated with @window 1111 * 1112 * Since: 2.24 1113 */ 1114 public Display getDisplay() 1115 { 1116 auto p = gdk_window_get_display(gdkWindow); 1117 1118 if(p is null) 1119 { 1120 return null; 1121 } 1122 1123 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 1124 } 1125 1126 /** 1127 * Finds out the DND protocol supported by a window. 1128 * 1129 * Params: 1130 * target = location of the window 1131 * where the drop should happen. This may be @window or a proxy window, 1132 * or %NULL if @window does not support Drag and Drop. 1133 * 1134 * Returns: the supported DND protocol. 1135 * 1136 * Since: 3.0 1137 */ 1138 public GdkDragProtocol getDragProtocol(out Window target) 1139 { 1140 GdkWindow* outtarget = null; 1141 1142 auto p = gdk_window_get_drag_protocol(gdkWindow, &outtarget); 1143 1144 target = ObjectG.getDObject!(Window)(outtarget); 1145 1146 return p; 1147 } 1148 1149 /** 1150 * Obtains the parent of @window, as known to GDK. Works like 1151 * gdk_window_get_parent() for normal windows, but returns the 1152 * window’s embedder for offscreen windows. 1153 * 1154 * See also: gdk_offscreen_window_get_embedder() 1155 * 1156 * Returns: effective parent of @window 1157 * 1158 * Since: 2.22 1159 */ 1160 public Window getEffectiveParent() 1161 { 1162 auto p = gdk_window_get_effective_parent(gdkWindow); 1163 1164 if(p is null) 1165 { 1166 return null; 1167 } 1168 1169 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1170 } 1171 1172 /** 1173 * Gets the toplevel window that’s an ancestor of @window. 1174 * 1175 * Works like gdk_window_get_toplevel(), but treats an offscreen window's 1176 * embedder as its parent, using gdk_window_get_effective_parent(). 1177 * 1178 * See also: gdk_offscreen_window_get_embedder() 1179 * 1180 * Returns: the effective toplevel window containing @window 1181 * 1182 * Since: 2.22 1183 */ 1184 public Window getEffectiveToplevel() 1185 { 1186 auto p = gdk_window_get_effective_toplevel(gdkWindow); 1187 1188 if(p is null) 1189 { 1190 return null; 1191 } 1192 1193 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1194 } 1195 1196 /** 1197 * Get the current event compression setting for this window. 1198 * 1199 * Returns: %TRUE if motion events will be compressed 1200 * 1201 * Since: 3.12 1202 */ 1203 public bool getEventCompression() 1204 { 1205 return gdk_window_get_event_compression(gdkWindow) != 0; 1206 } 1207 1208 /** 1209 * Gets the event mask for @window for all master input devices. See 1210 * gdk_window_set_events(). 1211 * 1212 * Returns: event mask for @window 1213 */ 1214 public GdkEventMask getEvents() 1215 { 1216 return gdk_window_get_events(gdkWindow); 1217 } 1218 1219 /** 1220 * Determines whether or not the desktop environment should be hinted that the 1221 * window does not want to receive input focus when it is mapped. 1222 * 1223 * Returns: whether or not the window wants to receive input focus when 1224 * it is mapped. 1225 * 1226 * Since: 2.22 1227 */ 1228 public bool getFocusOnMap() 1229 { 1230 return gdk_window_get_focus_on_map(gdkWindow) != 0; 1231 } 1232 1233 /** 1234 * Gets the frame clock for the window. The frame clock for a window 1235 * never changes unless the window is reparented to a new toplevel 1236 * window. 1237 * 1238 * Returns: the frame clock 1239 * 1240 * Since: 3.8 1241 */ 1242 public FrameClock getFrameClock() 1243 { 1244 auto p = gdk_window_get_frame_clock(gdkWindow); 1245 1246 if(p is null) 1247 { 1248 return null; 1249 } 1250 1251 return ObjectG.getDObject!(FrameClock)(cast(GdkFrameClock*) p); 1252 } 1253 1254 /** 1255 * Obtains the bounding box of the window, including window manager 1256 * titlebar/borders if any. The frame position is given in root window 1257 * coordinates. To get the position of the window itself (rather than 1258 * the frame) in root window coordinates, use gdk_window_get_origin(). 1259 * 1260 * Params: 1261 * rect = rectangle to fill with bounding box of the window frame 1262 */ 1263 public void getFrameExtents(out GdkRectangle rect) 1264 { 1265 gdk_window_get_frame_extents(gdkWindow, &rect); 1266 } 1267 1268 /** 1269 * Obtains the #GdkFullscreenMode of the @window. 1270 * 1271 * Returns: The #GdkFullscreenMode applied to the window when fullscreen. 1272 * 1273 * Since: 3.8 1274 */ 1275 public GdkFullscreenMode getFullscreenMode() 1276 { 1277 return gdk_window_get_fullscreen_mode(gdkWindow); 1278 } 1279 1280 /** 1281 * Any of the return location arguments to this function may be %NULL, 1282 * if you aren’t interested in getting the value of that field. 1283 * 1284 * The X and Y coordinates returned are relative to the parent window 1285 * of @window, which for toplevels usually means relative to the 1286 * window decorations (titlebar, etc.) rather than relative to the 1287 * root window (screen-size background window). 1288 * 1289 * On the X11 platform, the geometry is obtained from the X server, 1290 * so reflects the latest position of @window; this may be out-of-sync 1291 * with the position of @window delivered in the most-recently-processed 1292 * #GdkEventConfigure. gdk_window_get_position() in contrast gets the 1293 * position from the most recent configure event. 1294 * 1295 * Note: If @window is not a toplevel, it is much better 1296 * to call gdk_window_get_position(), gdk_window_get_width() and 1297 * gdk_window_get_height() instead, because it avoids the roundtrip to 1298 * the X server and because these functions support the full 32-bit 1299 * coordinate space, whereas gdk_window_get_geometry() is restricted to 1300 * the 16-bit coordinates of X11. 1301 * 1302 * Params: 1303 * x = return location for X coordinate of window (relative to its parent) 1304 * y = return location for Y coordinate of window (relative to its parent) 1305 * width = return location for width of window 1306 * height = return location for height of window 1307 */ 1308 public void getGeometry(out int x, out int y, out int width, out int height) 1309 { 1310 gdk_window_get_geometry(gdkWindow, &x, &y, &width, &height); 1311 } 1312 1313 /** 1314 * Returns the group leader window for @window. See gdk_window_set_group(). 1315 * 1316 * Returns: the group leader window for @window 1317 * 1318 * Since: 2.4 1319 */ 1320 public Window getGroup() 1321 { 1322 auto p = gdk_window_get_group(gdkWindow); 1323 1324 if(p is null) 1325 { 1326 return null; 1327 } 1328 1329 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1330 } 1331 1332 /** 1333 * Returns the height of the given @window. 1334 * 1335 * On the X11 platform the returned size is the size reported in the 1336 * most-recently-processed configure event, rather than the current 1337 * size on the X server. 1338 * 1339 * Returns: The height of @window 1340 * 1341 * Since: 2.24 1342 */ 1343 public int getHeight() 1344 { 1345 return gdk_window_get_height(gdkWindow); 1346 } 1347 1348 /** 1349 * Determines whether or not the window manager is hinted that @window 1350 * has modal behaviour. 1351 * 1352 * Returns: whether or not the window has the modal hint set. 1353 * 1354 * Since: 2.22 1355 */ 1356 public bool getModalHint() 1357 { 1358 return gdk_window_get_modal_hint(gdkWindow) != 0; 1359 } 1360 1361 /** 1362 * Obtains the position of a window in root window coordinates. 1363 * (Compare with gdk_window_get_position() and 1364 * gdk_window_get_geometry() which return the position of a window 1365 * relative to its parent window.) 1366 * 1367 * Params: 1368 * x = return location for X coordinate 1369 * y = return location for Y coordinate 1370 * 1371 * Returns: not meaningful, ignore 1372 */ 1373 public int getOrigin(out int x, out int y) 1374 { 1375 return gdk_window_get_origin(gdkWindow, &x, &y); 1376 } 1377 1378 /** 1379 * Obtains the parent of @window, as known to GDK. Does not query the 1380 * X server; thus this returns the parent as passed to gdk_window_new(), 1381 * not the actual parent. This should never matter unless you’re using 1382 * Xlib calls mixed with GDK calls on the X11 platform. It may also 1383 * matter for toplevel windows, because the window manager may choose 1384 * to reparent them. 1385 * 1386 * Note that you should use gdk_window_get_effective_parent() when 1387 * writing generic code that walks up a window hierarchy, because 1388 * gdk_window_get_parent() will most likely not do what you expect if 1389 * there are offscreen windows in the hierarchy. 1390 * 1391 * Returns: parent of @window 1392 */ 1393 public Window getParent() 1394 { 1395 auto p = gdk_window_get_parent(gdkWindow); 1396 1397 if(p is null) 1398 { 1399 return null; 1400 } 1401 1402 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1403 } 1404 1405 /** 1406 * Returns whether input to the window is passed through to the window 1407 * below. 1408 * 1409 * See gdk_window_set_pass_through() for details 1410 * 1411 * Since: 3.18 1412 */ 1413 public bool getPassThrough() 1414 { 1415 return gdk_window_get_pass_through(gdkWindow) != 0; 1416 } 1417 1418 /** 1419 * Obtains the current pointer position and modifier state. 1420 * The position is given in coordinates relative to the upper left 1421 * corner of @window. 1422 * 1423 * Deprecated: Use gdk_window_get_device_position() instead. 1424 * 1425 * Params: 1426 * x = return location for X coordinate of pointer or %NULL to not 1427 * return the X coordinate 1428 * y = return location for Y coordinate of pointer or %NULL to not 1429 * return the Y coordinate 1430 * mask = return location for modifier mask or %NULL to not return the 1431 * modifier mask 1432 * 1433 * Returns: the window containing the 1434 * pointer (as with gdk_window_at_pointer()), or %NULL if the window 1435 * containing the pointer isn’t known to GDK 1436 */ 1437 public Window getPointer(out int x, out int y, out GdkModifierType mask) 1438 { 1439 auto p = gdk_window_get_pointer(gdkWindow, &x, &y, &mask); 1440 1441 if(p is null) 1442 { 1443 return null; 1444 } 1445 1446 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1447 } 1448 1449 /** 1450 * Obtains the position of the window as reported in the 1451 * most-recently-processed #GdkEventConfigure. Contrast with 1452 * gdk_window_get_geometry() which queries the X server for the 1453 * current window position, regardless of which events have been 1454 * received or processed. 1455 * 1456 * The position coordinates are relative to the window’s parent window. 1457 * 1458 * Params: 1459 * x = X coordinate of window 1460 * y = Y coordinate of window 1461 */ 1462 public void getPosition(out int x, out int y) 1463 { 1464 gdk_window_get_position(gdkWindow, &x, &y); 1465 } 1466 1467 /** 1468 * Obtains the position of a window position in root 1469 * window coordinates. This is similar to 1470 * gdk_window_get_origin() but allows you to pass 1471 * in any position in the window, not just the origin. 1472 * 1473 * Params: 1474 * x = X coordinate in window 1475 * y = Y coordinate in window 1476 * rootX = return location for X coordinate 1477 * rootY = return location for Y coordinate 1478 * 1479 * Since: 2.18 1480 */ 1481 public void getRootCoords(int x, int y, out int rootX, out int rootY) 1482 { 1483 gdk_window_get_root_coords(gdkWindow, x, y, &rootX, &rootY); 1484 } 1485 1486 /** 1487 * Obtains the top-left corner of the window manager frame in root 1488 * window coordinates. 1489 * 1490 * Params: 1491 * x = return location for X position of window frame 1492 * y = return location for Y position of window frame 1493 */ 1494 public void getRootOrigin(out int x, out int y) 1495 { 1496 gdk_window_get_root_origin(gdkWindow, &x, &y); 1497 } 1498 1499 /** 1500 * Returns the internal scale factor that maps from window coordiantes 1501 * to the actual device pixels. On traditional systems this is 1, but 1502 * on very high density outputs this can be a higher value (often 2). 1503 * 1504 * A higher value means that drawing is automatically scaled up to 1505 * a higher resolution, so any code doing drawing will automatically look 1506 * nicer. However, if you are supplying pixel-based data the scale 1507 * value can be used to determine whether to use a pixel resource 1508 * with higher resolution data. 1509 * 1510 * The scale of a window may change during runtime, if this happens 1511 * a configure event will be sent to the toplevel window. 1512 * 1513 * Returns: the scale factor 1514 * 1515 * Since: 3.10 1516 */ 1517 public int getScaleFactor() 1518 { 1519 return gdk_window_get_scale_factor(gdkWindow); 1520 } 1521 1522 /** 1523 * Gets the #GdkScreen associated with a #GdkWindow. 1524 * 1525 * Returns: the #GdkScreen associated with @window 1526 * 1527 * Since: 2.24 1528 */ 1529 public Screen getScreen() 1530 { 1531 auto p = gdk_window_get_screen(gdkWindow); 1532 1533 if(p is null) 1534 { 1535 return null; 1536 } 1537 1538 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 1539 } 1540 1541 /** 1542 * Returns the event mask for @window corresponding to the device class specified 1543 * by @source. 1544 * 1545 * Params: 1546 * source = a #GdkInputSource to define the source class. 1547 * 1548 * Returns: source event mask for @window 1549 */ 1550 public GdkEventMask getSourceEvents(GdkInputSource source) 1551 { 1552 return gdk_window_get_source_events(gdkWindow, source); 1553 } 1554 1555 /** 1556 * Gets the bitwise OR of the currently active window state flags, 1557 * from the #GdkWindowState enumeration. 1558 * 1559 * Returns: window state bitfield 1560 */ 1561 public GdkWindowState getState() 1562 { 1563 return gdk_window_get_state(gdkWindow); 1564 } 1565 1566 /** 1567 * Returns %TRUE if the window is aware of the existence of multiple 1568 * devices. 1569 * 1570 * Returns: %TRUE if the window handles multidevice features. 1571 * 1572 * Since: 3.0 1573 */ 1574 public bool getSupportMultidevice() 1575 { 1576 return gdk_window_get_support_multidevice(gdkWindow) != 0; 1577 } 1578 1579 /** 1580 * Gets the toplevel window that’s an ancestor of @window. 1581 * 1582 * Any window type but %GDK_WINDOW_CHILD is considered a 1583 * toplevel window, as is a %GDK_WINDOW_CHILD window that 1584 * has a root window as parent. 1585 * 1586 * Note that you should use gdk_window_get_effective_toplevel() when 1587 * you want to get to a window’s toplevel as seen on screen, because 1588 * gdk_window_get_toplevel() will most likely not do what you expect 1589 * if there are offscreen windows in the hierarchy. 1590 * 1591 * Returns: the toplevel window containing @window 1592 */ 1593 public Window getToplevel() 1594 { 1595 auto p = gdk_window_get_toplevel(gdkWindow); 1596 1597 if(p is null) 1598 { 1599 return null; 1600 } 1601 1602 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 1603 } 1604 1605 /** 1606 * This function returns the type hint set for a window. 1607 * 1608 * Returns: The type hint set for @window 1609 * 1610 * Since: 2.10 1611 */ 1612 public GdkWindowTypeHint getTypeHint() 1613 { 1614 return gdk_window_get_type_hint(gdkWindow); 1615 } 1616 1617 /** 1618 * Transfers ownership of the update area from @window to the caller 1619 * of the function. That is, after calling this function, @window will 1620 * no longer have an invalid/dirty region; the update area is removed 1621 * from @window and handed to you. If a window has no update area, 1622 * gdk_window_get_update_area() returns %NULL. You are responsible for 1623 * calling cairo_region_destroy() on the returned region if it’s non-%NULL. 1624 * 1625 * Returns: the update area for @window 1626 */ 1627 public Region getUpdateArea() 1628 { 1629 auto p = gdk_window_get_update_area(gdkWindow); 1630 1631 if(p is null) 1632 { 1633 return null; 1634 } 1635 1636 return new Region(cast(cairo_region_t*) p); 1637 } 1638 1639 /** 1640 * Retrieves the user data for @window, which is normally the widget 1641 * that @window belongs to. See gdk_window_set_user_data(). 1642 * 1643 * Params: 1644 * data = return location for user data 1645 */ 1646 public void getUserData(out void* data) 1647 { 1648 gdk_window_get_user_data(gdkWindow, &data); 1649 } 1650 1651 /** 1652 * Computes the region of the @window that is potentially visible. 1653 * This does not necessarily take into account if the window is 1654 * obscured by other windows, but no area outside of this region 1655 * is visible. 1656 * 1657 * Returns: a #cairo_region_t. This must be freed with cairo_region_destroy() 1658 * when you are done. 1659 */ 1660 public Region getVisibleRegion() 1661 { 1662 auto p = gdk_window_get_visible_region(gdkWindow); 1663 1664 if(p is null) 1665 { 1666 return null; 1667 } 1668 1669 return new Region(cast(cairo_region_t*) p); 1670 } 1671 1672 /** 1673 * Gets the #GdkVisual describing the pixel format of @window. 1674 * 1675 * Returns: a #GdkVisual 1676 * 1677 * Since: 2.24 1678 */ 1679 public Visual getVisual() 1680 { 1681 auto p = gdk_window_get_visual(gdkWindow); 1682 1683 if(p is null) 1684 { 1685 return null; 1686 } 1687 1688 return ObjectG.getDObject!(Visual)(cast(GdkVisual*) p); 1689 } 1690 1691 /** 1692 * Returns the width of the given @window. 1693 * 1694 * On the X11 platform the returned size is the size reported in the 1695 * most-recently-processed configure event, rather than the current 1696 * size on the X server. 1697 * 1698 * Returns: The width of @window 1699 * 1700 * Since: 2.24 1701 */ 1702 public int getWidth() 1703 { 1704 return gdk_window_get_width(gdkWindow); 1705 } 1706 1707 /** 1708 * Gets the type of the window. See #GdkWindowType. 1709 * 1710 * Returns: type of window 1711 */ 1712 public GdkWindowType getWindowType() 1713 { 1714 return gdk_window_get_window_type(gdkWindow); 1715 } 1716 1717 /** 1718 * Checks whether the window has a native window or not. Note that 1719 * you can use gdk_window_ensure_native() if a native window is needed. 1720 * 1721 * Returns: %TRUE if the @window has a native window, %FALSE otherwise. 1722 * 1723 * Since: 2.22 1724 */ 1725 public bool hasNative() 1726 { 1727 return gdk_window_has_native(gdkWindow) != 0; 1728 } 1729 1730 /** 1731 * For toplevel windows, withdraws them, so they will no longer be 1732 * known to the window manager; for all windows, unmaps them, so 1733 * they won’t be displayed. Normally done automatically as 1734 * part of gtk_widget_hide(). 1735 */ 1736 public void hide() 1737 { 1738 gdk_window_hide(gdkWindow); 1739 } 1740 1741 /** 1742 * Asks to iconify (minimize) @window. The window manager may choose 1743 * to ignore the request, but normally will honor it. Using 1744 * gtk_window_iconify() is preferred, if you have a #GtkWindow widget. 1745 * 1746 * This function only makes sense when @window is a toplevel window. 1747 */ 1748 public void iconify() 1749 { 1750 gdk_window_iconify(gdkWindow); 1751 } 1752 1753 /** 1754 * Like gdk_window_shape_combine_region(), but the shape applies 1755 * only to event handling. Mouse events which happen while 1756 * the pointer position corresponds to an unset bit in the 1757 * mask will be passed on the window below @window. 1758 * 1759 * An input shape is typically used with RGBA windows. 1760 * The alpha channel of the window defines which pixels are 1761 * invisible and allows for nicely antialiased borders, 1762 * and the input shape controls where the window is 1763 * “clickable”. 1764 * 1765 * On the X11 platform, this requires version 1.1 of the 1766 * shape extension. 1767 * 1768 * On the Win32 platform, this functionality is not present and the 1769 * function does nothing. 1770 * 1771 * Params: 1772 * shapeRegion = region of window to be non-transparent 1773 * offsetX = X position of @shape_region in @window coordinates 1774 * offsetY = Y position of @shape_region in @window coordinates 1775 * 1776 * Since: 2.10 1777 */ 1778 public void inputShapeCombineRegion(Region shapeRegion, int offsetX, int offsetY) 1779 { 1780 gdk_window_input_shape_combine_region(gdkWindow, (shapeRegion is null) ? null : shapeRegion.getRegionStruct(), offsetX, offsetY); 1781 } 1782 1783 /** 1784 * Adds @region to the update area for @window. The update area is the 1785 * region that needs to be redrawn, or “dirty region.” The call 1786 * gdk_window_process_updates() sends one or more expose events to the 1787 * window, which together cover the entire update area. An 1788 * application would normally redraw the contents of @window in 1789 * response to those expose events. 1790 * 1791 * GDK will call gdk_window_process_all_updates() on your behalf 1792 * whenever your program returns to the main loop and becomes idle, so 1793 * normally there’s no need to do that manually, you just need to 1794 * invalidate regions that you know should be redrawn. 1795 * 1796 * The @child_func parameter controls whether the region of 1797 * each child window that intersects @region will also be invalidated. 1798 * Only children for which @child_func returns #TRUE will have the area 1799 * invalidated. 1800 * 1801 * Params: 1802 * region = a #cairo_region_t 1803 * childFunc = function to use to decide if to 1804 * recurse to a child, %NULL means never recurse. 1805 * userData = data passed to @child_func 1806 */ 1807 public void invalidateMaybeRecurse(Region region, GdkWindowChildFunc childFunc, void* userData) 1808 { 1809 gdk_window_invalidate_maybe_recurse(gdkWindow, (region is null) ? null : region.getRegionStruct(), childFunc, userData); 1810 } 1811 1812 /** 1813 * A convenience wrapper around gdk_window_invalidate_region() which 1814 * invalidates a rectangular region. See 1815 * gdk_window_invalidate_region() for details. 1816 * 1817 * Params: 1818 * rect = rectangle to invalidate or %NULL to invalidate the whole 1819 * window 1820 * invalidateChildren = whether to also invalidate child windows 1821 */ 1822 public void invalidateRect(GdkRectangle* rect, bool invalidateChildren) 1823 { 1824 gdk_window_invalidate_rect(gdkWindow, rect, invalidateChildren); 1825 } 1826 1827 /** 1828 * Adds @region to the update area for @window. The update area is the 1829 * region that needs to be redrawn, or “dirty region.” The call 1830 * gdk_window_process_updates() sends one or more expose events to the 1831 * window, which together cover the entire update area. An 1832 * application would normally redraw the contents of @window in 1833 * response to those expose events. 1834 * 1835 * GDK will call gdk_window_process_all_updates() on your behalf 1836 * whenever your program returns to the main loop and becomes idle, so 1837 * normally there’s no need to do that manually, you just need to 1838 * invalidate regions that you know should be redrawn. 1839 * 1840 * The @invalidate_children parameter controls whether the region of 1841 * each child window that intersects @region will also be invalidated. 1842 * If %FALSE, then the update area for child windows will remain 1843 * unaffected. See gdk_window_invalidate_maybe_recurse if you need 1844 * fine grained control over which children are invalidated. 1845 * 1846 * Params: 1847 * region = a #cairo_region_t 1848 * invalidateChildren = %TRUE to also invalidate child windows 1849 */ 1850 public void invalidateRegion(Region region, bool invalidateChildren) 1851 { 1852 gdk_window_invalidate_region(gdkWindow, (region is null) ? null : region.getRegionStruct(), invalidateChildren); 1853 } 1854 1855 /** 1856 * Check to see if a window is destroyed.. 1857 * 1858 * Returns: %TRUE if the window is destroyed 1859 * 1860 * Since: 2.18 1861 */ 1862 public bool isDestroyed() 1863 { 1864 return gdk_window_is_destroyed(gdkWindow) != 0; 1865 } 1866 1867 /** 1868 * Determines whether or not the window is an input only window. 1869 * 1870 * Returns: %TRUE if @window is input only 1871 * 1872 * Since: 2.22 1873 */ 1874 public bool isInputOnly() 1875 { 1876 return gdk_window_is_input_only(gdkWindow) != 0; 1877 } 1878 1879 /** 1880 * Determines whether or not the window is shaped. 1881 * 1882 * Returns: %TRUE if @window is shaped 1883 * 1884 * Since: 2.22 1885 */ 1886 public bool isShaped() 1887 { 1888 return gdk_window_is_shaped(gdkWindow) != 0; 1889 } 1890 1891 /** 1892 * Check if the window and all ancestors of the window are 1893 * mapped. (This is not necessarily "viewable" in the X sense, since 1894 * we only check as far as we have GDK window parents, not to the root 1895 * window.) 1896 * 1897 * Returns: %TRUE if the window is viewable 1898 */ 1899 public bool isViewable() 1900 { 1901 return gdk_window_is_viewable(gdkWindow) != 0; 1902 } 1903 1904 /** 1905 * Checks whether the window has been mapped (with gdk_window_show() or 1906 * gdk_window_show_unraised()). 1907 * 1908 * Returns: %TRUE if the window is mapped 1909 */ 1910 public bool isVisible() 1911 { 1912 return gdk_window_is_visible(gdkWindow) != 0; 1913 } 1914 1915 /** 1916 * Lowers @window to the bottom of the Z-order (stacking order), so that 1917 * other windows with the same parent window appear above @window. 1918 * This is true whether or not the other windows are visible. 1919 * 1920 * If @window is a toplevel, the window manager may choose to deny the 1921 * request to move the window in the Z-order, gdk_window_lower() only 1922 * requests the restack, does not guarantee it. 1923 * 1924 * Note that gdk_window_show() raises the window again, so don’t call this 1925 * function before gdk_window_show(). (Try gdk_window_show_unraised().) 1926 */ 1927 public void lower() 1928 { 1929 gdk_window_lower(gdkWindow); 1930 } 1931 1932 /** 1933 * If you call this during a paint (e.g. between gdk_window_begin_paint_region() 1934 * and gdk_window_end_paint() then GDK will mark the current clip region of the 1935 * window as being drawn. This is required when mixing GL rendering via 1936 * gdk_cairo_draw_from_gl() and cairo rendering, as otherwise GDK has no way 1937 * of knowing when something paints over the GL-drawn regions. 1938 * 1939 * This is typically called automatically by GTK+ and you don't need 1940 * to care about this. 1941 * 1942 * Params: 1943 * cr = a #cairo_t 1944 * 1945 * Since: 3.16 1946 */ 1947 public void markPaintFromClip(Context cr) 1948 { 1949 gdk_window_mark_paint_from_clip(gdkWindow, (cr is null) ? null : cr.getContextStruct()); 1950 } 1951 1952 /** 1953 * Maximizes the window. If the window was already maximized, then 1954 * this function does nothing. 1955 * 1956 * On X11, asks the window manager to maximize @window, if the window 1957 * manager supports this operation. Not all window managers support 1958 * this, and some deliberately ignore it or don’t have a concept of 1959 * “maximized”; so you can’t rely on the maximization actually 1960 * happening. But it will happen with most standard window managers, 1961 * and GDK makes a best effort to get it to happen. 1962 * 1963 * On Windows, reliably maximizes the window. 1964 */ 1965 public void maximize() 1966 { 1967 gdk_window_maximize(gdkWindow); 1968 } 1969 1970 /** 1971 * Merges the input shape masks for any child windows into the 1972 * input shape mask for @window. i.e. the union of all input masks 1973 * for @window and its children will become the new input mask 1974 * for @window. See gdk_window_input_shape_combine_region(). 1975 * 1976 * This function is distinct from gdk_window_set_child_input_shapes() 1977 * because it includes @window’s input shape mask in the set of 1978 * shapes to be merged. 1979 * 1980 * Since: 2.10 1981 */ 1982 public void mergeChildInputShapes() 1983 { 1984 gdk_window_merge_child_input_shapes(gdkWindow); 1985 } 1986 1987 /** 1988 * Merges the shape masks for any child windows into the 1989 * shape mask for @window. i.e. the union of all masks 1990 * for @window and its children will become the new mask 1991 * for @window. See gdk_window_shape_combine_region(). 1992 * 1993 * This function is distinct from gdk_window_set_child_shapes() 1994 * because it includes @window’s shape mask in the set of shapes to 1995 * be merged. 1996 */ 1997 public void mergeChildShapes() 1998 { 1999 gdk_window_merge_child_shapes(gdkWindow); 2000 } 2001 2002 /** 2003 * Repositions a window relative to its parent window. 2004 * For toplevel windows, window managers may ignore or modify the move; 2005 * you should probably use gtk_window_move() on a #GtkWindow widget 2006 * anyway, instead of using GDK functions. For child windows, 2007 * the move will reliably succeed. 2008 * 2009 * If you’re also planning to resize the window, use gdk_window_move_resize() 2010 * to both move and resize simultaneously, for a nicer visual effect. 2011 * 2012 * Params: 2013 * x = X coordinate relative to window’s parent 2014 * y = Y coordinate relative to window’s parent 2015 */ 2016 public void move(int x, int y) 2017 { 2018 gdk_window_move(gdkWindow, x, y); 2019 } 2020 2021 /** 2022 * Move the part of @window indicated by @region by @dy pixels in the Y 2023 * direction and @dx pixels in the X direction. The portions of @region 2024 * that not covered by the new position of @region are invalidated. 2025 * 2026 * Child windows are not moved. 2027 * 2028 * Params: 2029 * region = The #cairo_region_t to move 2030 * dx = Amount to move in the X direction 2031 * dy = Amount to move in the Y direction 2032 * 2033 * Since: 2.8 2034 */ 2035 public void moveRegion(Region region, int dx, int dy) 2036 { 2037 gdk_window_move_region(gdkWindow, (region is null) ? null : region.getRegionStruct(), dx, dy); 2038 } 2039 2040 /** 2041 * Equivalent to calling gdk_window_move() and gdk_window_resize(), 2042 * except that both operations are performed at once, avoiding strange 2043 * visual effects. (i.e. the user may be able to see the window first 2044 * move, then resize, if you don’t use gdk_window_move_resize().) 2045 * 2046 * Params: 2047 * x = new X position relative to window’s parent 2048 * y = new Y position relative to window’s parent 2049 * width = new width 2050 * height = new height 2051 */ 2052 public void moveResize(int x, int y, int width, int height) 2053 { 2054 gdk_window_move_resize(gdkWindow, x, y, width, height); 2055 } 2056 2057 /** 2058 * Like gdk_window_get_children(), but does not copy the list of 2059 * children, so the list does not need to be freed. 2060 * 2061 * Returns: a reference to the list of child windows in @window 2062 */ 2063 public ListG peekChildren() 2064 { 2065 auto p = gdk_window_peek_children(gdkWindow); 2066 2067 if(p is null) 2068 { 2069 return null; 2070 } 2071 2072 return new ListG(cast(GList*) p); 2073 } 2074 2075 /** 2076 * Sends one or more expose events to @window. The areas in each 2077 * expose event will cover the entire update area for the window (see 2078 * gdk_window_invalidate_region() for details). Normally GDK calls 2079 * gdk_window_process_all_updates() on your behalf, so there’s no 2080 * need to call this function unless you want to force expose events 2081 * to be delivered immediately and synchronously (vs. the usual 2082 * case, where GDK delivers them in an idle handler). Occasionally 2083 * this is useful to produce nicer scrolling behavior, for example. 2084 * 2085 * Params: 2086 * updateChildren = whether to also process updates for child windows 2087 */ 2088 public void processUpdates(bool updateChildren) 2089 { 2090 gdk_window_process_updates(gdkWindow, updateChildren); 2091 } 2092 2093 /** 2094 * Raises @window to the top of the Z-order (stacking order), so that 2095 * other windows with the same parent window appear below @window. 2096 * This is true whether or not the windows are visible. 2097 * 2098 * If @window is a toplevel, the window manager may choose to deny the 2099 * request to move the window in the Z-order, gdk_window_raise() only 2100 * requests the restack, does not guarantee it. 2101 */ 2102 public void raise() 2103 { 2104 gdk_window_raise(gdkWindow); 2105 } 2106 2107 /** 2108 * Registers a window as a potential drop destination. 2109 */ 2110 public void registerDnd() 2111 { 2112 gdk_window_register_dnd(gdkWindow); 2113 } 2114 2115 /** 2116 * Remove a filter previously added with gdk_window_add_filter(). 2117 * 2118 * Params: 2119 * funct = previously-added filter function 2120 * data = user data for previously-added filter function 2121 */ 2122 public void removeFilter(GdkFilterFunc funct, void* data) 2123 { 2124 gdk_window_remove_filter(gdkWindow, funct, data); 2125 } 2126 2127 /** 2128 * Reparents @window into the given @new_parent. The window being 2129 * reparented will be unmapped as a side effect. 2130 * 2131 * Params: 2132 * newParent = new parent to move @window into 2133 * x = X location inside the new parent 2134 * y = Y location inside the new parent 2135 */ 2136 public void reparent(Window newParent, int x, int y) 2137 { 2138 gdk_window_reparent(gdkWindow, (newParent is null) ? null : newParent.getWindowStruct(), x, y); 2139 } 2140 2141 /** 2142 * Resizes @window; for toplevel windows, asks the window manager to resize 2143 * the window. The window manager may not allow the resize. When using GTK+, 2144 * use gtk_window_resize() instead of this low-level GDK function. 2145 * 2146 * Windows may not be resized below 1x1. 2147 * 2148 * If you’re also planning to move the window, use gdk_window_move_resize() 2149 * to both move and resize simultaneously, for a nicer visual effect. 2150 * 2151 * Params: 2152 * width = new width of the window 2153 * height = new height of the window 2154 */ 2155 public void resize(int width, int height) 2156 { 2157 gdk_window_resize(gdkWindow, width, height); 2158 } 2159 2160 /** 2161 * Changes the position of @window in the Z-order (stacking order), so that 2162 * it is above @sibling (if @above is %TRUE) or below @sibling (if @above is 2163 * %FALSE). 2164 * 2165 * If @sibling is %NULL, then this either raises (if @above is %TRUE) or 2166 * lowers the window. 2167 * 2168 * If @window is a toplevel, the window manager may choose to deny the 2169 * request to move the window in the Z-order, gdk_window_restack() only 2170 * requests the restack, does not guarantee it. 2171 * 2172 * Params: 2173 * sibling = a #GdkWindow that is a sibling of @window, or %NULL 2174 * above = a boolean 2175 * 2176 * Since: 2.18 2177 */ 2178 public void restack(Window sibling, bool above) 2179 { 2180 gdk_window_restack(gdkWindow, (sibling is null) ? null : sibling.getWindowStruct(), above); 2181 } 2182 2183 /** 2184 * Scroll the contents of @window, both pixels and children, by the 2185 * given amount. @window itself does not move. Portions of the window 2186 * that the scroll operation brings in from offscreen areas are 2187 * invalidated. The invalidated region may be bigger than what would 2188 * strictly be necessary. 2189 * 2190 * For X11, a minimum area will be invalidated if the window has no 2191 * subwindows, or if the edges of the window’s parent do not extend 2192 * beyond the edges of the window. In other cases, a multi-step process 2193 * is used to scroll the window which may produce temporary visual 2194 * artifacts and unnecessary invalidations. 2195 * 2196 * Params: 2197 * dx = Amount to scroll in the X direction 2198 * dy = Amount to scroll in the Y direction 2199 */ 2200 public void scroll(int dx, int dy) 2201 { 2202 gdk_window_scroll(gdkWindow, dx, dy); 2203 } 2204 2205 /** 2206 * Setting @accept_focus to %FALSE hints the desktop environment that the 2207 * window doesn’t want to receive input focus. 2208 * 2209 * On X, it is the responsibility of the window manager to interpret this 2210 * hint. ICCCM-compliant window manager usually respect it. 2211 * 2212 * Params: 2213 * acceptFocus = %TRUE if the window should receive input focus 2214 * 2215 * Since: 2.4 2216 */ 2217 public void setAcceptFocus(bool acceptFocus) 2218 { 2219 gdk_window_set_accept_focus(gdkWindow, acceptFocus); 2220 } 2221 2222 /** 2223 * Sets the background color of @window. 2224 * 2225 * However, when using GTK+, influence the background of a widget 2226 * using a style class or CSS — if you’re an application — or with 2227 * gtk_style_context_set_background() — if you're implementing a 2228 * custom widget. 2229 * 2230 * Deprecated: Don't use this function 2231 * 2232 * Params: 2233 * color = a #GdkColor 2234 */ 2235 public void setBackground(Color color) 2236 { 2237 gdk_window_set_background(gdkWindow, (color is null) ? null : color.getColorStruct()); 2238 } 2239 2240 /** 2241 * Sets the background of @window. 2242 * 2243 * A background of %NULL means that the window will inherit its 2244 * background from its parent window. 2245 * 2246 * The windowing system will normally fill a window with its background 2247 * when the window is obscured then exposed. 2248 * 2249 * Deprecated: Don't use this function 2250 * 2251 * Params: 2252 * pattern = a pattern to use, or %NULL 2253 */ 2254 public void setBackgroundPattern(Pattern pattern) 2255 { 2256 gdk_window_set_background_pattern(gdkWindow, (pattern is null) ? null : pattern.getPatternStruct()); 2257 } 2258 2259 /** 2260 * Sets the background color of @window. 2261 * 2262 * See also gdk_window_set_background_pattern(). 2263 * 2264 * Deprecated: Don't use this function 2265 * 2266 * Params: 2267 * rgba = a #GdkRGBA color 2268 */ 2269 public void setBackgroundRgba(RGBA rgba) 2270 { 2271 gdk_window_set_background_rgba(gdkWindow, (rgba is null) ? null : rgba.getRGBAStruct()); 2272 } 2273 2274 /** 2275 * Sets the input shape mask of @window to the union of input shape masks 2276 * for all children of @window, ignoring the input shape mask of @window 2277 * itself. Contrast with gdk_window_merge_child_input_shapes() which includes 2278 * the input shape mask of @window in the masks to be merged. 2279 * 2280 * Since: 2.10 2281 */ 2282 public void setChildInputShapes() 2283 { 2284 gdk_window_set_child_input_shapes(gdkWindow); 2285 } 2286 2287 /** 2288 * Sets the shape mask of @window to the union of shape masks 2289 * for all children of @window, ignoring the shape mask of @window 2290 * itself. Contrast with gdk_window_merge_child_shapes() which includes 2291 * the shape mask of @window in the masks to be merged. 2292 */ 2293 public void setChildShapes() 2294 { 2295 gdk_window_set_child_shapes(gdkWindow); 2296 } 2297 2298 /** 2299 * Sets a #GdkWindow as composited, or unsets it. Composited 2300 * windows do not automatically have their contents drawn to 2301 * the screen. Drawing is redirected to an offscreen buffer 2302 * and an expose event is emitted on the parent of the composited 2303 * window. It is the responsibility of the parent’s expose handler 2304 * to manually merge the off-screen content onto the screen in 2305 * whatever way it sees fit. 2306 * 2307 * It only makes sense for child windows to be composited; see 2308 * gdk_window_set_opacity() if you need translucent toplevel 2309 * windows. 2310 * 2311 * An additional effect of this call is that the area of this 2312 * window is no longer clipped from regions marked for 2313 * invalidation on its parent. Draws done on the parent 2314 * window are also no longer clipped by the child. 2315 * 2316 * This call is only supported on some systems (currently, 2317 * only X11 with new enough Xcomposite and Xdamage extensions). 2318 * You must call gdk_display_supports_composite() to check if 2319 * setting a window as composited is supported before 2320 * attempting to do so. 2321 * 2322 * Deprecated: Compositing is an outdated technology that 2323 * only ever worked on X11. 2324 * 2325 * Params: 2326 * composited = %TRUE to set the window as composited 2327 * 2328 * Since: 2.12 2329 */ 2330 public void setComposited(bool composited) 2331 { 2332 gdk_window_set_composited(gdkWindow, composited); 2333 } 2334 2335 /** 2336 * Sets the default mouse pointer for a #GdkWindow. 2337 * 2338 * Note that @cursor must be for the same display as @window. 2339 * 2340 * Use gdk_cursor_new_for_display() or gdk_cursor_new_from_pixbuf() to 2341 * create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR. 2342 * Passing %NULL for the @cursor argument to gdk_window_set_cursor() means 2343 * that @window will use the cursor of its parent window. Most windows 2344 * should use this default. 2345 * 2346 * Params: 2347 * cursor = a cursor 2348 */ 2349 public void setCursor(Cursor cursor) 2350 { 2351 gdk_window_set_cursor(gdkWindow, (cursor is null) ? null : cursor.getCursorStruct()); 2352 } 2353 2354 /** 2355 * “Decorations” are the features the window manager adds to a toplevel #GdkWindow. 2356 * This function sets the traditional Motif window manager hints that tell the 2357 * window manager which decorations you would like your window to have. 2358 * Usually you should use gtk_window_set_decorated() on a #GtkWindow instead of 2359 * using the GDK function directly. 2360 * 2361 * The @decorations argument is the logical OR of the fields in 2362 * the #GdkWMDecoration enumeration. If #GDK_DECOR_ALL is included in the 2363 * mask, the other bits indicate which decorations should be turned off. 2364 * If #GDK_DECOR_ALL is not included, then the other bits indicate 2365 * which decorations should be turned on. 2366 * 2367 * Most window managers honor a decorations hint of 0 to disable all decorations, 2368 * but very few honor all possible combinations of bits. 2369 * 2370 * Params: 2371 * decorations = decoration hint mask 2372 */ 2373 public void setDecorations(GdkWMDecoration decorations) 2374 { 2375 gdk_window_set_decorations(gdkWindow, decorations); 2376 } 2377 2378 /** 2379 * Sets a specific #GdkCursor for a given device when it gets inside @window. 2380 * Use gdk_cursor_new_for_display() or gdk_cursor_new_from_pixbuf() to create 2381 * the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR. Passing 2382 * %NULL for the @cursor argument to gdk_window_set_cursor() means that 2383 * @window will use the cursor of its parent window. Most windows should 2384 * use this default. 2385 * 2386 * Params: 2387 * device = a master, pointer #GdkDevice 2388 * cursor = a #GdkCursor 2389 * 2390 * Since: 3.0 2391 */ 2392 public void setDeviceCursor(Device device, Cursor cursor) 2393 { 2394 gdk_window_set_device_cursor(gdkWindow, (device is null) ? null : device.getDeviceStruct(), (cursor is null) ? null : cursor.getCursorStruct()); 2395 } 2396 2397 /** 2398 * Sets the event mask for a given device (Normally a floating device, not 2399 * attached to any visible pointer) to @window. For example, an event mask 2400 * including #GDK_BUTTON_PRESS_MASK means the window should report button 2401 * press events. The event mask is the bitwise OR of values from the 2402 * #GdkEventMask enumeration. 2403 * 2404 * See the [input handling overview][event-masks] for details. 2405 * 2406 * Params: 2407 * device = #GdkDevice to enable events for. 2408 * eventMask = event mask for @window 2409 * 2410 * Since: 3.0 2411 */ 2412 public void setDeviceEvents(Device device, GdkEventMask eventMask) 2413 { 2414 gdk_window_set_device_events(gdkWindow, (device is null) ? null : device.getDeviceStruct(), eventMask); 2415 } 2416 2417 /** 2418 * Determines whether or not extra unprocessed motion events in 2419 * the event queue can be discarded. If %TRUE only the most recent 2420 * event will be delivered. 2421 * 2422 * Some types of applications, e.g. paint programs, need to see all 2423 * motion events and will benefit from turning off event compression. 2424 * 2425 * By default, event compression is enabled. 2426 * 2427 * Params: 2428 * eventCompression = %TRUE if motion events should be compressed 2429 * 2430 * Since: 3.12 2431 */ 2432 public void setEventCompression(bool eventCompression) 2433 { 2434 gdk_window_set_event_compression(gdkWindow, eventCompression); 2435 } 2436 2437 /** 2438 * The event mask for a window determines which events will be reported 2439 * for that window from all master input devices. For example, an event mask 2440 * including #GDK_BUTTON_PRESS_MASK means the window should report button 2441 * press events. The event mask is the bitwise OR of values from the 2442 * #GdkEventMask enumeration. 2443 * 2444 * See the [input handling overview][event-masks] for details. 2445 * 2446 * Params: 2447 * eventMask = event mask for @window 2448 */ 2449 public void setEvents(GdkEventMask eventMask) 2450 { 2451 gdk_window_set_events(gdkWindow, eventMask); 2452 } 2453 2454 /** 2455 * Setting @focus_on_map to %FALSE hints the desktop environment that the 2456 * window doesn’t want to receive input focus when it is mapped. 2457 * focus_on_map should be turned off for windows that aren’t triggered 2458 * interactively (such as popups from network activity). 2459 * 2460 * On X, it is the responsibility of the window manager to interpret 2461 * this hint. Window managers following the freedesktop.org window 2462 * manager extension specification should respect it. 2463 * 2464 * Params: 2465 * focusOnMap = %TRUE if the window should receive input focus when mapped 2466 * 2467 * Since: 2.6 2468 */ 2469 public void setFocusOnMap(bool focusOnMap) 2470 { 2471 gdk_window_set_focus_on_map(gdkWindow, focusOnMap); 2472 } 2473 2474 /** 2475 * Specifies whether the @window should span over all monitors (in a multi-head 2476 * setup) or only the current monitor when in fullscreen mode. 2477 * 2478 * The @mode argument is from the #GdkFullscreenMode enumeration. 2479 * If #GDK_FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen @window will 2480 * span over all monitors from the #GdkScreen. 2481 * 2482 * On X11, searches through the list of monitors from the #GdkScreen the ones 2483 * which delimit the 4 edges of the entire #GdkScreen and will ask the window 2484 * manager to span the @window over these monitors. 2485 * 2486 * If the XINERAMA extension is not available or not usable, this function 2487 * has no effect. 2488 * 2489 * Not all window managers support this, so you can’t rely on the fullscreen 2490 * window to span over the multiple monitors when #GDK_FULLSCREEN_ON_ALL_MONITORS 2491 * is specified. 2492 * 2493 * Params: 2494 * mode = fullscreen mode 2495 * 2496 * Since: 3.8 2497 */ 2498 public void setFullscreenMode(GdkFullscreenMode mode) 2499 { 2500 gdk_window_set_fullscreen_mode(gdkWindow, mode); 2501 } 2502 2503 /** 2504 * Sets hints about the window management functions to make available 2505 * via buttons on the window frame. 2506 * 2507 * On the X backend, this function sets the traditional Motif window 2508 * manager hint for this purpose. However, few window managers do 2509 * anything reliable or interesting with this hint. Many ignore it 2510 * entirely. 2511 * 2512 * The @functions argument is the logical OR of values from the 2513 * #GdkWMFunction enumeration. If the bitmask includes #GDK_FUNC_ALL, 2514 * then the other bits indicate which functions to disable; if 2515 * it doesn’t include #GDK_FUNC_ALL, it indicates which functions to 2516 * enable. 2517 * 2518 * Params: 2519 * functions = bitmask of operations to allow on @window 2520 */ 2521 public void setFunctions(GdkWMFunction functions) 2522 { 2523 gdk_window_set_functions(gdkWindow, functions); 2524 } 2525 2526 /** 2527 * Sets the geometry hints for @window. Hints flagged in @geom_mask 2528 * are set, hints not flagged in @geom_mask are unset. 2529 * To unset all hints, use a @geom_mask of 0 and a @geometry of %NULL. 2530 * 2531 * This function provides hints to the windowing system about 2532 * acceptable sizes for a toplevel window. The purpose of 2533 * this is to constrain user resizing, but the windowing system 2534 * will typically (but is not required to) also constrain the 2535 * current size of the window to the provided values and 2536 * constrain programatic resizing via gdk_window_resize() or 2537 * gdk_window_move_resize(). 2538 * 2539 * Note that on X11, this effect has no effect on windows 2540 * of type %GDK_WINDOW_TEMP or windows where override redirect 2541 * has been turned on via gdk_window_set_override_redirect() 2542 * since these windows are not resizable by the user. 2543 * 2544 * Since you can’t count on the windowing system doing the 2545 * constraints for programmatic resizes, you should generally 2546 * call gdk_window_constrain_size() yourself to determine 2547 * appropriate sizes. 2548 * 2549 * Params: 2550 * geometry = geometry hints 2551 * geomMask = bitmask indicating fields of @geometry to pay attention to 2552 */ 2553 public void setGeometryHints(GdkGeometry* geometry, GdkWindowHints geomMask) 2554 { 2555 gdk_window_set_geometry_hints(gdkWindow, geometry, geomMask); 2556 } 2557 2558 /** 2559 * Sets the group leader window for @window. By default, 2560 * GDK sets the group leader for all toplevel windows 2561 * to a global window implicitly created by GDK. With this function 2562 * you can override this default. 2563 * 2564 * The group leader window allows the window manager to distinguish 2565 * all windows that belong to a single application. It may for example 2566 * allow users to minimize/unminimize all windows belonging to an 2567 * application at once. You should only set a non-default group window 2568 * if your application pretends to be multiple applications. 2569 * 2570 * Params: 2571 * leader = group leader window, or %NULL to restore the default group leader window 2572 */ 2573 public void setGroup(Window leader) 2574 { 2575 gdk_window_set_group(gdkWindow, (leader is null) ? null : leader.getWindowStruct()); 2576 } 2577 2578 /** 2579 * Sets a list of icons for the window. One of these will be used 2580 * to represent the window when it has been iconified. The icon is 2581 * usually shown in an icon box or some sort of task bar. Which icon 2582 * size is shown depends on the window manager. The window manager 2583 * can scale the icon but setting several size icons can give better 2584 * image quality since the window manager may only need to scale the 2585 * icon by a small amount or not at all. 2586 * 2587 * Note that some platforms don't support window icons. 2588 * 2589 * Params: 2590 * pixbufs = A list of pixbufs, of different sizes. 2591 */ 2592 public void setIconList(ListG pixbufs) 2593 { 2594 gdk_window_set_icon_list(gdkWindow, (pixbufs is null) ? null : pixbufs.getListGStruct()); 2595 } 2596 2597 /** 2598 * Windows may have a name used while minimized, distinct from the 2599 * name they display in their titlebar. Most of the time this is a bad 2600 * idea from a user interface standpoint. But you can set such a name 2601 * with this function, if you like. 2602 * 2603 * After calling this with a non-%NULL @name, calls to gdk_window_set_title() 2604 * will not update the icon title. 2605 * 2606 * Using %NULL for @name unsets the icon title; further calls to 2607 * gdk_window_set_title() will again update the icon title as well. 2608 * 2609 * Note that some platforms don't support window icons. 2610 * 2611 * Params: 2612 * name = name of window while iconified (minimized) 2613 */ 2614 public void setIconName(string name) 2615 { 2616 gdk_window_set_icon_name(gdkWindow, Str.toStringz(name)); 2617 } 2618 2619 /** 2620 * Registers an invalidate handler for a specific window. This 2621 * will get called whenever a region in the window or its children 2622 * is invalidated. 2623 * 2624 * This can be used to record the invalidated region, which is 2625 * useful if you are keeping an offscreen copy of some region 2626 * and want to keep it up to date. You can also modify the 2627 * invalidated region in case you’re doing some effect where 2628 * e.g. a child widget appears in multiple places. 2629 * 2630 * Params: 2631 * handler = a #GdkWindowInvalidateHandlerFunc callback function 2632 * 2633 * Since: 3.10 2634 */ 2635 public void setInvalidateHandler(GdkWindowInvalidateHandlerFunc handler) 2636 { 2637 gdk_window_set_invalidate_handler(gdkWindow, handler); 2638 } 2639 2640 /** 2641 * Set if @window must be kept above other windows. If the 2642 * window was already above, then this function does nothing. 2643 * 2644 * On X11, asks the window manager to keep @window above, if the window 2645 * manager supports this operation. Not all window managers support 2646 * this, and some deliberately ignore it or don’t have a concept of 2647 * “keep above”; so you can’t rely on the window being kept above. 2648 * But it will happen with most standard window managers, 2649 * and GDK makes a best effort to get it to happen. 2650 * 2651 * Params: 2652 * setting = whether to keep @window above other windows 2653 * 2654 * Since: 2.4 2655 */ 2656 public void setKeepAbove(bool setting) 2657 { 2658 gdk_window_set_keep_above(gdkWindow, setting); 2659 } 2660 2661 /** 2662 * Set if @window must be kept below other windows. If the 2663 * window was already below, then this function does nothing. 2664 * 2665 * On X11, asks the window manager to keep @window below, if the window 2666 * manager supports this operation. Not all window managers support 2667 * this, and some deliberately ignore it or don’t have a concept of 2668 * “keep below”; so you can’t rely on the window being kept below. 2669 * But it will happen with most standard window managers, 2670 * and GDK makes a best effort to get it to happen. 2671 * 2672 * Params: 2673 * setting = whether to keep @window below other windows 2674 * 2675 * Since: 2.4 2676 */ 2677 public void setKeepBelow(bool setting) 2678 { 2679 gdk_window_set_keep_below(gdkWindow, setting); 2680 } 2681 2682 /** 2683 * The application can use this hint to tell the window manager 2684 * that a certain window has modal behaviour. The window manager 2685 * can use this information to handle modal windows in a special 2686 * way. 2687 * 2688 * You should only use this on windows for which you have 2689 * previously called gdk_window_set_transient_for() 2690 * 2691 * Params: 2692 * modal = %TRUE if the window is modal, %FALSE otherwise. 2693 */ 2694 public void setModalHint(bool modal) 2695 { 2696 gdk_window_set_modal_hint(gdkWindow, modal); 2697 } 2698 2699 /** 2700 * Set @window to render as partially transparent, 2701 * with opacity 0 being fully transparent and 1 fully opaque. (Values 2702 * of the opacity parameter are clamped to the [0,1] range.) 2703 * 2704 * For toplevel windows this depends on support from the windowing system 2705 * that may not always be there. For instance, On X11, this works only on 2706 * X screens with a compositing manager running. On Wayland, there is no 2707 * per-window opacity value that the compositor would apply. Instead, use 2708 * `gdk_window_set_opaque_region (window, NULL)` to tell the compositor 2709 * that the entire window is (potentially) non-opaque, and draw your content 2710 * with alpha, or use gtk_widget_set_opacity() to set an overall opacity 2711 * for your widgets. 2712 * 2713 * For child windows this function only works for non-native windows. 2714 * 2715 * For setting up per-pixel alpha topelevels, see gdk_screen_get_rgba_visual(), 2716 * and for non-toplevels, see gdk_window_set_composited(). 2717 * 2718 * Support for non-toplevel windows was added in 3.8. 2719 * 2720 * Params: 2721 * opacity = opacity 2722 * 2723 * Since: 2.12 2724 */ 2725 public void setOpacity(double opacity) 2726 { 2727 gdk_window_set_opacity(gdkWindow, opacity); 2728 } 2729 2730 /** 2731 * For optimisation purposes, compositing window managers may 2732 * like to not draw obscured regions of windows, or turn off blending 2733 * during for these regions. With RGB windows with no transparency, 2734 * this is just the shape of the window, but with ARGB32 windows, the 2735 * compositor does not know what regions of the window are transparent 2736 * or not. 2737 * 2738 * This function only works for toplevel windows. 2739 * 2740 * GTK+ will update this property automatically if 2741 * the @window background is opaque, as we know where the opaque regions 2742 * are. If your window background is not opaque, please update this 2743 * property in your #GtkWidget::style-updated handler. 2744 * 2745 * Params: 2746 * region = a region, or %NULL 2747 * 2748 * Since: 3.10 2749 */ 2750 public void setOpaqueRegion(Region region) 2751 { 2752 gdk_window_set_opaque_region(gdkWindow, (region is null) ? null : region.getRegionStruct()); 2753 } 2754 2755 /** 2756 * An override redirect window is not under the control of the window manager. 2757 * This means it won’t have a titlebar, won’t be minimizable, etc. - it will 2758 * be entirely under the control of the application. The window manager 2759 * can’t see the override redirect window at all. 2760 * 2761 * Override redirect should only be used for short-lived temporary 2762 * windows, such as popup menus. #GtkMenu uses an override redirect 2763 * window in its implementation, for example. 2764 * 2765 * Params: 2766 * overrideRedirect = %TRUE if window should be override redirect 2767 */ 2768 public void setOverrideRedirect(bool overrideRedirect) 2769 { 2770 gdk_window_set_override_redirect(gdkWindow, overrideRedirect); 2771 } 2772 2773 /** 2774 * Sets whether input to the window is passed through to the window 2775 * below. 2776 * 2777 * The default value of this is %FALSE, which means that pointer 2778 * events that happen inside the window are send first to the window, 2779 * but if the event is not selected by the event mask then the event 2780 * is sent to the parent window, and so on up the hierarchy. 2781 * 2782 * If @pass_through is %TRUE then such pointer events happen as if the 2783 * window wasn't there at all, and thus will be sent first to any 2784 * windows below @window. This is useful if the window is used in a 2785 * transparent fashion. In the terminology of the web this would be called 2786 * "pointer-events: none". 2787 * 2788 * Note that a window with @pass_through %TRUE can still have a subwindow 2789 * without pass through, so you can get events on a subset of a window. And in 2790 * that cases you would get the in-between related events such as the pointer 2791 * enter/leave events on its way to the destination window. 2792 * 2793 * Params: 2794 * passThrough = a boolean 2795 * 2796 * Since: 3.18 2797 */ 2798 public void setPassThrough(bool passThrough) 2799 { 2800 gdk_window_set_pass_through(gdkWindow, passThrough); 2801 } 2802 2803 /** 2804 * When using GTK+, typically you should use gtk_window_set_role() instead 2805 * of this low-level function. 2806 * 2807 * The window manager and session manager use a window’s role to 2808 * distinguish it from other kinds of window in the same application. 2809 * When an application is restarted after being saved in a previous 2810 * session, all windows with the same title and role are treated as 2811 * interchangeable. So if you have two windows with the same title 2812 * that should be distinguished for session management purposes, you 2813 * should set the role on those windows. It doesn’t matter what string 2814 * you use for the role, as long as you have a different role for each 2815 * non-interchangeable kind of window. 2816 * 2817 * Params: 2818 * role = a string indicating its role 2819 */ 2820 public void setRole(string role) 2821 { 2822 gdk_window_set_role(gdkWindow, Str.toStringz(role)); 2823 } 2824 2825 /** 2826 * Newer GTK+ windows using client-side decorations use extra geometry 2827 * around their frames for effects like shadows and invisible borders. 2828 * Window managers that want to maximize windows or snap to edges need 2829 * to know where the extents of the actual frame lie, so that users 2830 * don’t feel like windows are snapping against random invisible edges. 2831 * 2832 * Note that this property is automatically updated by GTK+, so this 2833 * function should only be used by applications which do not use GTK+ 2834 * to create toplevel windows. 2835 * 2836 * Params: 2837 * left = The left extent 2838 * right = The right extent 2839 * top = The top extent 2840 * bottom = The bottom extent 2841 * 2842 * Since: 3.12 2843 */ 2844 public void setShadowWidth(int left, int right, int top, int bottom) 2845 { 2846 gdk_window_set_shadow_width(gdkWindow, left, right, top, bottom); 2847 } 2848 2849 /** 2850 * Toggles whether a window should appear in a pager (workspace 2851 * switcher, or other desktop utility program that displays a small 2852 * thumbnail representation of the windows on the desktop). If a 2853 * window’s semantic type as specified with gdk_window_set_type_hint() 2854 * already fully describes the window, this function should 2855 * not be called in addition, instead you should 2856 * allow the window to be treated according to standard policy for 2857 * its semantic type. 2858 * 2859 * Params: 2860 * skipsPager = %TRUE to skip the pager 2861 * 2862 * Since: 2.2 2863 */ 2864 public void setSkipPagerHint(bool skipsPager) 2865 { 2866 gdk_window_set_skip_pager_hint(gdkWindow, skipsPager); 2867 } 2868 2869 /** 2870 * Toggles whether a window should appear in a task list or window 2871 * list. If a window’s semantic type as specified with 2872 * gdk_window_set_type_hint() already fully describes the window, this 2873 * function should not be called in addition, 2874 * instead you should allow the window to be treated according to 2875 * standard policy for its semantic type. 2876 * 2877 * Params: 2878 * skipsTaskbar = %TRUE to skip the taskbar 2879 * 2880 * Since: 2.2 2881 */ 2882 public void setSkipTaskbarHint(bool skipsTaskbar) 2883 { 2884 gdk_window_set_skip_taskbar_hint(gdkWindow, skipsTaskbar); 2885 } 2886 2887 /** 2888 * Sets the event mask for any floating device (i.e. not attached to any 2889 * visible pointer) that has the source defined as @source. This event 2890 * mask will be applied both to currently existing, newly added devices 2891 * after this call, and devices being attached/detached. 2892 * 2893 * Params: 2894 * source = a #GdkInputSource to define the source class. 2895 * eventMask = event mask for @window 2896 * 2897 * Since: 3.0 2898 */ 2899 public void setSourceEvents(GdkInputSource source, GdkEventMask eventMask) 2900 { 2901 gdk_window_set_source_events(gdkWindow, source, eventMask); 2902 } 2903 2904 /** 2905 * When using GTK+, typically you should use gtk_window_set_startup_id() 2906 * instead of this low-level function. 2907 * 2908 * Params: 2909 * startupId = a string with startup-notification identifier 2910 * 2911 * Since: 2.12 2912 */ 2913 public void setStartupId(string startupId) 2914 { 2915 gdk_window_set_startup_id(gdkWindow, Str.toStringz(startupId)); 2916 } 2917 2918 /** 2919 * Used to set the bit gravity of the given window to static, and flag 2920 * it so all children get static subwindow gravity. This is used if you 2921 * are implementing scary features that involve deep knowledge of the 2922 * windowing system. Don’t worry about it. 2923 * 2924 * Deprecated: static gravities haven't worked on anything but X11 2925 * for a long time. 2926 * 2927 * Params: 2928 * useStatic = %TRUE to turn on static gravity 2929 * 2930 * Returns: %FALSE 2931 */ 2932 public bool setStaticGravities(bool useStatic) 2933 { 2934 return gdk_window_set_static_gravities(gdkWindow, useStatic) != 0; 2935 } 2936 2937 /** 2938 * This function will enable multidevice features in @window. 2939 * 2940 * Multidevice aware windows will need to handle properly multiple, 2941 * per device enter/leave events, device grabs and grab ownerships. 2942 * 2943 * Params: 2944 * supportMultidevice = %TRUE to enable multidevice support in @window. 2945 * 2946 * Since: 3.0 2947 */ 2948 public void setSupportMultidevice(bool supportMultidevice) 2949 { 2950 gdk_window_set_support_multidevice(gdkWindow, supportMultidevice); 2951 } 2952 2953 /** 2954 * Sets the title of a toplevel window, to be displayed in the titlebar. 2955 * If you haven’t explicitly set the icon name for the window 2956 * (using gdk_window_set_icon_name()), the icon name will be set to 2957 * @title as well. @title must be in UTF-8 encoding (as with all 2958 * user-readable strings in GDK/GTK+). @title may not be %NULL. 2959 * 2960 * Params: 2961 * title = title of @window 2962 */ 2963 public void setTitle(string title) 2964 { 2965 gdk_window_set_title(gdkWindow, Str.toStringz(title)); 2966 } 2967 2968 /** 2969 * Indicates to the window manager that @window is a transient dialog 2970 * associated with the application window @parent. This allows the 2971 * window manager to do things like center @window on @parent and 2972 * keep @window above @parent. 2973 * 2974 * See gtk_window_set_transient_for() if you’re using #GtkWindow or 2975 * #GtkDialog. 2976 * 2977 * Params: 2978 * parent = another toplevel #GdkWindow 2979 */ 2980 public void setTransientFor(Window parent) 2981 { 2982 gdk_window_set_transient_for(gdkWindow, (parent is null) ? null : parent.getWindowStruct()); 2983 } 2984 2985 /** 2986 * The application can use this call to provide a hint to the window 2987 * manager about the functionality of a window. The window manager 2988 * can use this information when determining the decoration and behaviour 2989 * of the window. 2990 * 2991 * The hint must be set before the window is mapped. 2992 * 2993 * Params: 2994 * hint = A hint of the function this window will have 2995 */ 2996 public void setTypeHint(GdkWindowTypeHint hint) 2997 { 2998 gdk_window_set_type_hint(gdkWindow, hint); 2999 } 3000 3001 /** 3002 * Toggles whether a window needs the user's 3003 * urgent attention. 3004 * 3005 * Params: 3006 * urgent = %TRUE if the window is urgent 3007 * 3008 * Since: 2.8 3009 */ 3010 public void setUrgencyHint(bool urgent) 3011 { 3012 gdk_window_set_urgency_hint(gdkWindow, urgent); 3013 } 3014 3015 /** 3016 * For most purposes this function is deprecated in favor of 3017 * g_object_set_data(). However, for historical reasons GTK+ stores 3018 * the #GtkWidget that owns a #GdkWindow as user data on the 3019 * #GdkWindow. So, custom widget implementations should use 3020 * this function for that. If GTK+ receives an event for a #GdkWindow, 3021 * and the user data for the window is non-%NULL, GTK+ will assume the 3022 * user data is a #GtkWidget, and forward the event to that widget. 3023 * 3024 * Params: 3025 * userData = user data 3026 */ 3027 public void setUserData(ObjectG userData) 3028 { 3029 gdk_window_set_user_data(gdkWindow, (userData is null) ? null : userData.getObjectGStruct()); 3030 } 3031 3032 /** 3033 * Makes pixels in @window outside @shape_region be transparent, 3034 * so that the window may be nonrectangular. 3035 * 3036 * If @shape_region is %NULL, the shape will be unset, so the whole 3037 * window will be opaque again. @offset_x and @offset_y are ignored 3038 * if @shape_region is %NULL. 3039 * 3040 * On the X11 platform, this uses an X server extension which is 3041 * widely available on most common platforms, but not available on 3042 * very old X servers, and occasionally the implementation will be 3043 * buggy. On servers without the shape extension, this function 3044 * will do nothing. 3045 * 3046 * This function works on both toplevel and child windows. 3047 * 3048 * Params: 3049 * shapeRegion = region of window to be non-transparent 3050 * offsetX = X position of @shape_region in @window coordinates 3051 * offsetY = Y position of @shape_region in @window coordinates 3052 */ 3053 public void shapeCombineRegion(Region shapeRegion, int offsetX, int offsetY) 3054 { 3055 gdk_window_shape_combine_region(gdkWindow, (shapeRegion is null) ? null : shapeRegion.getRegionStruct(), offsetX, offsetY); 3056 } 3057 3058 /** 3059 * Like gdk_window_show_unraised(), but also raises the window to the 3060 * top of the window stack (moves the window to the front of the 3061 * Z-order). 3062 * 3063 * This function maps a window so it’s visible onscreen. Its opposite 3064 * is gdk_window_hide(). 3065 * 3066 * When implementing a #GtkWidget, you should call this function on the widget's 3067 * #GdkWindow as part of the “map” method. 3068 */ 3069 public void show() 3070 { 3071 gdk_window_show(gdkWindow); 3072 } 3073 3074 /** 3075 * Shows a #GdkWindow onscreen, but does not modify its stacking 3076 * order. In contrast, gdk_window_show() will raise the window 3077 * to the top of the window stack. 3078 * 3079 * On the X11 platform, in Xlib terms, this function calls 3080 * XMapWindow() (it also updates some internal GDK state, which means 3081 * that you can’t really use XMapWindow() directly on a GDK window). 3082 */ 3083 public void showUnraised() 3084 { 3085 gdk_window_show_unraised(gdkWindow); 3086 } 3087 3088 /** 3089 * Asks the windowing system to show the window menu. The window menu 3090 * is the menu shown when right-clicking the titlebar on traditional 3091 * windows managed by the window manager. This is useful for windows 3092 * using client-side decorations, activating it with a right-click 3093 * on the window decorations. 3094 * 3095 * Params: 3096 * event = a #GdkEvent to show the menu for 3097 * 3098 * Returns: %TRUE if the window menu was shown and %FALSE otherwise. 3099 * 3100 * Since: 3.14 3101 */ 3102 public bool showWindowMenu(Event event) 3103 { 3104 return gdk_window_show_window_menu(gdkWindow, (event is null) ? null : event.getEventStruct()) != 0; 3105 } 3106 3107 /** 3108 * “Pins” a window such that it’s on all workspaces and does not scroll 3109 * with viewports, for window managers that have scrollable viewports. 3110 * (When using #GtkWindow, gtk_window_stick() may be more useful.) 3111 * 3112 * On the X11 platform, this function depends on window manager 3113 * support, so may have no effect with many window managers. However, 3114 * GDK will do the best it can to convince the window manager to stick 3115 * the window. For window managers that don’t support this operation, 3116 * there’s nothing you can do to force it to happen. 3117 */ 3118 public void stick() 3119 { 3120 gdk_window_stick(gdkWindow); 3121 } 3122 3123 /** 3124 * Thaws a window frozen with 3125 * gdk_window_freeze_toplevel_updates_libgtk_only(). 3126 * 3127 * This function is not part of the GDK public API and is only 3128 * for use by GTK+. 3129 * 3130 * Deprecated: This symbol was never meant to be used outside of GTK+ 3131 */ 3132 public void thawToplevelUpdatesLibgtkOnly() 3133 { 3134 gdk_window_thaw_toplevel_updates_libgtk_only(gdkWindow); 3135 } 3136 3137 /** 3138 * Thaws a window frozen with gdk_window_freeze_updates(). 3139 */ 3140 public void thawUpdates() 3141 { 3142 gdk_window_thaw_updates(gdkWindow); 3143 } 3144 3145 /** 3146 * Moves the window out of fullscreen mode. If the window was not 3147 * fullscreen, does nothing. 3148 * 3149 * On X11, asks the window manager to move @window out of the fullscreen 3150 * state, if the window manager supports this operation. Not all 3151 * window managers support this, and some deliberately ignore it or 3152 * don’t have a concept of “fullscreen”; so you can’t rely on the 3153 * unfullscreenification actually happening. But it will happen with 3154 * most standard window managers, and GDK makes a best effort to get 3155 * it to happen. 3156 * 3157 * Since: 2.2 3158 */ 3159 public void unfullscreen() 3160 { 3161 gdk_window_unfullscreen(gdkWindow); 3162 } 3163 3164 /** 3165 * Unmaximizes the window. If the window wasn’t maximized, then this 3166 * function does nothing. 3167 * 3168 * On X11, asks the window manager to unmaximize @window, if the 3169 * window manager supports this operation. Not all window managers 3170 * support this, and some deliberately ignore it or don’t have a 3171 * concept of “maximized”; so you can’t rely on the unmaximization 3172 * actually happening. But it will happen with most standard window 3173 * managers, and GDK makes a best effort to get it to happen. 3174 * 3175 * On Windows, reliably unmaximizes the window. 3176 */ 3177 public void unmaximize() 3178 { 3179 gdk_window_unmaximize(gdkWindow); 3180 } 3181 3182 /** 3183 * Reverse operation for gdk_window_stick(); see gdk_window_stick(), 3184 * and gtk_window_unstick(). 3185 */ 3186 public void unstick() 3187 { 3188 gdk_window_unstick(gdkWindow); 3189 } 3190 3191 /** 3192 * Withdraws a window (unmaps it and asks the window manager to forget about it). 3193 * This function is not really useful as gdk_window_hide() automatically 3194 * withdraws toplevel windows before hiding them. 3195 */ 3196 public void withdraw() 3197 { 3198 gdk_window_withdraw(gdkWindow); 3199 } 3200 3201 /** 3202 * The ::create-surface signal is emitted when an offscreen window 3203 * needs its surface (re)created, which happens either when the 3204 * window is first drawn to, or when the window is being 3205 * resized. The first signal handler that returns a non-%NULL 3206 * surface will stop any further signal emission, and its surface 3207 * will be used. 3208 * 3209 * Note that it is not possible to access the window's previous 3210 * surface from within any callback of this signal. Calling 3211 * gdk_offscreen_window_get_surface() will lead to a crash. 3212 * 3213 * Params: 3214 * width = the width of the offscreen surface to create 3215 * height = the height of the offscreen surface to create 3216 * 3217 * Returns: the newly created #cairo_surface_t for the offscreen window 3218 * 3219 * Since: 3.0 3220 */ 3221 gulong addOnCreateSurface(Surface delegate(int, int, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3222 { 3223 return Signals.connect(this, "create-surface", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3224 } 3225 3226 /** 3227 * The ::from-embedder signal is emitted to translate coordinates 3228 * in the embedder of an offscreen window to the offscreen window. 3229 * 3230 * See also #GdkWindow::to-embedder. 3231 * 3232 * Params: 3233 * embedderX = x coordinate in the embedder window 3234 * embedderY = y coordinate in the embedder window 3235 * offscreenX = return location for the x 3236 * coordinate in the offscreen window 3237 * offscreenY = return location for the y 3238 * coordinate in the offscreen window 3239 * 3240 * Since: 2.18 3241 */ 3242 gulong addOnFromEmbedder(void delegate(double, double, void*, void*, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3243 { 3244 return Signals.connect(this, "from-embedder", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3245 } 3246 3247 /** 3248 * Emitted when the position of @window is finalized after being moved to a 3249 * destination rectangle. 3250 * 3251 * @window might be flipped over the destination rectangle in order to keep 3252 * it on-screen, in which case @flipped_x and @flipped_y will be set to %TRUE 3253 * accordingly. 3254 * 3255 * @flipped_rect is the ideal position of @window after any possible 3256 * flipping, but before any possible sliding. @final_rect is @flipped_rect, 3257 * but possibly translated in the case that flipping is still ineffective in 3258 * keeping @window on-screen. 3259 * 3260 * Params: 3261 * flippedRect = the position of @window after any possible 3262 * flipping or %NULL if the backend can't obtain it 3263 * finalRect = the final position of @window or %NULL if the 3264 * backend can't obtain it 3265 * flippedX = %TRUE if the anchors were flipped horizontally 3266 * flippedY = %TRUE if the anchors were flipped vertically 3267 * 3268 * Since: 3.22 3269 */ 3270 gulong addOnMovedToRect(void delegate(void*, void*, bool, bool, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3271 { 3272 return Signals.connect(this, "moved-to-rect", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3273 } 3274 3275 /** 3276 * The ::pick-embedded-child signal is emitted to find an embedded 3277 * child at the given position. 3278 * 3279 * Params: 3280 * x = x coordinate in the window 3281 * y = y coordinate in the window 3282 * 3283 * Returns: the #GdkWindow of the 3284 * embedded child at @x, @y, or %NULL 3285 * 3286 * Since: 2.18 3287 */ 3288 gulong addOnPickEmbeddedChild(Window delegate(double, double, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3289 { 3290 return Signals.connect(this, "pick-embedded-child", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3291 } 3292 3293 /** 3294 * The ::to-embedder signal is emitted to translate coordinates 3295 * in an offscreen window to its embedder. 3296 * 3297 * See also #GdkWindow::from-embedder. 3298 * 3299 * Params: 3300 * offscreenX = x coordinate in the offscreen window 3301 * offscreenY = y coordinate in the offscreen window 3302 * embedderX = return location for the x 3303 * coordinate in the embedder window 3304 * embedderY = return location for the y 3305 * coordinate in the embedder window 3306 * 3307 * Since: 2.18 3308 */ 3309 gulong addOnToEmbedder(void delegate(double, double, void*, void*, Window) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3310 { 3311 return Signals.connect(this, "to-embedder", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3312 } 3313 3314 /** 3315 * Obtains the root window (parent all other windows are inside) 3316 * for the default display and screen. 3317 * 3318 * Returns: the default root window 3319 */ 3320 public static Window getDefaultRootWindow() 3321 { 3322 auto p = gdk_get_default_root_window(); 3323 3324 if(p is null) 3325 { 3326 return null; 3327 } 3328 3329 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 3330 } 3331 3332 /** 3333 * Gets the window that @window is embedded in. 3334 * 3335 * Params: 3336 * window = a #GdkWindow 3337 * 3338 * Returns: the embedding #GdkWindow, or 3339 * %NULL if @window is not an mbedded offscreen window 3340 * 3341 * Since: 2.18 3342 */ 3343 public static Window offscreenWindowGetEmbedder(Window window) 3344 { 3345 auto p = gdk_offscreen_window_get_embedder((window is null) ? null : window.getWindowStruct()); 3346 3347 if(p is null) 3348 { 3349 return null; 3350 } 3351 3352 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 3353 } 3354 3355 /** 3356 * Gets the offscreen surface that an offscreen window renders into. 3357 * If you need to keep this around over window resizes, you need to 3358 * add a reference to it. 3359 * 3360 * Params: 3361 * window = a #GdkWindow 3362 * 3363 * Returns: The offscreen surface, or 3364 * %NULL if not offscreen 3365 */ 3366 public static Surface offscreenWindowGetSurface(Window window) 3367 { 3368 auto p = gdk_offscreen_window_get_surface((window is null) ? null : window.getWindowStruct()); 3369 3370 if(p is null) 3371 { 3372 return null; 3373 } 3374 3375 return new Surface(cast(cairo_surface_t*) p); 3376 } 3377 3378 /** 3379 * Sets @window to be embedded in @embedder. 3380 * 3381 * To fully embed an offscreen window, in addition to calling this 3382 * function, it is also necessary to handle the #GdkWindow::pick-embedded-child 3383 * signal on the @embedder and the #GdkWindow::to-embedder and 3384 * #GdkWindow::from-embedder signals on @window. 3385 * 3386 * Params: 3387 * window = a #GdkWindow 3388 * embedder = the #GdkWindow that @window gets embedded in 3389 * 3390 * Since: 2.18 3391 */ 3392 public static void offscreenWindowSetEmbedder(Window window, Window embedder) 3393 { 3394 gdk_offscreen_window_set_embedder((window is null) ? null : window.getWindowStruct(), (embedder is null) ? null : embedder.getWindowStruct()); 3395 } 3396 3397 /** */ 3398 public static void synthesizeWindowState(Window window, GdkWindowState unsetFlags, GdkWindowState setFlags) 3399 { 3400 gdk_synthesize_window_state((window is null) ? null : window.getWindowStruct(), unsetFlags, setFlags); 3401 } 3402 }