Merge pull request #79617 from sepTN/add-screensize-check-popup

Add size check to prevent popup bigger than the screen itself
This commit is contained in:
Rémi Verschelde 2024-02-19 00:07:01 +01:00
commit dfcecb77bd
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 1 deletions

View File

@ -1770,7 +1770,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();