Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge pull request #723 from myfreeweb/master
Fixes for Wayland (HiDPI and mouse lock) support, FreeBSD
  • Loading branch information
erorcun committed Nov 16, 2020
2 parents b508458 + 7d03a6f commit 72c0a6a68099fdc125381e21ef779eb9dc102304
Showing with 15 additions and 5 deletions.
  1. +4 −1 premake5.lua
  2. +11 −4 src/skel/glfw/glfw.cpp
@@ -92,7 +92,10 @@ workspace "re3"


filter { "system:bsd" } filter { "system:bsd" }
platforms { platforms {
"bsd-amd64-librw_gl3_glfw-oal" "bsd-x86-librw_gl3_glfw-oal",
"bsd-amd64-librw_gl3_glfw-oal",
"bsd-arm-librw_gl3_glfw-oal",
"bsd-arm64-librw_gl3_glfw-oal"
} }


filter { "system:macosx" } filter { "system:macosx" }
@@ -244,8 +244,10 @@ double
psTimer(void) psTimer(void)
{ {
struct timespec start; struct timespec start;
#ifdef __linux__ #if defined(CLOCK_MONOTONIC_RAW)
clock_gettime(CLOCK_MONOTONIC_RAW, &start); clock_gettime(CLOCK_MONOTONIC_RAW, &start);
#elif defined(CLOCK_MONOTONIC_FAST)
clock_gettime(CLOCK_MONOTONIC_FAST, &start);
#else #else
clock_gettime(CLOCK_MONOTONIC, &start); clock_gettime(CLOCK_MONOTONIC, &start);
#endif #endif
@@ -893,7 +895,7 @@ void psPostRWinit(void)
RwEngineGetVideoModeInfo(&vm, GcurSelVM); RwEngineGetVideoModeInfo(&vm, GcurSelVM);


glfwSetKeyCallback(PSGLOBAL(window), keypressCB); glfwSetKeyCallback(PSGLOBAL(window), keypressCB);
glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB); glfwSetFramebufferSizeCallback(PSGLOBAL(window), resizeCB);
glfwSetScrollCallback(PSGLOBAL(window), scrollCB); glfwSetScrollCallback(PSGLOBAL(window), scrollCB);
glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB); glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB);
glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB); glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB);
@@ -1414,8 +1416,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 // 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 void
cursorCB(GLFWwindow* window, double xpos, double ypos) { cursorCB(GLFWwindow* window, double xpos, double ypos) {
FrontEndMenuManager.m_nMouseTempPosX = xpos; int bufw, bufh, winw, winh;
FrontEndMenuManager.m_nMouseTempPosY = ypos; glfwGetWindowSize(window, &winw, &winh);
glfwGetFramebufferSize(window, &bufw, &bufh);
FrontEndMenuManager.m_nMouseTempPosX = xpos * (bufw / winw);
FrontEndMenuManager.m_nMouseTempPosY = ypos * (bufh / winh);
} }


void void
@@ -1643,6 +1648,8 @@ main(int argc, char *argv[])
#endif #endif
{ {
glfwPollEvents(); glfwPollEvents();
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR,
(FrontEndMenuManager.m_bMenuActive && !PSGLOBAL(fullScreen)) ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_DISABLED);
if( ForegroundApp ) if( ForegroundApp )
{ {
switch ( gGameState ) switch ( gGameState )

0 comments on commit 72c0a6a

Please sign in to comment.