### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gtk3/Window.rakumod
### ----------------------------------------------------
### -- Chunk 1 of 4
#TL:1:Gnome::Gtk3::Window

use v6;
#-------------------------------------------------------------------------------
=begin pod

=head1 Gnome::Gtk3::Window

Toplevel which can contain other widgets

![](images/window.png)

=head1 Description

A B<Gnome::Gtk3::Window> is a toplevel window which can contain other widgets. Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize it, move it, close it,...).

=head2 Gnome::Gtk3::Window as Gnome::Gtk3::Buildable

The B<Gnome::Gtk3::Window> implementation of the B<Gnome::Gtk3::Buildable> interface supports a custom <accel-groups> element, which supports any number of <group> elements representing the B<Gnome::Gtk3::AccelGroup> objects you want to add to your window (synonymous with C<gtk_window_add_accel_group()>.

It also supports the <initial-focus> element, whose name property names the widget to receive the focus when the window is mapped.

An example of a UI definition fragment with accel groups:


  <object class="GtkWindow>">
    <accel-groups>
      <group name="accelgroup1"/>
    </accel-groups>
    <initial-focus name="thunderclap"/>
  </object>
  ...
  <object class="GtkAccelGroup>" id="accelgroup1"/>

The B<Gnome::Gtk3::Window> implementation of the B<Gnome::Gtk3::Buildable> interface supports setting a child as the titlebar by specifying “titlebar” as the “type” attribute of a <child> element.

=head2 Css Nodes

  window
  ├── decoration
  ╰── <child>

B<Gnome::Gtk3::Window> has a main CSS node with name window and style class .background, and a subnode with name decoration.

Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). B<Gnome::Gtk3::Window> also represents window states with the following style classes on the main node: .tiled, .maximized, .fullscreen. Specialized types of window often add their own discriminating style classes, such as .popup or .tooltip.

B<Gnome::Gtk3::Window> adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.

=head1 Synopsis
=head2 Declaration

  unit class Gnome::Gtk3::Window;
  also is Gnome::Gtk3::Bin;

=head2 Uml Diagram

![](plantuml/Window.svg)

=head2 Inheriting this class

Inheriting is done in a special way in that it needs a call from new() to get the native object created by the class you are inheriting from.

  use Gnome::Gtk3::Window:api<1>;

  unit class MyGuiClass;
  also is Gnome::Gtk3::Window;

  submethod new ( |c ) {
    # let the Gnome::Gtk3::Window class process the options
    self.bless( :GtkWindow, |c);
  }

  submethod BUILD ( ... ) {
    ...
  }

=head2 Example

  my Gnome::Gtk3::Window $w .= new;
  $w.set-title('My Button In My Window');
  my Gnome::Gtk3::Button $b .= new(:label('The Button'));
  $w.add($b);
  $w.show-all;

  my Gnome::Gtk3::Main $m .= new;
  $m.gtk-main;

=end pod
#-------------------------------------------------------------------------------
use NativeCall;

use Gnome::N::X:api<1>;
use Gnome::N::N-GObject:api<1>;
use Gnome::N::NativeLib:api<1>;
use Gnome::N::GlibToRakuTypes:api<1>;

use Gnome::Glib::Error:api<1>;
use Gnome::Glib::List:api<1>;

use Gnome::Gdk3::Window:api<1>;
use Gnome::Gdk3::Events:api<1>;
use Gnome::Gdk3::Types:api<1>;

use Gnome::Gtk3::Bin:api<1>;

#-------------------------------------------------------------------------------
# See /usr/include/gtk-3.0/gtk/gtkwindow.h
# https://developer.gnome.org/gtk3/stable/GtkWindow.html
unit class Gnome::Gtk3::Window:auth<github:MARTIMM>:api<1>;
also is Gnome::Gtk3::Bin;

#-------------------------------------------------------------------------------
=begin pod
=head1 Types
=end pod

#-------------------------------------------------------------------------------
=begin pod
=head2 GtkWindowType

