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