2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* display_server_macos.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-07-20 08:28:22 +02:00
|
|
|
#ifndef DISPLAY_SERVER_MACOS_H
|
|
|
|
#define DISPLAY_SERVER_MACOS_H
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-04-28 15:19:37 +02:00
|
|
|
#include "core/input/input.h"
|
2020-03-07 17:02:54 +01:00
|
|
|
#include "servers/display_server.h"
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
#if defined(GLES3_ENABLED)
|
2021-11-12 13:49:49 +01:00
|
|
|
#include "gl_manager_macos_angle.h"
|
2022-07-20 08:28:22 +02:00
|
|
|
#include "gl_manager_macos_legacy.h"
|
2022-01-26 10:01:27 +01:00
|
|
|
#endif // GLES3_ENABLED
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2024-01-19 18:41:01 +01:00
|
|
|
#include "native_menu_macos.h"
|
|
|
|
|
2023-12-19 12:48:02 +01:00
|
|
|
#if defined(RD_ENABLED)
|
|
|
|
#include "servers/rendering/rendering_device.h"
|
|
|
|
|
2020-03-07 17:02:54 +01:00
|
|
|
#if defined(VULKAN_ENABLED)
|
2023-12-19 18:57:56 +01:00
|
|
|
#include "rendering_context_driver_vulkan_macos.h"
|
2022-01-26 10:01:27 +01:00
|
|
|
#endif // VULKAN_ENABLED
|
2023-12-19 12:48:02 +01:00
|
|
|
#endif // RD_ENABLED
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2023-06-08 14:51:32 +02:00
|
|
|
#define BitMap _QDBitMap // Suppress deprecated QuickDraw definition.
|
|
|
|
|
2022-05-10 20:02:26 +02:00
|
|
|
#import <AppKit/AppKit.h>
|
|
|
|
#import <AppKit/NSCursor.h>
|
|
|
|
#import <ApplicationServices/ApplicationServices.h>
|
|
|
|
#import <CoreVideo/CoreVideo.h>
|
|
|
|
#import <Foundation/Foundation.h>
|
2022-08-04 09:38:26 +02:00
|
|
|
#import <IOKit/pwr_mgt/IOPMLib.h>
|
2020-03-07 17:02:54 +01:00
|
|
|
|
|
|
|
#undef BitMap
|
|
|
|
#undef CursorShape
|
|
|
|
|
2022-07-20 08:28:22 +02:00
|
|
|
class DisplayServerMacOS : public DisplayServer {
|
2023-05-08 20:32:56 +02:00
|
|
|
// No need to register with GDCLASS, it's platform-specific and nothing is added.
|
2020-03-07 17:02:54 +01:00
|
|
|
|
|
|
|
_THREAD_SAFE_CLASS_
|
|
|
|
|
|
|
|
public:
|
|
|
|
struct KeyEvent {
|
2022-01-26 10:01:27 +01:00
|
|
|
WindowID window_id = INVALID_WINDOW_ID;
|
2022-07-20 08:28:22 +02:00
|
|
|
unsigned int macos_state = false;
|
2020-11-24 10:12:55 +01:00
|
|
|
bool pressed = false;
|
|
|
|
bool echo = false;
|
|
|
|
bool raw = false;
|
2021-08-13 23:31:57 +02:00
|
|
|
Key keycode = Key::NONE;
|
|
|
|
Key physical_keycode = Key::NONE;
|
2022-12-11 00:21:22 +01:00
|
|
|
Key key_label = Key::NONE;
|
2020-11-24 10:12:55 +01:00
|
|
|
uint32_t unicode = 0;
|
2023-08-03 15:18:26 +02:00
|
|
|
KeyLocation location = KeyLocation::UNSPECIFIED;
|
2020-03-07 17:02:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct WindowData {
|
|
|
|
id window_delegate;
|
|
|
|
id window_object;
|
|
|
|
id window_view;
|
2022-09-20 10:12:49 +02:00
|
|
|
id window_button_view;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-06-29 11:31:36 +02:00
|
|
|
Vector<Vector2> mpath;
|
|
|
|
|
2020-03-07 17:02:54 +01:00
|
|
|
Point2i mouse_pos;
|
|
|
|
|
|
|
|
Size2i min_size;
|
|
|
|
Size2i max_size;
|
|
|
|
Size2i size;
|
2022-09-21 10:15:19 +02:00
|
|
|
Vector2i wb_offset = Vector2i(14, 14);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-09-13 14:33:51 +02:00
|
|
|
NSRect last_frame_rect;
|
|
|
|
|
2020-03-07 17:02:54 +01:00
|
|
|
bool im_active = false;
|
|
|
|
Size2i im_position;
|
|
|
|
|
|
|
|
Callable rect_changed_callback;
|
|
|
|
Callable event_callback;
|
|
|
|
Callable input_event_callback;
|
|
|
|
Callable input_text_callback;
|
|
|
|
Callable drop_files_callback;
|
|
|
|
|
|
|
|
ObjectID instance_id;
|
2022-12-08 19:34:15 +01:00
|
|
|
bool fs_transition = false;
|
|
|
|
bool initial_size = true;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
|
|
|
WindowID transient_parent = INVALID_WINDOW_ID;
|
2022-01-19 13:04:05 +01:00
|
|
|
bool exclusive = false;
|
2022-05-19 17:00:06 +02:00
|
|
|
HashSet<WindowID> transient_children;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
|
|
|
bool layered_window = false;
|
|
|
|
bool fullscreen = false;
|
2022-11-04 15:23:01 +01:00
|
|
|
bool exclusive_fullscreen = false;
|
2020-03-07 17:02:54 +01:00
|
|
|
bool on_top = false;
|
|
|
|
bool borderless = false;
|
|
|
|
bool resize_disabled = false;
|
2020-07-03 12:06:03 +02:00
|
|
|
bool no_focus = false;
|
2022-02-24 10:21:23 +01:00
|
|
|
bool is_popup = false;
|
2023-01-15 11:05:25 +01:00
|
|
|
bool mpass = false;
|
2023-06-15 09:53:31 +02:00
|
|
|
bool focused = false;
|
2023-10-10 11:06:08 +02:00
|
|
|
bool is_visible = true;
|
2023-11-09 22:25:48 +01:00
|
|
|
bool extend_to_title = false;
|
2022-02-24 10:21:23 +01:00
|
|
|
|
|
|
|
Rect2i parent_safe_rect;
|
2020-03-07 17:02:54 +01:00
|
|
|
};
|
|
|
|
|
2022-02-24 10:21:23 +01:00
|
|
|
List<WindowID> popup_list;
|
|
|
|
uint64_t time_since_popup = 0;
|
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
private:
|
|
|
|
#if defined(GLES3_ENABLED)
|
2021-11-12 13:49:49 +01:00
|
|
|
GLManagerLegacy_MacOS *gl_manager_legacy = nullptr;
|
|
|
|
GLManagerANGLE_MacOS *gl_manager_angle = nullptr;
|
2022-01-26 10:01:27 +01:00
|
|
|
#endif
|
2023-12-19 12:48:02 +01:00
|
|
|
#if defined(RD_ENABLED)
|
2023-12-19 18:57:56 +01:00
|
|
|
RenderingContextDriver *rendering_context = nullptr;
|
2023-12-19 12:48:02 +01:00
|
|
|
RenderingDevice *rendering_device = nullptr;
|
2022-01-26 10:01:27 +01:00
|
|
|
#endif
|
|
|
|
String rendering_driver;
|
|
|
|
|
|
|
|
struct WarpEvent {
|
|
|
|
NSTimeInterval timestamp;
|
|
|
|
NSPoint delta;
|
|
|
|
};
|
|
|
|
List<WarpEvent> warp_events;
|
|
|
|
NSTimeInterval last_warp = 0;
|
|
|
|
bool ignore_warp = false;
|
|
|
|
|
|
|
|
Vector<KeyEvent> key_event_buffer;
|
|
|
|
int key_event_pos = 0;
|
|
|
|
|
2021-11-04 13:33:37 +01:00
|
|
|
id tts = nullptr;
|
2022-08-31 10:11:52 +02:00
|
|
|
id menu_delegate = nullptr;
|
2024-01-19 18:41:01 +01:00
|
|
|
NativeMenuMacOS *native_menu = nullptr;
|
2021-11-04 13:33:37 +01:00
|
|
|
|
2020-03-07 17:02:54 +01:00
|
|
|
Point2i im_selection;
|
|
|
|
String im_text;
|
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
CGEventSourceRef event_source;
|
|
|
|
MouseMode mouse_mode = MOUSE_MODE_VISIBLE;
|
2023-01-08 00:55:54 +01:00
|
|
|
BitField<MouseButtonMask> last_button_state;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
bool drop_events = false;
|
|
|
|
bool in_dispatch_input_event = false;
|
|
|
|
|
|
|
|
struct LayoutInfo {
|
|
|
|
String name;
|
|
|
|
String code;
|
|
|
|
};
|
|
|
|
Vector<LayoutInfo> kbd_layouts;
|
|
|
|
int current_layout = 0;
|
|
|
|
bool keyboard_layout_dirty = true;
|
2022-02-01 03:49:51 +01:00
|
|
|
|
2023-08-09 09:23:57 +02:00
|
|
|
WindowID window_mouseover_id = INVALID_WINDOW_ID;
|
2022-01-26 10:01:27 +01:00
|
|
|
WindowID last_focused_window = INVALID_WINDOW_ID;
|
2020-03-07 17:02:54 +01:00
|
|
|
WindowID window_id_counter = MAIN_WINDOW_ID;
|
2022-01-26 10:01:27 +01:00
|
|
|
float display_max_scale = 1.f;
|
|
|
|
Point2i origin;
|
|
|
|
bool displays_arrangement_dirty = true;
|
2022-03-04 09:25:39 +01:00
|
|
|
bool is_resizing = false;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
CursorShape cursor_shape = CURSOR_ARROW;
|
|
|
|
NSCursor *cursors[CURSOR_MAX];
|
2022-05-13 15:04:37 +02:00
|
|
|
HashMap<CursorShape, Vector<Variant>> cursors_cache;
|
2022-01-26 10:01:27 +01:00
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
HashMap<WindowID, WindowData> windows;
|
2022-01-26 10:01:27 +01:00
|
|
|
|
2023-08-03 11:45:56 +02:00
|
|
|
struct IndicatorData {
|
|
|
|
id view;
|
|
|
|
id item;
|
|
|
|
};
|
|
|
|
|
|
|
|
IndicatorID indicator_id_counter = 0;
|
|
|
|
HashMap<IndicatorID, IndicatorData> indicators;
|
|
|
|
|
2022-08-04 09:38:26 +02:00
|
|
|
IOPMAssertionID screen_keep_on_assertion = kIOPMNullAssertionID;
|
|
|
|
|
2023-10-22 13:29:56 +02:00
|
|
|
Callable help_search_callback;
|
|
|
|
Callable help_action_callback;
|
|
|
|
|
2022-09-24 22:57:00 +02:00
|
|
|
struct MenuCall {
|
|
|
|
Variant tag;
|
|
|
|
Callable callback;
|
|
|
|
};
|
2023-03-23 12:26:11 +01:00
|
|
|
List<MenuCall> deferred_menu_calls;
|
2022-09-24 22:57:00 +02:00
|
|
|
|
2024-01-19 19:46:26 +01:00
|
|
|
Callable system_theme_changed;
|
|
|
|
|
2023-01-04 23:00:02 +01:00
|
|
|
WindowID _create_window(WindowMode p_mode, VSyncMode p_vsync_mode, const Rect2i &p_rect);
|
2022-01-26 10:01:27 +01:00
|
|
|
void _update_window_style(WindowData p_wd);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
void _update_displays_arrangement();
|
2020-03-07 17:02:54 +01:00
|
|
|
Point2i _get_native_screen_position(int p_screen) const;
|
2022-01-26 10:01:27 +01:00
|
|
|
static void _displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplayChangeSummaryFlags flags, void *user_info);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
static void _dispatch_input_events(const Ref<InputEvent> &p_event);
|
|
|
|
void _dispatch_input_event(const Ref<InputEvent> &p_event);
|
2020-03-07 17:02:54 +01:00
|
|
|
void _push_input(const Ref<InputEvent> &p_event);
|
|
|
|
void _process_key_events();
|
2022-01-26 10:01:27 +01:00
|
|
|
void _update_keyboard_layouts();
|
|
|
|
static void _keyboard_layout_changed(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef user_info);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
static NSCursor *_cursor_from_selector(SEL p_selector, SEL p_fallback = nil);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2023-10-13 11:37:46 +02:00
|
|
|
Error _file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback, bool p_options_in_cb);
|
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
public:
|
|
|
|
void menu_callback(id p_sender);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2024-01-19 19:46:26 +01:00
|
|
|
void emit_system_theme_changed();
|
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
bool has_window(WindowID p_window) const;
|
|
|
|
WindowData &get_window(WindowID p_window);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2024-01-19 18:41:01 +01:00
|
|
|
NSImage *_convert_to_nsimg(Ref<Image> &p_image) const;
|
|
|
|
Point2i _get_screens_origin() const;
|
|
|
|
|
2024-03-27 21:09:13 +01:00
|
|
|
void set_menu_delegate(NSMenu *p_menu);
|
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
void send_event(NSEvent *p_event);
|
|
|
|
void send_window_event(const WindowData &p_wd, WindowEvent p_event);
|
|
|
|
void release_pressed_events();
|
2022-07-20 08:28:22 +02:00
|
|
|
void get_key_modifier_state(unsigned int p_macos_state, Ref<InputEventWithModifiers> r_state) const;
|
2022-01-26 10:01:27 +01:00
|
|
|
void update_mouse_pos(WindowData &p_wd, NSPoint p_location_in_window);
|
|
|
|
void push_to_key_event_buffer(const KeyEvent &p_event);
|
2022-12-11 00:21:22 +01:00
|
|
|
void pop_last_key_event();
|
2022-01-26 10:01:27 +01:00
|
|
|
void update_im_text(const Point2i &p_selection, const String &p_text);
|
|
|
|
void set_last_focused_window(WindowID p_window);
|
2022-05-30 10:06:08 +02:00
|
|
|
bool mouse_process_popups(bool p_close = false);
|
2022-02-24 10:21:23 +01:00
|
|
|
void popup_open(WindowID p_window);
|
|
|
|
void popup_close(WindowID p_window);
|
2022-03-04 09:25:39 +01:00
|
|
|
void set_is_resizing(bool p_is_resizing);
|
|
|
|
bool get_is_resizing() const;
|
2022-11-19 21:25:43 +01:00
|
|
|
void reparent_check(WindowID p_window);
|
2022-12-11 00:21:22 +01:00
|
|
|
WindowID _get_focused_window_or_popup() const;
|
2023-08-09 09:23:57 +02:00
|
|
|
void mouse_enter_window(WindowID p_window);
|
|
|
|
void mouse_exit_window(WindowID p_window);
|
2023-09-27 08:01:42 +02:00
|
|
|
void update_presentation_mode();
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
void window_destroy(WindowID p_window);
|
|
|
|
void window_resize(WindowID p_window, int p_width, int p_height);
|
2022-09-21 10:15:19 +02:00
|
|
|
void window_set_custom_window_buttons(WindowData &p_wd, bool p_enabled);
|
2023-11-09 22:25:48 +01:00
|
|
|
void set_window_per_pixel_transparency_enabled(bool p_enabled, WindowID p_window);
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual bool has_feature(Feature p_feature) const override;
|
|
|
|
virtual String get_name() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2023-10-22 13:29:56 +02:00
|
|
|
virtual void help_set_search_callbacks(const Callable &p_search_callback = Callable(), const Callable &p_action_callback = Callable()) override;
|
|
|
|
Callable _help_get_search_callback() const;
|
|
|
|
Callable _help_get_action_callback() const;
|
|
|
|
|
2021-11-04 13:33:37 +01:00
|
|
|
virtual bool tts_is_speaking() const override;
|
|
|
|
virtual bool tts_is_paused() const override;
|
2022-08-05 03:41:48 +02:00
|
|
|
virtual TypedArray<Dictionary> tts_get_voices() const override;
|
2021-11-04 13:33:37 +01:00
|
|
|
|
|
|
|
virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int p_utterance_id = 0, bool p_interrupt = false) override;
|
|
|
|
virtual void tts_pause() override;
|
|
|
|
virtual void tts_resume() override;
|
|
|
|
virtual void tts_stop() override;
|
|
|
|
|
2022-08-29 10:24:48 +02:00
|
|
|
virtual bool is_dark_mode_supported() const override;
|
|
|
|
virtual bool is_dark_mode() const override;
|
|
|
|
virtual Color get_accent_color() const override;
|
2024-01-19 19:46:26 +01:00
|
|
|
virtual Color get_base_color() const override;
|
|
|
|
virtual void set_system_theme_change_callback(const Callable &p_callable) override;
|
2022-08-29 10:24:48 +02:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) override;
|
|
|
|
virtual Error dialog_input_text(String p_title, String p_description, String p_partial, const Callable &p_callback) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2021-03-30 14:42:50 +02:00
|
|
|
virtual Error file_dialog_show(const String &p_title, const String &p_current_directory, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const Callable &p_callback) override;
|
2023-10-13 11:37:46 +02:00
|
|
|
virtual Error file_dialog_with_options_show(const String &p_title, const String &p_current_directory, const String &p_root, const String &p_filename, bool p_show_hidden, FileDialogMode p_mode, const Vector<String> &p_filters, const TypedArray<Dictionary> &p_options, const Callable &p_callback) override;
|
2021-03-30 14:42:50 +02:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void mouse_set_mode(MouseMode p_mode) override;
|
|
|
|
virtual MouseMode mouse_get_mode() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
bool update_mouse_wrap(WindowData &p_wd, NSPoint &r_delta, NSPoint &r_mpos, NSTimeInterval p_timestamp);
|
2022-03-27 11:17:36 +02:00
|
|
|
virtual void warp_mouse(const Point2i &p_position) override;
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual Point2i mouse_get_position() const override;
|
2023-01-08 00:55:54 +01:00
|
|
|
void mouse_set_button_state(BitField<MouseButtonMask> p_state);
|
|
|
|
virtual BitField<MouseButtonMask> mouse_get_button_state() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void clipboard_set(const String &p_text) override;
|
|
|
|
virtual String clipboard_get() const override;
|
2022-08-02 14:05:37 +02:00
|
|
|
virtual Ref<Image> clipboard_get_image() const override;
|
|
|
|
virtual bool clipboard_has() const override;
|
|
|
|
virtual bool clipboard_has_image() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual int get_screen_count() const override;
|
2023-01-04 23:00:02 +01:00
|
|
|
virtual int get_primary_screen() const override;
|
2023-03-21 12:08:46 +01:00
|
|
|
virtual int get_keyboard_focus_screen() const override;
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual Point2i screen_get_position(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
|
|
|
|
virtual Size2i screen_get_size(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
|
|
|
|
virtual int screen_get_dpi(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
|
|
|
|
virtual float screen_get_scale(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
|
|
|
|
virtual float screen_get_max_scale() const override;
|
|
|
|
virtual Rect2i screen_get_usable_rect(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
|
2022-01-27 20:46:57 +01:00
|
|
|
virtual float screen_get_refresh_rate(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
|
2023-02-27 19:36:13 +01:00
|
|
|
virtual Color screen_get_pixel(const Point2i &p_position) const override;
|
2023-03-16 22:26:09 +01:00
|
|
|
virtual Ref<Image> screen_get_image(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
|
2022-08-04 09:38:26 +02:00
|
|
|
virtual void screen_set_keep_on(bool p_enable) override;
|
2022-08-05 12:14:13 +02:00
|
|
|
virtual bool screen_is_kept_on() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual Vector<int> get_window_list() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2023-01-04 23:00:02 +01:00
|
|
|
virtual WindowID create_sub_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect = Rect2i()) override;
|
2020-08-21 09:39:30 +02:00
|
|
|
virtual void show_window(WindowID p_id) override;
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void delete_sub_window(WindowID p_id) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-02-24 10:21:23 +01:00
|
|
|
virtual WindowID window_get_active_popup() const override;
|
|
|
|
virtual void window_set_popup_safe_rect(WindowID p_window, const Rect2i &p_rect) override;
|
|
|
|
virtual Rect2i window_get_popup_safe_rect(WindowID p_window) const override;
|
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual void window_set_window_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual void window_set_input_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual void window_set_input_text_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual void window_set_drop_files_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_title(const String &p_title, WindowID p_window = MAIN_WINDOW_ID) override;
|
2023-08-08 10:31:56 +02:00
|
|
|
virtual Size2i window_get_title_size(const String &p_title, WindowID p_window) const override;
|
2020-06-29 11:31:36 +02:00
|
|
|
virtual void window_set_mouse_passthrough(const Vector<Vector2> &p_region, WindowID p_window = MAIN_WINDOW_ID) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual int window_get_current_screen(WindowID p_window = MAIN_WINDOW_ID) const override;
|
|
|
|
virtual void window_set_current_screen(int p_screen, WindowID p_window = MAIN_WINDOW_ID) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual Point2i window_get_position(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2022-11-30 09:28:16 +01:00
|
|
|
virtual Point2i window_get_position_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_transient(WindowID p_window, WindowID p_parent) override;
|
2022-01-19 13:04:05 +01:00
|
|
|
virtual void window_set_exclusive(WindowID p_window, bool p_exclusive) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual Size2i window_get_max_size(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_min_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual Size2i window_get_min_size(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual Size2i window_get_size(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2022-11-30 09:28:16 +01:00
|
|
|
virtual Size2i window_get_size_with_decorations(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_mode(WindowMode p_mode, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual WindowMode window_get_mode(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual bool window_is_maximize_allowed(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual bool window_get_flag(WindowFlags p_flag, WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_request_attention(WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual void window_move_to_foreground(WindowID p_window = MAIN_WINDOW_ID) override;
|
2023-06-15 09:53:31 +02:00
|
|
|
virtual bool window_is_focused(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2023-12-22 17:50:21 +01:00
|
|
|
virtual WindowID get_focused_window() const override;
|
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual bool window_can_draw(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual bool can_any_window_draw() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_set_ime_active(const bool p_active, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual void window_set_ime_position(const Point2i &p_pos, WindowID p_window = MAIN_WINDOW_ID) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual WindowID get_window_at_screen_position(const Point2i &p_position) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-14 11:41:04 +01:00
|
|
|
virtual int64_t window_get_native_handle(HandleType p_handle_type, WindowID p_window = MAIN_WINDOW_ID) const override;
|
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void window_attach_instance_id(ObjectID p_instance, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual ObjectID window_get_attached_instance_id(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2021-11-02 11:27:38 +01:00
|
|
|
virtual void gl_window_make_current(DisplayServer::WindowID p_window_id) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2021-06-19 17:44:59 +02:00
|
|
|
virtual void window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window = MAIN_WINDOW_ID) override;
|
|
|
|
virtual DisplayServer::VSyncMode window_get_vsync_mode(WindowID p_vsync_mode) const override;
|
|
|
|
|
2022-08-23 12:40:48 +02:00
|
|
|
virtual bool window_maximize_on_title_dbl_click() const override;
|
|
|
|
virtual bool window_minimize_on_title_dbl_click() const override;
|
|
|
|
|
2022-09-20 10:12:49 +02:00
|
|
|
virtual void window_set_window_buttons_offset(const Vector2i &p_offset, WindowID p_window = MAIN_WINDOW_ID) override;
|
2022-10-10 09:32:41 +02:00
|
|
|
virtual Vector3i window_get_safe_title_margins(WindowID p_window = MAIN_WINDOW_ID) const override;
|
2022-08-23 12:40:48 +02:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual Point2i ime_get_selection() const override;
|
|
|
|
virtual String ime_get_text() const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2022-01-26 10:01:27 +01:00
|
|
|
void cursor_update_shape();
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void cursor_set_shape(CursorShape p_shape) override;
|
|
|
|
virtual CursorShape cursor_get_shape() const override;
|
2022-05-03 01:43:50 +02:00
|
|
|
virtual void cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-09 01:02:38 +02:00
|
|
|
virtual bool get_swap_cancel_ok() override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual int keyboard_get_layout_count() const override;
|
|
|
|
virtual int keyboard_get_current_layout() const override;
|
|
|
|
virtual void keyboard_set_current_layout(int p_index) override;
|
|
|
|
virtual String keyboard_get_layout_language(int p_index) const override;
|
|
|
|
virtual String keyboard_get_layout_name(int p_index) const override;
|
2021-09-17 03:07:59 +02:00
|
|
|
virtual Key keyboard_get_keycode_from_physical(Key p_keycode) const override;
|
2023-06-08 08:26:48 +02:00
|
|
|
virtual Key keyboard_get_label_from_physical(Key p_keycode) const override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void process_events() override;
|
|
|
|
virtual void force_process_and_drop_events() override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void release_rendering_thread() override;
|
|
|
|
virtual void swap_buffers() override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void set_native_icon(const String &p_filename) override;
|
|
|
|
virtual void set_icon(const Ref<Image> &p_icon) override;
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2023-08-03 11:45:56 +02:00
|
|
|
virtual IndicatorID create_status_indicator(const Ref<Image> &p_icon, const String &p_tooltip, const Callable &p_callback) override;
|
|
|
|
virtual void status_indicator_set_icon(IndicatorID p_id, const Ref<Image> &p_icon) override;
|
|
|
|
virtual void status_indicator_set_tooltip(IndicatorID p_id, const String &p_tooltip) override;
|
|
|
|
virtual void status_indicator_set_callback(IndicatorID p_id, const Callable &p_callback) override;
|
|
|
|
virtual void delete_status_indicator(IndicatorID p_id) override;
|
|
|
|
|
2023-01-04 23:00:02 +01:00
|
|
|
static DisplayServer *create_func(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Error &r_error);
|
2020-03-07 17:02:54 +01:00
|
|
|
static Vector<String> get_rendering_drivers_func();
|
|
|
|
|
2022-07-20 08:28:22 +02:00
|
|
|
static void register_macos_driver();
|
2020-03-07 17:02:54 +01:00
|
|
|
|
2023-01-04 23:00:02 +01:00
|
|
|
DisplayServerMacOS(const String &p_rendering_driver, WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Error &r_error);
|
2022-07-20 08:28:22 +02:00
|
|
|
~DisplayServerMacOS();
|
2020-03-07 17:02:54 +01:00
|
|
|
};
|
|
|
|
|
2022-07-20 08:28:22 +02:00
|
|
|
#endif // DISPLAY_SERVER_MACOS_H
|