-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support the 'ExtendedDesktopSize' and the 'SetDesktopSize' encodings #271
Conversation
…mewhat related to noVNC issue novnc#117
* Implemented correct use of the FBU.bytes variable. * Removed the non-incremental update from ext_desktop_size to prevent the server from sending extra ExtendedDesktopSize rectangles. * The code is now using the 'onFBUComplete' callback from rfb to resize the session on reconnect instead of a timer.
I have added a couple of fixes to this, I appreciate any comments. |
Sorry for the slow reply. Hopefully I'll be able to take a look and give some feedback this weekend. |
Merged to keep up to date with head |
How can I test your changes? |
Sorry for the slow response! I don't know what you are doing wrong, could be some restrictions with your server since this sort of resize is initated by the client. Which browser do you use? I do not think you have missunderstood my changes, both the scenarios you describe should work and they did work for us when I left off. I am still on vacation, I will be back to work in about two weeks, I will then verify that the code still works and I will also write down a way for you to test my changes properly. In the meanwhile, would you mind trying to invoke a resize of the session from the server? To resize the session on the server you can use the xrandr -s command. Please use the setup where this patch doesn't work. This server side resize should work without problems, but I am interested in the behavior of your browser when you do this. Edit: formatted for readability |
…due to the new control-bar height.
Okey, I am back and I can verify that my code still works flawlessly for us. I found a small error due to the code being somewhat out of date, but the effect of the bug was minor. @thardeck I would like to get some info about which vnc server and browser you use so that I can try and reproduce a scenario where my patch doens't work. |
I have tested it with Chromium 30 and Firefox 23 on Linux against QEMU. I need to scroll in case of 1024x768 guest resolutions and if I decrease the browser window size, the noVNC canvas keeps its original size. |
As far as I could find the vnc server in QEMU does not support ExtendedDesktopSize which is required for this patch to work. You could send feedback to them if you would like them to implement it. I also updated my first post here to clarify. |
Ok, that does explain it, thanks for the clarification. |
The bug would prevent the viewport from properly changing size.
This now works for vnc_auto.html as well. |
Conflicts: vnc_auto.html
|
||
fb_width = width; | ||
fb_height = height; | ||
|
||
rescale(conf.scale); | ||
that.viewportChange(); | ||
that.viewportChange(0, 0, width, height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this change breaks the viewport pan function.. @kanaka do you have a quick explanation? Otherwise I will keep digging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's doesn't work on my project,i used libvirt in centos,javascript in the browser,i just can't let the vnc's width&height follow the browser change.could u help me?thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.. first of all you need a VNC server which supports the ExtendedDesktopSize encoding. Then you need the functionality that this PR is supposed to give. As I mentioned here, this function works but sadly it breaks the viewport pan function.
@samhed : are you still interested in working on this? It looks like a good feature to have. |
@DirectXMan12 yes, I will get back to solving the bug in this patch, as soon as I get time. I do have some things that I have to prioritize at the moment, but this is still on my list. |
This reverts commit e894bf7.
Conflicts: include/display.js include/rfb.js include/ui.js vnc_auto.html
…lbars when "clipping" is disabled.
…e or smaller than the remote session size.
… make the code easier to read.
Okay, I'm finally done with this! 🎉 I'll give people a chance to review the patch over the weekend before I merge it. |
Had forgot to test vnc_auto.html, works now after I added two quick fixes. |
😮 I'll try to take a look at this tomorrow. Thanks for finishing this up -- it'll be a good feature to have. |
I'd love to put this PR behind me, it's been nagging me for one and a half years now :) Did you get a chance to have a look? |
@@ -198,9 +222,10 @@ | |||
'local_cursor': WebUtil.getQueryVar('cursor', true), | |||
'shared': WebUtil.getQueryVar('shared', true), | |||
'view_only': WebUtil.getQueryVar('view_only', false), | |||
'onUpdateState': updateState, | |||
'updateState': updateState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be onUpdateState (otherwise the status bar doesn't function correctly)
@samhed : the actual functionality looks like a charm ✨, but I have a couple of general comments, as well as some inline comments.
|
Thank you @DirectXMan12 for taking your time to go through this! I agree with your comments and will get to work.
Yes, I was contemplating doing this.. the reason I didn't was that since not all VNC servers have this functionality. Do you think that an option called "Resize remote session to fit the browser window" would be confusing?
I'm not 100% sure what you mean by "original PR" here, but yes I will clean it up. 👍 |
Perhaps look at it the other way around: have an option that says "Disable remote session resize to fit browser window". That might be a bit less confusing (not checked just means we haven't explicitly disabled it, not that it's always supported). Another option (albeit a bit more complicated) would be a dropdown with three options: "off", "ask", and "always try". "Off" would mean "never resize"; "Ask" (the default) would mean that if a server sent ExtendedDesktopSize, ask the user if they would like to send SetDesktopSize in the future; and "always try" would mean always use it if the server supported it (we may or may not need this -- it may be sufficient just to have "ask"). This also paves the road for supporting other resize methods, such as automatic scaling (just add another dropdown option).
whoops, I mean to say "back to their original commit" ;-) |
Hm, that's true, your first option might be a bit more clear for users in some cases. But I don't like the idea of having an option which you can check to "disable" something. I feel the second option seems a bit too much, I would personally prefer something very simple-looking. noVNC is after all a VNC client without attachments to any specific VNC servers. The goal should be to be able to handle messages any server following the RFB-protocol sends our way. I think I lean towards simply labeling the option "Resize to window" in the same short style as the rest of the options. |
That works for me. You may want to make it "resize desktop to window" or "resize remote to window" so it's not unclear what it does if we merge a scaling patch as well (with "resize to window" vs "scale to window", it's unclear how they're different). |
That sounds good! I will create a new PR with cleaned up commits. I will start looking on the tests on monday. |
Hm.. when I want to try to run some of my tests I get this:
And nothing more, no hints! If i run 'PATH=$PATH:node_modules/karma/bin npm tests' I do get more output:
I'm not sure what I can do to actually understand what's wrong! 😟 |
sometimes, the console test runners leave a bit to be desired (specifically, PhantomJS's array-related errors are not always the best). Try |
When the data type is the same but the assertion fails like in this case, should we not have displayed the difference in the data? Hehe well, I guess I can resort to debugging my tests through "console.log" and the javascript console in the browser at least! |
I didn't get that fancy when I wrote the assertion ;-). The actual browsers often display the full arrays (instead of Phantom's "[ Array(24) ]"), so running with the |
Somewhat related to noVNC issue #117, but instead of scaling it is using the RFB protocol message 'SetDesktopSize' from the client to the server.
Edit:
This patch adds support in noVNC for the encodings 'ExtendedDesktopSize' (-308) and 'SetDesktopSize' (251). If the 'ExtendedDesktopSize' encoding is supported by the server, this patch allows for automatic resizes of the session shown in noVNC to fit the browser window. Note that the server still has the option of denying the resize request from noVNC.
When supported, this is a client-initiated resize. For this to work the 'ExtendedDesktopSize' encoding is required on the server. Aside from client-initiated resizes this encoding brings support from the server for multiple monitors (Note that mulitple monitors are not supported by noVNC). Documentation can be found here.
The resize is triggered by changes to the browser window's size. Note that this will have the effect that if multiple viewers are connected to one session on the VNC server the latest change will decide the size of the session as viewed on all clients.
The 'ExtendedDesktopSize' encoding is fairly new to the protocol and I know that many VNC servers have not yet implemented this, but I do know that TigerVNC's server have implemented it.
Summary: