Table of Contents

Class Window

Base class for all windows, dialogs, and popups.

Inheritance
Window
Derived

Remarks

A node that creates a window. The window can either be a native system window or embedded inside another Window (see gui_embed_subwindows).

At runtime, Windows will not close automatically when requested. You need to handle it manually using the close_requested signal (this applies both to pressing the close button and clicking outside of a popup).

Fields

NOTIFICATION_VISIBILITY_CHANGED

Emitted when Window's visibility changes, right before visibility_changed.

const NOTIFICATION_VISIBILITY_CHANGED = 30

NOTIFICATION_THEME_CHANGED

Sent when the node needs to refresh its theme items. This happens in one of the following cases:

  • The theme property is changed on this node or any of its ancestors.

  • The theme_type_variation property is changed on this node.

  • The node enters the scene tree.

Note: As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree.

const NOTIFICATION_THEME_CHANGED = 32

Properties

always_on_top

If true, the window will be on top of all other windows. Does not work if transient is enabled.

var always_on_top : bool = false

Property Value

bool

Remarks

auto_translate

Toggles if any text should automatically change to its translated version depending on the current locale.

var auto_translate : bool = true

Property Value

bool

Remarks

  • void set_auto_translate(bool value)
  • bool is_auto_translating

borderless

If true, the window will have no borders.

var borderless : bool = false

Property Value

bool

Remarks

content_scale_aspect

Specifies how the content's aspect behaves when the Window is resized. The base aspect is determined by content_scale_size.

var content_scale_aspect : int = 0

Property Value

int

Remarks

  • void set_content_scale_aspect(int value)
  • int get_content_scale_aspect

content_scale_factor

Specifies the base scale of Window's content when its size is equal to content_scale_size. See also get_stretch_transform.

var content_scale_factor : float = 1.0

Property Value

float

Remarks

  • void set_content_scale_factor(float value)
  • float get_content_scale_factor

content_scale_mode

Specifies how the content is scaled when the Window is resized.

var content_scale_mode : int = 0

Property Value

int

Remarks

  • void set_content_scale_mode(int value)
  • int get_content_scale_mode

content_scale_size

Base size of the content (i.e. nodes that are drawn inside the window). If non-zero, Window's content will be scaled when the window is resized to a different size.

var content_scale_size : Vector2i = Vector2i(0, 0)

Property Value

Vector2i

Remarks

content_scale_stretch

The policy to use to determine the final scale factor for 2D elements. This affects how content_scale_factor is applied, in addition to the automatic scale factor determined by content_scale_size.

var content_scale_stretch : int = 0

Property Value

int

Remarks

  • void set_content_scale_stretch(int value)
  • int get_content_scale_stretch

current_screen

The screen the window is currently on.

var current_screen : int

Property Value

int

Remarks

  • void set_current_screen(int value)
  • int get_current_screen

exclude_from_capture

Windows is excluded from screenshots taken by DisplayServer.screen_get_image, DisplayServer.screen_get_image_rect, and DisplayServer.screen_get_pixel.

var exclude_from_capture : bool = false

Property Value

bool

Remarks

exclusive

If true, the Window will be in exclusive mode. Exclusive windows are always on top of their parent and will block all input going to the parent Window.

Needs transient enabled to work.

var exclusive : bool = false

Property Value

bool

Remarks

  • void set_exclusive(bool value)
  • bool is_exclusive

extend_to_title

If true, the Window contents is expanded to the full size of the window, window title bar is transparent.

Note: This property is implemented only on macOS.

Note: This property only works with native windows.

var extend_to_title : bool = false

Property Value

bool

Remarks

force_native

If true, native window will be used regardless of parent viewport and project settings.

var force_native : bool = false

Property Value

bool

Remarks

  • void set_force_native(bool value)
  • bool get_force_native

initial_position

Specifies the initial type of position for the Window. See WindowInitialPosition constants.

var initial_position : int = 0

Property Value

int

Remarks

  • void set_initial_position(int value)
  • int get_initial_position

keep_title_visible

If true, the Window width is expanded to keep the title bar text fully visible.

var keep_title_visible : bool = false

Property Value

bool

Remarks

  • void set_keep_title_visible(bool value)
  • bool get_keep_title_visible

