From 34210e812a15265b941e150e88af0d997355c804 Mon Sep 17 00:00:00 2001 From: Septian Date: Tue, 18 Jul 2023 22:14:32 +0700 Subject: [PATCH] Add screen size check on `popup` --- scene/main/window.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 3ea53da14131..6f1ad2762b58 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1633,7 +1633,10 @@ void Window::popup(const Rect2i &p_screen_rect) { if (p_screen_rect != Rect2i()) { set_position(p_screen_rect.position); - set_size(p_screen_rect.size); + int screen_id = DisplayServer::get_singleton()->get_screen_from_rect(p_screen_rect); + Size2i screen_size = DisplayServer::get_singleton()->screen_get_usable_rect(screen_id).size; + Size2i new_size = p_screen_rect.size.min(screen_size); + set_size(new_size); } Rect2i adjust = _popup_adjust_rect();