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