max_size

If non-zero, the Window can't be resized to be bigger than this size.

Note: This property will be ignored if the value is lower than min_size.

var max_size : Vector2i = Vector2i(0, 0)

Property Value

Vector2i

Remarks

min_size

If non-zero, the Window can't be resized to be smaller than this size.

Note: This property will be ignored in favor of get_contents_minimum_size if wrap_controls is enabled and if its size is bigger.

var min_size : Vector2i = Vector2i(0, 0)

Property Value

Vector2i

Remarks

mode

Set's the window's current mode.

Note: Fullscreen mode is not exclusive full screen on Windows and Linux.

Note: This method only works with native windows, i.e. the main window and Window-derived nodes when gui_embed_subwindows is disabled in the main viewport.

var mode : int = 0

Property Value

int

Remarks

  • void set_mode(int value)
  • int get_mode

mouse_passthrough

If true, all mouse events will be passed to the underlying window of the same application. See also mouse_passthrough_polygon.

Note: This property is implemented on Linux (X11), macOS and Windows.

Note: This property only works with native windows.

var mouse_passthrough : bool = false

Property Value

bool

Remarks

mouse_passthrough_polygon

Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.

Passing an empty array will disable passthrough support (all mouse events will be intercepted by the window, which is the default behavior).

# Set region, using Path2D node.
$Window.mouse_passthrough_polygon = $Path2D.curve.get_baked_points()

# Set region, using Polygon2D node.
$Window.mouse_passthrough_polygon = $Polygon2D.polygon

# Reset region to default.
$Window.mouse_passthrough_polygon = []

Note: This property is ignored if mouse_passthrough is set to true.

Note: On Windows, the portion of a window that lies outside the region is not drawn, while on Linux (X11) and macOS it is.

Note: This property is implemented on Linux (X11), macOS and Windows.

var mouse_passthrough_polygon : PackedVector2Array = PackedVector2Array()

Property Value

PackedVector2Array

Remarks

popup_window

If true, the Window will be considered a popup. Popups are sub-windows that don't show as separate windows in system's window manager's window list and will send close request when anything is clicked outside of them (unless exclusive is enabled).

var popup_window : bool = false

Property Value

bool

Remarks

position

The window's position in pixels.

If display/window/subwindows/embed_subwindows is false, the position is in absolute screen coordinates. This typically applies to editor plugins. If the setting is true, the window's position is in the coordinates of its parent Viewport.

Note: This property only works if initial_position is set to Window.WINDOW_INITIAL_POSITION_ABSOLUTE.

var position : Vector2i = Vector2i(0, 0)

Property Value

Vector2i

Remarks

sharp_corners

If true, the Window will override the OS window style to display sharp corners.

Note: This property is implemented only on Windows (11).

Note: This property only works with native windows.

var sharp_corners : bool = false

Property Value

bool

Remarks

size

The window's size in pixels.

var size : Vector2i = Vector2i(100, 100)

Property Value

Vector2i

Remarks

theme

The Theme resource this node and all its Control and Window children use. If a child node has its own Theme resource set, theme items are merged with child's definitions having higher priority.

Note: Window styles will have no effect unless the window is embedded.

var theme : Theme

Property Value

Theme

Remarks

theme_type_variation

The name of a theme type variation used by this Window to look up its own theme items. See theme_type_variation for more details.

var theme_type_variation : StringName = &""

Property Value

StringName

Remarks

title

The window's title. If the Window is native, title styles set in Theme will have no effect.

var title : String = ""

Property Value

String

Remarks

transient

If true, the Window is transient, i.e. it's considered a child of another Window. The transient window will be destroyed with its transient parent and will return focus to their parent when closed. The transient window is displayed on top of a non-exclusive full-screen parent window. Transient windows can't enter full-screen mode.

Note that behavior might be different depending on the platform.

var transient : bool = false

Property Value

bool

Remarks

  • void set_transient(bool value)
  • bool is_transient

transient_to_focused

If true, and the Window is transient, this window will (at the time of becoming visible) become transient to the currently focused window instead of the immediate parent window in the hierarchy. Note that the transient parent is assigned at the time this window becomes visible, so changing it afterwards has no effect until re-shown.

var transient_to_focused : bool = false

Property Value

bool

