summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-13 17:13:30 +0100
committerGitHub <noreply@github.com>2019-02-13 17:13:30 +0100
commitf015bc8d2ba9e2caecd8eb627d414e4ea5f53ba4 (patch)
tree8ea89b1a535611a8c68b9092e1a8394f009b61c1
parent419fb45a3eea68516828fe4541a62f8641cf13ef (diff)
parentf48829d1a4154df68c19fff171e81a07c4b60ccd (diff)
Merge pull request #25858 from buresu/fix-package-installer
Fix button alignment of Package Installer on OSX
-rw-r--r--scene/gui/popup.cpp35
1 files changed, 4 insertions, 31 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 2d2c54594a..80ec7049fc 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -124,49 +124,22 @@ void Popup::popup_centered_minsize(const Size2 &p_minsize) {
void Popup::popup_centered(const Size2 &p_size) {
- Point2 window_size = get_viewport_rect().size;
-
- emit_signal("about_to_show");
Rect2 rect;
+ Size2 window_size = get_viewport_rect().size;
rect.size = p_size == Size2() ? get_size() : p_size;
-
rect.position = ((window_size - rect.size) / 2.0).floor();
- set_position(rect.position);
- set_size(rect.size);
-
- show_modal(exclusive);
- _fix_size();
- Control *focusable = find_next_valid_focus();
- if (focusable)
- focusable->grab_focus();
-
- _post_popup();
- notification(NOTIFICATION_POST_POPUP);
- popped_up = true;
+ popup(rect);
}
void Popup::popup_centered_ratio(float p_screen_ratio) {
- emit_signal("about_to_show");
-
Rect2 rect;
- Point2 window_size = get_viewport_rect().size;
+ Size2 window_size = get_viewport_rect().size;
rect.size = (window_size * p_screen_ratio).floor();
rect.position = ((window_size - rect.size) / 2.0).floor();
- set_position(rect.position);
- set_size(rect.size);
- show_modal(exclusive);
- _fix_size();
-
- Control *focusable = find_next_valid_focus();
- if (focusable)
- focusable->grab_focus();
-
- _post_popup();
- notification(NOTIFICATION_POST_POPUP);
- popped_up = true;
+ popup(rect);
}
void Popup::popup(const Rect2 &p_bounds) {