Mathyn's picture

OpenTK.Input.Mouse not working on Windows 8

Recently I installed Windows 8 on my computer. After checking if my programs still worked I discovered that all mouse input using the OpenTK.Input namespace no longer works.

When I call:
OpenTK.Input.MouseState mouseState= OpenTK.Input.Mouse.GetState();
it only reports mouseState.IsConnected is false.

It worked just fine on windows 7, which leads me to believe it is a problem with Windows 8 and/or OpenTK.

Could anyone verify this problem? I would like to be sure before making a topic in the issues forum.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ollipekka's picture

I think people will have to start living with the fact that this project is going to have to live in GitHub in people's forks until we get someone to push updates to the SVN. Anyone got an idea whether MonoDevelop guys have their own fork somewhere or if they are using the SVN?

AndyKorth's picture

I got some notes from some folks on github about this. I'm still not sure about the earlier Windows versions, like XP, but here is my patch that attempts to be backwards compatible. (Since I sort of assume the registry value "ClassGUID" isn't on windows XP..?)

So this is the fix I'm committing to my personal repository at least:

                        string deviceClass = (string)regkey.GetValue("Class");
                        string deviceClassGUID = (string)regkey.GetValue("ClassGUID"); // for windows 8 support via OpenTK issue 3198
                        // making a guess at backwards compatability. Not sure what older windows returns in these cases...
                        if(deviceClass != null || deviceClass.Equals(string.Empty)){
                            RegistryKey classGUIDKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\" + deviceClassGUID);
                            deviceClass = classGUIDKey != null ? (string) classGUIDKey.GetValue("Class") : string.Empty;

Mouse fix was commit a while ago.