add initial window size tiling workaround
This commit is contained in:
parent
1461293594
commit
ccdd8601d2
1 changed files with 11 additions and 1 deletions
12
src/ptk.c
12
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue