Mouse not locked after full screen

Hi,

I would like to report what I think is a bug. After switching to full screen mode, the mouse is no longer captured by my game.

Right now, I’m doing something like this:

	// Get game user settings
	if (GEngine)
	{
		UGameUserSettings *settings = GEngine->GetGameUserSettings();
		settings->SetFullscreenMode(EWindowMode::Fullscreen);
		settings->SetVSyncEnabled(true);
		settings->ApplySettings(true);
	}

This works, as my game switches to full screen mode. However, I am using two monitors at the moment (both running at 1920x1080 pixels resolution). And if I move the mouse out of the window (to the other monitor) and make a click there, my game loses the focus (it does not minimize however, it just won’t receiver any input from the mouse and keyboard until I click into the game window again).

Hi ,

Are you looking for a way to keep the mouse inside your game window?

Hi ,

yes, that is correct. This is because the player should not see the mouse in the game and he has to left-click for interaction.

If a left click occurs outside of the game window, it becomes inactive without the player even knowing (if in full screen) - which is bad.

Edit: I marked this as “bug report” since the mouse should not be able to leave the window in full screen mode, if there is no mouse cursor, right?

What version of the Engine are you using, and did you install the binary version of the Engine or did you build the Engine from source code? The StrategyGame sample has a visible mouse that is kept within the game window, and the ShooterGame sample uses mouse input without the mouse being visible. Do you see this same issue that you have described with either one of those samples?

I’m using the precompiled 4.4.3 release of Unreal Engine 4.

And yes, it is the same with the shooter game demo. The mouse is initially locked (as intended). However, if I go to the options menu and activate the full screen mode, the mouse is no longer locked and I can move it to the second monitor (which should not be possible). You should be able to reproduce this in the shooter demo, if you have two monitors.

If it matters: My main monitor is on the left side (this is where the game runs) and my second monitor is on the right side.

Edit: I apply the settings by double clicking the “Apply settings” menu point, if this matters.

Hi ,

I was able to see the issue that you described with ShooterGame, but only if I did not click in the game window before trying to move the mouse outside of the game window. If I switch to fullscreen and immediately move the mouse, I can move the mouse outside of the game window. However, if I click inside the game window first, then the mouse is again locked inside the game window. Do you see this as well with your project?

I went ahead and submitted a report about the behavior I saw, since this shouldn’t be happening (TTP# 349488).

Hi ,

thank you very much. Yes, I see this behaviour in my game as well.