Skip to content
This repository has been archived by the owner. It is now read-only.

Fixes for Wayland (HiDPI and mouse lock) support, FreeBSD #723

Merged
merged 5 commits into from Nov 16, 2020
Merged
Use GLFW_CURSOR_DISABLED (glfw's native mouse restriction)
On Wayland, clients cannot move the mouse pointer.
Mouse constraints, as required for 3D camera movement, are an explicit specific thing,
and glfw supports it with GLFW_CURSOR_DISABLED.
Use DISABLED, unless we're in a menu in windowed mode, where HIDDEN is still appropriate.
  • Loading branch information
unrelentingtech committed Sep 28, 2020
commit 0205960a2fe13174b5dc17abf080b6821a3c883a
@@ -1628,6 +1628,8 @@ main(int argc, char *argv[])
#endif
{
glfwPollEvents();
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR,
(FrontEndMenuManager.m_bMenuActive && !PSGLOBAL(fullScreen)) ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_DISABLED);

This comment has been minimized.

@erorcun

erorcun Oct 18, 2020
Collaborator

there is a few problems in here:

  • why set input mode on every frame?
  • I agree with you on using GLFW_CURSOR_DISABLED, but you should wrap our mouse centering with #ifndef RW_GL3 in that case. it's in main.cpp, should show up when you search for // This is from SA, but it's nice for windowed mode.
  • fullScreen isn't updated after screen mode change, you'll have to update it if you want to use that variable.

This comment has been minimized.

@unrelentingtech

unrelentingtech Oct 18, 2020
Author Contributor

why set input mode on every frame?

I could not find the places where this condition would change :(

This comment has been minimized.

@erorcun

erorcun Oct 18, 2020
Collaborator

at the end of CMenuManager::SwitchMenuOnAndOff() you will see if (m_bMenuActive != menuWasActive), you can add your code under it. you can use !m_nPrefsWindowed for checking if it's fullscreen. also don't forget to wrap it with #ifdef RW_GL3 if it's certain that you want to add it there.

if( ForegroundApp )
{
switch ( gGameState )