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