Windows Support for sharing a single monitor on a multiple monitor system

14 views
Skip to first unread message

Danny Park

unread,
Jun 2, 2020, 10:56:50 AM6/2/20
to TigerVNC Developer Discussion
I am in the process of implementing support for choosing which monitor to share on a multiple monitor windows system running winvnc4 from TigerVNC.  I would like contribute my solution to the project for other users benefit.  The purpose of this post is to (1) solicit feedback for the best way to expose this new option and (2) minimally document my solution for someone to use in the future in case I am pulled to another project before contributing the full solution.

My understanding is that Windows has a concept of a Virtual Screen (https://docs.microsoft.com/en-us/windows/win32/gdi/the-virtual-screen).  This Virtual Screen includes all the monitors and blank space bounding those monitors in a rectangle.  TigerVNC currently shares the entire virtual screen.  In my case, this leads to significant black space and one monitor display I don't care about when I connect remotely to my TigerVNC server on Windows.

The file win/rfb_win32/SDisplay.cxx contains a StringParameter called displayDevice that defaults to a blank string.  The default displayDevice as a blank string causes winvnc4.exe to share the entire virtual screen.  However, if displayDevice is set to the proper string, then only a single monitor can be shared.  I have tested the string "\\\\.\\DISPLAY1" (slashes are escaped) and it works in 2 different setups for me.  The proper string can be found using the EnumDisplayMonitors function (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdisplaymonitors).

Would it be reasonable to expose the displayDevice string as a registry and/or command line option without providing a user interface as a first step that could be incorporated into the TigerVNC project or would it also require modifying vncconfig?  Is this already available for the *nix version? If so, how does that work?  I would like to make it consistent.

Thanks,
Danny

P.S. I have had significant issues compiling for Windows.  I noticed others have, too (https://groups.google.com/forum/#!topic/tigervnc-devel/2-Y0ahJ2zgE and https://github.com/TigerVNC/tigervnc/issues/1038).

Pierre Ossman

unread,
Jun 3, 2020, 1:33:59 AM6/3/20
to Danny Park, TigerVNC Developer Discussion
On 02/06/2020 16:56, Danny Park wrote:
>
> Would it be reasonable to expose the displayDevice string as a registry
> and/or command line option without providing a user interface as a first
> step that could be incorporated into the TigerVNC project or would it also
> require modifying vncconfig? Is this already available for the *nix
> version? If so, how does that work? I would like to make it consistent.
>

On Unix we have two servers. One of them supports giving coordinates for
which part of the (virtual) screen to export. The other always exports
the entire thing.

I don't see it as a must to be consistent with that though. Exporting
based on monitors sounds like a reasonable approach. I don't think we
should expose users to techincal low level details though, so a more
user friendly interface would be desirable. In what ways can we identify
the monitors? Is there a way that stays somewhat stable, and/or is easy
for the user to understand?

The Windows server is generally configured using vncconfig, not the
command line. So for the feature to really be useful it would need to
get some GUI there as well.

>
> P.S. I have had significant issues compiling for Windows. I noticed others
> have, too
> (https://groups.google.com/forum/#!topic/tigervnc-devel/2-Y0ahJ2zgE and
> https://github.com/TigerVNC/tigervnc/issues/1038).
>

We don't have any maintainers focusing on Windows, so unfortunately it
hasn't gotten much attention. Feel free to add what you can to the wiki
(or build system) if you can improve things.

Regards
--
Pierre Ossman Software Development
Cendio AB http://cendio.com
Teknikringen 8 http://twitter.com/ThinLinc
583 30 Linköping http://facebook.com/ThinLinc
Phone: +46-13-214600 http://plus.google.com/+CendioThinLinc

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Danny Park

unread,
Jun 4, 2020, 8:33:55 AM6/4/20
to TigerVNC Developer Discussion


On Wednesday, June 3, 2020 at 1:33:59 AM UTC-4, Pierre Ossman wrote:
I don't see it as a must to be consistent with that though. Exporting
based on monitors sounds like a reasonable approach. I don't think we
should expose users to techincal low level details though, so a more
user friendly interface would be desirable. In what ways can we identify
the monitors? Is there a way that stays somewhat stable, and/or is easy
for the user to understand?

I think I can look up the technical device name using a display number (and integer).  I'm not sure if it corresponds to anything the user can check or if it will just have to be trial and error to get the correct display.


The Windows server is generally configured using vncconfig, not the
command line. So for the feature to really be useful it would need to
get some GUI there as well.

I'll see what I can do.


We don't have any maintainers focusing on Windows, so unfortunately it
hasn't gotten much attention. Feel free to add what you can to the wiki
(or build system) if you can improve things.
 
I realize my comment made it sound like I was complaining. I am working on the compiling aspect and will make a few posts dedicated to that.
Reply all
Reply to author
Forward
0 new messages