Mouse no longer in 'freelook' after fullscreen toggle

Hi everyone. I’m using the full screen toggle method, which works fine except that when the app restarts in the new mode, the mouse no longer works in ‘freelook’ mode (ie, the mouse changes the camera, until the invisible cursor hits the edges of the screen).

The only way I can get it back to its original state is by changing screens (like jumping to and from the main menu).

I’m not doing anything special with the mouse. The player uses BetterCharacterControl and when onStartScreen is called it just does this:

[java]
app.getFlyByCamera.setEnabled(true)
app.getInputManager.setCursorVisible(false)[/java]

I suspect it has something to do with the app restarting and nifty not updating? I’ve tried several things, like enqueuing a call to the state’s onStartScreen method and manually running nifty.update, but the only thing that works is manually switching between screens. eg

[java]if (settings.isFullscreen) settings.setWindowed
else settings.setFullScreen

this.setSettings(settings)
this.restart

this.enqueue(new Callable[Unit] {
def call: Unit = {
gameState.onStartScreen
nifty.update}
})[/java]

Seems like I’m missing something pretty fundamental here, but I’m not sure what to try next.

Update

It appears that the window is partially losing focus, despite it being full screen (and responding to input etc). When I toggle back to windowed mode and click the window frame, then it works fine.

I’m not sure if this is a jme problem, but I’d be grateful for any suggestions.