Remarks

  • void set_transient_to_focused(bool value)
  • bool is_transient_to_focused

transparent

If true, the Window's background can be transparent. This is best used with embedded windows.

Note: Transparency support is implemented on Linux, macOS and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities.

Note: This property has no effect if display/window/per_pixel_transparency/allowed is set to false.

var transparent : bool = false

Property Value

bool

Remarks

unfocusable

If true, the Window can't be focused nor interacted with. It can still be visible.

var unfocusable : bool = false

Property Value

bool

Remarks

unresizable

If true, the window can't be resized. Minimize and maximize buttons are disabled.

var unresizable : bool = false

Property Value

bool

Remarks

visible

If true, the window is visible.

var visible : bool = true

Property Value

bool

Remarks

  • void set_visible(bool value)
  • bool is_visible

wrap_controls

If true, the window's size will automatically update when a child node is added or removed, ignoring min_size if the new size is bigger.

If false, you need to call child_controls_changed manually.

var wrap_controls : bool = false

Property Value

bool

Remarks

  • void set_wrap_controls(bool value)
  • bool is_wrapping_controls

title_color

Theme Property

The color of the title's text.

 = ``Color(0.875, 0.875, 0.875, 1)``

Property Value

Color

title_outline_modulate

Theme Property

The color of the title's text outline.

 = ``Color(0, 0, 0, 1)``

Property Value

Color

close_h_offset

Theme Property

Horizontal position offset of the close button.

 = ``18``

Property Value

int

close_v_offset

Theme Property

Vertical position offset of the close button.

 = ``24``

Property Value

int

resize_margin

Theme Property

Defines the outside margin at which the window border can be grabbed with mouse and resized.

 = ``4``

Property Value

int

title_height

Theme Property

Height of the title bar.

 = ``36``

Property Value

int

title_outline_size

Theme Property

The size of the title outline.

 = ``0``

Property Value

int

title_font

Theme Property

The font used to draw the title.

Font title_font

Property Value

Font

title_font_size

Theme Property

The size of the title font.

int title_font_size

Property Value

int

close

Theme Property

The icon for the close button.

Texture2D close

Property Value

Texture2D

close_pressed

Theme Property

The icon for the close button when it's being pressed.

Texture2D close_pressed

Property Value

Texture2D

embedded_border

Theme Property

The background style used when the Window is embedded. Note that this is drawn only under the window's content, excluding the title. For proper borders and title bar style, you can use expand_margin_* properties of StyleBoxFlat.

Note: The content background will not be visible unless transparent is enabled.

StyleBox embedded_border

Property Value

StyleBox

embedded_unfocused_border

Theme Property

The background style used when the Window is embedded and unfocused.

StyleBox embedded_unfocused_border

Property Value

StyleBox

Methods

_get_contents_minimum_size

Qualifiers: virtualconst

Virtual method to be implemented by the user. Overrides the value returned by get_contents_minimum_size.

Vector2 _get_contents_minimum_size

add_theme_color_override(StringName, Color)

Creates a local override for a theme Color with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Window.remove_theme_color_override.

See also Window.get_theme_color and Control.add_theme_color_override for more details.

void add_theme_color_override(StringName name, Color color)

Parameters

name StringName
color Color

add_theme_constant_override(StringName, int)

Creates a local override for a theme constant with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Window.remove_theme_constant_override.

See also Window.get_theme_constant.

void add_theme_constant_override(StringName name, int constant)

Parameters

name StringName
constant int

add_theme_font_override(StringName, Font)

Creates a local override for a theme Font with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Window.remove_theme_font_override.

See also Window.get_theme_font.

void add_theme_font_override(StringName name, Font font)

Parameters

name StringName
font Font

add_theme_font_size_override(StringName, int)

Creates a local override for a theme font size with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Window.remove_theme_font_size_override.

See also Window.get_theme_font_size.

void add_theme_font_size_override(StringName name, int font_size)

Parameters

name StringName
font_size int

add_theme_icon_override(StringName, Texture2D)

Creates a local override for a theme icon with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Window.remove_theme_icon_override.

See also Window.get_theme_icon.

void add_theme_icon_override(StringName name, Texture2D texture)

Parameters

name StringName
texture Texture2D

