This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help porting the XLaunch feature to autoselect the display number


On 24/02/2015 03:57, Michael DePaulo wrote:
I am trying to port this feature of VcXsrv (and XMing also I think) to
Cygwin XLaunch:
https://sourceforge.net/p/vcxsrv/code/ci/460182676a960385dff96c1563f781213060f6fc/

Attached is my WIP patch. (I know it needs the comments updated for main.cc).

There's a bug in main.cc that is causing this to happen when -1 is specified:
http://imgur.com/Jv4tpip

Protip: Ctrl-c works on MessageBox dialogs to copy their contents.

Thanks for looking into this.

Unfortunately, this turns into a non-trivial amount of work.

The upstream design is that -displayfd introduces a file descriptor that the child X server process inherits, to which it will write it's display number.

(This fd will be one end of a pipe which the parent process has opened, and it will read the display number from the fd for the other end)

In the VcXsrv implementation, instead a handle to some shared memory is used to pass the display number back. (I guess a Windows anonymous pipe would have worked just as well, but possibly this is simpler to implement).

So, you will need to re-write the changes to main.cc to create a pipe (using pipe()), pass the write fd using -displayfd, and read the diplay number from the read fd.

Even after you've done this, I'm not 100% sure that cygwin pipes are successfully propagated across CreateProcess(). I have a vague memory this is where I got stuck when I last looked at this, but I'm not sure I'd noticed that CreateProcess() is being invoked with bInheritHandles=FALSE.

I found my old (non-working) attempt at implementing this [1], which might help you a bit.

[1] https://github.com/jon-turney/xlaunch/commit/b3fc02fcc9ac43224137963e2aba39abb88608da

--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]