Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local cursor not supported in IE or Edge #572

Closed
samhed opened this issue Jan 25, 2016 · 7 comments
Closed

Local cursor not supported in IE or Edge #572

samhed opened this issue Jan 25, 2016 · 7 comments

Comments

@samhed
Copy link
Member

samhed commented Jan 25, 2016

Normally we use a data uri to store the cursor, we then use this URI as a value for style.cursor on the canvas. However, this isn't supported in any version of Internet Explorer or Microsoft Edge.

http://caniuse.com/#search=cursor
http://caniuse.com/#feat=datauri

Can anyone think of another way to support local cursor in noVNC?

@kanaka
Copy link
Member

kanaka commented Jan 25, 2016

Here is another couple of relevant links:

Unfortunately, it doesn't seem that IE/Edge are going to support either data URIs or the "none" option to hide the cursor. One option we could explore is the PointerLock API which would allow us to hide the cursor and then render our own directly in the canvas. However the downside is that the captures the pointer inside the canvas and it requires user permission.

Probably the best option that would work everywhere (all browsers and older versions too) would be to change the cursor to a blank cursor file and then directly render the mouse in the canvas. It's not as nice as just having the browser to the work of rendering the cursor for us, but it's the best option I can think of for supporting this widely if we think it's important.

@samhed
Copy link
Member Author

samhed commented Jan 27, 2016

Thank you @kanaka

Wouldn't rendering the mouse in the canvas be quite slow?

@kanaka
Copy link
Member

kanaka commented Jan 27, 2016

@samhed I think it would be pretty efficient.

I also thought of a more efficient method: whenever the cursor is changed, you would just create a separate cursor sized transparent canvas with that cursor rendered inside it (this shouldn't happen that often and it's basically something we already do when the local cursor changes). Then, whenever you get a mouse move event you position the canvas at that position over the main canvas area.

@JSkier21
Copy link

JSkier21 commented May 15, 2017

I don't see a cursor in Google Chrome either. With TigerVNC x0vncserver and novnc, there is no cursor.
TigerVNC/tigervnc#361

@samhed
Copy link
Member Author

samhed commented May 16, 2017

@JSkier21 your problem is not related to this issue. Please open a new issue.

@samhed samhed added the bug label Oct 24, 2017
@samhed samhed added this to the Future Features milestone Oct 24, 2017
DirectXMan12 added a commit that referenced this issue Mar 5, 2018
Some browsers (*cough* IE *cough*) don't support cursors via data URIs,
and touch devices sometimes don't have proper cursors, so we had to rely
on remote cursor support in some cases.

Instead, we can now display local cursors by rendering the cursor to a
transparent canvas (with pointer events disabled on that mini-canvas)
when we encounter those conditions, meaning we can now advertise local
cursor support in all conditions.

Fixes #572.
DirectXMan12 added a commit that referenced this issue Mar 5, 2018
Some browsers (*cough* IE *cough*) don't support cursors via data URIs,
and touch devices sometimes don't have proper cursors, so we had to rely
on remote cursor support in some cases.

Instead, we can now display local cursors by rendering the cursor to a
transparent canvas (with pointer events disabled on that mini-canvas)
when we encounter those conditions, meaning we can now advertise local
cursor support in all conditions.

Fixes #572.
@sourabhtiwari
Copy link

Instead of changing too much of code and using manually rendered canvas in place of a mouse. I have used a workaround for novnc 1.0.0.

Replace

this._display.disableLocalCursor(); in _negotiate_Server_init()

With

if (!this._viewOnly){ if(supportsCursorURIs()){ this._display.disableLocalCursor(); }

and use

if (this._fb_depth == 24) {
           if (!this._viewOnly)          
           encs.push(encodings.pseudoEncodingCursor);
       }

in _sendEncodings();

As Edge does not support data-URI. We are simply using pseudoEncodingCursor and not disabling local cursor.

This will stop mouse cursor from being kind of unresponsive.

Worked for Me.

The only Drawback with this approach is that the mouse will not change cursor icons. It will only show the default cursor. Which is not a very big issue.

@samhed
Copy link
Member Author

samhed commented Oct 23, 2018

@sourabhtiwari Are you seeing any practical problems with the approach merged in #1032 or are you simply sharing a different workaround you guys are using?

@samhed samhed added the fixed label Oct 23, 2018
@samhed samhed modified the milestones: Future Features, v1.1.0 Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants