CXO2's picture

CursorVisible bugs

Project:The Open Toolkit library
Version:1.1-2014-01-02
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hello, I encountered bug when I am trying to hide the cursor using CursorVisible = false; in GameWindow

There are 2 bugs

  1. It seem the cursor cannot move to outside window when the GameWindow is focused, its like the cursor just locked for that window. I need to switch to other program to make the cursor move freely.
  2. The Window position suddenly go to bottom of screen when I am trying to click the titlebar (when I am not focus on the GameWindow).

I am running under Windows 7 x86 Bit (But I am trying to make this game cross platform, at least running at Linux and Mac too)
and I hope this will be fixed in the next version because I wanted to use custom cursor in my game! :D


Comments

Comment viewing options

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

#1

This is expected behavior, CursorVisible locks the cursor to the window by design. You can draw a custom cursor using OpenGL.

Can you please test if the second issue is reproducible with git master (https://github.com/opentk/opentk/archive/master.zip)?

the Fiddler's picture

#2

Status:open» need info
CXO2's picture

#3

Status:need info» confirmed

Sorry for delayed reply

Yes, the second issue still occurred with git master.
Oh anyway, can you tell me how to use custom cursor in OpenGL?

Thanks

Edit:
Here the video that describing the second Issue..

the Fiddler's picture

#4

1. Create a regular OpenGL texture with the image you wish to use. 2. Draw a quad with that texture under the mouse location.

The exact implementation depends on the version of OpenGL you are using (desktop or ES, 1.x, 2.x or 3.x+).

Note that this is currently the only cross-platform way to get a color or animated cursor.

CXO2's picture

#5

But that mean... the System cursor will still visible?
That why I need this to hide the system cursor...
Also, is there a way to unlock the cursor to the window by design?

And check my previous comment, I include the video that maybe could help you

the Fiddler's picture

#6

You can set CursorVisible = true as soon as the cursor reaches the edge of the window.

Thanks, I can reproduce the issue and I'm working on a fix.

(The cursor API should probably be revisited for the next version.)

CXO2's picture

#7

Thanks for the trick Fiddler!
I never think about it @___@

Anyway, goodluck! :))

CXO2's picture

#8

Status:confirmed» in progress

Just want to update the status ;)
Goodluck Fiddler!

the Fiddler's picture

#9

I can reproduce this issue with native SDL, so it's not specific to OpenTK. It occurs on Windows when a program calls ClipCursor() and the user alt-tabs away.

I've informed the SDL people, hopefully we will be able to come up with a solution.

the Fiddler's picture

#10

Status:in progress» fixed

Commit e2404d2cfc3ceb1444d07a9929a42552df418e01 fixes this in the native backend.

The SDL backend requires an upstream fix. I've forwarded my findings there.