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

Add WINDOW_FLAG_MOUSE_PASSTHROUGH flag and enabled it for tooltips. Expose window_set_mouse_passthrough to Window.

This commit is contained in:
bruvzg
2023-01-15 12:05:25 +02:00
parent 0f0b853c98
commit 34b34b104c
13 changed files with 127 additions and 12 deletions

View File

@@ -2974,6 +2974,9 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win
case WINDOW_FLAG_NO_FOCUS: {
wd.no_focus = p_enabled;
} break;
case WINDOW_FLAG_MOUSE_PASSTHROUGH: {
wd.mpass = p_enabled;
} break;
case WINDOW_FLAG_POPUP: {
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
ERR_FAIL_COND_MSG([wd.window_object isVisible] && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
@@ -3013,6 +3016,9 @@ bool DisplayServerMacOS::window_get_flag(WindowFlags p_flag, WindowID p_window)
case WINDOW_FLAG_NO_FOCUS: {
return wd.no_focus;
} break;
case WINDOW_FLAG_MOUSE_PASSTHROUGH: {
return wd.mpass;
} break;
case WINDOW_FLAG_POPUP: {
return wd.is_popup;
} break;
@@ -3487,7 +3493,11 @@ void DisplayServerMacOS::process_events() {
for (KeyValue<WindowID, WindowData> &E : windows) {
WindowData &wd = E.value;
if (wd.mpath.size() > 0) {
if (wd.mpass) {
if (![wd.window_object ignoresMouseEvents]) {
[wd.window_object setIgnoresMouseEvents:YES];
}
} else if (wd.mpath.size() > 0) {
update_mouse_pos(wd, [wd.window_object mouseLocationOutsideOfEventStream]);
if (Geometry2D::is_point_in_polygon(wd.mouse_pos, wd.mpath)) {
if ([wd.window_object ignoresMouseEvents]) {