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