Skip to content

Commit

Permalink
Merge pull request #99669 from syntaxerror247/root_window_issues
Browse files Browse the repository at this point in the history
Fix root window size bug on `Android`
  • Loading branch information
akien-mga committed Dec 2, 2024
2 parents 200bb20 + c699d5b commit 302da3d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,12 @@ void Window::move_to_center() {

void Window::set_size(const Size2i &p_size) {
ERR_MAIN_THREAD_GUARD;
#if defined(ANDROID_ENABLED)
if (!get_parent()) {
// Can't set root window size on Android.
return;
}
#endif

size = p_size;
_update_window_size();
Expand Down Expand Up @@ -467,6 +473,12 @@ void Window::_validate_limit_size() {

void Window::set_max_size(const Size2i &p_max_size) {
ERR_MAIN_THREAD_GUARD;
#if defined(ANDROID_ENABLED)
if (!get_parent()) {
// Can't set root window size on Android.
return;
}
#endif
Size2i max_size_clamped = _clamp_limit_size(p_max_size);
if (max_size == max_size_clamped) {
return;
Expand All @@ -484,6 +496,12 @@ Size2i Window::get_max_size() const {

void Window::set_min_size(const Size2i &p_min_size) {
ERR_MAIN_THREAD_GUARD;
#if defined(ANDROID_ENABLED)
if (!get_parent()) {
// Can't set root window size on Android.
return;
}
#endif
Size2i min_size_clamped = _clamp_limit_size(p_min_size);
if (min_size == min_size_clamped) {
return;
Expand Down

0 comments on commit 302da3d

Please sign in to comment.