Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minetest locks cursor to center of screen even if minetest window is not active. #3507

Closed
red-001 opened this Issue Dec 31, 2015 · 30 comments

Comments

Projects
None yet
@red-001
Copy link
Contributor

red-001 commented Dec 31, 2015

This bug happens when while minetest is loading an other window is open. If the minetest windows is also minimized minetest may crash or lock the cursor to the top left of the screen instead.

@gregorycu

This comment has been minimized.

Copy link
Contributor

gregorycu commented Jan 1, 2016

Are you able to elaborate on the platform you are on?

@RobertZenz

This comment has been minimized.

Copy link
Contributor

RobertZenz commented Jan 1, 2016

I'm not seeing this problem on Ubuntu 14.04, as soon as the window loses the focus (may it be by switching windows or switching to a different workspace) the cursor is released.

@rubenwardy

This comment has been minimized.

Copy link
Member

rubenwardy commented Jan 1, 2016

@red-001

This comment has been minimized.

Copy link
Contributor Author

red-001 commented Jan 1, 2016

@gregorycu I use windows 7 x64, the bug also used to happen in windows xp.

@paramat paramat added the Bug label Jan 8, 2016

@neoascetic

This comment has been minimized.

Copy link
Contributor

neoascetic commented Jan 9, 2016

Same problem on OSX

@est31

This comment has been minimized.

Copy link
Contributor

est31 commented Jan 27, 2016

This might be upstream bug, idk.

@ShadowNinja

This comment has been minimized.

Copy link
Member

ShadowNinja commented Jan 27, 2016

Also reproduced in Gnome shell in #3619.

@red-001

This comment has been minimized.

Copy link
Contributor Author

red-001 commented Feb 3, 2016

This has also happened in older minetest versions.

@neoascetic

This comment has been minimized.

Copy link
Contributor

neoascetic commented May 11, 2016

Any news?

@nerzhul

This comment has been minimized.

Copy link
Member

nerzhul commented May 11, 2016

it's also present on archlinux with gnome shell

@nerzhul

This comment has been minimized.

Copy link
Member

nerzhul commented May 11, 2016

It's not platform specific.

@ShadowNinja

This comment has been minimized.

Copy link
Member

ShadowNinja commented May 11, 2016

@nerzhul: It seems it is. I've only heard of it happening on OSX, Windows, and Gnome Shell. KDE, XFCE, etc work fine AFAIK.

@DonBatman

This comment has been minimized.

Copy link
Contributor

DonBatman commented May 11, 2016

This happened in Gnome for me. Since I upgraded to Gnome Ubuntu 16.04 it does not happen.

@yusf

This comment has been minimized.

Copy link

yusf commented May 23, 2016

Can confirm it happening on OS X.

@yusf

This comment has been minimized.

Copy link

yusf commented Jun 1, 2016

Couldn't this be quite easily resolved by copying the code that disables cursor lock when opening the main menu in-game?

@est31

This comment has been minimized.

Copy link
Contributor

est31 commented Jun 1, 2016

@yusf if you manage to come up with a solution that works for you it would be appreciated.

@davisonio

This comment has been minimized.

Copy link
Contributor

davisonio commented May 4, 2017

Still happening on macOS and I had the same problem on Windows too. Is avoidable by using ESC before changing windows but largely still annoying.

@ShadowNinja

This comment has been minimized.

Copy link
Member

ShadowNinja commented May 8, 2017

Can't confirm on Windows 10 or KDE.

@nerzhul

This comment has been minimized.

Copy link
Member

nerzhul commented May 8, 2017

@ShadowNinja fullscreen or not ? i think it's an interesting parameter for this

@Fixer-007

This comment has been minimized.

Copy link
Contributor

Fixer-007 commented May 8, 2017

I've experienced that bug few times on Windows 7 sp1. Using minimise and alt-tab hotkeys may help reproducing it.

@SmallJoker

This comment has been minimized.

Copy link
Member

SmallJoker commented May 8, 2017

 src/game.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/game.cpp b/src/game.cpp
index ace6474..782c02b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -2929,7 +2929,8 @@ void Game::toggleFullViewRange()
 
 void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
 {
-	if ((device->isWindowActive() && noMenuActive()) || random_input) {
+	if ((device->isWindowActive() && device->isWindowFocused()
+			&& noMenuActive()) || random_input) {
 
 #ifndef __ANDROID__
 		if (!random_input) {
@@ -2954,9 +2955,7 @@ void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
 			device->getCursorControl()->setVisible(true);
 #endif
 
-		if (!m_first_loop_after_window_activation)
-			m_first_loop_after_window_activation = true;
-
+		m_first_loop_after_window_activation = true;
 	}
 }

Tried to reproduce the bug a few times on my Windows machine. Could someone please be so nice and check if this fixes the problem?

@nerzhul

This comment has been minimized.

Copy link
Member

nerzhul commented May 9, 2017

@SmallJoker looking at functions names seems lgtm for the first part, for the second part, it's strange no ?

@yusf

This comment has been minimized.

Copy link

yusf commented May 13, 2017

Did this solve the issue for Mac too?

@nerzhul

This comment has been minimized.

Copy link
Member

nerzhul commented May 13, 2017

@neoascetic

This comment has been minimized.

Copy link
Contributor

neoascetic commented May 14, 2017

I confirm. The issue has been fixed, thanks, @SmallJoker! Although, there is still an issue: when I am clicking on minetest's window title in order to move it on the screen, the game grabs the cursor and nasty things happen. Simply said, I am unable to move the window. Could we do something with it?

@nerzhul

This comment has been minimized.

Copy link
Member

nerzhul commented May 15, 2017

nice ! thanks

@tacotexmex

This comment has been minimized.

Copy link
Contributor

tacotexmex commented May 16, 2017

@neoascetic Does that also happen when the cursor is unlocked by means of opening a menu or inventory? If so it's a somewhat rarer bug, which is still good though still a bug.

@neoascetic

This comment has been minimized.

Copy link
Contributor

neoascetic commented May 17, 2017

@tacotexmex no, everything is fine when in that case

@neoascetic

This comment has been minimized.

Copy link
Contributor

neoascetic commented May 17, 2017

Here is the thing I am talking about

@tacotexmex

This comment has been minimized.

Copy link
Contributor

tacotexmex commented May 17, 2017

I've seen this behavior in many Mac games unfortunately. Maybe file another bug for grabbing the cursor when window is active but cursor is outside "renderering area"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.