Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
glfw: scale cursor position by the ratio of framebuffer to screen size
This fixes the mouse being constrained to the top left quarter of the window on Wayland HiDPI setups.
  • Loading branch information
unrelentingtech committed Sep 28, 2020
1 parent 5654347 commit b95accb8ff6a594d1a920b94823b38be3515f149
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/skel/glfw/glfw.cpp
@@ -1397,8 +1397,11 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
// TODO this only works in frontend(and luckily only frontend use this). Fun fact: if I get pos manually in game, glfw reports that it's > 32000
void
cursorCB(GLFWwindow* window, double xpos, double ypos) {
FrontEndMenuManager.m_nMouseTempPosX = xpos;
FrontEndMenuManager.m_nMouseTempPosY = ypos;
int bufw, bufh, winw, winh;
glfwGetWindowSize(window, &winw, &winh);
glfwGetFramebufferSize(window, &bufw, &bufh);
FrontEndMenuManager.m_nMouseTempPosX = xpos * (bufw / winw);
FrontEndMenuManager.m_nMouseTempPosY = ypos * (bufh / winh);
}

void

0 comments on commit b95accb

Please sign in to comment.