1 2@c %start of fragment 3 4@deftp Class <gtk-window> 5Derives from @code{<gtk-bin>}. 6 7This class defines the following slots: 8 9@table @code 10@item type 11The type of the window 12 13@item title 14The title of the window 15 16@item startup-id 17Unique startup identifier for the window used by startup-notification 18 19@item role 20Unique identifier for the window to be used when restoring a session 21 22@item allow-shrink 23If TRUE, the window has no mimimum size. Setting this to TRUE is 99% of the time 24a bad idea 25 26@item allow-grow 27If TRUE, users can expand the window beyond its minimum size 28 29@item resizable 30If TRUE, users can resize the window 31 32@item modal 33If TRUE, the window is modal (other windows are not usable while this one is up) 34 35@item window-position 36The initial position of the window 37 38@item default-width 39The default width of the window, used when initially showing the window 40 41@item default-height 42The default height of the window, used when initially showing the window 43 44@item destroy-with-parent 45If this window should be destroyed when the parent is destroyed 46 47@item icon 48Icon for this window 49 50@item icon-name 51Name of the themed icon for this window 52 53@item screen 54The screen where this window will be displayed 55 56@item type-hint 57Hint to help the desktop environment understand what kind of window this is and 58how to treat it. 59 60@item skip-taskbar-hint 61TRUE if the window should not be in the task bar. 62 63@item skip-pager-hint 64TRUE if the window should not be in the pager. 65 66@item urgency-hint 67TRUE if the window should be brought to the user's attention. 68 69@item accept-focus 70TRUE if the window should receive the input focus. 71 72@item focus-on-map 73TRUE if the window should receive the input focus when mapped. 74 75@item decorated 76Whether the window should be decorated by the window manager 77 78@item deletable 79Whether the window frame should have a close button 80 81@item gravity 82The window gravity of the window 83 84@item transient-for 85The transient parent of the dialog 86 87@item opacity 88The opacity of the window, from 0 to 1 89 90@item is-active 91Whether the toplevel is the current active window 92 93@item has-toplevel-focus 94Whether the input focus is within this GtkWindow 95 96@end table 97 98@end deftp 99 100@defop Signal <gtk-window> set-focus (arg0@tie{}@code{<gtk-widget>}) 101@end defop 102 103@defop Signal <gtk-window> frame-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 104@end defop 105 106@defop Signal <gtk-window> activate-focus 107@end defop 108 109@defop Signal <gtk-window> activate-default 110@end defop 111 112@defop Signal <gtk-window> keys-changed 113@end defop 114 115@deffn Function gtk-window-new (type@tie{}@code{<gtk-window-type>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 116Creates a new @code{<gtk-window>}, which is a toplevel window that can contain 117other widgets. Nearly always, the type of the window should be 118@code{<gtk-window-toplevel>}. If you're implementing something like a popup menu 119from scratch (which is a bad idea, just use @code{<gtk-menu>}), you might use 120@code{<gtk-window-popup>}. @code{<gtk-window-popup>} is not for dialogs, though 121in some other toolkits dialogs are called "popups". In GTK+, 122@code{<gtk-window-popup>} means a pop-up menu or pop-up tooltip. On X11, popup 123windows are not controlled by the window manager. 124 125If you simply want an undecorated window (no window borders), use 126@code{gtk-window-set-decorated}, don't use @code{<gtk-window-popup>}. 127 128@table @var 129@item type 130type of window 131 132@item ret 133a new @code{<gtk-window>}. 134 135@end table 136 137@end deffn 138 139@deffn Function gtk-window-set-title (self@tie{}@code{<gtk-window>}) (title@tie{}@code{mchars}) 140@deffnx Method set-title 141Sets the title of the @code{<gtk-window>}. The title of a window will be 142displayed in its title bar; on the X Window System, the title bar is rendered by 143the window manager, so exactly how the title appears to users may vary according 144to a user's exact configuration. The title should help a user distinguish this 145window from other windows they may have open. A good title might include the 146application name and current document filename, for example. 147 148@table @var 149@item window 150a @code{<gtk-window>} 151 152@item title 153title of the window 154 155@end table 156 157@end deffn 158 159@deffn Function gtk-window-set-wmclass (self@tie{}@code{<gtk-window>}) (wmclass_name@tie{}@code{mchars}) (wmclass_class@tie{}@code{mchars}) 160@deffnx Method set-wmclass 161Don't use this function. It sets the X Window System "class" and "name" hints 162for a window. According to the ICCCM, you should always set these to the same 163value for all windows in an application, and GTK+ sets them to that value by 164default, so calling this function is sort of pointless. However, you may want to 165call @code{gtk-window-set-role} on each window in your application, for the 166benefit of the session manager. Setting the role allows the window manager to 167restore window positions when loading a saved session. 168 169@table @var 170@item window 171a @code{<gtk-window>} 172 173@item wmclass-name 174window name hint 175 176@item wmclass-class 177window class hint 178 179@end table 180 181@end deffn 182 183@deffn Function gtk-window-set-resizable (self@tie{}@code{<gtk-window>}) (resizable@tie{}@code{bool}) 184@deffnx Method set-resizable 185Sets whether the user can resize a window. Windows are user resizable by 186default. 187 188@table @var 189@item window 190a @code{<gtk-window>} 191 192@item resizable 193@samp{@code{#t}} if the user can resize this window 194 195@end table 196 197@end deffn 198 199@deffn Function gtk-window-get-resizable (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 200@deffnx Method get-resizable 201Gets the value set by @code{gtk-window-set-resizable}. 202 203@table @var 204@item window 205a @code{<gtk-window>} 206 207@item ret 208@samp{@code{#t}} if the user can resize the window 209 210@end table 211 212@end deffn 213 214@deffn Function gtk-window-add-accel-group (self@tie{}@code{<gtk-window>}) (accel_group@tie{}@code{<gtk-accel-group>}) 215@deffnx Method add-accel-group 216Associate @var{accel-group} with @var{window}, such that calling 217@code{gtk-accel-groups-activate} on @var{window} will activate accelerators in 218@var{accel-group}. 219 220@table @var 221@item window 222window to attach accelerator group to 223 224@item accel-group 225a @code{<gtk-accel-group>} 226 227@end table 228 229@end deffn 230 231@deffn Function gtk-window-remove-accel-group (self@tie{}@code{<gtk-window>}) (accel_group@tie{}@code{<gtk-accel-group>}) 232@deffnx Method remove-accel-group 233Reverses the effects of @code{gtk-window-add-accel-group}. 234 235@table @var 236@item window 237a @code{<gtk-window>} 238 239@item accel-group 240a @code{<gtk-accel-group>} 241 242@end table 243 244@end deffn 245 246@deffn Function gtk-window-activate-focus (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 247@deffnx Method activate-focus 248Activates the current focused widget within the window. 249 250@table @var 251@item window 252a @code{<gtk-window>} 253 254@item ret 255@samp{@code{#t}} if a widget got activated. 256 257@end table 258 259@end deffn 260 261@deffn Function gtk-window-activate-default (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 262@deffnx Method activate-default 263Activates the default widget for the window, unless the current focused widget 264has been configured to receive the default action (see 265@code{<gtk-receives-default>} in @code{<gtk-widget-flags>}), in which case the 266focused widget is activated. 267 268@table @var 269@item window 270a @code{<gtk-window>} 271 272@item ret 273@samp{@code{#t}} if a widget got activated. 274 275@end table 276 277@end deffn 278 279@deffn Function gtk-window-set-modal (self@tie{}@code{<gtk-window>}) (modal@tie{}@code{bool}) 280@deffnx Method set-modal 281Sets a window modal or non-modal. Modal windows prevent interaction with other 282windows in the same application. To keep modal dialogs on top of main 283application windows, use @code{gtk-window-set-transient-for} to make the dialog 284transient for the parent; most window managers will then disallow lowering the 285dialog below the parent. 286 287@table @var 288@item window 289a @code{<gtk-window>} 290 291@item modal 292whether the window is modal 293 294@end table 295 296@end deffn 297 298@deffn Function gtk-window-set-default-size (self@tie{}@code{<gtk-window>}) (width@tie{}@code{int}) (height@tie{}@code{int}) 299@deffnx Method set-default-size 300Sets the default size of a window. If the window's "natural" size (its size 301request) is larger than the default, the default will be ignored. More 302generally, if the default size does not obey the geometry hints for the window 303(@code{gtk-window-set-geometry-hints} can be used to set these explicitly), the 304default size will be clamped to the nearest permitted size. 305 306Unlike @code{gtk-widget-set-size-request}, which sets a size request for a 307widget and thus would keep users from shrinking the window, this function only 308sets the initial size, just as if the user had resized the window themselves. 309Users can still shrink the window again as they normally would. Setting a 310default size of -1 means to use the "natural" default size (the size request of 311the window). 312 313For more control over a window's initial size and how resizing works, 314investigate @code{gtk-window-set-geometry-hints}. 315 316For some uses, @code{gtk-window-resize} is a more appropriate function. 317@code{gtk-window-resize} changes the current size of the window, rather than the 318size to be used on initial display. @code{gtk-window-resize} always affects the 319window itself, not the geometry widget. 320 321The default size of a window only affects the first time a window is shown; if a 322window is hidden and re-shown, it will remember the size it had prior to hiding, 323rather than using the default size. 324 325Windows can't actually be 0x0 in size, they must be at least 1x1, but passing 0 326for @var{width} and @var{height} is OK, resulting in a 1x1 default size. 327 328@table @var 329@item window 330a @code{<gtk-window>} 331 332@item width 333width in pixels, or -1 to unset the default width 334 335@item height 336height in pixels, or -1 to unset the default height 337 338@end table 339 340@end deffn 341 342@deffn Function gtk-window-set-gravity (self@tie{}@code{<gtk-window>}) (gravity@tie{}@code{<gdk-gravity>}) 343@deffnx Method set-gravity 344Window gravity defines the meaning of coordinates passed to 345@code{gtk-window-move}. See @code{gtk-window-move} and @code{<gdk-gravity>} for 346more details. 347 348The default window gravity is @code{<gdk-gravity-north-west>} which will 349typically "do what you mean." 350 351@table @var 352@item window 353a @code{<gtk-window>} 354 355@item gravity 356window gravity 357 358@end table 359 360@end deffn 361 362@deffn Function gtk-window-get-gravity (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gdk-gravity>}) 363@deffnx Method get-gravity 364Gets the value set by @code{gtk-window-set-gravity}. 365 366@table @var 367@item window 368a @code{<gtk-window>} 369 370@item ret 371window gravity 372 373@end table 374 375@end deffn 376 377@deffn Function gtk-window-set-position (self@tie{}@code{<gtk-window>}) (position@tie{}@code{<gtk-window-position>}) 378@deffnx Method set-position 379Sets a position constraint for this window. If the old or new constraint is 380@samp{GTK_WIN_POS_CENTER_ALWAYS}, this will also cause the window to be 381repositioned to satisfy the new constraint. 382 383@table @var 384@item window 385a @code{<gtk-window>}. 386 387@item position 388a position constraint. 389 390@end table 391 392@end deffn 393 394@deffn Function gtk-window-set-transient-for (self@tie{}@code{<gtk-window>}) (parent@tie{}@code{<gtk-window>}) 395@deffnx Method set-transient-for 396Dialog windows should be set transient for the main application window they were 397spawned from. This allows window managers to e.g. keep the dialog on top of the 398main window, or center the dialog over the main window. 399@code{gtk-dialog-new-with-buttons} and other convenience functions in GTK+ will 400sometimes call @code{gtk-window-set-transient-for} on your behalf. 401 402On Windows, this function will and put the child window on top of the parent, 403much as the window manager would have done on X. 404 405@table @var 406@item window 407a @code{<gtk-window>} 408 409@item parent 410parent window 411 412@end table 413 414@end deffn 415 416@deffn Function gtk-window-set-destroy-with-parent (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 417@deffnx Method set-destroy-with-parent 418If @var{setting} is @samp{@code{#t}}, then destroying the transient parent of 419@var{window} will also destroy @var{window} itself. This is useful for dialogs 420that shouldn't persist beyond the lifetime of the main window they're associated 421with, for example. 422 423@table @var 424@item window 425a @code{<gtk-window>} 426 427@item setting 428whether to destroy @var{window} with its transient parent 429 430@end table 431 432@end deffn 433 434@deffn Function gtk-window-set-screen (self@tie{}@code{<gtk-window>}) (screen@tie{}@code{<gdk-screen>}) 435@deffnx Method set-screen 436Sets the @code{<gdk-screen>} where the @var{window} is displayed; if the window 437is already mapped, it will be unmapped, and then remapped on the new screen. 438 439@table @var 440@item window 441a @code{<gtk-window>}. 442 443@item screen 444a @code{<gdk-screen>}. 445 446@end table 447 448Since 2.2 449 450@end deffn 451 452@deffn Function gtk-window-get-screen (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gdk-screen>}) 453@deffnx Method get-screen 454Returns the @code{<gdk-screen>} associated with @var{window}. 455 456@table @var 457@item window 458a @code{<gtk-window>}. 459 460@item ret 461a @code{<gdk-screen>}. 462 463@end table 464 465Since 2.2 466 467@end deffn 468 469@deffn Function gtk-window-is-active (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 470@deffnx Method is-active 471Returns whether the window is part of the current active toplevel. (That is, the 472toplevel window receiving keystrokes.) The return value is @samp{@code{#t}} if 473the window is active toplevel itself, but also if it is, say, a 474@code{<gtk-plug>} embedded in the active toplevel. You might use this function 475if you wanted to draw a widget differently in an active window from a widget in 476an inactive window. See @code{gtk-window-has-toplevel-focus} 477 478@table @var 479@item window 480a @code{<gtk-window>} 481 482@item ret 483@samp{@code{#t}} if the window part of the current active window. 484 485@end table 486 487Since 2.4 488 489@end deffn 490 491@deffn Function gtk-window-has-toplevel-focus (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 492@deffnx Method has-toplevel-focus 493Returns whether the input focus is within this GtkWindow. For real toplevel 494windows, this is identical to @code{gtk-window-is-active}, but for embedded 495windows, like @code{<gtk-plug>}, the results will differ. 496 497@table @var 498@item window 499a @code{<gtk-window>} 500 501@item ret 502@samp{@code{#t}} if the input focus is within this GtkWindow 503 504@end table 505 506Since 2.4 507 508@end deffn 509 510@deffn Function gtk-window-list-toplevels @result{}@tie{} (ret@tie{}@code{glist-of}) 511Returns a list of all existing toplevel windows. The widgets in the list are not 512individually referenced. If you want to iterate through the list and perform 513actions involving callbacks that might destroy the widgets, you @emph{must} call 514@samp{g_list_foreach (result, (GFunc)g_object_ref, NULL)} first, and then unref 515all the widgets afterwards. 516 517@table @var 518@item ret 519list of toplevel widgets 520 521@end table 522 523@end deffn 524 525@deffn Function gtk-window-add-mnemonic (self@tie{}@code{<gtk-window>}) (keyval@tie{}@code{unsigned-int}) (target@tie{}@code{<gtk-widget>}) 526@deffnx Method add-mnemonic 527Adds a mnemonic to this window. 528 529@table @var 530@item window 531a @code{<gtk-window>} 532 533@item keyval 534the mnemonic 535 536@item target 537the widget that gets activated by the mnemonic 538 539@end table 540 541@end deffn 542 543@deffn Function gtk-window-remove-mnemonic (self@tie{}@code{<gtk-window>}) (keyval@tie{}@code{unsigned-int}) (target@tie{}@code{<gtk-widget>}) 544@deffnx Method remove-mnemonic 545Removes a mnemonic from this window. 546 547@table @var 548@item window 549a @code{<gtk-window>} 550 551@item keyval 552the mnemonic 553 554@item target 555the widget that gets activated by the mnemonic 556 557@end table 558 559@end deffn 560 561@deffn Function gtk-window-mnemonic-activate (self@tie{}@code{<gtk-window>}) (keyval@tie{}@code{unsigned-int}) (modifier@tie{}@code{<gdk-modifier-type>}) @result{}@tie{} (ret@tie{}@code{bool}) 562@deffnx Method mnemonic-activate 563Activates the targets associated with the mnemonic. 564 565@table @var 566@item window 567a @code{<gtk-window>} 568 569@item keyval 570the mnemonic 571 572@item modifier 573the modifiers 574 575@item ret 576@samp{@code{#t}} if the activation is done. 577 578@end table 579 580@end deffn 581 582@deffn Function gtk-window-activate-key (self@tie{}@code{<gtk-window>}) (event@tie{}@code{<gdk-event-key>}) @result{}@tie{} (ret@tie{}@code{bool}) 583@deffnx Method activate-key 584Activates mnemonics and accelerators for this @code{<gtk-window>}. This is 585normally called by the default ::key_press_event handler for toplevel windows, 586however in some cases it may be useful to call this directly when overriding the 587standard key handling for a toplevel window. 588 589@table @var 590@item window 591a @code{<gtk-window>} 592 593@item event 594a @code{<gdk-event-key>} 595 596@item ret 597@samp{@code{#t}} if a mnemonic or accelerator was found and activated. 598 599@end table 600 601@end deffn 602 603@deffn Function gtk-window-propagate-key-event (self@tie{}@code{<gtk-window>}) (event@tie{}@code{<gdk-event-key>}) @result{}@tie{} (ret@tie{}@code{bool}) 604@deffnx Method propagate-key-event 605Propagate a key press or release event to the focus widget and up the focus 606container chain until a widget handles @var{event}. This is normally called by 607the default ::key_press_event and ::key_release_event handlers for toplevel 608windows, however in some cases it may be useful to call this directly when 609overriding the standard key handling for a toplevel window. 610 611@table @var 612@item window 613a @code{<gtk-window>} 614 615@item event 616a @code{<gdk-event-key>} 617 618@item ret 619@samp{@code{#t}} if a widget in the focus chain handled the event. 620 621@end table 622 623@end deffn 624 625@deffn Function gtk-window-get-focus (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 626@deffnx Method get-focus 627Retrieves the current focused widget within the window. Note that this is the 628widget that would have the focus if the toplevel window focused; if the toplevel 629window is not focused then @samp{GTK_WIDGET_HAS_FOCUS (widget)} will not be 630@samp{@code{#t}} for the widget. 631 632@table @var 633@item window 634a @code{<gtk-window>} 635 636@item ret 637the currently focused widget, or @samp{@code{#f}} if there is none. 638 639@end table 640 641@end deffn 642 643@deffn Function gtk-window-set-focus (self@tie{}@code{<gtk-window>}) (focus@tie{}@code{<gtk-widget>}) 644@deffnx Method set-focus 645If @var{focus} is not the current focus widget, and is focusable, sets it as the 646focus widget for the window. If @var{focus} is @samp{@code{#f}}, unsets the 647focus widget for this window. To set the focus to a particular widget in the 648toplevel, it is usually more convenient to use @code{gtk-widget-grab-focus} 649instead of this function. 650 651@table @var 652@item window 653a @code{<gtk-window>} 654 655@item focus 656widget to be the new focus widget, or @samp{@code{#f}} to unset any focus widget 657for the toplevel window. 658 659@end table 660 661@end deffn 662 663@deffn Function gtk-window-set-default (self@tie{}@code{<gtk-window>}) (default_widget@tie{}@code{<gtk-widget>}) 664@deffnx Method set-default 665The default widget is the widget that's activated when the user presses Enter in 666a dialog (for example). This function sets or unsets the default widget for a 667@code{<gtk-window>} about. When setting (rather than unsetting) the default 668widget it's generally easier to call @code{gtk-widget-grab-focus} on the widget. 669Before making a widget the default widget, you must set the 670@code{<gtk-can-default>} flag on the widget you'd like to make the default using 671@code{gtk-widget-set-flags}. 672 673@table @var 674@item window 675a @code{<gtk-window>} 676 677@item default-widget 678widget to be the default, or @samp{@code{#f}} to unset the default widget for 679the toplevel. 680 681@end table 682 683@end deffn 684 685@deffn Function gtk-window-present (self@tie{}@code{<gtk-window>}) 686@deffnx Method present 687Presents a window to the user. This may mean raising the window in the stacking 688order, deiconifying it, moving it to the current desktop, and/or giving it the 689keyboard focus, possibly dependent on the user's platform, window manager, and 690preferences. 691 692If @var{window} is hidden, this function calls @code{gtk-widget-show} as well. 693 694This function should be used when the user tries to open a window that's already 695open. Say for example the preferences dialog is currently open, and the user 696chooses Preferences from the menu a second time; use @code{gtk-window-present} 697to move the already-open dialog where the user can see it. 698 699If you are calling this function in response to a user interaction, it is 700preferable to use @code{gtk-window-present-with-time}. 701 702@table @var 703@item window 704a @code{<gtk-window>} 705 706@end table 707 708@end deffn 709 710@deffn Function gtk-window-present-with-time (self@tie{}@code{<gtk-window>}) (timestamp@tie{}@code{unsigned-int32}) 711@deffnx Method present-with-time 712Presents a window to the user in response to a user interaction. If you need to 713present a window without a timestamp, use @code{gtk-window-present}. See 714@code{gtk-window-present} for details. 715 716@table @var 717@item window 718a @code{<gtk-window>} 719 720@item timestamp 721the timestamp of the user interaction (typically a button or key press event) 722which triggered this call 723 724@end table 725 726Since 2.8 727 728@end deffn 729 730@deffn Function gtk-window-iconify (self@tie{}@code{<gtk-window>}) 731@deffnx Method iconify 732Asks to iconify (i.e. minimize) the specified @var{window}. Note that you 733shouldn't assume the window is definitely iconified afterward, because other 734entities (e.g. the user or window manager) could deiconify it again, or there 735may not be a window manager in which case iconification isn't possible, etc. But 736normally the window will end up iconified. Just don't write code that crashes if 737not. 738 739It's permitted to call this function before showing a window, in which case the 740window will be iconified before it ever appears onscreen. 741 742You can track iconification via the "window_state_event" signal on 743@code{<gtk-widget>}. 744 745@table @var 746@item window 747a @code{<gtk-window>} 748 749@end table 750 751@end deffn 752 753@deffn Function gtk-window-deiconify (self@tie{}@code{<gtk-window>}) 754@deffnx Method deiconify 755Asks to deiconify (i.e. unminimize) the specified @var{window}. Note that you 756shouldn't assume the window is definitely deiconified afterward, because other 757entities (e.g. the user or window manager) could iconify it again before your 758code which assumes deiconification gets to run. 759 760You can track iconification via the "window_state_event" signal on 761@code{<gtk-widget>}. 762 763@table @var 764@item window 765a @code{<gtk-window>} 766 767@end table 768 769@end deffn 770 771@deffn Function gtk-window-stick (self@tie{}@code{<gtk-window>}) 772@deffnx Method stick 773Asks to stick @var{window}, which means that it will appear on all user 774desktops. Note that you shouldn't assume the window is definitely stuck 775afterward, because other entities (e.g. the user or window manager) could 776unstick it again, and some window managers do not support sticking windows. But 777normally the window will end up stuck. Just don't write code that crashes if 778not. 779 780It's permitted to call this function before showing a window. 781 782You can track stickiness via the "window_state_event" signal on 783@code{<gtk-widget>}. 784 785@table @var 786@item window 787a @code{<gtk-window>} 788 789@end table 790 791@end deffn 792 793@deffn Function gtk-window-unstick (self@tie{}@code{<gtk-window>}) 794@deffnx Method unstick 795Asks to unstick @var{window}, which means that it will appear on only one of the 796user's desktops. Note that you shouldn't assume the window is definitely unstuck 797afterward, because other entities (e.g. the user or window manager) could stick 798it again. But normally the window will end up stuck. Just don't write code that 799crashes if not. 800 801You can track stickiness via the "window_state_event" signal on 802@code{<gtk-widget>}. 803 804@table @var 805@item window 806a @code{<gtk-window>} 807 808@end table 809 810@end deffn 811 812@deffn Function gtk-window-maximize (self@tie{}@code{<gtk-window>}) 813@deffnx Method maximize 814Asks to maximize @var{window}, so that it becomes full-screen. Note that you 815shouldn't assume the window is definitely maximized afterward, because other 816entities (e.g. the user or window manager) could unmaximize it again, and not 817all window managers support maximization. But normally the window will end up 818maximized. Just don't write code that crashes if not. 819 820It's permitted to call this function before showing a window, in which case the 821window will be maximized when it appears onscreen initially. 822 823You can track maximization via the "window_state_event" signal on 824@code{<gtk-widget>}. 825 826@table @var 827@item window 828a @code{<gtk-window>} 829 830@end table 831 832@end deffn 833 834@deffn Function gtk-window-unmaximize (self@tie{}@code{<gtk-window>}) 835@deffnx Method unmaximize 836Asks to unmaximize @var{window}. Note that you shouldn't assume the window is 837definitely unmaximized afterward, because other entities (e.g. the user or 838window manager) could maximize it again, and not all window managers honor 839requests to unmaximize. But normally the window will end up unmaximized. Just 840don't write code that crashes if not. 841 842You can track maximization via the "window_state_event" signal on 843@code{<gtk-widget>}. 844 845@table @var 846@item window 847a @code{<gtk-window>} 848 849@end table 850 851@end deffn 852 853@deffn Function gtk-window-fullscreen (self@tie{}@code{<gtk-window>}) 854@deffnx Method fullscreen 855Asks to place @var{window} in the fullscreen state. Note that you shouldn't 856assume the window is definitely full screen afterward, because other entities 857(e.g. the user or window manager) could unfullscreen it again, and not all 858window managers honor requests to fullscreen windows. But normally the window 859will end up fullscreen. Just don't write code that crashes if not. 860 861You can track the fullscreen state via the "window_state_event" signal on 862@code{<gtk-widget>}. 863 864@table @var 865@item window 866a @code{<gtk-window>} 867 868@end table 869 870Since 2.2 871 872@end deffn 873 874@deffn Function gtk-window-unfullscreen (self@tie{}@code{<gtk-window>}) 875@deffnx Method unfullscreen 876Asks to toggle off the fullscreen state for @var{window}. Note that you 877shouldn't assume the window is definitely not full screen afterward, because 878other entities (e.g. the user or window manager) could fullscreen it again, and 879not all window managers honor requests to unfullscreen windows. But normally the 880window will end up restored to its normal state. Just don't write code that 881crashes if not. 882 883You can track the fullscreen state via the "window_state_event" signal on 884@code{<gtk-widget>}. 885 886@table @var 887@item window 888a @code{<gtk-window>} 889 890@end table 891 892Since 2.2 893 894@end deffn 895 896@deffn Function gtk-window-set-keep-above (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 897@deffnx Method set-keep-above 898Asks to keep @var{window} above, so that it stays on top. Note that you 899shouldn't assume the window is definitely above afterward, because other 900entities (e.g. the user or window manager) could not keep it above, and not all 901window managers support keeping windows above. But normally the window will end 902kept above. Just don't write code that crashes if not. 903 904It's permitted to call this function before showing a window, in which case the 905window will be kept above when it appears onscreen initially. 906 907You can track the above state via the "window_state_event" signal on 908@code{<gtk-widget>}. 909 910Note that, according to the 911@uref{http://www.freedesktop.org/Standards/wm-spec,Extended Window Manager 912Hints} specification, the above state is mainly meant for user preferences and 913should not be used by applications e.g. for drawing attention to their dialogs. 914 915@table @var 916@item window 917a @code{<gtk-window>} 918 919@item setting 920whether to keep @var{window} above other windows 921 922@end table 923 924Since 2.4 925 926@end deffn 927 928@deffn Function gtk-window-set-keep-below (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 929@deffnx Method set-keep-below 930Asks to keep @var{window} below, so that it stays in bottom. Note that you 931shouldn't assume the window is definitely below afterward, because other 932entities (e.g. the user or window manager) could not keep it below, and not all 933window managers support putting windows below. But normally the window will be 934kept below. Just don't write code that crashes if not. 935 936It's permitted to call this function before showing a window, in which case the 937window will be kept below when it appears onscreen initially. 938 939You can track the below state via the "window_state_event" signal on 940@code{<gtk-widget>}. 941 942Note that, according to the 943@uref{http://www.freedesktop.org/Standards/wm-spec,Extended Window Manager 944Hints} specification, the above state is mainly meant for user preferences and 945should not be used by applications e.g. for drawing attention to their dialogs. 946 947@table @var 948@item window 949a @code{<gtk-window>} 950 951@item setting 952whether to keep @var{window} below other windows 953 954@end table 955 956Since 2.4 957 958@end deffn 959 960@deffn Function gtk-window-begin-resize-drag (self@tie{}@code{<gtk-window>}) (edge@tie{}@code{<gdk-window-edge>}) (button@tie{}@code{int}) (root_x@tie{}@code{int}) (root_y@tie{}@code{int}) (timestamp@tie{}@code{unsigned-int32}) 961@deffnx Method begin-resize-drag 962Starts resizing a window. This function is used if an application has window 963resizing controls. When GDK can support it, the resize will be done using the 964standard mechanism for the window manager or windowing system. Otherwise, GDK 965will try to emulate window resizing, potentially not all that well, depending on 966the windowing system. 967 968@table @var 969@item window 970a @code{<gtk-window>} 971 972@item edge 973position of the resize control 974 975@item button 976mouse button that initiated the drag 977 978@item root-x 979X position where the user clicked to initiate the drag, in root window 980coordinates 981 982@item root-y 983Y position where the user clicked to initiate the drag 984 985@item timestamp 986timestamp from the click event that initiated the drag 987 988@end table 989 990@end deffn 991 992@deffn Function gtk-window-begin-move-drag (self@tie{}@code{<gtk-window>}) (button@tie{}@code{int}) (root_x@tie{}@code{int}) (root_y@tie{}@code{int}) (timestamp@tie{}@code{unsigned-int32}) 993@deffnx Method begin-move-drag 994Starts moving a window. This function is used if an application has window 995movement grips. When GDK can support it, the window movement will be done using 996the standard mechanism for the window manager or windowing system. Otherwise, 997GDK will try to emulate window movement, potentially not all that well, 998depending on the windowing system. 999 1000@table @var 1001@item window 1002a @code{<gtk-window>} 1003 1004@item button 1005mouse button that initiated the drag 1006 1007@item root-x 1008X position where the user clicked to initiate the drag, in root window 1009coordinates 1010 1011@item root-y 1012Y position where the user clicked to initiate the drag 1013 1014@item timestamp 1015timestamp from the click event that initiated the drag 1016 1017@end table 1018 1019@end deffn 1020 1021@deffn Function gtk-window-set-decorated (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1022@deffnx Method set-decorated 1023By default, windows are decorated with a title bar, resize controls, etc. Some 1024window managers allow GTK+ to disable these decorations, creating a borderless 1025window. If you set the decorated property to @samp{@code{#f}} using this 1026function, GTK+ will do its best to convince the window manager not to decorate 1027the window. Depending on the system, this function may not have any effect when 1028called on a window that is already visible, so you should call it before calling 1029@code{gtk-window-show}. 1030 1031On Windows, this function always works, since there's no window manager policy 1032involved. 1033 1034@table @var 1035@item window 1036a @code{<gtk-window>} 1037 1038@item setting 1039@samp{@code{#t}} to decorate the window 1040 1041@end table 1042 1043@end deffn 1044 1045@deffn Function gtk-window-set-deletable (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1046@deffnx Method set-deletable 1047By default, windows have a close button in the window frame. Some window 1048managers allow GTK+ to disable this button. If you set the deletable property to 1049@samp{@code{#f}} using this function, GTK+ will do its best to convince the 1050window manager not to show a close button. Depending on the system, this 1051function may not have any effect when called on a window that is already 1052visible, so you should call it before calling @code{gtk-window-show}. 1053 1054On Windows, this function always works, since there's no window manager policy 1055involved. 1056 1057@table @var 1058@item window 1059a @code{<gtk-window>} 1060 1061@item setting 1062@samp{@code{#t}} to decorate the window as deletable 1063 1064@end table 1065 1066Since 2.10 1067 1068@end deffn 1069 1070@deffn Function gtk-window-set-frame-dimensions (self@tie{}@code{<gtk-window>}) (left@tie{}@code{int}) (top@tie{}@code{int}) (right@tie{}@code{int}) (bottom@tie{}@code{int}) 1071@deffnx Method set-frame-dimensions 1072(Note: this is a special-purpose function intended for the framebuffer port; see 1073@code{gtk-window-set-has-frame}. It will have no effect on the window border 1074drawn by the window manager, which is the normal case when using the X Window 1075system.) 1076 1077For windows with frames (see @code{gtk-window-set-has-frame}) this function can 1078be used to change the size of the frame border. 1079 1080@table @var 1081@item window 1082a @code{<gtk-window>} that has a frame 1083 1084@item left 1085The width of the left border 1086 1087@item top 1088The height of the top border 1089 1090@item right 1091The width of the right border 1092 1093@item bottom 1094The height of the bottom border 1095 1096@end table 1097 1098@end deffn 1099 1100@deffn Function gtk-window-set-has-frame (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1101@deffnx Method set-has-frame 1102(Note: this is a special-purpose function for the framebuffer port, that causes 1103GTK+ to draw its own window border. For most applications, you want 1104@code{gtk-window-set-decorated} instead, which tells the window manager whether 1105to draw the window border.) 1106 1107If this function is called on a window with setting of @samp{@code{#t}}, before 1108it is realized or showed, it will have a "frame" window around 1109@var{window->window}, accessible in @var{window->frame}. Using the signal 1110frame_event you can receive all events targeted at the frame. 1111 1112This function is used by the linux-fb port to implement managed windows, but it 1113could conceivably be used by X-programs that want to do their own window 1114decorations. 1115 1116@table @var 1117@item window 1118a @code{<gtk-window>} 1119 1120@item setting 1121a boolean 1122 1123@end table 1124 1125@end deffn 1126 1127@deffn Function gtk-window-set-mnemonic-modifier (self@tie{}@code{<gtk-window>}) (modifier@tie{}@code{<gdk-modifier-type>}) 1128@deffnx Method set-mnemonic-modifier 1129Sets the mnemonic modifier for this window. 1130 1131@table @var 1132@item window 1133a @code{<gtk-window>} 1134 1135@item modifier 1136the modifier mask used to activate mnemonics on this window. 1137 1138@end table 1139 1140@end deffn 1141 1142@deffn Function gtk-window-set-role (self@tie{}@code{<gtk-window>}) (role@tie{}@code{mchars}) 1143@deffnx Method set-role 1144This function is only useful on X11, not with other GTK+ targets. 1145 1146In combination with the window title, the window role allows a window manager to 1147identify "the same" window when an application is restarted. So for example you 1148might set the "toolbox" role on your app's toolbox window, so that when the user 1149restarts their session, the window manager can put the toolbox back in the same 1150place. 1151 1152If a window already has a unique title, you don't need to set the role, since 1153the WM can use the title to identify the window when restoring the session. 1154 1155@table @var 1156@item window 1157a @code{<gtk-window>} 1158 1159@item role 1160unique identifier for the window to be used when restoring a session 1161 1162@end table 1163 1164@end deffn 1165 1166@deffn Function gtk-window-set-type-hint (self@tie{}@code{<gtk-window>}) (hint@tie{}@code{<gdk-window-type-hint>}) 1167@deffnx Method set-type-hint 1168By setting the type hint for the window, you allow the window manager to 1169decorate and handle the window in a way which is suitable to the function of the 1170window in your application. 1171 1172This function should be called before the window becomes visible. 1173 1174@code{gtk-dialog-new-with-buttons} and other convenience functions in GTK+ will 1175sometimes call @code{gtk-window-set-type-hint} on your behalf. 1176 1177@table @var 1178@item window 1179a @code{<gtk-window>} 1180 1181@item hint 1182the window type 1183 1184@end table 1185 1186@end deffn 1187 1188@deffn Function gtk-window-set-skip-taskbar-hint (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1189@deffnx Method set-skip-taskbar-hint 1190Windows may set a hint asking the desktop environment not to display the window 1191in the task bar. This function sets this hint. 1192 1193@table @var 1194@item window 1195a @code{<gtk-window>} 1196 1197@item setting 1198@samp{@code{#t}} to keep this window from appearing in the task bar 1199 1200@end table 1201 1202Since 2.2 1203 1204@end deffn 1205 1206@deffn Function gtk-window-set-skip-pager-hint (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1207@deffnx Method set-skip-pager-hint 1208Windows may set a hint asking the desktop environment not to display the window 1209in the pager. This function sets this hint. (A "pager" is any desktop navigation 1210tool such as a workspace switcher that displays a thumbnail representation of 1211the windows on the screen.) 1212 1213@table @var 1214@item window 1215a @code{<gtk-window>} 1216 1217@item setting 1218@samp{@code{#t}} to keep this window from appearing in the pager 1219 1220@end table 1221 1222Since 2.2 1223 1224@end deffn 1225 1226@deffn Function gtk-window-set-urgency-hint (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1227@deffnx Method set-urgency-hint 1228Windows may set a hint asking the desktop environment to draw the users 1229attention to the window. This function sets this hint. 1230 1231@table @var 1232@item window 1233a @code{<gtk-window>} 1234 1235@item setting 1236@samp{@code{#t}} to mark this window as urgent 1237 1238@end table 1239 1240Since 2.8 1241 1242@end deffn 1243 1244@deffn Function gtk-window-set-accept-focus (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1245@deffnx Method set-accept-focus 1246Windows may set a hint asking the desktop environment not to receive the input 1247focus. This function sets this hint. 1248 1249@table @var 1250@item window 1251a @code{<gtk-window>} 1252 1253@item setting 1254@samp{@code{#t}} to let this window receive input focus 1255 1256@end table 1257 1258Since 2.4 1259 1260@end deffn 1261 1262@deffn Function gtk-window-set-focus-on-map (self@tie{}@code{<gtk-window>}) (setting@tie{}@code{bool}) 1263@deffnx Method set-focus-on-map 1264Windows may set a hint asking the desktop environment not to receive the input 1265focus when the window is mapped. This function sets this hint. 1266 1267@table @var 1268@item window 1269a @code{<gtk-window>} 1270 1271@item setting 1272@samp{@code{#t}} to let this window receive input focus on map 1273 1274@end table 1275 1276Since 2.6 1277 1278@end deffn 1279 1280@deffn Function gtk-window-get-decorated (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1281@deffnx Method get-decorated 1282Returns whether the window has been set to have decorations such as a title bar 1283via @code{gtk-window-set-decorated}. 1284 1285@table @var 1286@item window 1287a @code{<gtk-window>} 1288 1289@item ret 1290@samp{@code{#t}} if the window has been set to have decorations 1291 1292@end table 1293 1294@end deffn 1295 1296@deffn Function gtk-window-get-deletable (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1297@deffnx Method get-deletable 1298Returns whether the window has been set to have a close button via 1299@code{gtk-window-set-deletable}. 1300 1301@table @var 1302@item window 1303a @code{<gtk-window>} 1304 1305@item ret 1306@samp{@code{#t}} if the window has been set to have a close button 1307 1308@end table 1309 1310Since 2.10 1311 1312@end deffn 1313 1314@deffn Function gtk-window-get-default-icon-list @result{}@tie{} (ret@tie{}@code{glist-of}) 1315Gets the value set by @code{gtk-window-set-default-icon-list}. The list is a 1316copy and should be freed with @code{g-list-free}, but the pixbufs in the list 1317have not had their reference count incremented. 1318 1319@table @var 1320@item ret 1321copy of default icon list 1322 1323@end table 1324 1325@end deffn 1326 1327@deffn Function gtk-window-get-default-size (self@tie{}@code{<gtk-window>}) @result{}@tie{} (width@tie{}@code{int}) (height@tie{}@code{int}) 1328@deffnx Method get-default-size 1329Gets the default size of the window. A value of -1 for the width or height 1330indicates that a default size has not been explicitly set for that dimension, so 1331the "natural" size of the window will be used. 1332 1333@table @var 1334@item window 1335a @code{<gtk-window>} 1336 1337@item width 1338location to store the default width, or @samp{@code{#f}} 1339 1340@item height 1341location to store the default height, or @samp{@code{#f}} 1342 1343@end table 1344 1345@end deffn 1346 1347@deffn Function gtk-window-get-destroy-with-parent (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1348@deffnx Method get-destroy-with-parent 1349Returns whether the window will be destroyed with its transient parent. See 1350@code{gtk-window-set-destroy-with-parent}. 1351 1352@table @var 1353@item window 1354a @code{<gtk-window>} 1355 1356@item ret 1357@samp{@code{#t}} if the window will be destroyed with its transient parent. 1358 1359@end table 1360 1361@end deffn 1362 1363@deffn Function gtk-window-get-frame-dimensions (self@tie{}@code{<gtk-window>}) @result{}@tie{} (left@tie{}@code{int}) (top@tie{}@code{int}) (right@tie{}@code{int}) (bottom@tie{}@code{int}) 1364@deffnx Method get-frame-dimensions 1365(Note: this is a special-purpose function intended for the framebuffer port; see 1366@code{gtk-window-set-has-frame}. It will not return the size of the window 1367border drawn by the window manager, which is the normal case when using a 1368windowing system. See @code{gdk-window-get-frame-extents} to get the standard 1369window border extents.) 1370 1371Retrieves the dimensions of the frame window for this toplevel. See 1372@code{gtk-window-set-has-frame}, @code{gtk-window-set-frame-dimensions}. 1373 1374@table @var 1375@item window 1376a @code{<gtk-window>} 1377 1378@item left 1379location to store the width of the frame at the left, or @samp{@code{#f}} 1380 1381@item top 1382location to store the height of the frame at the top, or @samp{@code{#f}} 1383 1384@item right 1385location to store the width of the frame at the returns, or @samp{@code{#f}} 1386 1387@item bottom 1388location to store the height of the frame at the bottom, or @samp{@code{#f}} 1389 1390@end table 1391 1392@end deffn 1393 1394@deffn Function gtk-window-get-has-frame (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1395@deffnx Method get-has-frame 1396Accessor for whether the window has a frame window exterior to 1397@var{window->window}. Gets the value set by @code{gtk-window-set-has-frame}. 1398 1399@table @var 1400@item window 1401a @code{<gtk-window>} 1402 1403@item ret 1404@samp{@code{#t}} if a frame has been added to the window via 1405@code{gtk-window-set-has-frame}. 1406 1407@end table 1408 1409@end deffn 1410 1411@deffn Function gtk-window-get-icon (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>}) 1412@deffnx Method get-icon 1413Gets the value set by @code{gtk-window-set-icon} (or if you've called 1414@code{gtk-window-set-icon-list}, gets the first icon in the icon list). 1415 1416@table @var 1417@item window 1418a @code{<gtk-window>} 1419 1420@item ret 1421icon for window 1422 1423@end table 1424 1425@end deffn 1426 1427@deffn Function gtk-window-get-icon-list (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{glist-of}) 1428@deffnx Method get-icon-list 1429Retrieves the list of icons set by @code{gtk-window-set-icon-list}. The list is 1430copied, but the reference count on each member won't be incremented. 1431 1432@table @var 1433@item window 1434a @code{<gtk-window>} 1435 1436@item ret 1437copy of window's icon list 1438 1439@end table 1440 1441@end deffn 1442 1443@deffn Function gtk-window-get-icon-name (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{mchars}) 1444@deffnx Method get-icon-name 1445Returns the name of the themed icon for the window, see 1446@code{gtk-window-set-icon-name}. 1447 1448@table @var 1449@item window 1450a @code{<gtk-window>} 1451 1452@item ret 1453the icon name or @samp{@code{#f}} if the window has no themed icon 1454 1455@end table 1456 1457Since 2.6 1458 1459@end deffn 1460 1461@deffn Function gtk-window-get-mnemonic-modifier (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gdk-modifier-type>}) 1462@deffnx Method get-mnemonic-modifier 1463Returns the mnemonic modifier for this window. See 1464@code{gtk-window-set-mnemonic-modifier}. 1465 1466@table @var 1467@item window 1468a @code{<gtk-window>} 1469 1470@item ret 1471the modifier mask used to activate mnemonics on this window. 1472 1473@end table 1474 1475@end deffn 1476 1477@deffn Function gtk-window-get-modal (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1478@deffnx Method get-modal 1479Returns whether the window is modal. See @code{gtk-window-set-modal}. 1480 1481@table @var 1482@item window 1483a @code{<gtk-window>} 1484 1485@item ret 1486@samp{@code{#t}} if the window is set to be modal and establishes a grab when 1487shown 1488 1489@end table 1490 1491@end deffn 1492 1493@deffn Function gtk-window-get-position (self@tie{}@code{<gtk-window>}) @result{}@tie{} (root_x@tie{}@code{int}) (root_y@tie{}@code{int}) 1494@deffnx Method get-position 1495This function returns the position you need to pass to @code{gtk-window-move} to 1496keep @var{window} in its current position. This means that the meaning of the 1497returned value varies with window gravity. See @code{gtk-window-move} for more 1498details. 1499 1500If you haven't changed the window gravity, its gravity will be 1501@code{<gdk-gravity-north-west>}. This means that @code{gtk-window-get-position} 1502gets the position of the top-left corner of the window manager frame for the 1503window. @code{gtk-window-move} sets the position of this same top-left corner. 1504 1505@code{gtk-window-get-position} is not 100% reliable because the X Window System 1506does not specify a way to obtain the geometry of the decorations placed on a 1507window by the window manager. Thus GTK+ is using a "best guess" that works with 1508most window managers. 1509 1510Moreover, nearly all window managers are historically broken with respect to 1511their handling of window gravity. So moving a window to its current position as 1512returned by @code{gtk-window-get-position} tends to result in moving the window 1513slightly. Window managers are slowly getting better over time. 1514 1515If a window has gravity @code{<gdk-gravity-static>} the window manager frame is 1516not relevant, and thus @code{gtk-window-get-position} will always produce 1517accurate results. However you can't use static gravity to do things like place a 1518window in a corner of the screen, because static gravity ignores the window 1519manager decorations. 1520 1521If you are saving and restoring your application's window positions, you should 1522know that it's impossible for applications to do this without getting it 1523somewhat wrong because applications do not have sufficient knowledge of window 1524manager state. The Correct Mechanism is to support the session management 1525protocol (see the "GnomeClient" object in the GNOME libraries for example) and 1526allow the window manager to save your window sizes and positions. 1527 1528@table @var 1529@item window 1530a @code{<gtk-window>} 1531 1532@item root-x 1533return location for X coordinate of gravity-determined reference p\oint 1534 1535@item root-y 1536return location for Y coordinate of gravity-determined reference p\oint 1537 1538@end table 1539 1540@end deffn 1541 1542@deffn Function gtk-window-get-role (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{mchars}) 1543@deffnx Method get-role 1544Returns the role of the window. See @code{gtk-window-set-role} for further 1545explanation. 1546 1547@table @var 1548@item window 1549a @code{<gtk-window>} 1550 1551@item ret 1552the role of the window if set, or @samp{@code{#f}}. The returned is owned by the 1553widget and must not be modified or freed. 1554 1555@end table 1556 1557@end deffn 1558 1559@deffn Function gtk-window-get-size (self@tie{}@code{<gtk-window>}) @result{}@tie{} (width@tie{}@code{int}) (height@tie{}@code{int}) 1560@deffnx Method get-size 1561Obtains the current size of @var{window}. If @var{window} is not onscreen, it 1562returns the size GTK+ will suggest to the window manager for the initial window 1563size (but this is not reliably the same as the size the window manager will 1564actually select). The size obtained by @code{gtk-window-get-size} is the last 1565size received in a @code{<gdk-event-configure>}, that is, GTK+ uses its 1566locally-stored size, rather than querying the X server for the size. As a 1567result, if you call @code{gtk-window-resize} then immediately call 1568@code{gtk-window-get-size}, the size won't have taken effect yet. After the 1569window manager processes the resize request, GTK+ receives notification that the 1570size has changed via a configure event, and the size of the window gets updated. 1571 1572Note 1: Nearly any use of this function creates a race condition, because the 1573size of the window may change between the time that you get the size and the 1574time that you perform some action assuming that size is the current size. To 1575avoid race conditions, connect to "configure_event" on the window and adjust 1576your size-dependent state to match the size delivered in the 1577@code{<gdk-event-configure>}. 1578 1579Note 2: The returned size does @emph{not} include the size of the window manager 1580decorations (aka the window frame or border). Those are not drawn by GTK+ and 1581GTK+ has no reliable method of determining their size. 1582 1583Note 3: If you are getting a window size in order to position the window 1584onscreen, there may be a better way. The preferred way is to simply set the 1585window's semantic type with @code{gtk-window-set-type-hint}, which allows the 1586window manager to e.g. center dialogs. Also, if you set the transient parent of 1587dialogs with @code{gtk-window-set-transient-for} window managers will often 1588center the dialog over its parent window. It's much preferred to let the window 1589manager handle these things rather than doing it yourself, because all apps will 1590behave consistently and according to user prefs if the window manager handles 1591it. Also, the window manager can take the size of the window decorations/border 1592into account, while your application cannot. 1593 1594In any case, if you insist on application-specified window positioning, there's 1595@emph{still} a better way than doing it yourself - 1596@code{gtk-window-set-position} will frequently handle the details for you. 1597 1598@table @var 1599@item window 1600a @code{<gtk-window>} 1601 1602@item width 1603return location for width, or @samp{@code{#f}} 1604 1605@item height 1606return location for height, or @samp{@code{#f}} 1607 1608@end table 1609 1610@end deffn 1611 1612@deffn Function gtk-window-get-title (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{mchars}) 1613@deffnx Method get-title 1614Retrieves the title of the window. See @code{gtk-window-set-title}. 1615 1616@table @var 1617@item window 1618a @code{<gtk-window>} 1619 1620@item ret 1621the title of the window, or @samp{@code{#f}} if none has been set explicitely. 1622The returned string is owned by the widget and must not be modified or freed. 1623 1624@end table 1625 1626@end deffn 1627 1628@deffn Function gtk-window-get-transient-for (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gtk-window>}) 1629@deffnx Method get-transient-for 1630Fetches the transient parent for this window. See 1631@code{gtk-window-set-transient-for}. 1632 1633@table @var 1634@item window 1635a @code{<gtk-window>} 1636 1637@item ret 1638the transient parent for this window, or @samp{@code{#f}} if no transient parent 1639has been set. 1640 1641@end table 1642 1643@end deffn 1644 1645@deffn Function gtk-window-get-type-hint (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gdk-window-type-hint>}) 1646@deffnx Method get-type-hint 1647Gets the type hint for this window. See @code{gtk-window-set-type-hint}. 1648 1649@table @var 1650@item window 1651a @code{<gtk-window>} 1652 1653@item ret 1654the type hint for @var{window}. 1655 1656@end table 1657 1658@end deffn 1659 1660@deffn Function gtk-window-get-skip-taskbar-hint (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1661@deffnx Method get-skip-taskbar-hint 1662Gets the value set by @code{gtk-window-set-skip-taskbar-hint} 1663 1664@table @var 1665@item window 1666a @code{<gtk-window>} 1667 1668@item ret 1669@samp{@code{#t}} if window shouldn't be in taskbar 1670 1671@end table 1672 1673Since 2.2 1674 1675@end deffn 1676 1677@deffn Function gtk-window-get-skip-pager-hint (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1678@deffnx Method get-skip-pager-hint 1679Gets the value set by @code{gtk-window-set-skip-pager-hint}. 1680 1681@table @var 1682@item window 1683a @code{<gtk-window>} 1684 1685@item ret 1686@samp{@code{#t}} if window shouldn't be in pager 1687 1688@end table 1689 1690Since 2.2 1691 1692@end deffn 1693 1694@deffn Function gtk-window-get-urgency-hint (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1695@deffnx Method get-urgency-hint 1696Gets the value set by @code{gtk-window-set-urgency-hint} 1697 1698@table @var 1699@item window 1700a @code{<gtk-window>} 1701 1702@item ret 1703@samp{@code{#t}} if window is urgent 1704 1705@end table 1706 1707Since 2.8 1708 1709@end deffn 1710 1711@deffn Function gtk-window-get-accept-focus (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1712@deffnx Method get-accept-focus 1713Gets the value set by @code{gtk-window-set-accept-focus}. 1714 1715@table @var 1716@item window 1717a @code{<gtk-window>} 1718 1719@item ret 1720@samp{@code{#t}} if window should receive the input focus 1721 1722@end table 1723 1724Since 2.4 1725 1726@end deffn 1727 1728@deffn Function gtk-window-get-focus-on-map (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{bool}) 1729@deffnx Method get-focus-on-map 1730Gets the value set by @code{gtk-window-set-focus-on-map}. 1731 1732@table @var 1733@item window 1734a @code{<gtk-window>} 1735 1736@item ret 1737@samp{@code{#t}} if window should receive the input focus when mapped. 1738 1739@end table 1740 1741Since 2.6 1742 1743@end deffn 1744 1745@deffn Function gtk-window-get-group (self@tie{}@code{<gtk-window>}) @result{}@tie{} (ret@tie{}@code{<gtk-window-group>}) 1746@deffnx Method get-group 1747Returns the group for @var{window} or the default group, if @var{window} is 1748@samp{@code{#f}} or if @var{window} does not have an explicit window group. 1749 1750@table @var 1751@item window 1752a @code{<gtk-window>}, or @samp{@code{#f}} 1753 1754@item ret 1755the @code{<gtk-window-group>} for a window or the default group 1756 1757@end table 1758 1759Since 2.10 1760 1761@end deffn 1762 1763@deffn Function gtk-window-move (self@tie{}@code{<gtk-window>}) (x@tie{}@code{int}) (y@tie{}@code{int}) 1764@deffnx Method move 1765Asks the window manager to move @var{window} to the given position. Window 1766managers are free to ignore this; most window managers ignore requests for 1767initial window positions (instead using a user-defined placement algorithm) and 1768honor requests after the window has already been shown. 1769 1770Note: the position is the position of the gravity-determined reference point for 1771the window. The gravity determines two things: first, the location of the 1772reference point in root window coordinates; and second, which point on the 1773window is positioned at the reference point. 1774 1775By default the gravity is @code{<gdk-gravity-north-west>}, so the reference 1776point is simply the @var{x}, @var{y} supplied to @code{gtk-window-move}. The 1777top-left corner of the window decorations (aka window frame or border) will be 1778placed at @var{x}, @var{y}. Therefore, to position a window at the top left of 1779the screen, you want to use the default gravity (which is 1780@code{<gdk-gravity-north-west>}) and move the window to 0,0. 1781 1782To position a window at the bottom right corner of the screen, you would set 1783@code{<gdk-gravity-south-east>}, which means that the reference point is at 1784@var{x} + the window width and @var{y} + the window height, and the bottom-right 1785corner of the window border will be placed at that reference point. So, to place 1786a window in the bottom right corner you would first set gravity to south east, 1787then write: @samp{gtk_window_move (window, @code{gdk-screen-width} - 1788window_width, @code{gdk-screen-height} - window_height)} (note that this example 1789does not take multi-head scenarios into account). 1790 1791The Extended Window Manager Hints specification at 1792@uref{http://www.freedesktop.org/Standards/wm-spec, 1793http://www.freedesktop.org/Standards/wm-spec} has a nice table of gravities in 1794the "implementation notes" section. 1795 1796The @code{gtk-window-get-position} documentation may also be relevant. 1797 1798@table @var 1799@item window 1800a @code{<gtk-window>} 1801 1802@item x 1803X coordinate to move window to 1804 1805@item y 1806Y coordinate to move window to 1807 1808@end table 1809 1810@end deffn 1811 1812@deffn Function gtk-window-parse-geometry (self@tie{}@code{<gtk-window>}) (geometry@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{bool}) 1813@deffnx Method parse-geometry 1814Parses a standard X Window System geometry string - see the manual page for X 1815(type 'man X') for details on this. @code{gtk-window-parse-geometry} does work 1816on all GTK+ ports including Win32 but is primarily intended for an X 1817environment. 1818 1819If either a size or a position can be extracted from the geometry string, 1820@code{gtk-window-parse-geometry} returns @samp{@code{#t}} and calls 1821@code{gtk-window-set-default-size} and/or @code{gtk-window-move} to resize/move 1822the window. 1823 1824If @code{gtk-window-parse-geometry} returns @samp{@code{#t}}, it will also set 1825the @code{<gdk-hint-user-pos>} and/or @code{<gdk-hint-user-size>} hints 1826indicating to the window manager that the size/position of the window was 1827user-specified. This causes most window managers to honor the geometry. 1828 1829Note that for @code{gtk-window-parse-geometry} to work as expected, it has to be 1830called when the window has its "final" size, i.e. after calling 1831@code{gtk-widget-show-all} on the contents and 1832@code{gtk-window-set-geometry-hints} on the window. 1833 1834@example 1835 1836#include <gtk/gtk.h> 1837 1838static void 1839fill_with_content (GtkWidget *vbox) 1840@{ 1841 /* fill with content... */ 1842@} 1843 1844int 1845main (int argc, char *argv[]) 1846@{ 1847 GtkWidget *window, *vbox; 1848 GdkGeometry size_hints = @{ 1849 100, 50, 0, 0, 100, 50, 10, 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST 1850 @}; 1851 1852 gtk_init (&argc, &argv); 1853 1854 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 1855 vbox = gtk_vbox_new (FALSE, 0); 1856 1857 gtk_container_add (GTK_CONTAINER (window), vbox); 1858 fill_with_content (vbox); 1859 gtk_widget_show_all (vbox); 1860 1861 gtk_window_set_geometry_hints (GTK_WINDOW (window), 1862 window, 1863 &size_hints, 1864 GDK_HINT_MIN_SIZE | 1865 GDK_HINT_BASE_SIZE | 1866 GDK_HINT_RESIZE_INC); 1867 1868 if (argc > 1) 1869 @{ 1870 if (!gtk_window_parse_geometry (GTK_WINDOW (window), argv[1])) 1871 fprintf (stderr, "Failed to parse '%s'\n", argv[1]); 1872 @} 1873 1874 gtk_widget_show_all (window); 1875 gtk_main (); 1876 1877 return 0; 1878@} 1879@end example 1880 1881@table @var 1882@item window 1883a @code{<gtk-window>} 1884 1885@item geometry 1886geometry string 1887 1888@item ret 1889@samp{@code{#t}} if string was parsed successfully 1890 1891@end table 1892 1893@end deffn 1894 1895@deffn Function gtk-window-reshow-with-initial-size (self@tie{}@code{<gtk-window>}) 1896@deffnx Method reshow-with-initial-size 1897Hides @var{window}, then reshows it, resetting the default size and position of 1898the window. Used by GUI builders only. 1899 1900@table @var 1901@item window 1902a @code{<gtk-window>} 1903 1904@end table 1905 1906@end deffn 1907 1908@deffn Function gtk-window-resize (self@tie{}@code{<gtk-window>}) (width@tie{}@code{int}) (height@tie{}@code{int}) 1909@deffnx Method resize 1910Resizes the window as if the user had done so, obeying geometry constraints. The 1911default geometry constraint is that windows may not be smaller than their size 1912request; to override this constraint, call @code{gtk-widget-set-size-request} to 1913set the window's request to a smaller value. 1914 1915If @code{gtk-window-resize} is called before showing a window for the first 1916time, it overrides any default size set with @code{gtk-window-set-default-size}. 1917 1918Windows may not be resized smaller than 1 by 1 pixels. 1919 1920@table @var 1921@item window 1922a @code{<gtk-window>} 1923 1924@item width 1925width in pixels to resize the window to 1926 1927@item height 1928height in pixels to resize the window to 1929 1930@end table 1931 1932@end deffn 1933 1934@deffn Function gtk-window-set-default-icon-list (list@tie{}@code{glist-of}) 1935Sets an icon list to be used as fallback for windows that haven't had 1936@code{gtk-window-set-icon-list} called on them to set up a window-specific icon 1937list. This function allows you to set up the icon for all windows in your app at 1938once. 1939 1940See @code{gtk-window-set-icon-list} for more details. 1941 1942@table @var 1943@item list 1944a list of @code{<gdk-pixbuf>} 1945 1946@end table 1947 1948@end deffn 1949 1950@deffn Function gtk-window-set-default-icon (icon@tie{}@code{<gdk-pixbuf>}) 1951Sets an icon to be used as fallback for windows that haven't had 1952@code{gtk-window-set-icon} called on them from a pixbuf. 1953 1954@table @var 1955@item icon 1956the icon 1957 1958@end table 1959 1960Since 2.4 1961 1962@end deffn 1963 1964@deffn Function gtk-window-set-default-icon-name (name@tie{}@code{mchars}) 1965Sets an icon to be used as fallback for windows that haven't had 1966@code{gtk-window-set-icon-list} called on them from a named themed icon, see 1967@code{gtk-window-set-icon-name}. 1968 1969@table @var 1970@item name 1971the name of the themed icon 1972 1973@end table 1974 1975Since 2.6 1976 1977@end deffn 1978 1979@deffn Function gtk-window-set-icon (self@tie{}@code{<gtk-window>}) (icon@tie{}@code{<gdk-pixbuf>}) 1980@deffnx Method set-icon 1981Sets up the icon representing a @code{<gtk-window>}. This icon is used when the 1982window is minimized (also known as iconified). Some window managers or desktop 1983environments may also place it in the window frame, or display it in other 1984contexts. 1985 1986The icon should be provided in whatever size it was naturally drawn; that is, 1987don't scale the image before passing it to GTK+. Scaling is postponed until the 1988last minute, when the desired final size is known, to allow best quality. 1989 1990If you have your icon hand-drawn in multiple sizes, use 1991@code{gtk-window-set-icon-list}. Then the best size will be used. 1992 1993This function is equivalent to calling @code{gtk-window-set-icon-list} with a 19941-element list. 1995 1996See also @code{gtk-window-set-default-icon-list} to set the icon for all windows 1997in your application in one go. 1998 1999@table @var 2000@item window 2001a @code{<gtk-window>} 2002 2003@item icon 2004icon image, or @samp{@code{#f}} 2005 2006@end table 2007 2008@end deffn 2009 2010@deffn Function gtk-window-set-icon-list (self@tie{}@code{<gtk-window>}) (list@tie{}@code{glist-of}) 2011@deffnx Method set-icon-list 2012Sets up the icon representing a @code{<gtk-window>}. The icon is used when the 2013window is minimized (also known as iconified). Some window managers or desktop 2014environments may also place it in the window frame, or display it in other 2015contexts. 2016 2017@code{gtk-window-set-icon-list} allows you to pass in the same icon in several 2018hand-drawn sizes. The list should contain the natural sizes your icon is 2019available in; that is, don't scale the image before passing it to GTK+. Scaling 2020is postponed until the last minute, when the desired final size is known, to 2021allow best quality. 2022 2023By passing several sizes, you may improve the final image quality of the icon, 2024by reducing or eliminating automatic image scaling. 2025 2026Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images 2027(64x64, 128x128) if you have them. 2028 2029See also @code{gtk-window-set-default-icon-list} to set the icon for all windows 2030in your application in one go. 2031 2032Note that transient windows (those who have been set transient for another 2033window using @code{gtk-window-set-transient-for}) will inherit their icon from 2034their transient parent. So there's no need to explicitly set the icon on 2035transient windows. 2036 2037@table @var 2038@item window 2039a @code{<gtk-window>} 2040 2041@item list 2042list of @code{<gdk-pixbuf>} 2043 2044@end table 2045 2046@end deffn 2047 2048@deffn Function gtk-window-set-icon-from-file (self@tie{}@code{<gtk-window>}) (filename@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{bool}) 2049@deffnx Method set-icon-from-file 2050Sets the icon for @var{window}. Warns on failure if @var{err} is 2051@samp{@code{#f}}. 2052 2053This function is equivalent to calling @code{gtk-window-set-icon} with a pixbuf 2054created by loading the image from @var{filename}. 2055 2056@table @var 2057@item window 2058a @code{<gtk-window>} 2059 2060@item filename 2061location of icon file 2062 2063@item err 2064location to store error, or @samp{@code{#f}}. 2065 2066@item ret 2067@samp{@code{#t}} if setting the icon succeeded. 2068 2069@end table 2070 2071Since 2.2 2072 2073@end deffn 2074 2075@deffn Function gtk-window-set-icon-name (self@tie{}@code{<gtk-window>}) (name@tie{}@code{mchars}) 2076@deffnx Method set-icon-name 2077Sets the icon for the window from a named themed icon. See the docs for 2078@code{<gtk-icon-theme>} for more details. 2079 2080Note that this has nothing to do with the WM_ICON_NAME property which is 2081mentioned in the ICCCM. 2082 2083@table @var 2084@item window 2085a @code{<gtk-window>} 2086 2087@item name 2088the name of the themed icon 2089 2090@end table 2091 2092Since 2.6 2093 2094@end deffn 2095 2096 2097@c %end of fragment 2098