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