DisplayServer

Inherits: Object

A server interface for low-level window management.

Description

DisplayServer handles everything related to window management. It is separated from OS as a single operating system may support multiple display servers.

Headless mode: Starting the engine with the --headless command line argument disables all rendering and window management functions. Most functions from DisplayServer will return dummy values in this case.

Methods

String

clipboard_get ( ) const

Image

clipboard_get_image ( ) const

String

clipboard_get_primary ( ) const

bool

clipboard_has ( ) const

bool

clipboard_has_image ( ) const

void

clipboard_set ( String clipboard )

void

clipboard_set_primary ( String clipboard_primary )

CursorShape

cursor_get_shape ( ) const

void

cursor_set_custom_image ( Resource cursor, CursorShape shape=0, Vector2 hotspot=Vector2(0, 0) )

void

cursor_set_shape ( CursorShape shape )

Error

dialog_input_text ( String title, String description, String existing_text, Callable callback )

Error

dialog_show ( String title, String description, PackedStringArray buttons, Callable callback )

void

enable_for_stealing_focus ( int process_id )

Error

file_dialog_show ( String title, String current_directory, String filename, bool show_hidden, FileDialogMode mode, PackedStringArray filters, Callable callback )

void

force_process_and_drop_events ( )

Color

get_accent_color ( ) const

Rect2[]

get_display_cutouts ( ) const

Rect2i

get_display_safe_area ( ) const

int

get_keyboard_focus_screen ( ) const

String

get_name ( ) const

int

get_primary_screen ( ) const

int

get_screen_count ( ) const

int

get_screen_from_rect ( Rect2 rect ) const

bool

get_swap_cancel_ok ( )

int

get_window_at_screen_position ( Vector2i position ) const

PackedInt32Array

get_window_list ( ) const

int

