MacOS: Fix restoring of window size not correct on Retina screens

Fixes #382
This commit is contained in:
Kovid Goyal 2018-03-13 08:19:15 +05:30
parent f7f9ceec34
commit 9c46de319e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 4 additions and 2 deletions

View File

@ -754,7 +754,7 @@ main_loop(ChildMonitor *self, PyObject *a UNUSED) {
OSWindow *os_window = global_state.os_windows + w - 1;
if (should_os_window_close(os_window)) {
destroy_os_window(os_window);
call_boss(on_os_window_closed, "Kii", os_window->id, os_window->viewport_width, os_window->viewport_height);
call_boss(on_os_window_closed, "Kii", os_window->id, os_window->window_width, os_window->window_height);
for (size_t t=0; t < os_window->num_tabs; t++) {
Tab *tab = os_window->tabs + t;
for (size_t w = 0; w < tab->num_windows; w++) mark_child_for_close(self, tab->windows[w].id);

View File

@ -30,6 +30,8 @@ update_os_window_viewport(OSWindow *window, bool notify_boss) {
window->has_pending_resizes = false;
window->viewport_width = MAX(window->viewport_width, 100);
window->viewport_height = MAX(window->viewport_height, 100);
window->window_width = MAX(w, 100);
window->window_height = MAX(h, 100);
if (notify_boss) {
call_boss(on_window_resize, "KiiO", window->id, window->viewport_width, window->viewport_height, dpi_changed ? Py_True : Py_False);
}

View File

@ -97,7 +97,7 @@ typedef struct {
void *handle;
id_type id;
OSWindowGeometry before_fullscreen;
int viewport_width, viewport_height;
int viewport_width, viewport_height, window_width, window_height;
double viewport_x_ratio, viewport_y_ratio;
Tab *tabs;
unsigned int active_tab, num_tabs, capacity, last_active_tab, last_num_tabs, last_active_window_id;