Fix button alignment of Package Installer on OSX

This problem occurs only in the HiDPI environment.
This commit is contained in:
Naoto Kondo 2019-02-13 23:51:38 +09:00
parent bc9c1e899e
commit f48829d1a4

View file

@ -124,49 +124,22 @@ void Popup::popup_centered_minsize(const Size2 &p_minsize) {
void Popup::popup_centered(const Size2 &p_size) { void Popup::popup_centered(const Size2 &p_size) {
Point2 window_size = get_viewport_rect().size;
emit_signal("about_to_show");
Rect2 rect; Rect2 rect;
Size2 window_size = get_viewport_rect().size;
rect.size = p_size == Size2() ? get_size() : p_size; rect.size = p_size == Size2() ? get_size() : p_size;
rect.position = ((window_size - rect.size) / 2.0).floor(); rect.position = ((window_size - rect.size) / 2.0).floor();
set_position(rect.position);
set_size(rect.size);
show_modal(exclusive); popup(rect);
_fix_size();
Control *focusable = find_next_valid_focus();
if (focusable)
focusable->grab_focus();
_post_popup();
notification(NOTIFICATION_POST_POPUP);
popped_up = true;
} }
void Popup::popup_centered_ratio(float p_screen_ratio) { void Popup::popup_centered_ratio(float p_screen_ratio) {
emit_signal("about_to_show");
Rect2 rect; 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.size = (window_size * p_screen_ratio).floor();
rect.position = ((window_size - rect.size) / 2.0).floor(); rect.position = ((window_size - rect.size) / 2.0).floor();
set_position(rect.position);
set_size(rect.size);
show_modal(exclusive); popup(rect);
_fix_size();
Control *focusable = find_next_valid_focus();
if (focusable)
focusable->grab_focus();
_post_popup();
notification(NOTIFICATION_POST_POPUP);
popped_up = true;
} }
void Popup::popup(const Rect2 &p_bounds) { void Popup::popup(const Rect2 &p_bounds) {