any1 / neatvnc

A liberally licensed VNC server library with a clean interface
ISC License
120 stars 30 forks source link

Desktop resizing #81

Closed pH5 closed 1 year ago

pH5 commented 1 year ago

Implement minimal desktop resizing support and demonstrate it in the draw example, tested with TigerVNC.

This uses the ExtendedDesktopSize pseudo-encoding to let clients know that they may issue SetDesktopSize messages. Neat VNC reports those via the nvnc_desktop_size_fn callback. Right now the callback is not prepared for multi-display support (the screen layout structures are not passed in) and it can't report back the out-of-resources or request-forwarded (async) status codes - a return value of true maps to no-error and false maps to resize-administratively-prohibited.

pH5 commented 1 year ago

I was a bit wary to add RFB protocol details to the nvnc API without knowing how it is supposed to be used, but I think nvnc_desktop_size_fn could get an array of translated rfb_screen structures passed in, possibly with matching nvnc_display pointers filled in by Neat VNC, assuming the nvnc displays correspond to rfb screens 1:1.

It could also return an enum instead of bool to allow reporting the out-of-resources or request-forwarded status codes.

any1 commented 1 year ago

We try to follow the Linux kernel style guide, with exceptions. See: https://github.com/any1/wayvnc/blob/master/CONTRIBUTING.md#style

Can you go through these changes and make sure that they adhere to the prescribed style?

Maybe I should add a CONTRIBUTING.md to this project to eliminated the guesswork.

pH5 commented 1 year ago

Could this be encoded in _clang-format? For example:

UseTab: ForContinuationAndIndentation
AlignAfterOpenBracket: DontAlign
ContinuationIndentWidth: 16

to wrap argument lists as described.

any1 commented 1 year ago

Oh, I forgot that there was a _clang-format; haven't run it in a while. If you can make it work properly, I'll happily accept changes to it.

pH5 commented 1 year ago

Oh, I forgot that there was a _clang-format; haven't run it in a while. If you can make it work properly, I'll happily accept changes to it.

Unfortunately, clang-format appears to use ContinuationIndentWidth both for argument lists (with AlignAfterOpenBracket: DontAlign) and for struct initializers. I see no way to configure one to be two tabs, and the other just one.

I've updated the style semi-manually now.

any1 commented 1 year ago

Thanks!