You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
MacOS: Embedded window support.
This commit is contained in:
@@ -32,8 +32,49 @@
|
||||
|
||||
#include "scene/gui/control.h"
|
||||
|
||||
class EmbeddedProcess : public Control {
|
||||
GDCLASS(EmbeddedProcess, Control);
|
||||
class ScriptEditorDebugger;
|
||||
|
||||
class EmbeddedProcessBase : public Control {
|
||||
GDCLASS(EmbeddedProcessBase, Control);
|
||||
|
||||
void _draw();
|
||||
|
||||
protected:
|
||||
Ref<StyleBox> focus_style_box;
|
||||
Size2i window_size;
|
||||
bool keep_aspect = false;
|
||||
Point2i margin_top_left;
|
||||
Point2i margin_bottom_right;
|
||||
Window *window = nullptr;
|
||||
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
virtual void set_script_debugger(ScriptEditorDebugger *p_debugger) {}
|
||||
|
||||
virtual bool is_embedding_completed() const = 0;
|
||||
virtual bool is_embedding_in_progress() const = 0;
|
||||
virtual bool is_process_focused() const = 0;
|
||||
virtual void embed_process(OS::ProcessID p_pid) = 0;
|
||||
virtual int get_embedded_pid() const = 0;
|
||||
virtual void reset() = 0;
|
||||
virtual void request_close() = 0;
|
||||
virtual void queue_update_embedded_process() = 0;
|
||||
|
||||
void set_window_size(const Size2i &p_window_size);
|
||||
void set_keep_aspect(bool p_keep_aspect);
|
||||
virtual Rect2i get_adjusted_embedded_window_rect(const Rect2i &p_rect) const = 0;
|
||||
Rect2i get_screen_embedded_window_rect() const;
|
||||
int get_margin_size(Side p_side) const;
|
||||
Size2 get_margins_size() const;
|
||||
|
||||
EmbeddedProcessBase();
|
||||
virtual ~EmbeddedProcessBase();
|
||||
};
|
||||
|
||||
class EmbeddedProcess : public EmbeddedProcessBase {
|
||||
GDCLASS(EmbeddedProcess, EmbeddedProcessBase);
|
||||
|
||||
bool application_has_focus = true;
|
||||
uint64_t last_application_focus_time = 0;
|
||||
@@ -45,51 +86,37 @@ class EmbeddedProcess : public Control {
|
||||
bool updated_embedded_process_queued = false;
|
||||
bool last_updated_embedded_process_focused = false;
|
||||
|
||||
Window *window = nullptr;
|
||||
Timer *timer_embedding = nullptr;
|
||||
Timer *timer_update_embedded_process = nullptr;
|
||||
|
||||
const int embedding_timeout = 45000;
|
||||
|
||||
bool keep_aspect = false;
|
||||
Size2i window_size;
|
||||
Ref<StyleBox> focus_style_box;
|
||||
Point2i margin_top_left;
|
||||
Point2i margin_bottom_right;
|
||||
Rect2i last_global_rect;
|
||||
|
||||
void _try_embed_process();
|
||||
void _update_embedded_process();
|
||||
void _timer_embedding_timeout();
|
||||
void _timer_update_embedded_process_timeout();
|
||||
void _draw();
|
||||
void _check_mouse_over();
|
||||
void _check_focused_process_id();
|
||||
bool _is_embedded_process_updatable();
|
||||
Rect2i _get_global_embedded_window_rect();
|
||||
Window *_get_current_modal_window();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
void embed_process(OS::ProcessID p_pid);
|
||||
void reset();
|
||||
void request_close();
|
||||
bool is_embedding_in_progress() const override;
|
||||
bool is_embedding_completed() const override;
|
||||
bool is_process_focused() const override;
|
||||
void embed_process(OS::ProcessID p_pid) override;
|
||||
int get_embedded_pid() const override;
|
||||
void reset() override;
|
||||
void request_close() override;
|
||||
void queue_update_embedded_process() override;
|
||||
|
||||
void set_window_size(const Size2i p_window_size);
|
||||
void set_keep_aspect(bool p_keep_aspect);
|
||||
void queue_update_embedded_process();
|
||||
|
||||
Rect2i get_adjusted_embedded_window_rect(Rect2i p_rect);
|
||||
Rect2i get_screen_embedded_window_rect();
|
||||
int get_margin_size(Side p_side) const;
|
||||
Size2 get_margins_size();
|
||||
bool is_embedding_in_progress();
|
||||
bool is_embedding_completed();
|
||||
int get_embedded_pid() const;
|
||||
Rect2i get_adjusted_embedded_window_rect(const Rect2i &p_rect) const override;
|
||||
|
||||
EmbeddedProcess();
|
||||
~EmbeddedProcess();
|
||||
~EmbeddedProcess() override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user