A B<Gnome::Gtk3::Window> can be one of these types. Most things you’d consider a “window” should have type C<GTK_WINDOW_TOPLEVEL>; windows with this type are managed by the window manager and have a frame by default (call C<gtk_window_set_decorated()> to toggle the frame).  Windows with type C<GTK_WINDOW_POPUP> are ignored by the window manager; window manager keybindings won’t work on them, the window manager won’t decorate the window with a frame, many GTK+ features that rely on the window manager will not work (e.g. resize grips and maximization/minimization). C<GTK_WINDOW_POPUP> is used to implement widgets such as B<Gnome::Gtk3::Menu> or tooltips that you normally don’t think of as windows per se. Nearly all windows should be C<GTK_WINDOW_TOPLEVEL>. In particular, do not use C<GTK_WINDOW_POPUP> just to turn off the window borders; use C<gtk_window_set_decorated()> for that.

=item GTK_WINDOW_TOPLEVEL. A regular window, such as a dialog.
=item GTK_WINDOW_POPUP. A special window such as a tooltip.

=end pod

#TE:1:GtkWindowType:
enum GtkWindowType is export <
  GTK_WINDOW_TOPLEVEL GTK_WINDOW_POPUP
>;

#-------------------------------------------------------------------------------
=begin pod
=head2 GtkWindowPosition

Window placement can be influenced using this enumeration. Note that using GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea. It won’t necessarily work well with all window managers or on all windowing systems.

=item GTK_WIN_POS_NONE. No influence is made on placement.
=item GTK_WIN_POS_CENTER. Windows should be placed in the center of the screen.
=item GTK_WIN_POS_MOUSE. Windows should be placed at the current mouse position.
=item GTK_WIN_POS_CENTER_ALWAYS. Keep window centered as it changes size, etc.
=item GTK_WIN_POS_CENTER_ON_PARENT. Center the window on its transient parent.

=end pod

#TE:4:GtkWindowPosition:QAManager
enum GtkWindowPosition is export <
  GTK_WIN_POS_NONE
  GTK_WIN_POS_CENTER
  GTK_WIN_POS_MOUSE
  GTK_WIN_POS_CENTER_ALWAYS
  GTK_WIN_POS_CENTER_ON_PARENT
>;

#-------------------------------------------------------------------------------
my Bool $signals-added = False;
#-------------------------------------------------------------------------------
=begin pod
=head1 Methods
=head2 new

=head3 default, no options

Creates a new B<Gnome::Gtk3::Window>, which is a toplevel window that can contain other widgets. The window type is set to C<GTK_WINDOW_TOPLEVEL>.

  multi method new ( )


=head3 :window-type

Nearly always, the type of the window should be C<GTK_WINDOW_TOPLEVEL> which is the default. If you’re implementing something like a popup menu from scratch (which is a bad idea, just use B<Gnome::Gtk3::Menu>), you might use C<GTK_WINDOW_POPUP>. C<GTK_WINDOW_POPUP> is not for dialogs, though in some other toolkits dialogs are called “popups”. In GTK+, C<GTK_WINDOW_POPUP> means a pop-up menu or pop-up tooltip. On X11, popup windows are not controlled by the window manager.

If you simply want an undecorated window (no window borders), use C<set-decorated()>, don’t use C<GTK_WINDOW_POPUP>.

All top-level windows created by C<new()> are stored in an internal top-level window list.  This list can be obtained from C<list-toplevels()>.
=comment Due to Gtk+ keeping a reference to the window internally, C<new()> does not return a reference to the caller.

To delete a B<Gnome::Gtk3::Window>, call C<destroy()>.

  multi method new ( GtkWindowType :$window-type! )

=end pod

#TM:2:inheriting:*
#TM:1:new():
#TM:1:new(:window-type):
#TM:4:new(:native-object):TopLevelClassSupport
#TM:4:new(:build-id):Object