global_menu_add_check_item ( String menu_root, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

int

global_menu_add_icon_check_item ( String menu_root, Texture2D icon, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

int

global_menu_add_icon_item ( String menu_root, Texture2D icon, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

int

global_menu_add_icon_radio_check_item ( String menu_root, Texture2D icon, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

int

global_menu_add_item ( String menu_root, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

int

global_menu_add_multistate_item ( String menu_root, String label, int max_states, int default_state, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

int

global_menu_add_radio_check_item ( String menu_root, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

int

global_menu_add_separator ( String menu_root, int index=-1 )

int

global_menu_add_submenu_item ( String menu_root, String label, String submenu, int index=-1 )

void

global_menu_clear ( String menu_root )

Key

global_menu_get_item_accelerator ( String menu_root, int idx ) const

Callable

global_menu_get_item_callback ( String menu_root, int idx ) const

int

global_menu_get_item_count ( String menu_root ) const

Texture2D

global_menu_get_item_icon ( String menu_root, int idx ) const

int

global_menu_get_item_indentation_level ( String menu_root, int idx ) const

int

global_menu_get_item_index_from_tag ( String menu_root, Variant tag ) const

int

global_menu_get_item_index_from_text ( String menu_root, String text ) const

Callable

global_menu_get_item_key_callback ( String menu_root, int idx ) const

int

global_menu_get_item_max_states ( String menu_root, int idx ) const

int

global_menu_get_item_state ( String menu_root, int idx ) const

String

global_menu_get_item_submenu ( String menu_root, int idx ) const

Variant

global_menu_get_item_tag ( String menu_root, int idx ) const

String

global_menu_get_item_text ( String menu_root, int idx ) const

String

global_menu_get_item_tooltip ( String menu_root, int idx ) const

bool

global_menu_is_item_checkable ( String menu_root, int idx ) const

bool

global_menu_is_item_checked ( String menu_root, int idx ) const

bool

global_menu_is_item_disabled ( String menu_root, int idx ) const

bool

global_menu_is_item_hidden ( String menu_root, int idx ) const

bool

global_menu_is_item_radio_checkable ( String menu_root, int idx ) const

void

global_menu_remove_item ( String menu_root, int idx )

void

global_menu_set_item_accelerator ( String menu_root, int idx, Key keycode )

void

global_menu_set_item_callback ( String menu_root, int idx, Callable callback )

void

global_menu_set_item_checkable ( String menu_root, int idx, bool checkable )

void

global_menu_set_item_checked ( String menu_root, int idx, bool checked )

void

global_menu_set_item_disabled ( String menu_root, int idx, bool disabled )

void

global_menu_set_item_hidden ( String menu_root, int idx, bool hidden )

void

global_menu_set_item_hover_callbacks ( String menu_root, int idx, Callable callback )

void

global_menu_set_item_icon ( String menu_root, int idx, Texture2D icon )

void

global_menu_set_item_indentation_level ( String menu_root, int idx, int level )

void

global_menu_set_item_key_callback ( String menu_root, int idx, Callable key_callback )

void

global_menu_set_item_max_states ( String menu_root, int idx, int max_states )

void

global_menu_set_item_radio_checkable ( String menu_root, int idx, bool checkable )

void

global_menu_set_item_state ( String menu_root, int idx, int state )

void

global_menu_set_item_submenu ( String menu_root, int idx, String submenu )

void

global_menu_set_item_tag ( String menu_root, int idx, Variant tag )

void

global_menu_set_item_text ( String menu_root, int idx, String text )

void

global_menu_set_item_tooltip ( String menu_root, int idx, String tooltip )

void

global_menu_set_popup_callbacks ( String menu_root, Callable open_callback, Callable close_callback )

bool

has_feature ( Feature feature ) const

Vector2i

ime_get_selection ( ) const

String

ime_get_text ( ) const

bool

is_dark_mode ( ) const

bool

is_dark_mode_supported ( ) const

bool

is_touchscreen_available ( ) const

int

keyboard_get_current_layout ( ) const

Key

keyboard_get_keycode_from_physical ( Key keycode ) const

Key

keyboard_get_label_from_physical ( Key keycode ) const

int

keyboard_get_layout_count ( ) const

String

keyboard_get_layout_language ( int index ) const

String

keyboard_get_layout_name ( int index ) const

void

keyboard_set_current_layout ( int index )

BitField<MouseButtonMask>

mouse_get_button_state ( ) const

MouseMode

mouse_get_mode ( ) const

Vector2i

mouse_get_position ( ) const

void

mouse_set_mode ( MouseMode mouse_mode )

void

process_events ( )

int

screen_get_dpi ( int screen=-1 ) const

Image

screen_get_image ( int screen=-1 ) const

float

screen_get_max_scale ( ) const

ScreenOrientation

screen_get_orientation ( int screen=-1 ) const

Color

screen_get_pixel ( Vector2i position ) const

Vector2i

screen_get_position ( int screen=-1 ) const

float

screen_get_refresh_rate ( int screen=-1 ) const

float

screen_get_scale ( int screen=-1 ) const

Vector2i

screen_get_size ( int screen=-1 ) const

Rect2i

screen_get_usable_rect ( int screen=-1 ) const

bool

screen_is_kept_on ( ) const

void

screen_set_keep_on ( bool enable )

void

screen_set_orientation ( ScreenOrientation orientation, int screen=-1 )

void

set_icon ( Image image )

void

set_native_icon ( String filename )

String

tablet_get_current_driver ( ) const

int

tablet_get_driver_count ( ) const

String

tablet_get_driver_name ( int idx ) const

void

tablet_set_current_driver ( String name )

Dictionary[]

tts_get_voices ( ) const

PackedStringArray

tts_get_voices_for_language ( String language ) const

bool

tts_is_paused ( ) const

bool

tts_is_speaking ( ) const

void

tts_pause ( )

void

tts_resume ( )

void

tts_set_utterance_callback ( TTSUtteranceEvent event, Callable callable )

void

tts_speak ( String text, String voice, int volume=50, float pitch=1.0, float rate=1.0, int utterance_id=0, bool interrupt=false )

void

tts_stop ( )

int

virtual_keyboard_get_height ( ) const

void

virtual_keyboard_hide ( )

void

virtual_keyboard_show ( String existing_text, Rect2 position=Rect2(0, 0, 0, 0), VirtualKeyboardType type=0, int max_length=-1, int cursor_start=-1, int cursor_end=-1 )

void

warp_mouse ( Vector2i position )

bool

window_can_draw ( int window_id=0 ) const

int

window_get_active_popup ( ) const

int

window_get_attached_instance_id ( int window_id=0 ) const

int

window_get_current_screen ( int window_id=0 ) const

bool

window_get_flag ( WindowFlags flag, int window_id=0 ) const

Vector2i

window_get_max_size ( int window_id=0 ) const

Vector2i

window_get_min_size ( int window_id=0 ) const

WindowMode

window_get_mode ( int window_id=0 ) const

int

window_get_native_handle ( HandleType handle_type, int window_id=0 ) const

Rect2i

window_get_popup_safe_rect ( int window ) const

Vector2i

window_get_position ( int window_id=0 ) const

Vector2i

window_get_position_with_decorations ( int window_id=0 ) const

Vector3i

window_get_safe_title_margins ( int window_id=0 ) const

Vector2i

window_get_size ( int window_id=0 ) const

Vector2i

window_get_size_with_decorations ( int window_id=0 ) const

Vector2i

window_get_title_size ( String title, int window_id=0 ) const

VSyncMode

window_get_vsync_mode ( int window_id=0 ) const

bool

window_is_focused ( int window_id=0 ) const

bool

window_is_maximize_allowed ( int window_id=0 ) const

bool

window_maximize_on_title_dbl_click ( ) const

bool

window_minimize_on_title_dbl_click ( ) const

void

window_move_to_foreground ( int window_id=0 )

void

window_request_attention ( int window_id=0 )

void

window_set_current_screen ( int screen, int window_id=0 )

void

window_set_drop_files_callback ( Callable callback, int window_id=0 )

void

window_set_exclusive ( int window_id, bool exclusive )

void

window_set_flag ( WindowFlags flag, bool enabled, int window_id=0 )

void

window_set_ime_active ( bool active, int window_id=0 )

void

window_set_ime_position ( Vector2i position, int window_id=0 )

void

window_set_input_event_callback ( Callable callback, int window_id=0 )

void

window_set_input_text_callback ( Callable callback, int window_id=0 )

void

window_set_max_size ( Vector2i max_size, int window_id=0 )

void

window_set_min_size ( Vector2i min_size, int window_id=0 )

void

window_set_mode ( WindowMode mode, int window_id=0 )

void

window_set_mouse_passthrough ( PackedVector2Array region, int window_id=0 )

void

window_set_popup_safe_rect ( int window, Rect2i rect )

void

window_set_position ( Vector2i position, int window_id=0 )

void

window_set_rect_changed_callback ( Callable callback, int window_id=0 )

void

window_set_size ( Vector2i size, int window_id=0 )

void

window_set_title ( String title, int window_id=0 )

void

window_set_transient ( int window_id, int parent_window_id )

void

window_set_vsync_mode ( VSyncMode vsync_mode, int window_id=0 )

void

window_set_window_buttons_offset ( Vector2i offset, int window_id=0 )

void

window_set_window_event_callback ( Callable callback, int window_id=0 )


Enumerations

enum Feature:

Feature FEATURE_GLOBAL_MENU = 0

Display server supports global menu. This allows the application to display its menu items in the operating system’s top bar. macOS

Feature FEATURE_SUBWINDOWS = 1

Display server supports multiple windows that can be moved outside of the main window. Windows, macOS, Linux (X11)

Feature FEATURE_TOUCHSCREEN = 2

Display server supports touchscreen input. Windows, Linux (X11), Android, iOS, Web

Feature FEATURE_MOUSE = 3

Display server supports mouse input. Windows, macOS, Linux (X11), Android, Web

Feature FEATURE_MOUSE_WARP = 4

Display server supports warping mouse coordinates to keep the mouse cursor constrained within an area, but looping when one of the edges is reached. Windows, macOS, Linux (X11)

Feature FEATURE_CLIPBOARD = 5

Display server supports setting and getting clipboard data. See also FEATURE_CLIPBOARD_PRIMARY. Windows, macOS, Linux (X11), Android, iOS, Web

Feature FEATURE_VIRTUAL_KEYBOARD = 6

Display server supports popping up a virtual keyboard when requested to input text without a physical keyboard. Android, iOS, Web

Feature FEATURE_CURSOR_SHAPE = 7

Display server supports setting the mouse cursor shape to be different from the default. Windows, macOS, Linux (X11), Android, Web

Feature FEATURE_CUSTOM_CURSOR_SHAPE = 8

Display server supports setting the mouse cursor shape to a custom image. Windows, macOS, Linux (X11), Web

Feature FEATURE_NATIVE_DIALOG = 9

Display server supports spawning dialogs using the operating system’s native look-and-feel. macOS

Feature FEATURE_IME = 10

Display server supports Input Method Editor, which is commonly used for inputting Chinese/Japanese/Korean text. This is handled by the operating system, rather than by Godot. Windows, macOS, Linux (X11)

Feature FEATURE_WINDOW_TRANSPARENCY = 11

Display server supports windows can use per-pixel transparency to make windows behind them partially or fully visible. Windows, macOS, Linux (X11)

Feature FEATURE_HIDPI = 12

Display server supports querying the operating system’s display scale factor. This allows for reliable automatic hiDPI display detection, as opposed to guessing based on the screen resolution and reported display DPI (which can be unreliable due to broken monitor EDID). Windows, macOS

Feature FEATURE_ICON = 13

Display server supports changing the window icon (usually displayed in the top-left corner). Windows, macOS, Linux (X11)

Feature FEATURE_NATIVE_ICON = 14

Display server supports changing the window icon (usually displayed in the top-left corner). Windows, macOS

Feature FEATURE_ORIENTATION = 15

Display server supports changing the screen orientation. Android, iOS

Feature FEATURE_SWAP_BUFFERS = 16

Display server supports V-Sync status can be changed from the default (which is forced to be enabled platforms not supporting this feature). Windows, macOS, Linux (X11)

Feature FEATURE_CLIPBOARD_PRIMARY = 18

Display server supports Primary clipboard can be used. This is a different clipboard from FEATURE_CLIPBOARD. Linux (X11)

Feature FEATURE_TEXT_TO_SPEECH = 19

Display server supports text-to-speech. See tts_* methods. Windows, macOS, Linux (X11), Android, iOS, Web

Feature FEATURE_EXTEND_TO_TITLE = 20

Display server supports expanding window content to the title. See WINDOW_FLAG_EXTEND_TO_TITLE. macOS

Feature FEATURE_SCREEN_CAPTURE = 21

Display server supports reading screen pixels. See screen_get_pixel.


enum MouseMode:

MouseMode MOUSE_MODE_VISIBLE = 0

Makes the mouse cursor visible if it is hidden.

MouseMode MOUSE_MODE_HIDDEN = 1

Makes the mouse cursor hidden if it is visible.

MouseMode MOUSE_MODE_CAPTURED = 2

Captures the mouse. The mouse will be hidden and its position locked at the center of the window manager’s window.

Note: If you want to process the mouse’s movement in this mode, you need to use InputEventMouseMotion.relative.

MouseMode MOUSE_MODE_CONFINED = 3

Confines the mouse cursor to the game window, and make it visible.

MouseMode MOUSE_MODE_CONFINED_HIDDEN = 4

Confines the mouse cursor to the game window, and make it hidden.


enum ScreenOrientation:

ScreenOrientation SCREEN_LANDSCAPE = 0

Default landscape orientation.

ScreenOrientation SCREEN_PORTRAIT = 1

Default portrait orientation.

ScreenOrientation SCREEN_REVERSE_LANDSCAPE = 2

Reverse landscape orientation (upside down).

ScreenOrientation SCREEN_REVERSE_PORTRAIT = 3

Reverse portrait orientation (upside down).

ScreenOrientation SCREEN_SENSOR_LANDSCAPE = 4

Automatic landscape orientation (default or reverse depending on sensor).

ScreenOrientation SCREEN_SENSOR_PORTRAIT = 5

Automatic portrait orientation (default or reverse depending on sensor).

ScreenOrientation SCREEN_SENSOR = 6

Automatic landscape or portrait orientation (default or reverse depending on sensor).


enum VirtualKeyboardType:

VirtualKeyboardType KEYBOARD_TYPE_DEFAULT = 0

Default text virtual keyboard.

VirtualKeyboardType KEYBOARD_TYPE_MULTILINE = 1

Multiline virtual keyboard.

VirtualKeyboardType KEYBOARD_TYPE_NUMBER = 2

Virtual number keypad, useful for PIN entry.

VirtualKeyboardType KEYBOARD_TYPE_NUMBER_DECIMAL = 3

Virtual number keypad, useful for entering fractional numbers.

VirtualKeyboardType KEYBOARD_TYPE_PHONE = 4

Virtual phone number keypad.

VirtualKeyboardType KEYBOARD_TYPE_EMAIL_ADDRESS = 5

Virtual keyboard with additional keys to assist with typing email addresses.

VirtualKeyboardType KEYBOARD_TYPE_PASSWORD = 6

Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization.

Note: This is not supported on Web. Instead, this behaves identically to KEYBOARD_TYPE_DEFAULT.

VirtualKeyboardType KEYBOARD_TYPE_URL = 7

Virtual keyboard with additional keys to assist with typing URLs.


enum CursorShape:

CursorShape CURSOR_ARROW = 0

Arrow cursor shape. This is the default when not pointing anything that overrides the mouse cursor, such as a LineEdit or TextEdit.

CursorShape CURSOR_IBEAM = 1

I-beam cursor shape. This is used by default when hovering a control that accepts text input, such as LineEdit or TextEdit.

CursorShape CURSOR_POINTING_HAND = 2

Pointing hand cursor shape. This is used by default when hovering a LinkButton or a URL tag in a RichTextLabel.

CursorShape CURSOR_CROSS = 3

Crosshair cursor. This is intended to be displayed when the user needs precise aim over an element, such as a rectangle selection tool or a color picker.

CursorShape CURSOR_WAIT = 4

Wait cursor. On most cursor themes, this displays a spinning icon besides the arrow. Intended to be used for non-blocking operations (when the user can do something else at the moment). See also CURSOR_BUSY.

CursorShape CURSOR_BUSY = 5

Wait cursor. On most cursor themes, this replaces the arrow with a spinning icon. Intended to be used for blocking operations (when the user can’t do anything else at the moment). See also CURSOR_WAIT.

CursorShape CURSOR_DRAG = 6

Dragging hand cursor. This is displayed during drag-and-drop operations. See also CURSOR_CAN_DROP.

CursorShape CURSOR_CAN_DROP = 7

“Can drop” cursor. This is displayed during drag-and-drop operations if hovering over a Control that can accept the drag-and-drop event. On most cursor themes, this displays a dragging hand with an arrow symbol besides it. See also CURSOR_DRAG.

CursorShape CURSOR_FORBIDDEN = 8

Forbidden cursor. This is displayed during drag-and-drop operations if the hovered Control can’t accept the drag-and-drop event.

CursorShape CURSOR_VSIZE = 9

Vertical resize cursor. Intended to be displayed when the hovered Control can be vertically resized using the mouse. See also CURSOR_VSPLIT.

CursorShape CURSOR_HSIZE = 10

Horizontal resize cursor. Intended to be displayed when the hovered Control can be horizontally resized using the mouse. See also CURSOR_HSPLIT.

CursorShape CURSOR_BDIAGSIZE = 11

Secondary diagonal resize cursor (top-right/bottom-left). Intended to be displayed when the hovered Control can be resized on both axes at once using the mouse.

CursorShape CURSOR_FDIAGSIZE = 12

Main diagonal resize cursor (top-left/bottom-right). Intended to be displayed when the hovered Control can be resized on both axes at once using the mouse.

CursorShape CURSOR_MOVE = 13

Move cursor. Intended to be displayed when the hovered Control can be moved using the mouse.

CursorShape CURSOR_VSPLIT = 14

Vertical split cursor. This is displayed when hovering a Control with splits that can be vertically resized using the mouse, such as VSplitContainer. On some cursor themes, this cursor may have the same appearance as CURSOR_VSIZE.

CursorShape CURSOR_HSPLIT = 15

Horizontal split cursor. This is displayed when hovering a Control with splits that can be horizontally resized using the mouse, such as HSplitContainer. On some cursor themes, this cursor may have the same appearance as CURSOR_HSIZE.

CursorShape CURSOR_HELP = 16

Help cursor. On most cursor themes, this displays a question mark icon instead of the mouse cursor. Intended to be used when the user has requested help on the next element that will be clicked.

CursorShape CURSOR_MAX = 17

Represents the size of the CursorShape enum.


enum FileDialogMode:

FileDialogMode FILE_DIALOG_MODE_OPEN_FILE = 0

The native file dialog allows selecting one, and only one file.

FileDialogMode FILE_DIALOG_MODE_OPEN_FILES = 1

The native file dialog allows selecting multiple files.

FileDialogMode FILE_DIALOG_MODE_OPEN_DIR = 2

The native file dialog only allows selecting a directory, disallowing the selection of any file.

FileDialogMode FILE_DIALOG_MODE_OPEN_ANY = 3

The native file dialog allows selecting one file or directory.

FileDialogMode FILE_DIALOG_MODE_SAVE_FILE = 4

The native file dialog will warn when a file exists.


enum WindowMode:

WindowMode WINDOW_MODE_WINDOWED = 0

Windowed mode, i.e. Window doesn’t occupy the whole screen (unless set to the size of the screen).

WindowMode WINDOW_MODE_MINIMIZED = 1

Minimized window mode, i.e. Window is not visible and available on window manager’s window list. Normally happens when the minimize button is pressed.

WindowMode WINDOW_MODE_MAXIMIZED = 2

Maximized window mode, i.e. Window will occupy whole screen area except task bar and still display its borders. Normally happens when the maximize button is pressed.

WindowMode WINDOW_MODE_FULLSCREEN = 3

Full screen mode with full multi-window support.

Full screen window covers the entire display area of a screen and has no decorations. The display’s video mode is not changed.

On Windows: Multi-window full-screen mode has a 1px border of the ProjectSettings.rendering/environment/defaults/default_clear_color color.

On macOS: A new desktop is used to display the running project.

Note: Regardless of the platform, enabling full screen will change the window size to match the monitor’s size. Therefore, make sure your project supports multiple resolutions when enabling full screen mode.

WindowMode WINDOW_MODE_EXCLUSIVE_FULLSCREEN = 4

A single window full screen mode. This mode has less overhead, but only one window can be open on a given screen at a time (opening a child window or application switching will trigger a full screen transition).

Full screen window covers the entire display area of a screen and has no border or decorations. The display’s video mode is not changed.

On Windows: Depending on video driver, full screen transition might cause screens to go black for a moment.

On macOS: A new desktop is used to display the running project. Exclusive full screen mode prevents Dock and Menu from showing up when the mouse pointer is hovering the edge of the screen.

On Linux (X11): Exclusive full screen mode bypasses compositor.

Note: Regardless of the platform, enabling full screen will change the window size to match the monitor’s size. Therefore, make sure your project supports multiple resolutions when enabling full screen mode.


enum WindowFlags:

WindowFlags WINDOW_FLAG_RESIZE_DISABLED = 0

The window can’t be resized by dragging its resize grip. It’s still possible to resize the window using window_set_size. This flag is ignored for full screen windows.

WindowFlags WINDOW_FLAG_BORDERLESS = 1

The window do not have native title bar and other decorations. This flag is ignored for full-screen windows.

WindowFlags WINDOW_FLAG_ALWAYS_ON_TOP = 2

The window is floating on top of all other windows. This flag is ignored for full-screen windows.

WindowFlags WINDOW_FLAG_TRANSPARENT = 3

The window background can be transparent.

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

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

WindowFlags WINDOW_FLAG_NO_FOCUS = 4

The window can’t be focused. No-focus window will ignore all input, except mouse clicks.

WindowFlags WINDOW_FLAG_POPUP = 5

Window is part of menu or OptionButton dropdown. This flag can’t be changed when the window is visible. An active popup window will exclusively receive all input, without stealing focus from its parent. Popup windows are automatically closed when uses click outside it, or when an application is switched. Popup window must have transient parent set (see window_set_transient).

WindowFlags WINDOW_FLAG_EXTEND_TO_TITLE = 6

Window content is expanded to the full size of the window. Unlike borderless window, the frame is left intact and can be used to resize the window, title bar is transparent, but have minimize/maximize/close buttons.

Use window_set_window_buttons_offset to adjust minimize/maximize/close buttons offset.

Use window_get_safe_title_margins to determine area under the title bar that is not covered by decorations.

Note: This flag is implemented only on macOS.

WindowFlags WINDOW_FLAG_MOUSE_PASSTHROUGH = 7

All mouse events are passed to the underlying window of the same application.

WindowFlags WINDOW_FLAG_MAX = 8

Max value of the WindowFlags.


enum WindowEvent:

WindowEvent WINDOW_EVENT_MOUSE_ENTER = 0

Sent when the mouse pointer enters the window.

WindowEvent WINDOW_EVENT_MOUSE_EXIT = 1

Sent when the mouse pointer exits the window.

WindowEvent WINDOW_EVENT_FOCUS_IN = 2

Sent when the window grabs focus.

WindowEvent WINDOW_EVENT_FOCUS_OUT = 3

Sent when the window loses focus.

WindowEvent WINDOW_EVENT_CLOSE_REQUEST = 4

Sent when the user has attempted to close the window (e.g. close button is pressed).

WindowEvent WINDOW_EVENT_GO_BACK_REQUEST = 5

Sent when the device “Back” button is pressed.

Note: This event is implemented only on Android.

WindowEvent WINDOW_EVENT_DPI_CHANGE = 6

Sent when the window is moved to the display with different DPI, or display DPI is changed.

Note: This flag is implemented only on macOS.

WindowEvent WINDOW_EVENT_TITLEBAR_CHANGE = 7

Sent when the window title bar decoration is changed (e.g. WINDOW_FLAG_EXTEND_TO_TITLE is set or window entered/exited full screen mode).

Note: This flag is implemented only on macOS.


enum VSyncMode:

VSyncMode VSYNC_DISABLED = 0

No vertical synchronization, which means the engine will display frames as fast as possible (tearing may be visible). Framerate is unlimited (notwithstanding Engine.max_fps).

VSyncMode VSYNC_ENABLED = 1

Default vertical synchronization mode, the image is displayed only on vertical blanking intervals (no tearing is visible). Framerate is limited by the monitor refresh rate (notwithstanding Engine.max_fps).

VSyncMode VSYNC_ADAPTIVE = 2

Behaves like VSYNC_DISABLED when the framerate drops below the screen’s refresh rate to reduce stuttering (tearing may be visible). Otherwise, vertical synchronization is enabled to avoid tearing. Framerate is limited by the monitor refresh rate (notwithstanding Engine.max_fps). Behaves like VSYNC_ENABLED when using the Compatibility rendering method.

VSyncMode VSYNC_MAILBOX = 3

Displays the most recent image in the queue on vertical blanking intervals, while rendering to the other images (no tearing is visible). Framerate is unlimited (notwithstanding Engine.max_fps).

Although not guaranteed, the images can be rendered as fast as possible, which may reduce input lag (also called “Fast” V-Sync mode). VSYNC_MAILBOX works best when at least twice as many frames as the display refresh rate are rendered. Behaves like VSYNC_ENABLED when using the Compatibility rendering method.


enum HandleType:

HandleType DISPLAY_HANDLE = 0

Display handle:

  • Linux (X11): X11::Display* for the display.

  • Android: EGLDisplay for the display.

HandleType WINDOW_HANDLE = 1

Window handle:

  • Windows: HWND for the window.

  • Linux (X11): X11::Window* for the window.

  • macOS: NSWindow* for the window.

  • iOS: UIViewController* for the view controller.

  • Android: jObject for the activity.

HandleType WINDOW_VIEW = 2

Window view:

  • Windows: HDC for the window (only with the GL Compatibility renderer).

  • macOS: NSView* for the window main view.

  • iOS: UIView* for the window main view.

HandleType OPENGL_CONTEXT = 3

OpenGL context (only with the GL Compatibility renderer):

  • Windows: HGLRC for the window (native GL), or EGLContext for the window (ANGLE).

  • Linux: GLXContext* for the window.

  • macOS: NSOpenGLContext* for the window (native GL), or EGLContext for the window (ANGLE).

  • Android: EGLContext for the window.


enum TTSUtteranceEvent:

TTSUtteranceEvent TTS_UTTERANCE_STARTED = 0

Utterance has begun to be spoken.

TTSUtteranceEvent TTS_UTTERANCE_ENDED = 1

Utterance was successfully finished.

TTSUtteranceEvent TTS_UTTERANCE_CANCELED = 2

Utterance was canceled, or TTS service was unable to process it.

TTSUtteranceEvent TTS_UTTERANCE_BOUNDARY = 3

Utterance reached a word or sentence boundary.


Constants

SCREEN_WITH_MOUSE_FOCUS = -4

Represents the screen containing the mouse pointer.

SCREEN_WITH_KEYBOARD_FOCUS = -3

Represents the screen containing the window with the keyboard focus.

SCREEN_PRIMARY = -2

Represents the primary screen.

SCREEN_OF_MAIN_WINDOW = -1

Represents the screen where the main window is located. This is usually the default value in functions that allow specifying one of several screens.

MAIN_WINDOW_ID = 0

The ID of the main window spawned by the engine, which can be passed to methods expecting a window_id.

INVALID_WINDOW_ID = -1

The ID that refers to a nonexisting window. This is be returned by some DisplayServer methods if no window matches the requested result.


Method Descriptions

String clipboard_get ( ) const

Returns the user’s clipboard as a string if possible.


Image clipboard_get_image ( ) const

Returns the user’s clipboard as an image if possible.


String clipboard_get_primary ( ) const

Returns the user’s primary clipboard as a string if possible. This is the clipboard that is set when the user selects text in any application, rather than when pressing Ctrl + C. The clipboard data can then be pasted by clicking the middle mouse button in any application that supports the primary clipboard mechanism.

Note: This method is only implemented on Linux (X11).


bool clipboard_has ( ) const

Returns true if there is a text content on the user’s clipboard.


bool clipboard_has_image ( ) const

Returns true if there is an image content on the user’s clipboard.


void clipboard_set ( String clipboard )

Sets the user’s clipboard content to the given string.


void clipboard_set_primary ( String clipboard_primary )

Sets the user’s primary clipboard content to the given string. This is the clipboard that is set when the user selects text in any application, rather than when pressing Ctrl + C. The clipboard data can then be pasted by clicking the middle mouse button in any application that supports the primary clipboard mechanism.

Note: This method is only implemented on Linux (X11).


CursorShape cursor_get_shape ( ) const

Returns the default mouse cursor shape set by cursor_set_shape.


void cursor_set_custom_image ( Resource cursor, CursorShape shape=0, Vector2 hotspot=Vector2(0, 0) )

Sets a custom mouse cursor image for the defined shape. This means the user’s operating system and mouse cursor theme will no longer influence the mouse cursor’s appearance. The image must be 256x256 or smaller for correct appearance. hotspot can optionally be set to define the area where the cursor will click. By default, hotspot is set to Vector2(0, 0), which is the top-left corner of the image. See also cursor_set_shape.


void cursor_set_shape ( CursorShape shape )

Sets the default mouse cursor shape. The cursor’s appearance will vary depending on the user’s operating system and mouse cursor theme. See also cursor_get_shape and cursor_set_custom_image.


Error dialog_input_text ( String title, String description, String existing_text, Callable callback )

Shows a text input dialog which uses the operating system’s native look-and-feel. callback will be called with a String argument equal to the text field’s contents when the dialog is closed for any reason.

Note: This method is implemented only on macOS.


Error dialog_show ( String title, String description, PackedStringArray buttons, Callable callback )

Shows a text dialog which uses the operating system’s native look-and-feel. callback will be called when the dialog is closed for any reason.

Note: This method is implemented only on macOS.


void enable_for_stealing_focus ( int process_id )

Allows the process_id PID to steal focus from this window. In other words, this disables the operating system’s focus stealing protection for the specified PID.

Note: This method is implemented only on Windows.


Error file_dialog_show ( String title, String current_directory, String filename, bool show_hidden, FileDialogMode mode, PackedStringArray filters, Callable callback )

Displays OS native dialog for selecting files or directories in the file system.

Callbacks have the following arguments: bool status, PackedStringArray selected_paths, int selected_filter_index.

Note: This method is implemented if the display server has the FEATURE_NATIVE_DIALOG feature.

Note: This method is implemented on Linux, Windows and macOS.

Note: current_directory might be ignored.

Note: On Linux, show_hidden is ignored.

Note: On macOS, native file dialogs have no title.

Note: On macOS, sandboxed apps will save security-scoped bookmarks to retain access to the opened folders across multiple sessions. Use OS.get_granted_permissions to get a list of saved bookmarks.


void force_process_and_drop_events ( )

Forces window manager processing while ignoring all InputEvents. See also process_events.

Note: This method is implemented on Windows and macOS.


Color get_accent_color ( ) const

Returns OS theme accent color. Returns Color(0, 0, 0, 0), if accent color is unknown.

Note: This method is implemented on macOS and Windows.


Rect2[] get_display_cutouts ( ) const

Returns an Array of Rect2, each of which is the bounding rectangle for a display cutout or notch. These are non-functional areas on edge-to-edge screens used by cameras and sensors. Returns an empty array if the device does not have cutouts. See also get_display_safe_area.

Note: Currently only implemented on Android. Other platforms will return an empty array even if they do have display cutouts or notches.


Rect2i get_display_safe_area ( ) const

Returns the unobscured area of the display where interactive controls should be rendered. See also get_display_cutouts.


int get_keyboard_focus_screen ( ) const

Returns the index of the screen containing the window with the keyboard focus, or the primary screen if there’s no focused window.


String get_name ( ) const

Returns the name of the DisplayServer currently in use. Most operating systems only have a single DisplayServer, but Linux has access to more than one DisplayServer (although only X11 is currently implemented in Godot).

The names of built-in display servers are Windows, macOS, X11 (Linux), Android, iOS, web (HTML5) and headless (when started with the --headless command line argument).


int get_primary_screen ( ) const

Returns index of the primary screen.


int get_screen_count ( ) const

Returns the number of displays available.


int get_screen_from_rect ( Rect2 rect ) const

Returns index of the screen which contains specified rectangle.


bool get_swap_cancel_ok ( )

Returns true if positions of OK and Cancel buttons are swapped in dialogs. This is enabled by default on Windows to follow interface conventions, and be toggled by changing ProjectSettings.gui/common/swap_cancel_ok.

Note: This doesn’t affect native dialogs such as the ones spawned by dialog_show.


int get_window_at_screen_position ( Vector2i position ) const

Returns the ID of the window at the specified screen position (in pixels). On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:

  1. * (0, 0) +-------+
  2. | |
  3. +-------------+ | |
  4. | | | |
  5. | | | |
  6. +-------------+ +-------+

PackedInt32Array get_window_list ( ) const

Returns the list of Godot window IDs belonging to this process.

Note: Native dialogs are not included in this list.


int global_menu_add_check_item ( String menu_root, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

Adds a new checkable item with text label to the global menu with ID menu_root.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

An accelerator can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it’s not currently open. The accelerator is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_icon_check_item ( String menu_root, Texture2D icon, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

Adds a new checkable item with text label and icon icon to the global menu with ID menu_root.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

An accelerator can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it’s not currently open. The accelerator is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_icon_item ( String menu_root, Texture2D icon, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

Adds a new item with text label and icon icon to the global menu with ID menu_root.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

An accelerator can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it’s not currently open. The accelerator is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_icon_radio_check_item ( String menu_root, Texture2D icon, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

Adds a new radio-checkable item with text label and icon icon to the global menu with ID menu_root.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

An accelerator can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it’s not currently open. The accelerator is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: Radio-checkable items just display a checkmark, but don’t have any built-in checking behavior and must be checked/unchecked manually. See global_menu_set_item_checked for more info on how to control it.

Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_item ( String menu_root, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

Adds a new item with text label to the global menu with ID menu_root.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

An accelerator can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it’s not currently open. The accelerator is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_multistate_item ( String menu_root, String label, int max_states, int default_state, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

Adds a new item with text label to the global menu with ID menu_root.

Contrarily to normal binary items, multistate items can have more than two states, as defined by max_states. Each press or activate of the item will increase the state by one. The default value is defined by default_state.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

An accelerator can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it’s not currently open. The accelerator is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: By default, there’s no indication of the current item state, it should be changed manually.

Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_radio_check_item ( String menu_root, String label, Callable callback=Callable(), Callable key_callback=Callable(), Variant tag=null, Key accelerator=0, int index=-1 )

Adds a new radio-checkable item with text label to the global menu with ID menu_root.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

An accelerator can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it’s not currently open. The accelerator is generally a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: Radio-checkable items just display a checkmark, but don’t have any built-in checking behavior and must be checked/unchecked manually. See global_menu_set_item_checked for more info on how to control it.

Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_separator ( String menu_root, int index=-1 )

Adds a separator between items to the global menu with ID menu_root. Separators also occupy an index.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

int global_menu_add_submenu_item ( String menu_root, String label, String submenu, int index=-1 )

Adds an item that will act as a submenu of the global menu menu_root. The submenu argument is the ID of the global menu root that will be shown when the item is clicked.

Returns index of the inserted item, it’s not guaranteed to be the same as index value.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

void global_menu_clear ( String menu_root )

Removes all items from the global menu with ID menu_root.

Note: This method is implemented only on macOS.

Supported system menu IDs:

  1. "_main" - Main menu (macOS).
  2. "_dock" - Dock popup menu (macOS).

Key global_menu_get_item_accelerator ( String menu_root, int idx ) const

Returns the accelerator of the item at index idx. Accelerators are special combinations of keys that activate the item, no matter which control is focused.

Note: This method is implemented only on macOS.


Callable global_menu_get_item_callback ( String menu_root, int idx ) const

Returns the callback of the item at index idx.

Note: This method is implemented only on macOS.


int global_menu_get_item_count ( String menu_root ) const

Returns number of items in the global menu with ID menu_root.

Note: This method is implemented only on macOS.


Texture2D global_menu_get_item_icon ( String menu_root, int idx ) const

Returns the icon of the item at index idx.

Note: This method is implemented only on macOS.


int global_menu_get_item_indentation_level ( String menu_root, int idx ) const

Returns the horizontal offset of the item at the given idx.

Note: This method is implemented only on macOS.


int global_menu_get_item_index_from_tag ( String menu_root, Variant tag ) const

Returns the index of the item with the specified tag. Index is automatically assigned to each item by the engine. Index can not be set manually.

Note: This method is implemented only on macOS.


int global_menu_get_item_index_from_text ( String menu_root, String text ) const

Returns the index of the item with the specified text. Index is automatically assigned to each item by the engine. Index can not be set manually.

Note: This method is implemented only on macOS.


Callable global_menu_get_item_key_callback ( String menu_root, int idx ) const

Returns the callback of the item accelerator at index idx.

Note: This method is implemented only on macOS.


int global_menu_get_item_max_states ( String menu_root, int idx ) const

Returns number of states of a multistate item. See global_menu_add_multistate_item for details.

Note: This method is implemented only on macOS.


int global_menu_get_item_state ( String menu_root, int idx ) const

Returns the state of a multistate item. See global_menu_add_multistate_item for details.

Note: This method is implemented only on macOS.


String global_menu_get_item_submenu ( String menu_root, int idx ) const

Returns the submenu ID of the item at index idx. See global_menu_add_submenu_item for more info on how to add a submenu.

Note: This method is implemented only on macOS.


Variant global_menu_get_item_tag ( String menu_root, int idx ) const

Returns the metadata of the specified item, which might be of any type. You can set it with global_menu_set_item_tag, which provides a simple way of assigning context data to items.

Note: This method is implemented only on macOS.


String global_menu_get_item_text ( String menu_root, int idx ) const

Returns the text of the item at index idx.

Note: This method is implemented only on macOS.


String global_menu_get_item_tooltip ( String menu_root, int idx ) const

Returns the tooltip associated with the specified index idx.

Note: This method is implemented only on macOS.


bool global_menu_is_item_checkable ( String menu_root, int idx ) const

Returns true if the item at index idx is checkable in some way, i.e. if it has a checkbox or radio button.

Note: This method is implemented only on macOS.


bool global_menu_is_item_checked ( String menu_root, int idx ) const

Returns true if the item at index idx is checked.

Note: This method is implemented only on macOS.


bool global_menu_is_item_disabled ( String menu_root, int idx ) const

Returns true if the item at index idx is disabled. When it is disabled it can’t be selected, or its action invoked.

See global_menu_set_item_disabled for more info on how to disable an item.

Note: This method is implemented only on macOS.


bool global_menu_is_item_hidden ( String menu_root, int idx ) const

Returns true if the item at index idx is hidden.

See global_menu_set_item_hidden for more info on how to hide an item.

Note: This method is implemented only on macOS.


bool global_menu_is_item_radio_checkable ( String menu_root, int idx ) const

Returns true if the item at index idx has radio button-style checkability.

Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.

Note: This method is implemented only on macOS.


void global_menu_remove_item ( String menu_root, int idx )

Removes the item at index idx from the global menu menu_root.

Note: The indices of items after the removed item will be shifted by one.

Note: This method is implemented only on macOS.


void global_menu_set_item_accelerator ( String menu_root, int idx, Key keycode )

Sets the accelerator of the item at index idx. keycode can be a single Key, or a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: This method is implemented only on macOS.


void global_menu_set_item_callback ( String menu_root, int idx, Callable callback )

Sets the callback of the item at index idx. Callback is emitted when an item is pressed.

Note: The callback Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.

Note: This method is implemented only on macOS.


void global_menu_set_item_checkable ( String menu_root, int idx, bool checkable )

Sets whether the item at index idx has a checkbox. If false, sets the type of the item to plain text.

Note: This method is implemented only on macOS.


void global_menu_set_item_checked ( String menu_root, int idx, bool checked )

Sets the checkstate status of the item at index idx.

Note: This method is implemented only on macOS.


void global_menu_set_item_disabled ( String menu_root, int idx, bool disabled )

Enables/disables the item at index idx. When it is disabled, it can’t be selected and its action can’t be invoked.

Note: This method is implemented only on macOS.


void global_menu_set_item_hidden ( String menu_root, int idx, bool hidden )

Hides/shows the item at index idx. When it is hidden, an item does not appear in a menu and its action cannot be invoked.

Note: This method is implemented only on macOS.


void global_menu_set_item_hover_callbacks ( String menu_root, int idx, Callable callback )

Sets the callback of the item at index idx. The callback is emitted when an item is hovered.

Note: The callback Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.

Note: This method is implemented only on macOS.


void global_menu_set_item_icon ( String menu_root, int idx, Texture2D icon )

Replaces the Texture2D icon of the specified idx.

Note: This method is implemented only on macOS.

Note: This method is not supported by macOS “_dock” menu items.


void global_menu_set_item_indentation_level ( String menu_root, int idx, int level )

Sets the horizontal offset of the item at the given idx.

Note: This method is implemented only on macOS.


void global_menu_set_item_key_callback ( String menu_root, int idx, Callable key_callback )

Sets the callback of the item at index idx. Callback is emitted when its accelerator is activated.

Note: The key_callback Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.

Note: This method is implemented only on macOS.


void global_menu_set_item_max_states ( String menu_root, int idx, int max_states )

Sets number of state of a multistate item. See global_menu_add_multistate_item for details.

Note: This method is implemented only on macOS.


void global_menu_set_item_radio_checkable ( String menu_root, int idx, bool checkable )

Sets the type of the item at the specified index idx to radio button. If false, sets the type of the item to plain text.

Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.

Note: This method is implemented only on macOS.


void global_menu_set_item_state ( String menu_root, int idx, int state )

Sets the state of a multistate item. See global_menu_add_multistate_item for details.

Note: This method is implemented only on macOS.


void global_menu_set_item_submenu ( String menu_root, int idx, String submenu )

Sets the submenu of the item at index idx. The submenu is the ID of a global menu root that would be shown when the item is clicked.

Note: This method is implemented only on macOS.


void global_menu_set_item_tag ( String menu_root, int idx, Variant tag )

Sets the metadata of an item, which may be of any type. You can later get it with global_menu_get_item_tag, which provides a simple way of assigning context data to items.

Note: This method is implemented only on macOS.


void global_menu_set_item_text ( String menu_root, int idx, String text )

Sets the text of the item at index idx.

Note: This method is implemented only on macOS.


void global_menu_set_item_tooltip ( String menu_root, int idx, String tooltip )

Sets the String tooltip of the item at the specified index idx.

Note: This method is implemented only on macOS.


void global_menu_set_popup_callbacks ( String menu_root, Callable open_callback, Callable close_callback )

Registers callables to emit when the menu is respectively about to show or closed.


bool has_feature ( Feature feature ) const

Returns true if the specified feature is supported by the current DisplayServer, false otherwise.


Vector2i ime_get_selection ( ) const

Returns the text selection in the Input Method Editor composition string, with the Vector2i‘s x component being the caret position and y being the length of the selection.

Note: This method is implemented only on macOS.


String ime_get_text ( ) const

Returns the composition string contained within the Input Method Editor window.

Note: This method is implemented only on macOS.


bool is_dark_mode ( ) const

Returns true if OS is using dark mode.

Note: This method is implemented on Android, iOS, macOS, Windows, and Linux (X11).


bool is_dark_mode_supported ( ) const

Returns true if OS supports dark mode.

Note: This method is implemented on Android, iOS, macOS, Windows, and Linux (X11).


bool is_touchscreen_available ( ) const

Returns true if touch events are available (Android or iOS), the capability is detected on the Web platform or if ProjectSettings.input_devices/pointing/emulate_touch_from_mouse is true.


int keyboard_get_current_layout ( ) const

Returns active keyboard layout index.

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


Key keyboard_get_keycode_from_physical ( Key keycode ) const

Converts a physical (US QWERTY) keycode to one in the active keyboard layout.

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


Key keyboard_get_label_from_physical ( Key keycode ) const

Converts a physical (US QWERTY) keycode to localized label printed on the key in the active keyboard layout.

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


int keyboard_get_layout_count ( ) const

Returns the number of keyboard layouts.

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


String keyboard_get_layout_language ( int index ) const

Returns the ISO-639/BCP-47 language code of the keyboard layout at position index.

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


String keyboard_get_layout_name ( int index ) const

Returns the localized name of the keyboard layout at position index.

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


void keyboard_set_current_layout ( int index )

Sets the active keyboard layout.

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


BitField<MouseButtonMask> mouse_get_button_state ( ) const

Returns the current state of mouse buttons (whether each button is pressed) as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. Equivalent to Input.get_mouse_button_mask.


MouseMode mouse_get_mode ( ) const

Returns the current mouse mode. See also mouse_set_mode.


Vector2i mouse_get_position ( ) const

Returns the mouse cursor’s current position in screen coordinates.


void mouse_set_mode ( MouseMode mouse_mode )

Sets the current mouse mode. See also mouse_get_mode.


void process_events ( )

Perform window manager processing, including input flushing. See also force_process_and_drop_events, Input.flush_buffered_events and Input.use_accumulated_input.


int screen_get_dpi ( int screen=-1 ) const

Returns the dots per inch density of the specified screen. If screen is SCREEN_OF_MAIN_WINDOW (the default value), a screen with the main window will be used.

Note: On macOS, returned value is inaccurate if fractional display scaling mode is used.

Note: On Android devices, the actual screen densities are grouped into six generalized densities:

  1. ldpi - 120 dpi
  2. mdpi - 160 dpi
  3. hdpi - 240 dpi
  4. xhdpi - 320 dpi
  5. xxhdpi - 480 dpi
  6. xxxhdpi - 640 dpi

Note: This method is implemented on Android, Linux (X11), macOS and Windows. Returns 72 on unsupported platforms.


Image screen_get_image ( int screen=-1 ) const

Returns screenshot of the screen.

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

Note: On macOS, this method requires “Screen Recording” permission, if permission is not granted it will return desktop wallpaper color.


float screen_get_max_scale ( ) const

Returns the greatest scale factor of all screens.

Note: On macOS returned value is 2.0 if there is at least one hiDPI (Retina) screen in the system, and 1.0 in all other cases.

Note: This method is implemented only on macOS.


ScreenOrientation screen_get_orientation ( int screen=-1 ) const

Returns the screen‘s current orientation. See also screen_set_orientation.

Note: This method is implemented on Android and iOS.


Color screen_get_pixel ( Vector2i position ) const

Returns color of the display pixel at the position.

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

Note: On macOS, this method requires “Screen Recording” permission, if permission is not granted it will return desktop wallpaper color.


Vector2i screen_get_position ( int screen=-1 ) const

Returns the screen’s top-left corner position in pixels. On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:

  1. * (0, 0) +-------+
  2. | |
  3. +-------------+ | |
  4. | | | |
  5. | | | |
  6. +-------------+ +-------+

See also screen_get_size.


float screen_get_refresh_rate ( int screen=-1 ) const

Returns the current refresh rate of the specified screen. If screen is SCREEN_OF_MAIN_WINDOW (the default value), a screen with the main window will be used.

Note: Returns -1.0 if the DisplayServer fails to find the refresh rate for the specified screen. On Web, screen_get_refresh_rate will always return -1.0 as there is no way to retrieve the refresh rate on that platform.

To fallback to a default refresh rate if the method fails, try:

  1. var refresh_rate = DisplayServer.screen_get_refresh_rate()
  2. if refresh_rate < 0:
  3. refresh_rate = 60.0

float screen_get_scale ( int screen=-1 ) const

Returns the scale factor of the specified screen by index.

Note: On macOS returned value is 2.0 for hiDPI (Retina) screen, and 1.0 for all other cases.

Note: This method is implemented only on macOS.


Vector2i screen_get_size ( int screen=-1 ) const

Returns the screen’s size in pixels. See also screen_get_position and screen_get_usable_rect.


Rect2i screen_get_usable_rect ( int screen=-1 ) const

Returns the portion of the screen that is not obstructed by a status bar in pixels. See also screen_get_size.


bool screen_is_kept_on ( ) const

Returns true if the screen should never be turned off by the operating system’s power-saving measures. See also screen_set_keep_on.


void screen_set_keep_on ( bool enable )

Sets whether the screen should never be turned off by the operating system’s power-saving measures. See also screen_is_kept_on.


void screen_set_orientation ( ScreenOrientation orientation, int screen=-1 )

Sets the screen‘s orientation. See also screen_get_orientation.

Note: On iOS, this method has no effect if ProjectSettings.display/window/handheld/orientation is not set to SCREEN_SENSOR.


void set_icon ( Image image )

Sets the window icon (usually displayed in the top-left corner) with an Image. To use icons in the operating system’s native format, use set_native_icon instead.


void set_native_icon ( String filename )

Sets the window icon (usually displayed in the top-left corner) in the operating system’s native format. The file at filename must be in .ico format on Windows or .icns on macOS. By using specially crafted .ico or .icns icons, set_native_icon allows specifying different icons depending on the size the icon is displayed at. This size is determined by the operating system and user preferences (including the display scale factor). To use icons in other formats, use set_icon instead.


String tablet_get_current_driver ( ) const

Returns current active tablet driver name.

Note: This method is implemented only on Windows.


int tablet_get_driver_count ( ) const

Returns the total number of available tablet drivers.

Note: This method is implemented only on Windows.


String tablet_get_driver_name ( int idx ) const

Returns the tablet driver name for the given index.

Note: This method is implemented only on Windows.


void tablet_set_current_driver ( String name )

Set active tablet driver name.

Note: This method is implemented only on Windows.


Dictionary[] tts_get_voices ( ) const

Returns an Array of voice information dictionaries.

Each Dictionary contains two String entries:

  • name is voice name.

  • id is voice identifier.

  • language is language code in lang_Variant format. The lang part is a 2 or 3-letter code based on the ISO-639 standard, in lowercase. The Variant part is an engine-dependent string describing country, region or/and dialect.

Note that Godot depends on system libraries for text-to-speech functionality. These libraries are installed by default on Windows and macOS, but not on all Linux distributions. If they are not present, this method will return an empty list. This applies to both Godot users on Linux, as well as end-users on Linux running Godot games that use text-to-speech.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


PackedStringArray tts_get_voices_for_language ( String language ) const

Returns an PackedStringArray of voice identifiers for the language.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


bool tts_is_paused ( ) const

Returns true if the synthesizer is in a paused state.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


bool tts_is_speaking ( ) const

Returns true if the synthesizer is generating speech, or have utterance waiting in the queue.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


void tts_pause ( )

Puts the synthesizer into a paused state.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


void tts_resume ( )

Resumes the synthesizer if it was paused.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


void tts_set_utterance_callback ( TTSUtteranceEvent event, Callable callable )

Adds a callback, which is called when the utterance has started, finished, canceled or reached a text boundary.

Note: The granularity of the boundary callbacks is engine dependent.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


void tts_speak ( String text, String voice, int volume=50, float pitch=1.0, float rate=1.0, int utterance_id=0, bool interrupt=false )

Adds an utterance to the queue. If interrupt is true, the queue is cleared first.

  • voice identifier is one of the "id" values returned by tts_get_voices or one of the values returned by tts_get_voices_for_language.

  • volume ranges from 0 (lowest) to 100 (highest).

  • pitch ranges from 0.0 (lowest) to 2.0 (highest), 1.0 is default pitch for the current voice.

  • rate ranges from 0.1 (lowest) to 10.0 (highest), 1.0 is a normal speaking rate. Other values act as a percentage relative.

  • utterance_id is passed as a parameter to the callback functions.

Note: On Windows and Linux (X11), utterance text can use SSML markup. SSML support is engine and voice dependent. If the engine does not support SSML, you should strip out all XML markup before calling tts_speak.

Note: The granularity of pitch, rate, and volume is engine and voice dependent. Values may be truncated.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


void tts_stop ( )

Stops synthesis in progress and removes all utterances from the queue.

Note: This method is implemented on Android, iOS, Web, Linux (X11), macOS, and Windows.

Note: ProjectSettings.audio/general/text_to_speech should be true to use text-to-speech.


int virtual_keyboard_get_height ( ) const

Returns the on-screen keyboard’s height in pixels. Returns 0 if there is no keyboard or if it is currently hidden.


void virtual_keyboard_hide ( )

Hides the virtual keyboard if it is shown, does nothing otherwise.


void virtual_keyboard_show ( String existing_text, Rect2 position=Rect2(0, 0, 0, 0), VirtualKeyboardType type=0, int max_length=-1, int cursor_start=-1, int cursor_end=-1 )

Shows the virtual keyboard if the platform has one.

existing_text parameter is useful for implementing your own LineEdit or TextEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions).

position parameter is the screen space Rect2 of the edited text.

type parameter allows configuring which type of virtual keyboard to show.

max_length limits the number of characters that can be entered if different from -1.

cursor_start can optionally define the current text cursor position if cursor_end is not set.

cursor_start and cursor_end can optionally define the current text selection.

Note: This method is implemented on Android, iOS and Web.


void warp_mouse ( Vector2i position )

Sets the mouse cursor position to the given position relative to an origin at the upper left corner of the currently focused game Window Manager window.

Note: warp_mouse is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.


bool window_can_draw ( int window_id=0 ) const

Returns true if anything can be drawn in the window specified by window_id, false otherwise. Using the --disable-render-loop command line argument or a headless build will return false.


int window_get_active_popup ( ) const

Returns ID of the active popup window, or INVALID_WINDOW_ID if there is none.


int window_get_attached_instance_id ( int window_id=0 ) const

Returns the Object.get_instance_id of the Window the window_id is attached to.


int window_get_current_screen ( int window_id=0 ) const

Returns the screen the window specified by window_id is currently positioned on. If the screen overlaps multiple displays, the screen where the window’s center is located is returned. See also window_set_current_screen.


bool window_get_flag ( WindowFlags flag, int window_id=0 ) const

Returns the current value of the given window’s flag.


Vector2i window_get_max_size ( int window_id=0 ) const

Returns the window’s maximum size (in pixels). See also window_set_max_size.


Vector2i window_get_min_size ( int window_id=0 ) const

Returns the window’s minimum size (in pixels). See also window_set_min_size.


WindowMode window_get_mode ( int window_id=0 ) const

Returns the mode of the given window.


int window_get_native_handle ( HandleType handle_type, int window_id=0 ) const

Returns internal structure pointers for use in plugins.

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


Rect2i window_get_popup_safe_rect ( int window ) const

Returns the bounding box of control, or menu item that was used to open the popup window, in the screen coordinate system.


Vector2i window_get_position ( int window_id=0 ) const

Returns the position of the client area of the given window on the screen.


Vector2i window_get_position_with_decorations ( int window_id=0 ) const

Returns the position of the given window on the screen including the borders drawn by the operating system. See also window_get_position.


Vector3i window_get_safe_title_margins ( int window_id=0 ) const

Returns left margins (x), right margins (y) and height (z) of the title that are safe to use (contains no buttons or other elements) when WINDOW_FLAG_EXTEND_TO_TITLE flag is set.


Vector2i window_get_size ( int window_id=0 ) const

Returns the size of the window specified by window_id (in pixels), excluding the borders drawn by the operating system. This is also called the “client area”. See also window_get_size_with_decorations, window_set_size and window_get_position.


Vector2i window_get_size_with_decorations ( int window_id=0 ) const

Returns the size of the window specified by window_id (in pixels), including the borders drawn by the operating system. See also window_get_size.


Vector2i window_get_title_size ( String title, int window_id=0 ) const

Returns the estimated window title bar size (including text and window buttons) for the window specified by window_id (in pixels). This method does not change the window title.

Note: This method is implemented on macOS and Windows.


VSyncMode window_get_vsync_mode ( int window_id=0 ) const

Returns the V-Sync mode of the given window.


bool window_is_focused ( int window_id=0 ) const

Returns true if the window specified by window_id is focused.


bool window_is_maximize_allowed ( int window_id=0 ) const

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


bool window_maximize_on_title_dbl_click ( ) const

Returns true, if double-click on a window title should maximize it.

Note: This method is implemented only on macOS.


bool window_minimize_on_title_dbl_click ( ) const

Returns true, if double-click on a window title should minimize it.

Note: This method is implemented only on macOS.


void window_move_to_foreground ( int window_id=0 )

Moves the window specified by window_id to the foreground, so that it is visible over other windows.


void window_request_attention ( int window_id=0 )

Makes the window specified by window_id request attention, which is materialized by the window title and taskbar entry blinking until the window is focused. This usually has no visible effect if the window is currently focused. The exact behavior varies depending on the operating system.


void window_set_current_screen ( int screen, int window_id=0 )

Moves the window specified by window_id to the specified screen. See also window_get_current_screen.


void window_set_drop_files_callback ( Callable callback, int window_id=0 )

Sets the callback that should be called when files are dropped from the operating system’s file manager to the window specified by window_id.

Warning: Advanced users only! Adding such a callback to a Window node will override its default implementation, which can introduce bugs.

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


void window_set_exclusive ( int window_id, bool exclusive )

If set to true, this window will always stay on top of its parent window, parent window will ignore input while this window is opened.

Note: On macOS, exclusive windows are confined to the same space (virtual desktop or screen) as the parent window.

Note: This method is implemented on macOS and Windows.


void window_set_flag ( WindowFlags flag, bool enabled, int window_id=0 )

Enables or disables the given window’s given flag. See WindowFlags for possible values and their behavior.


void window_set_ime_active ( bool active, int window_id=0 )

Sets whether Input Method Editor should be enabled for the window specified by window_id. See also window_set_ime_position.


void window_set_ime_position ( Vector2i position, int window_id=0 )

Sets the position of the Input Method Editor popup for the specified window_id. Only effective if window_set_ime_active was set to true for the specified window_id.


void window_set_input_event_callback ( Callable callback, int window_id=0 )

Sets the callback that should be called when any InputEvent is sent to the window specified by window_id.

Warning: Advanced users only! Adding such a callback to a Window node will override its default implementation, which can introduce bugs.


void window_set_input_text_callback ( Callable callback, int window_id=0 )

Sets the callback that should be called when text is entered using the virtual keyboard to the window specified by window_id.

Warning: Advanced users only! Adding such a callback to a Window node will override its default implementation, which can introduce bugs.


void window_set_max_size ( Vector2i max_size, int window_id=0 )

Sets the maximum size of the window specified by window_id in pixels. Normally, the user will not be able to drag the window to make it smaller than the specified size. See also window_get_max_size.

Note: It’s recommended to change this value using Window.max_size instead.

Note: Using third-party tools, it is possible for users to disable window geometry restrictions and therefore bypass this limit.


void window_set_min_size ( Vector2i min_size, int window_id=0 )

Sets the minimum size for the given window to min_size (in pixels). Normally, the user will not be able to drag the window to make it larger than the specified size. See also window_get_min_size.

Note: It’s recommended to change this value using Window.min_size instead.

Note: By default, the main window has a minimum size of Vector2i(64, 64). This prevents issues that can arise when the window is resized to a near-zero size.

Note: Using third-party tools, it is possible for users to disable window geometry restrictions and therefore bypass this limit.


void window_set_mode ( WindowMode mode, int window_id=0 )

Sets window mode for the given window to mode. See WindowMode for possible values and how each mode behaves.

Note: Setting the window to full screen forcibly sets the borderless flag to true, so make sure to set it back to false when not wanted.


void window_set_mouse_passthrough ( PackedVector2Array region, int window_id=0 )

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).

GDScriptC#

  1. # Set region, using Path2D node.
  2. DisplayServer.window_set_mouse_passthrough($Path2D.curve.get_baked_points())
  3. # Set region, using Polygon2D node.
  4. DisplayServer.window_set_mouse_passthrough($Polygon2D.polygon)
  5. # Reset region to default.
  6. DisplayServer.window_set_mouse_passthrough([])
  1. // Set region, using Path2D node.
  2. DisplayServer.WindowSetMousePassthrough(GetNode<Path2D>("Path2D").Curve.GetBakedPoints());
  3. // Set region, using Polygon2D node.
  4. DisplayServer.WindowSetMousePassthrough(GetNode<Polygon2D>("Polygon2D").Polygon);
  5. // Reset region to default.
  6. DisplayServer.WindowSetMousePassthrough(new Vector2[] {});

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 method is implemented on Linux (X11), macOS and Windows.


void window_set_popup_safe_rect ( int window, Rect2i rect )

Sets the bounding box of control, or menu item that was used to open the popup window, in the screen coordinate system. Clicking this area will not auto-close this popup.


void window_set_position ( Vector2i position, int window_id=0 )

Sets the position of the given window to position. On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:

  1. * (0, 0) +-------+
  2. | |
  3. +-------------+ | |
  4. | | | |
  5. | | | |
  6. +-------------+ +-------+

See also window_get_position and window_set_size.

Note: It’s recommended to change this value using Window.position instead.


void window_set_rect_changed_callback ( Callable callback, int window_id=0 )

Sets the callback that will be called when the window specified by window_id is moved or resized.

Warning: Advanced users only! Adding such a callback to a Window node will override its default implementation, which can introduce bugs.


void window_set_size ( Vector2i size, int window_id=0 )

Sets the size of the given window to size (in pixels). See also window_get_size and window_get_position.

Note: It’s recommended to change this value using Window.size instead.


void window_set_title ( String title, int window_id=0 )

Sets the title of the given window to title.

Note: It’s recommended to change this value using Window.title instead.

Note: Avoid changing the window title every frame, as this can cause performance issues on certain window managers. Try to change the window title only a few times per second at most.


void window_set_transient ( int window_id, int parent_window_id )

Sets window transient parent. Transient window is 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: It’s recommended to change this value using Window.transient instead.

Note: The behavior might be different depending on the platform.


void window_set_vsync_mode ( VSyncMode vsync_mode, int window_id=0 )

Sets the V-Sync mode of the given window. See also ProjectSettings.display/window/vsync/vsync_mode.

See VSyncMode for possible values and how they affect the behavior of your application.

Depending on the platform and used renderer, the engine will fall back to VSYNC_ENABLED if the desired mode is not supported.

Note: V-Sync modes other than VSYNC_ENABLED are only supported in the Forward+ and Mobile rendering methods, not Compatibility.


void window_set_window_buttons_offset ( Vector2i offset, int window_id=0 )

When WINDOW_FLAG_EXTEND_TO_TITLE flag is set, set offset to the center of the first titlebar button.

Note: This flag is implemented only on macOS.


void window_set_window_event_callback ( Callable callback, int window_id=0 )

Sets the callback that will be called when an event occurs in the window specified by window_id.

Warning: Advanced users only! Adding such a callback to a Window node will override its default implementation, which can introduce bugs.

Previous Next


© Copyright 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision 53e837c6.

Built with Sphinx using a theme provided by Read the Docs.