Move the window context changing during show fix into glfw code
It more logically belongs there.
This commit is contained in:
parent
9837531b63
commit
55417e4269
2 changed files with 4 additions and 2 deletions
4
glfw/wl_window.c
vendored
4
glfw/wl_window.c
vendored
|
|
@ -896,6 +896,7 @@ attach_temp_buffer_during_window_creation(_GLFWwindow *window) {
|
|||
static void
|
||||
loop_till_window_fully_created(_GLFWwindow *window) {
|
||||
if (!window->wl.window_fully_created) {
|
||||
GLFWwindow *ctx = glfwGetCurrentContext();
|
||||
debug("Waiting for compositor to send fractional scale for window %llu\n", window->id);
|
||||
monotonic_t start = monotonic();
|
||||
while (!window->wl.window_fully_created && monotonic() - start < ms_to_monotonic_t(300)) {
|
||||
|
|
@ -904,6 +905,9 @@ loop_till_window_fully_created(_GLFWwindow *window) {
|
|||
}
|
||||
}
|
||||
window->wl.window_fully_created = true;
|
||||
// If other OS windows were resized when this window is shown, the ctx might have been changed by
|
||||
// user code, restore it to whatever it was at the start.
|
||||
if (glfwGetCurrentContext() != ctx) glfwMakeContextCurrent(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1226,8 +1226,6 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
|
|||
#ifndef __APPLE__
|
||||
is_apple = false;
|
||||
glfwShowWindow(glfw_window);
|
||||
// On Wayland glfwShowWindow spins the event loop, which could include resize events for other OS Windows causing the context to change
|
||||
if (glfwGetCurrentContext() != glfw_window) glfwMakeContextCurrent(glfw_window);
|
||||
#endif
|
||||
if (global_state.is_wayland || is_apple) {
|
||||
float n_xscale, n_yscale;
|
||||
|
|
|
|||
Loading…
Reference in a new issue