submethod BUILD ( *%options ) {
  $signals-added = self.add-signal-types( $?CLASS.^name,
    :w0<activate-default activate-focus keys-changed>,
    :w1<enable-debugging set-focus>,
  ) unless $signals-added;

  # prevent creating wrong native-objects
  if self.^name eq 'Gnome::Gtk3::Window' or %options<GtkWindow> {

    if self.is-valid { }

    # check if common options are handled by some parent
    elsif %options<native-object>:exists { }
    elsif %options<build-id>:exists { }

    # process all other options
    else {
      my $no;
      if ? %options<window-type> {
        $no = _gtk_window_new(%options<window-type>);
      }

      #`{{ use this when the module is not made inheritable
      # check if there are unknown options
      elsif %options.elems {
        die X:Gnome.new(
          :message(
            'Unsupported, undefined, incomplete or wrongly typed options for ' ~
            self.^name ~ ': ' ~ %options.keys.join(', ')
          )
        );
      }
      }}

      #`{{ when there are no defaults use this
      # check if there are any options
      elsif %options.elems == 0 {
        die X:Gnome.new(:message('No options specified ' ~ self.^name));
      }
      }}

      ##`{{ when there are defaults use this instead
      # create default object
      else {
        $no = _gtk_window_new(GTK_WINDOW_TOPLEVEL);
      }
      #}}

      self._set-native-object($no);
    }

    # only after creating the native-object, the gtype is known
    self._set-class-info('GtkWindow');
  }
}

#-------------------------------------------------------------------------------
# no pod. user does not have to know about it.
method _fallback ( $native-sub is copy --> Callable ) {

  my Callable $s;
  try { $s = &::("gtk_window_$native-sub"); };
  try { $s = &::("gtk_$native-sub"); } unless ?$s;
  try { $s = &::($native-sub); } if !$s and $native-sub ~~ m/^ 'gtk_' /;

  self._set-class-name-of-sub('GtkWindow');
  $s = callsame unless ?$s;

  $s;
}

#-------------------------------------------------------------------------------
#TM:0:activate-default:
=begin pod
=head2 activate-default

Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see C<Gnome::Gtk3::Widget.set-receives-default()>), in which case the focused widget is activated.

Returns: C<True> if a widget got activated.

  method activate-default ( --> Bool )

=end pod

