Skip to content

Commit

Permalink
Add screen size check on popup
Browse files Browse the repository at this point in the history
  • Loading branch information
sepTN committed Feb 18, 2024
1 parent 2797325 commit 34210e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 34210e8

Please sign in to comment.