public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Jon TURNEY <jon.turney@dronecode.org.uk>
To: cygwin-xfree@cygwin.com
Cc: mikedep333@gmail.com
Subject: Re: Help porting the XLaunch feature to autoselect the display number
Date: Tue, 24 Feb 2015 14:59:00 -0000	[thread overview]
Message-ID: <54EC91B9.4040602@dronecode.org.uk> (raw)
In-Reply-To: <CAMKht8jmDcsEZYrf2518f2oXzc+WO4cWGd4haNVndMkyUzKHrg@mail.gmail.com>

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/


      reply	other threads:[~2015-02-24 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  3:57 Michael DePaulo
2015-02-24 14:59 ` Jon TURNEY [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54EC91B9.4040602@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-xfree@cygwin.com \
    --cc=mikedep333@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).