method activate-default ( --> Bool ) {

  gtk_window_activate_default(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_activate_default (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:activate-focus:
=begin pod
=head2 activate-focus

Activates the current focused widget within the window.

Returns: C<True> if a widget got activated.

  method activate-focus ( --> Bool )

=end pod

method activate-focus ( --> Bool ) {

  gtk_window_activate_focus(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_activate_focus (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:activate-key:
=begin pod
=head2 activate-key

Activates mnemonics and accelerators for this B<Gnome::Gtk3::Window>. This is normally called by the default ::key-press-event handler for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.

Returns: C<True> if a mnemonic or accelerator was found and activated.

  method activate-key ( N-GdkEventKey $event --> Bool )

=item N-GdkEventKey $event; an EventKey structure
=end pod

method activate-key ( N-GdkEventKey $event --> Bool ) {
  gtk_window_activate_key( self._f('GtkWindow'), $event).Bool
}

sub gtk_window_activate_key (
  N-GObject $window, N-GdkEventKey $event --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:add-accel-group:
=begin pod
=head2 add-accel-group

Associate I<accel-group> with I<window>, such that calling C<gtk-accel-groups-activate()> on I<window> will activate accelerators in I<accel-group>.

  method add-accel-group ( N-GObject $accel_group )

=item N-GObject $accel_group; a B<Gnome::Gtk3::AccelGroup>
=end pod

method add-accel-group ( $accel_group is copy ) {
  $accel_group .= _get-native-object-no-reffing unless $accel_group ~~ N-GObject;
  gtk_window_add_accel_group( self._f('GtkWindow'), $accel_group);
}

sub gtk_window_add_accel_group (
  N-GObject $window, N-GObject $accel_group
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:add-mnemonic:
=begin pod
=head2 add-mnemonic

Adds a mnemonic to this window.

  method add-mnemonic ( UInt $keyval, N-GObject $target )

=item UInt $keyval; the mnemonic
=item N-GObject $target; the widget that gets activated by the mnemonic
=end pod

method add-mnemonic ( UInt $keyval, $target is copy ) {
  $target .= _get-native-object-no-reffing unless $target ~~ N-GObject;

  gtk_window_add_mnemonic(
    self._f('GtkWindow'), $keyval
  );
}

sub gtk_window_add_mnemonic (
  N-GObject $window, guint $keyval, N-GObject $target
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:begin-move-drag:
=begin pod
=head2 begin-move-drag

Starts moving a window. This function is used if an application has window movement grips. When GDK can support it, the window movement will be done using the standard mechanism for the [window manager][gtk-X11-arch] or windowing system. Otherwise, GDK will try to emulate window movement, potentially not all that well, depending on the windowing system.

  method begin-move-drag ( Int $button, Int $root_x, Int $root_y, UInt $timestamp )

=item Int $button; mouse button that initiated the drag
=item Int $root_x; X position where the user clicked to initiate the drag, in root window coordinates
=item Int $root_y; Y position where the user clicked to initiate the drag
=item UInt $timestamp; timestamp from the click event that initiated the drag
=end pod

method begin-move-drag ( Int $button, Int $root_x, Int $root_y, UInt $timestamp ) {

  gtk_window_begin_move_drag(
    self._f('GtkWindow'), $button, $root_x, $root_y, $timestamp
  );
}

sub gtk_window_begin_move_drag (
  N-GObject $window, gint $button, gint $root_x, gint $root_y, guint32 $timestamp
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:begin-resize-drag:
=begin pod
=head2 begin-resize-drag

Starts resizing a window. This function is used if an application has window resizing controls. When GDK can support it, the resize will be done using the standard mechanism for the [window manager][gtk-X11-arch] or windowing system. Otherwise, GDK will try to emulate window resizing, potentially not all that well, depending on the windowing system.

  method begin-resize-drag ( GdkWindowEdge $edge, Int $button, Int $root_x, Int $root_y, UInt $timestamp )

=item GdkWindowEdge $edge; mouse button that initiated the drag
=item Int $button; position of the resize control
=item Int $root_x; X position where the user clicked to initiate the drag, in root window coordinates
=item Int $root_y; Y position where the user clicked to initiate the drag
=item UInt $timestamp; timestamp from the click event that initiated the drag
=end pod

method begin-resize-drag ( GdkWindowEdge $edge, Int $button, Int $root_x, Int $root_y, UInt $timestamp ) {

  gtk_window_begin_resize_drag(
    self._f('GtkWindow'), $edge, $button, $root_x, $root_y, $timestamp
  );
}

sub gtk_window_begin_resize_drag (
  N-GObject $window, GEnum $edge, gint $button, gint $root_x, gint $root_y, guint32 $timestamp
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:close:
=begin pod
=head2 close

Requests that the window is closed, similar to what happens when a window manager close button is clicked.

This function can be used with close buttons in custom titlebars.

  method close ( )

=end pod

method close ( ) {

  gtk_window_close(
    self._f('GtkWindow'),
  );
}

sub gtk_window_close (
  N-GObject $window
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:deiconify:
=begin pod
=head2 deiconify

Asks to deiconify (i.e. unminimize) the specified I<window>. Note that you shouldn’t assume the window is definitely deiconified afterward, because other entities (e.g. the user or [window manager][gtk-X11-arch])) could iconify it again before your code which assumes deiconification gets to run.

You can track iconification via the “window-state-event” signal on B<Gnome::Gtk3::Widget>.

  method deiconify ( )

=end pod

method deiconify ( ) {

  gtk_window_deiconify(
    self._f('GtkWindow'),
  );
}

sub gtk_window_deiconify (
  N-GObject $window
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:fullscreen:
=begin pod
=head2 fullscreen

Asks to place I<window> in the fullscreen state. Note that you shouldn’t assume the window is definitely full screen afterward, because other entities (e.g. the user or [window manager][gtk-X11-arch]) could unfullscreen it again, and not all window managers honor requests to fullscreen windows. But normally the window will end up fullscreen. Just don’t write code that crashes if not.

You can track the fullscreen state via the “window-state-event” signal on B<Gnome::Gtk3::Widget>.

  method fullscreen ( )

=end pod

method fullscreen ( ) {

  gtk_window_fullscreen(
    self._f('GtkWindow'),
  );
}

sub gtk_window_fullscreen (
  N-GObject $window
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:fullscreen-on-monitor:
=begin pod
=head2 fullscreen-on-monitor

Asks to place I<window> in the fullscreen state. Note that you shouldn't assume the window is definitely full screen afterward.

You can track the fullscreen state via the "window-state-event" signal on B<Gnome::Gtk3::Widget>.

  method fullscreen-on-monitor ( N-GObject $screen, Int $monitor )

=item N-GObject $screen; a B<Gnome::Gdk3::Screen> to draw to
=item Int $monitor; which monitor to go fullscreen on
=end pod

method fullscreen-on-monitor ( $screen is copy, Int $monitor ) {
  $screen .= _get-native-object-no-reffing unless $screen ~~ N-GObject;

  gtk_window_fullscreen_on_monitor(
    self._f('GtkWindow'), $monitor
  );
}

sub gtk_window_fullscreen_on_monitor (
  N-GObject $window, N-GObject $screen, gint $monitor
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-accept-focus:
=begin pod
=head2 get-accept-focus

Gets the value set by C<set-accept-focus()>.

Returns: C<True> if window should receive the input focus

  method get-accept-focus ( --> Bool )

=end pod

method get-accept-focus ( --> Bool ) {

  gtk_window_get_accept_focus(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_accept_focus (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-application:
=begin pod
=head2 get-application

Gets the B<Gnome::Gtk3::Application> associated with the window (if any).

Returns: a B<Gnome::Gtk3::Application>, or C<undefined>

  method get-application ( --> N-GObject )

=end pod

method get-application ( --> N-GObject ) {

  gtk_window_get_application(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_application (
  N-GObject $window --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-attached-to:
=begin pod
=head2 get-attached-to

Fetches the attach widget for this window. See C<set-attached-to()>.

Returns: the widget where the window is attached, or C<undefined> if the window is not attached to any widget.

  method get-attached-to ( --> N-GObject )

=end pod

method get-attached-to ( --> N-GObject ) {

  gtk_window_get_attached_to(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_attached_to (
  N-GObject $window --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-decorated:
=begin pod
=head2 get-decorated

Returns whether the window has been set to have decorations such as a title bar via C<set-decorated()>.

Returns: C<True> if the window has been set to have decorations

  method get-decorated ( --> Bool )

=end pod

method get-decorated ( --> Bool ) {

  gtk_window_get_decorated(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_decorated (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-default-icon-list:
=begin pod
=head2 get-default-icon-list

Gets the value set by C<set-default-icon-list()>. The list is a copy and should be freed with C<g-list-free()>, but the pixbufs in the list have not had their reference count incremented.

Returns: (element-type GdkPixbuf) (transfer container): copy of default icon list

  method get-default-icon-list ( --> N-GList )

=end pod

method get-default-icon-list ( --> N-GList ) {

  gtk_window_get_default_icon_list(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_default_icon_list (
   --> N-GList
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-default-icon-name:
=begin pod
=head2 get-default-icon-name

Returns the fallback icon name for windows that has been set with C<set-default-icon-name()>. The returned string is owned by GTK+ and should not be modified. It is only valid until the next call to C<set-default-icon-name()>.

Returns: the fallback icon name for windows

  method get-default-icon-name ( --> Str )

=end pod

method get-default-icon-name ( --> Str ) {

  gtk_window_get_default_icon_name(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_default_icon_name (
   --> gchar-ptr
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-default-size:
=begin pod
=head2 get-default-size

Gets the default size of the window. A value of -1 for the width or height indicates that a default size has not been explicitly set for that dimension, so the “natural” size of the window will be used.

  method get-default-size ( --> List )

The List returns;
=item Int width; location to store the default width, or C<undefined>
=item Int height; location to store the default height, or C<undefined>
=end pod

method get-default-size ( --> List ) {

  gtk_window_get_default_size(
    self._f('GtkWindow'), my gint $width, my gint $height
  );
  ( $width, $height)
}

sub gtk_window_get_default_size (
  N-GObject $window, gint $width is rw, gint $height is rw
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-default-widget:
=begin pod
=head2 get-default-widget

Returns the default widget for I<window>. See C<set-default()> for more details.

Returns: the default widget, or C<undefined> if there is none.

  method get-default-widget ( --> N-GObject )

=end pod

method get-default-widget ( --> N-GObject ) {

  gtk_window_get_default_widget(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_default_widget (
  N-GObject $window --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-deletable:
=begin pod
=head2 get-deletable

Returns whether the window has been set to have a close button via C<set-deletable()>.

Returns: C<True> if the window has been set to have a close button

  method get-deletable ( --> Bool )

=end pod

method get-deletable ( --> Bool ) {

  gtk_window_get_deletable(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_deletable (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-destroy-with-parent:
=begin pod
=head2 get-destroy-with-parent

Returns whether the window will be destroyed with its transient parent. See C<set-destroy-with-parent()>.

Returns: C<True> if the window will be destroyed with its transient parent.

  method get-destroy-with-parent ( --> Bool )

=end pod

method get-destroy-with-parent ( --> Bool ) {

  gtk_window_get_destroy_with_parent(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_destroy_with_parent (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-focus:
=begin pod
=head2 get-focus

Retrieves the current focused widget within the window. Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then `gtk-widget-has-focus (widget)` will not be C<True> for the widget.

Returns: the currently focused widget, or C<undefined> if there is none.

  method get-focus ( --> N-GObject )

=end pod

method get-focus ( --> N-GObject ) {

  gtk_window_get_focus(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_focus (
  N-GObject $window --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-focus-on-map:
=begin pod
=head2 get-focus-on-map

Gets the value set by C<set-focus-on-map()>.

Returns: C<True> if window should receive the input focus when mapped.

  method get-focus-on-map ( --> Bool )

=end pod

method get-focus-on-map ( --> Bool ) {

  gtk_window_get_focus_on_map(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_focus_on_map (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-focus-visible:
=begin pod
=head2 get-focus-visible

Gets the value of the  I<focus-visible> property.

Returns: C<True> if “focus rectangles” are supposed to be visible in this window.

  method get-focus-visible ( --> Bool )

=end pod

method get-focus-visible ( --> Bool ) {

  gtk_window_get_focus_visible(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_focus_visible (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-gravity:
=begin pod
=head2 get-gravity

Gets the value set by C<set-gravity()>.

Returns: window gravity

  method get-gravity ( --> GdkGravity )

=end pod

method get-gravity ( --> GdkGravity ) {

  gtk_window_get_gravity(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_gravity (
  N-GObject $window --> GEnum
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-group:
=begin pod
=head2 get-group

Returns the group for I<window> or the default group, if I<window> is C<undefined> or if I<window> does not have an explicit window group.

Returns: the B<Gnome::Gtk3::WindowGroup> for a window or the default group

  method get-group ( --> N-GObject )

=end pod

method get-group ( --> N-GObject ) {

  gtk_window_get_group(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_group (
  N-GObject $window --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-hide-titlebar-when-maximized:
=begin pod
=head2 get-hide-titlebar-when-maximized

Returns whether the window has requested to have its titlebar hidden when maximized. See C<set-hide-titlebar-when-maximized()>.

Returns: C<True> if the window has requested to have its titlebar hidden when maximized

  method get-hide-titlebar-when-maximized ( --> Bool )

=end pod

method get-hide-titlebar-when-maximized ( --> Bool ) {

  gtk_window_get_hide_titlebar_when_maximized(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_hide_titlebar_when_maximized (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-icon:
=begin pod
=head2 get-icon

Gets the value set by C<set-icon()> (or if you've called C<set-icon-list()>, gets the first icon in the icon list).

Returns: icon for window or C<undefined> if none

  method get-icon ( --> N-GObject )

=end pod

method get-icon ( --> N-GObject ) {

  gtk_window_get_icon(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_icon (
  N-GObject $window --> N-GObject
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-icon-list:
=begin pod
=head2 get-icon-list

Retrieves the list of icons set by C<set-icon-list()>. The list is copied, but the reference count on each member won’t be incremented.

Returns: (element-type GdkPixbuf) (transfer container): copy of window’s icon list

  method get-icon-list ( --> N-GList )

=end pod

method get-icon-list ( --> N-GList ) {

  gtk_window_get_icon_list(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_icon_list (
  N-GObject $window --> N-GList
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-icon-name:
=begin pod
=head2 get-icon-name

Returns the name of the themed icon for the window, see C<set-icon-name()>.

Returns: the icon name or C<undefined> if the window has no themed icon

  method get-icon-name ( --> Str )

=end pod

method get-icon-name ( --> Str ) {

  gtk_window_get_icon_name(
    self._f('GtkWindow'),
  )
}

sub gtk_window_get_icon_name (
  N-GObject $window --> gchar-ptr
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-mnemonic-modifier:
=begin pod
=head2 get-mnemonic-modifier

Returns the mnemonic modifier for this window. See C<set-mnemonic-modifier()>.

Returns: the modifier mask used to activate mnemonics on this window.

  method get-mnemonic-modifier ( --> GdkModifierType )

=end pod

method get-mnemonic-modifier ( --> GdkModifierType ) {

  GdkModifierType(
    gtk_window_get_mnemonic_modifier(self._f('GtkWindow'))
  )
}

sub gtk_window_get_mnemonic_modifier (
  N-GObject $window --> GEnum
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-mnemonics-visible:
=begin pod
=head2 get-mnemonics-visible

Gets the value of the  I<mnemonics-visible> property.

Returns: C<True> if mnemonics are supposed to be visible in this window.

  method get-mnemonics-visible ( --> Bool )

=end pod

method get-mnemonics-visible ( --> Bool ) {

  gtk_window_get_mnemonics_visible(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_mnemonics_visible (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-modal:
=begin pod
=head2 get-modal

Returns whether the window is modal. See C<set-modal()>.

Returns: C<True> if the window is set to be modal and establishes a grab when shown

  method get-modal ( --> Bool )

=end pod

method get-modal ( --> Bool ) {

  gtk_window_get_modal(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get_modal (
  N-GObject $window --> gboolean
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:get-position:
=begin pod
=head2 get-position

This function returns the position you need to pass to C<move()> to keep I<window> in its current position. This means that the meaning of the returned value varies with window gravity. See C<move()> for more details.

The reliability of this function depends on the windowing system currently in use. Some windowing systems, such as Wayland, do not support a global coordinate system, and thus the position of the window will always be (0, 0). Others, like X11, do not have a reliable way to obtain the geometry of the decorations of a window if they are provided by the window manager. Additionally, on X11, window manager have been known to mismanage window gravity, which result in windows moving even if you use the coordinates of the current position as returned by this function.

If you haven’t changed the window gravity, its gravity will be C<GDK_GRAVITY_NORTH_WEST>. This means that C<get-position()> gets the position of the top-left corner of the window manager frame for the window. C<move()> sets the position of this same top-left corner.

If a window has gravity C<GDK_GRAVITY_STATIC> the window manager frame is not relevant, and thus C<get-position()> will always produce accurate results. However you can’t use static gravity to do things like place a window in a corner of the screen, because static gravity ignores the window manager decorations.

Ideally, this function should return appropriate values if the window has client side decorations, assuming that the windowing system supports global coordinates.

In practice, saving the window position should not be left to applications, as they lack enough knowledge of the windowing system and the window manager state to effectively do so. The appropriate way to implement saving the window position is to use a platform-specific protocol, wherever that is available.

  method get-position ( --> List )

The List returns;
=item Int root_x; return location for X coordinate of gravity-determined reference point, or C<undefined>
=item Int root_y; return location for Y coordinate of gravity-determined reference point, or C<undefined>
=end pod

method get-position ( --> List ) {
  gtk_window_get_position(
    self._f('GtkWindow'), my gint $root_x, my gint $root_y
  );

  ( $root_x, $root_y)
}

sub gtk_window_get_position (
  N-GObject $window, gint $root_x is rw, gint $root_y is rw
) is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:get-resizable:
=begin pod
=head2 get-resizable

Gets the value set by C<set-resizable()>.

Returns: C<True> if the user can resize the window

  method get-resizable ( --> Bool )

=end pod

method get-resizable ( --> Bool ) {

  gtk_window_get_resizable(
    self._f('GtkWindow'),
  ).Bool
}

sub gtk_window_get