Debugging issue concerning setCursorVisible()

Hi!



When the application stops because of exception, I get into debug mode, but I loose control of the mouse cursor in the system…

I have no idea how to setCursorVisible(true) just before the IDE go to debug mode.

I am on linux but on windows I had a similar problem.

This problem is so that I have to go to text console and kill the java running inside the IDE, in other words I cant debug… :(.



Any tips on this?



PS.: I am using jME3_08-18-2010.zip, I put on eclipse cuz the autocompletion broke on NetBeans :(, the debug issue above happened on NetBeans also (even with old sdk lib).



thx on any tip!

On windows you can just alt-tab into the netbeans debugger and you should get your cursor back. I've been debugging jME3 millions of times and it worked fine for me.

I think on Linux and Mac things are quite different, since you don't get the cursor back. Maybe normen might have some insight on this.

On mac command tab works as well.

yup thats it…

on linux, I dont get the cursor back!!!



on windows I get the cursor back, but its movement is limited to the window size, so if I created a 320x200 window on a 1024x768 desktop (it needs to be small window), I am messed :(, cant even reach the stop button xD



I think, on linux, may have a way to disable mouse and re-enable it with some command, but havent tried/researched yet…



anyone else on linux having mouse lock problems? (ubuntu 10.04)

Yeah, Linux is a bit problematic with the cursor handling. In windows the cursor is locked initially to the "former" display window but you can unlock it by alt-tabbing around. You'll get used to it eventually.

Momoko_Fan said:

On windows you can just alt-tab into the netbeans debugger and you should get your cursor back. I've been debugging jME3 millions of times and it worked fine for me.
I think on Linux and Mac things are quite different, since you don't get the cursor back. Maybe normen might have some insight on this.

That reflection has a little bug. I think you need to fix it.
MistaHamsta said:

Momoko_Fan said:

On windows you can just alt-tab into the netbeans debugger and you should get your cursor back. I've been debugging jME3 millions of times and it worked fine for me.
I think on Linux and Mac things are quite different, since you don't get the cursor back. Maybe normen might have some insight on this.

I did alt tab on windows xp and it worked but i'm still having issues

I found a weird workaround to be able to get mouse back while debugging jme3 on eclipse on ubuntu:

Menu: window -> show view -> expressions

add this expression: mouseInput.setCursorVisible(true)

at any point the application breaks, when the expression be evaluated, the mouse is released!!!



YEY !!! back to business!! :smiley:



PS.: that var mouseInput may not be visible, if so try to create a public static pointing to it.



EDIT: this works MUCH better:

org.lwjgl.input.Mouse.setGrabbed(false)

1 Like
@teique said:
I found a weird workaround to be able to get mouse back while debugging jme3 on eclipse on ubuntu:
Menu: window -> show view -> expressions
add this expression: mouseInput.setCursorVisible(true)
at any point the application breaks, when the expression be evaluated, the mouse is released!!!!!!!

YEY !!! back to business!! :D

PS.: that var mouseInput may not be visible, if so try to create a public static pointing to it.

EDIT: this works MUCH better:
org.lwjgl.input.Mouse.setGrabbed(false)


You are a life saver, this is an old topic but still relevant. It would be nice to make a plug-in for this but before I wade into the netbeans documentation, anyone know if it is even possible to find an event or trigger for when the debugger hits a breakpoint?
@jmaasing said:
It would be nice to make a plug-in for this but before I wade into the netbeans documentation, anyone know if it is even possible to find an event or trigger for when the debugger hits a breakpoint?

Or simply to fix the issue on linux based systems, because there are people around who dont use netbeans.
@kardinal said:
Or simply to fix the issue on linux based systems, because there are people around who dont use netbeans.


I would like to suggest another trick,
you can use xdotool to detect the active window,
so, when the application stops it will (probably) set the IDE (eclipse or netbeans) to be the active window, when this is detected, you will run a command to make lwjgl ungrab the mouse (as I understand this is a global system behavior and not application specific, someone could confirm this?) so you can create a simple jar and execute it to ungrab the mouse.

so, this could be a workaround not related to an specific IDE or even other applications (like a frozen Wine application for ex.),

btw, if someone create such a script (I suggest bash) it would be cool to share it here :)

I found a better solution: ctrl + alt + numpad /

As explained in http://unix.stackexchange.com/questions/40458/command-for-forcing-a-pointer-ungrab-captured-mouse-release

1 Like

This issue is impossible for us to fix since once debug mode is entered, jME3 has no control over what’s going on. You will need to find a fix in your OS instead.

Well, jMonkey Engine has no control but the jMonkey SDK sure has, not a complete fix but I’d settle for the SDK emitting the beanshell-expression that you now have to type by hand in “Expressions” window.



I couldn’t get the ‘ctrl + alt + numpad /’ - XF86_Ungrab sent on the OS-level, seems to have been considered a security flaw and have been removed or disabled in many distros.

Well then that’s something you’re gonna have to ask @Normen for …

Hack a jar into the project to press some buttons or what? I think I don’t understand.

The problem is that LWJGL does not ungrab the mouse when the debugger hits a breakpoint and the app-window looses focus. So the best way to solve it would actually to get LWJGL to behave.



But I don’t know too much about that and teique found a work around for the SDK by going ctrl-F9 and execute “org.lwjgl.input.Mouse.setGrabbed(false)”



So I thought maybe I could just make a simple plugin that is accessible on the Debug menu that does just that, i.e. execute that single line of code in the application JVM, that would be good enough for me until there is a fix in LWJGL.



The thing I’m stuck at right now is how to get the debugger to execute the code in the target JVM. I can find the debug manager and debug session alright but then I’m stumped. If I have time I’ll look at the netbeans source this weekend.

:? Sorry… So I call that in my own lwjgl space or the applications? You have to see the project isn’t run in the SDKs JVM…

Got swamped this weekend so I haven’t time to look into it.

But yes, that code needs to execute in the application (the debugee) and not in the SDK JVM. This is what ctrl-F9 does, it evaluates code in the application JVM. So I’m kinda hoping there is some way tell the platform to do same thing as “Evaluate expression” but the plugin will supply the expression.

Mhm… well at some point I planned to sneak something into the basic app to do stuffs like that, also for tighter SDK integration. However as you see I’d have to do something to the application itself and use RMI or stuffs like that…