diff --git a/src/ptk.c b/src/ptk.c index da1d76f..bdb0b39 100644 --- a/src/ptk.c +++ b/src/ptk.c @@ -124,7 +124,17 @@ bool ptk_init(const size_t width, const size_t height, const char *title, const vk_init_vertices(); - if (!vk_init(m_window, width, height, title, application_version)) { + // on tiling desktops (most standalone X11 WMs / Wayland compositors) + // the size of the window won't necessarily be what the user set due to tiling + // so we do this ugly workaround where we fetch the size again + // after creating the window and then initialize vulkan with that size + // + // this fixes an issue where components would get drawn squished + // and their hitboxes wouldn't match up with them visually + int actual_width = 0, actual_height = 0; + glfwGetFramebufferSize(m_window, &actual_width, &actual_height); + + if (!vk_init(m_window, actual_width, actual_height, title, application_version)) { PTK_ERR("failed initializing vulkan"); return false; }