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