add_theme_stylebox_override(StringName, StyleBox)

Creates a local override for a theme StyleBox with the specified name. Local overrides always take precedence when fetching theme items for the control. An override can be removed with Window.remove_theme_stylebox_override.

See also Window.get_theme_stylebox and Control.add_theme_stylebox_override for more details.

void add_theme_stylebox_override(StringName name, StyleBox stylebox)

Parameters

name StringName
stylebox StyleBox

begin_bulk_theme_override

Prevents *_theme_*_override methods from emitting NOTIFICATION_THEME_CHANGED until end_bulk_theme_override is called.

void begin_bulk_theme_override

can_draw

Qualifiers: const

Returns whether the window is being drawn to the screen.

bool can_draw

child_controls_changed

Requests an update of the Window size to fit underlying Control nodes.

void child_controls_changed

end_bulk_theme_override

Ends a bulk theme override update. See begin_bulk_theme_override.

void end_bulk_theme_override

get_contents_minimum_size

Qualifiers: const

Returns the combined minimum size from the child Control nodes of the window. Use child_controls_changed to update it when child nodes have changed.

The value returned by this method can be overridden with _get_contents_minimum_size.

Vector2 get_contents_minimum_size

get_flag(int)

Qualifiers: const

Returns true if the flag is set.

bool get_flag(int flag)

Parameters

flag int

get_layout_direction

Qualifiers: const

Returns layout direction and text writing direction.

int get_layout_direction

get_position_with_decorations

Qualifiers: const

Returns the window's position including its border.

Note: If visible is false, this method returns the same value as position.

Vector2i get_position_with_decorations

get_size_with_decorations

Qualifiers: const

Returns the window's size including its border.

Note: If visible is false, this method returns the same value as size.

Vector2i get_size_with_decorations

get_theme_color(StringName, StringName)

Qualifiers: const

Returns a Color from the first matching Theme in the tree if that Theme has a color item with the specified name and theme_type.

See Control.get_theme_color for more details.

