1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

MacOS: Embedded window support.

This commit is contained in:
Stuart Carnie
2025-04-29 07:01:27 +10:00
parent 1cf573f44d
commit 00e1fdec2c
37 changed files with 3670 additions and 384 deletions

View File

@@ -51,6 +51,7 @@
#endif
#endif // RD_ENABLED
#define FontVariation __FontVariation
#define BitMap _QDBitMap // Suppress deprecated QuickDraw definition.
#import <AppKit/AppKit.h>
@@ -60,8 +61,18 @@
#import <Foundation/Foundation.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
@class GodotWindow;
@class GodotContentView;
@class GodotWindowDelegate;
@class GodotButtonView;
@class GodotEmbeddedView;
@class CALayerHost;
#undef BitMap
#undef CursorShape
#undef FontVariation
class EmbeddedProcessMacOS;
class DisplayServerMacOS : public DisplayServer {
GDSOFTCLASS(DisplayServerMacOS, DisplayServer);
@@ -83,10 +94,10 @@ public:
};
struct WindowData {
id window_delegate;
id window_object;
id window_view;
id window_button_view;
GodotWindowDelegate *window_delegate;
GodotWindow *window_object;
GodotContentView *window_view;
GodotButtonView *window_button_view;
Vector<Vector2> mpath;
@@ -241,6 +252,12 @@ private:
void initialize_tts() const;
struct EmbeddedProcessData {
const EmbeddedProcessMacOS *process;
CALayer *layer_host = nil;
};
HashMap<OS::ProcessID, EmbeddedProcessData> embedded_processes;
public:
void menu_callback(id p_sender);
@@ -442,6 +459,13 @@ public:
virtual bool get_swap_cancel_ok() override;
virtual void enable_for_stealing_focus(OS::ProcessID pid) override;
#ifdef DEBUG_ENABLED
Error embed_process_update(WindowID p_window, const EmbeddedProcessMacOS *p_process);
#endif
virtual Error request_close_embedded_process(OS::ProcessID p_pid) override;
virtual Error remove_embedded_process(OS::ProcessID p_pid) override;
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;