Ugh, apparently my mail client had something messed up and wasn't
notifying me of new mail in this list for the last few months -- so I
didn't even see this until now!  Sorry!

On Sat, Apr 19, 2008 at 4:02 AM, Mark Seaborn <[EMAIL PROTECTED]> wrote:
> This patch adds a "standalone" subcommand to xpra.
>
> "xpra standalone COMMAND ARGS..." runs the given command so that the X
> display is proxied by xpra.  This is useful for testing.  The xpra
> client and server are run within the same process, although they still
> communicate through a socket.

Interesting idea.  I'm not convinced it's worth the code ugliness
required (in particular, having to be super-careful with displays
everywhere is the sort of thing that becomes a constant source of
hard-to-notice bugs) and especially worth just diking out wimpiggy's
icon support for, when it seems like other solutions could be nearly
as useful.  (Some of the convenience ideas are independently valuable
-- e.g., the X display autoselection code, if it can be made to really
work -- and for the rest, if the only use case is testing, one might
as well just write a little script to spawn the server and client
separately.  And there are more changes that might make this more
convenient too, e.g. giving the client automatic reconnection code to
make it robust against both unreliable networks and a server that is
slow to start up.)

> I refactored xpra.server to use a gdk.Display object instead of using
> Gdk's global default display.  That did not work in all cases.  I had
> to disable the handler for _NET_WM_ICON, which caused xpra to fail on
> gedit (among others).  It was trying to create a pixmap on the wrong
> display.  This is a regression for parti, though this is not used in
> xpra.

Yeah, I originally tried to write wimpiggy to never use the global
display object -- until I discovered that GDK is missing some bits of
its api, so that that was impossible, and I gave up.  (I think it
might be that there's no pixmap_new_for_display or something?  I
forget what the actual problem was.)  I still have no objection to
making wimpiggy display-clean where possible, since it makes whitebox
testing easier.

Some specific notes on your patch:

> --- wimpiggy/composite.py       9b35416f3062bc9705cd604eb04b079838063097
> +++ wimpiggy/composite.py       c586a5d8cced26465c19ce4b705ed54a4c7fb6f8
> @@ -85,7 +85,7 @@ class CompositeHelper(AutoPropGObjectMix
>                 listening = []
>                 win = get_parent(self._window)
> -                while win is not gtk.gdk.get_default_root_window():
> +                while win.get_parent() is not None:

Fine, applied.

> --- wimpiggy/window.py  844185278c5ff36fbb7f1d01dfaa038537783739
> +++ wimpiggy/window.py  58de424d8490f5ca3382dc5341b8ed38a5d9e540
> @@ -649,7 +649,8 @@ class WindowModel(BaseWindowModel):
>         print "icon is now %r" % (self.get_property("icon"),)
> -    _property_handlers["_NET_WM_ICON"] = _handle_net_wm_icon
> +    # Causes gedit to fail
> +    #_property_handlers["_NET_WM_ICON"] = _handle_net_wm_icon

Not so fine.  (What does "causes gedit to fail" even mean?)

> --- wimpiggy/wm.py      f708add7d38d8a0260a16a8e0981f1078d3fc233
> +++ wimpiggy/wm.py      a07296ee7c2c6c9c4854970ded4ea2d4eb17a5df
> @@ -163,6 +163,7 @@ class Wm(gobject.GObject):
>         # Load up our full-screen widget
>         self._world_window = WorldWindow()
> +        self._world_window.set_screen(self._display.get_default_screen())

Fine, applied.

> @@ -37,21 +40,23 @@ def main(cmdline):
> -    mode = args[0]
> +    mode = args.pop(0)

Good idea, applied.

> +
> +def allocate_display():
> +    # TODO: This interacts badly with SSH, which listens on TCP only.
> +    # It is also racy.
> +    number = 20
> +    while os.path.exists("/tmp/.X11-unix/X%i" % number):
> +        number += 1
> +    return ":%i" % number

Yeah, this is ugly.  You might be able to attempt to connect to each
display to see if they're running (and hope that there's some way to
distinguish "failed to connect because there's no server there" and
"failed to connect because there's a server but my credentials were
bad").

> +def run_standalone(parser, args):
> +    if len(args) < 1:
> +        parser.error("Expected command argument")
> +
> +    import gtk.gdk
> +    import xpra.client
> +    import xpra.scripts.server
> +    import xpra.server

xpra/scripts/ could use some refactoring in general, but this kind of
thing would make it *particularly* urgent.

> +    new_display = allocate_display()
> +    # TODO: could use socketpair() instead of a named socket
> +    temp_dir = tempfile.mkdtemp(prefix="xpra-")
> +    try:
> +        socket_path = os.path.join(temp_dir, "xpra-socket")
> +        xvfb_proc = xpra.scripts.server.start_xvfb(new_display)
> +        server_display = gtk.gdk.Display(new_display)
> +        server = xpra.server.XpraServer(socket_path, server_display,
> +                                        clobber=False)
> +        client_socket = socket.socket(socket.AF_UNIX)
> +        client_socket.connect(socket_path)

The Clever UI Trick that xpra currently uses is to make the "xpra
display" and "X display" namespaces match each other; deviating from
it here doesn't seem to buy you anything?

-- Nathaniel

_______________________________________________
Parti-discuss mailing list
[email protected]
http://lists.partiwm.org/cgi-bin/mailman/listinfo/parti-discuss

Reply via email to