Color get_theme_color(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

get_theme_constant(StringName, StringName)

Qualifiers: const

Returns a constant from the first matching Theme in the tree if that Theme has a constant item with the specified name and theme_type.

See Control.get_theme_color for more details.

int get_theme_constant(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

get_theme_default_base_scale

Qualifiers: const

Returns the default base scale value from the first matching Theme in the tree if that Theme has a valid default_base_scale value.

See Control.get_theme_color for details.

float get_theme_default_base_scale

get_theme_default_font

Qualifiers: const

Returns the default font from the first matching Theme in the tree if that Theme has a valid default_font value.

See Control.get_theme_color for details.

Font get_theme_default_font

get_theme_default_font_size

Qualifiers: const

Returns the default font size value from the first matching Theme in the tree if that Theme has a valid default_font_size value.

See Control.get_theme_color for details.

int get_theme_default_font_size

get_theme_font(StringName, StringName)

Qualifiers: const

Returns a Font from the first matching Theme in the tree if that Theme has a font item with the specified name and theme_type.

See Control.get_theme_color for details.

Font get_theme_font(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

get_theme_font_size(StringName, StringName)

Qualifiers: const

Returns a font size from the first matching Theme in the tree if that Theme has a font size item with the specified name and theme_type.

See Control.get_theme_color for details.

int get_theme_font_size(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

get_theme_icon(StringName, StringName)

Qualifiers: const

Returns an icon from the first matching Theme in the tree if that Theme has an icon item with the specified name and theme_type.

See Control.get_theme_color for details.

Texture2D get_theme_icon(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

get_theme_stylebox(StringName, StringName)

Qualifiers: const

Returns a StyleBox from the first matching Theme in the tree if that Theme has a stylebox item with the specified name and theme_type.

See Control.get_theme_color for details.

StyleBox get_theme_stylebox(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

get_window_id

Qualifiers: const

Returns the ID of the window.

int get_window_id

grab_focus

Causes the window to grab focus, allowing it to receive user input.

void grab_focus

has_focus

Qualifiers: const

Returns true if the window is focused.

bool has_focus

has_theme_color(StringName, StringName)

Qualifiers: const

Returns true if there is a matching Theme in the tree that has a color item with the specified name and theme_type.

See Control.get_theme_color for details.

bool has_theme_color(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

has_theme_color_override(StringName)

Qualifiers: const

Returns true if there is a local override for a theme Color with the specified name in this Control node.

See Window.add_theme_color_override.

bool has_theme_color_override(StringName name)

Parameters

name StringName

has_theme_constant(StringName, StringName)

Qualifiers: const

Returns true if there is a matching Theme in the tree that has a constant item with the specified name and theme_type.

See Control.get_theme_color for details.

bool has_theme_constant(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

has_theme_constant_override(StringName)

Qualifiers: const

Returns true if there is a local override for a theme constant with the specified name in this Control node.

See Window.add_theme_constant_override.

bool has_theme_constant_override(StringName name)

Parameters

name StringName

has_theme_font(StringName, StringName)

Qualifiers: const

Returns true if there is a matching Theme in the tree that has a font item with the specified name and theme_type.

See Control.get_theme_color for details.

bool has_theme_font(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

has_theme_font_override(StringName)

Qualifiers: const

Returns true if there is a local override for a theme Font with the specified name in this Control node.

See Window.add_theme_font_override.

bool has_theme_font_override(StringName name)

Parameters

name StringName

has_theme_font_size(StringName, StringName)

Qualifiers: const

Returns true if there is a matching Theme in the tree that has a font size item with the specified name and theme_type.

See Control.get_theme_color for details.

bool has_theme_font_size(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

has_theme_font_size_override(StringName)

Qualifiers: const

Returns true if there is a local override for a theme font size with the specified name in this Control node.

See Window.add_theme_font_size_override.

bool has_theme_font_size_override(StringName name)

Parameters

name StringName

has_theme_icon(StringName, StringName)

Qualifiers: const

Returns true if there is a matching Theme in the tree that has an icon item with the specified name and theme_type.

See Control.get_theme_color for details.

bool has_theme_icon(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

has_theme_icon_override(StringName)

Qualifiers: const

Returns true if there is a local override for a theme icon with the specified name in this Control node.

See Window.add_theme_icon_override.

bool has_theme_icon_override(StringName name)

Parameters

name StringName

has_theme_stylebox(StringName, StringName)

Qualifiers: const

Returns true if there is a matching Theme in the tree that has a stylebox item with the specified name and theme_type.

See Control.get_theme_color for details.

bool has_theme_stylebox(StringName name, StringName theme_type)

Parameters

name StringName
theme_type StringName

has_theme_stylebox_override(StringName)

Qualifiers: const

Returns true if there is a local override for a theme StyleBox with the specified name in this Control node.

See Window.add_theme_stylebox_override.

bool has_theme_stylebox_override(StringName name)

Parameters

name StringName

hide

Hides the window. This is not the same as minimized state. Hidden window can't be interacted with and needs to be made visible with show.

void hide

is_embedded

Qualifiers: const

Returns true if the window is currently embedded in another window.

bool is_embedded

is_layout_rtl

Qualifiers: const

Returns true if layout is right-to-left.

bool is_layout_rtl

is_maximize_allowed

Qualifiers: const

Returns true if the window can be maximized (the maximize button is enabled).

bool is_maximize_allowed

is_using_font_oversampling

Qualifiers: const

Returns true if font oversampling is enabled. See Window.set_use_font_oversampling.

bool is_using_font_oversampling

move_to_center

Centers a native window on the current screen and an embedded window on its embedder Viewport.

void move_to_center

move_to_foreground

Causes the window to grab focus, allowing it to receive user input.

void move_to_foreground

popup(Rect2i)

Shows the Window and makes it transient (see transient). If rect is provided, it will be set as the Window's size. Fails if called on the main window.

If display/window/subwindows/embed_subwindows is true (single-window mode), rect's coordinates are global and relative to the main window's top-left corner (excluding window decorations). If rect's position coordinates are negative, the window will be located outside the main window and may not be visible as a result.

If display/window/subwindows/embed_subwindows is false (multi-window mode), rect's coordinates are global and relative to the top-left corner of the leftmost screen. If rect's position coordinates are negative, the window will be placed at the top-left corner of the screen.

Note: rect must be in global coordinates if specified.

void popup(Rect2i rect)

Parameters

rect Rect2i

popup_centered(Vector2i)

Popups the Window at the center of the current screen, with optionally given minimum size. If the Window is embedded, it will be centered in the parent Viewport instead.

Note: Calling it with the default value of minsize is equivalent to calling it with size.

void popup_centered(Vector2i minsize)

Parameters

minsize Vector2i

popup_centered_clamped(Vector2i, float)

Popups the Window centered inside its parent Window. fallback_ratio determines the maximum size of the Window, in relation to its parent.

Note: Calling it with the default value of minsize is equivalent to calling it with size.

void popup_centered_clamped(Vector2i minsize, float fallback_ratio)

Parameters

minsize Vector2i
fallback_ratio float

popup_centered_ratio(float)

If Window is embedded, popups the Window centered inside its embedder and sets its size as a ratio of embedder's size.

If Window is a native window, popups the Window centered inside the screen of its parent Window and sets its size as a ratio of the screen size.

void popup_centered_ratio(float ratio)

Parameters

ratio float

popup_exclusive(Node, Rect2i)

Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls Window.popup on it. The dialog must have no current parent, otherwise the method fails.

See also Window.set_unparent_when_invisible and get_last_exclusive_window.

void popup_exclusive(Node from_node, Rect2i rect)

Parameters

from_node Node
rect Rect2i

popup_exclusive_centered(Node, Vector2i)

Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls Window.popup_centered on it. The dialog must have no current parent, otherwise the method fails.

See also Window.set_unparent_when_invisible and get_last_exclusive_window.

void popup_exclusive_centered(Node from_node, Vector2i minsize)

Parameters

from_node Node
minsize Vector2i

popup_exclusive_centered_clamped(Node, Vector2i, float)

Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls Window.popup_centered_clamped on it. The dialog must have no current parent, otherwise the method fails.

See also Window.set_unparent_when_invisible and get_last_exclusive_window.

void popup_exclusive_centered_clamped(Node from_node, Vector2i minsize, float fallback_ratio)

Parameters

from_node Node
minsize Vector2i
fallback_ratio float

popup_exclusive_centered_ratio(Node, float)

Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls Window.popup_centered_ratio on it. The dialog must have no current parent, otherwise the method fails.

See also Window.set_unparent_when_invisible and get_last_exclusive_window.

void popup_exclusive_centered_ratio(Node from_node, float ratio)

Parameters

from_node Node
ratio float

popup_exclusive_on_parent(Node, Rect2i)

Attempts to parent this dialog to the last exclusive window relative to from_node, and then calls Window.popup_on_parent on it. The dialog must have no current parent, otherwise the method fails.

See also Window.set_unparent_when_invisible and get_last_exclusive_window.

void popup_exclusive_on_parent(Node from_node, Rect2i parent_rect)

Parameters

from_node Node
parent_rect Rect2i

popup_on_parent(Rect2i)

Popups the Window with a position shifted by parent Window's position. If the Window is embedded, has the same effect as Window.popup.

void popup_on_parent(Rect2i parent_rect)

Parameters

parent_rect Rect2i

remove_theme_color_override(StringName)

Removes a local override for a theme Color with the specified name previously added by Window.add_theme_color_override or via the Inspector dock.

void remove_theme_color_override(StringName name)

Parameters

name StringName

remove_theme_constant_override(StringName)

Removes a local override for a theme constant with the specified name previously added by Window.add_theme_constant_override or via the Inspector dock.

void remove_theme_constant_override(StringName name)

Parameters

name StringName

remove_theme_font_override(StringName)

Removes a local override for a theme Font with the specified name previously added by Window.add_theme_font_override or via the Inspector dock.

void remove_theme_font_override(StringName name)

Parameters

name StringName

remove_theme_font_size_override(StringName)

Removes a local override for a theme font size with the specified name previously added by Window.add_theme_font_size_override or via the Inspector dock.

void remove_theme_font_size_override(StringName name)

Parameters

name StringName

remove_theme_icon_override(StringName)

Removes a local override for a theme icon with the specified name previously added by Window.add_theme_icon_override or via the Inspector dock.

void remove_theme_icon_override(StringName name)

Parameters

name StringName

remove_theme_stylebox_override(StringName)

Removes a local override for a theme StyleBox with the specified name previously added by Window.add_theme_stylebox_override or via the Inspector dock.

void remove_theme_stylebox_override(StringName name)

Parameters

name StringName

request_attention

Tells the OS that the Window needs an attention. This makes the window stand out in some way depending on the system, e.g. it might blink on the task bar.

void request_attention

reset_size

Resets the size to the minimum size, which is the max of min_size and (if wrap_controls is enabled) get_contents_minimum_size. This is equivalent to calling set_size(Vector2i()) (or any size below the minimum).

void reset_size

set_flag(int, bool)

Sets a specified window flag.

void set_flag(int flag, bool enabled)

Parameters

flag int
enabled bool

set_ime_active(bool)

If active is true, enables system's native IME (Input Method Editor).

void set_ime_active(bool active)

Parameters

active bool

set_ime_position(Vector2i)

Moves IME to the given position.

void set_ime_position(Vector2i position)

Parameters

position Vector2i

set_layout_direction(int)

Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).

void set_layout_direction(int direction)

Parameters

direction int

set_unparent_when_invisible(bool)

If unparent is true, the window is automatically unparented when going invisible.

Note: Make sure to keep a reference to the node, otherwise it will be orphaned. You also need to manually call queue_free to free the window if it's not parented.

void set_unparent_when_invisible(bool unparent)

Parameters

unparent bool

set_use_font_oversampling(bool)

Enables font oversampling. This makes fonts look better when they are scaled up.

void set_use_font_oversampling(bool enable)

Parameters

enable bool

show

Makes the Window appear. This enables interactions with the Window and doesn't change any of its property other than visibility (unlike e.g. Window.popup).

void show

start_drag

Starts an interactive drag operation on the window, using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's title bar. Using this method allows the window to participate in space switching, tiling, and other system features.

void start_drag

start_resize(int)

Starts an interactive resize operation on the window, using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's edge.

void start_resize(int edge)

Parameters

edge int

Events

about_to_popup

Emitted right after Window.popup call, before the Window appears or does anything.

signal about_to_popup

close_requested

Emitted when the Window's close button is pressed or when popup_window is enabled and user clicks outside the window.

This signal can be used to handle window closing, e.g. by connecting it to hide.

signal close_requested

dpi_changed

Emitted when the Window's DPI changes as a result of OS-level changes (e.g. moving the window from a Retina display to a lower resolution one).

Note: Only implemented on macOS.

signal dpi_changed

files_dropped(PackedStringArray)

Emitted when files are dragged from the OS file manager and dropped in the game window. The argument is a list of file paths.

func _ready():
    get_window().files_dropped.connect(on_files_dropped)

func on_files_dropped(files):
    print(files)

Note: This signal only works with native windows, i.e. the main window and Window-derived nodes when gui_embed_subwindows is disabled in the main viewport.

signal files_dropped(PackedStringArray files)

Parameters

files PackedStringArray

focus_entered

Emitted when the Window gains focus.

signal focus_entered

focus_exited

Emitted when the Window loses its focus.

signal focus_exited

go_back_requested

Emitted when a go back request is sent (e.g. pressing the "Back" button on Android), right after NOTIFICATION_WM_GO_BACK_REQUEST.

signal go_back_requested

mouse_entered

Emitted when the mouse cursor enters the Window's visible area, that is not occluded behind other Controls or windows, provided its gui_disable_input is false and regardless if it's currently focused or not.

signal mouse_entered

mouse_exited

Emitted when the mouse cursor leaves the Window's visible area, that is not occluded behind other Controls or windows, provided its gui_disable_input is false and regardless if it's currently focused or not.

signal mouse_exited

theme_changed

Emitted when the NOTIFICATION_THEME_CHANGED notification is sent.

signal theme_changed

title_changed

Emitted when window title bar text is changed.

signal title_changed

titlebar_changed

Emitted when window title bar decorations are changed, e.g. macOS window enter/exit full screen mode, or extend-to-title flag is changed.

signal titlebar_changed

visibility_changed

Emitted when Window is made visible or disappears.

signal visibility_changed

window_input(InputEvent)

Emitted when the Window is currently focused and receives any input, passing the received event as an argument. The event's position, if present, is in the embedder's coordinate system.

signal window_input(InputEvent event)

Parameters

event InputEvent