Fix for window being opened on secondary monitor using primary monitor DPI

This commit is contained in:
Kovid Goyal 2017-12-20 23:01:06 +05:30
parent c8aee8c881
commit 70a4720bf9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 1 deletions

View File

@ -374,8 +374,17 @@ show_window(PyObject UNUSED *self, PyObject *args) {
if (!PyArg_ParseTuple(args, "K|p", &os_window_id, &yes)) return NULL;
for (size_t i = 0; i < global_state.num_os_windows; i++) {
OSWindow *w = global_state.os_windows + i;
set_dpi_from_os_window(w);
if (w->id == os_window_id) {
if (yes) glfwShowWindow(w->handle); else glfwHideWindow(w->handle);
if (yes) {
bool first_show = !w->shown_once;
glfwShowWindow(w->handle);
w->shown_once = true;
if (first_show) {
w->has_pending_resizes = true;
global_state.has_pending_resizes = true;
}
} else glfwHideWindow(w->handle);
break;
}
}

View File

@ -105,6 +105,7 @@ typedef struct {
double last_resize_at;
bool has_pending_resizes;
bool is_semi_transparent;
bool shown_once;
uint32_t offscreen_texture_id;
unsigned int clear_count;
} OSWindow;