xpra icon
Bug tracker and wiki

Opened 4 years ago

Closed 16 months ago

Last modified 12 months ago

#391 closed enhancement (fixed)

osx shadow server improvements: mdns, keyboard support, etc

Reported by: Antoine Martin Owned by: alas
Priority: minor Milestone: 0.17
Component: server Version:
Keywords: osx Cc:

Description (last modified by Antoine Martin)

The OSX shadow server needs similar fixes to the win32 one (#389), namely:

Change History (16)

comment:1 Changed 4 years ago by Antoine Martin

Description: modified (diff)

comment:2 Changed 3 years ago by Antoine Martin

Milestone: future0.16

Scheduling for 0.16

comment:3 Changed 2 years ago by Antoine Martin

Milestone: 0.160.17

Re-scheduling.

comment:4 Changed 20 months ago by Antoine Martin

Status: newassigned

Running from a non GUI terminal bails out with this ugly message, which should be turned into a more friendly init check:

xpra main error:
Traceback (most recent call last):
  File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/scripts/main.py", line 124, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/scripts/main.py", line 919, in run_mode
    return run_server(error_cb, options, mode, script_file, args)
  File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/scripts/server.py", line 927, in run_server
    app = ShadowServer()
  File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/platform/darwin/shadow_server.py", line 48, in __init__
    raise Exception("cannot grab test screenshot - maybe you need to run this command whilst logged in via the UI")
Exception: cannot grab test screenshot - maybe you need to run this command whilst logged in via the UI

comment:5 Changed 20 months ago by Antoine Martin

Not sure if this is specific to OSX, but we should skip the stacktrace:

failed to create socket /var/tmp/502-Xpra/osx-2.local-0
Traceback (most recent call last):
  File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/scripts/server.py", line 357, in setup_local_sockets
    sock, cleanup_socket = create_unix_domain_socket(sockpath, mmap_group, socket_permissions)
  File "/Users/osx/Desktop/Xpra.app/Contents/Resources/lib/python/xpra/scripts/server.py", line 231, in create_unix_domain_socket
    listener.bind(sockpath)
  File "socket.pyc", line 228, in meth
error: [Errno 13] Permission denied
xpra initialization error:
 failed to create socket /var/tmp/502-Xpra/osx-2.local-0
closing tcp socket 0.0.0.0:10000

comment:6 Changed 20 months ago by Antoine Martin

Some fixes:

  • as of r11712 + r11714, the error from comment:4 looks like this:
    cannot grab pixels from the screen, make sure this command is launched from a GUI session
    
  • r11714 also fixes sound forwarding from osx and win32 shadow servers (and therefore microphone forwarding too)
  • r11711 removes the full stacktrace from the error in comment:5
  • r11713 fixes the underlying error: the default xpra config was including a path specific to the machine it is built on! oops (part of the changes for #963)

New TODO: we should either ship the pybonjour mdns wrapper (as done with winswitch), or not bother trying avahi to avoid this message:

Warning: failed to load the mdns avahi publisher: No module named avahi
 either fix your installation or use the 'mdns=no' option

comment:7 Changed 18 months ago by Antoine Martin

  • r12246: the osx shadow server also has a systray
  • r12231: publishes the shadow server via mdns using pybonjour

comment:8 Changed 18 months ago by Antoine Martin

Description: modified (diff)

Important fix to backport (keypresses cause a crash!) in r.

The CGRegisterScreenRefreshCallback is deprecated in 10.8, instead we're supposed to use the Streaming the Contents of a Display API, which can send us frames in BGRA, YUV420, ..

Using Quartz API, CGRegisterScreenRefreshCallback should be able to replace the timer, and look like this (adapted from the pyobjc tests):

from Quartz.CoreGraphics import CGRegisterScreenRefreshCallback, CGRect
myInfo = object()
callcount = [0]
def callbackRefresh(count, rects, info):
    assert info is myInfo
    assert isinstance(rects, tuple)
    assert isinstance(count, (int, long))
    for i in rects:
        assert isinstance(i, CGRect)
        callcount[0] += 1
err = CGRegisterScreenRefreshCallback(callbackRefresh, myInfo)
assert err==0
...
CGUnregisterScreenRefreshCallback(callbackRefresh, myInfo)

Also useful:

The keymapping is not implemented yet..

Last edited 18 months ago by Antoine Martin (previous) (diff)

comment:9 Changed 18 months ago by Antoine Martin

  • osx shadow server fixes: r12250 (crash!), r12254 (fix control-c hang)
  • damage notifications implemented in r12252!

The printing stuff is blocked by #641: we need the installer to add the cups backend script to the system.

Last edited 18 months ago by Antoine Martin (previous) (diff)

comment:10 Changed 18 months ago by Antoine Martin

Note about selecting the audio device on OSX: osxaudiosrc/osaudiosink uses non-unique identifiers as device ID

comment:11 Changed 18 months ago by Antoine Martin

A lot of progress in #641 / r12376:

  • we have a PKG
  • man page is installed
  • cups backend (needs testing)
  • /usr/bin wrappers

In order to support launching a remote shadow server via ssh (ie: xpra shadow ssh:OSXIP), we would need to run as an agent:

Maybe the agent can just sit there, listening for events and we just tell it what to run (ie: xpra shadow "$@"?) - which will then run from the correct context and be able to access the display server (avoiding the dreaded _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.): see #1169.

Last edited 17 months ago by Antoine Martin (previous) (diff)

comment:12 Changed 17 months ago by Antoine Martin

Owner: changed from Antoine Martin to alas
Status: assignednew
  • r12390 switches to gstreamer 1.6 (see #1069)
  • r12394 will make us use the osxaudiosrc ahead of autoaudiosrc
  • r12395 + r12393 + r12396 + r12398: add very basic shadow keymap support (hardcoded) - will follow up in #1171
  • r12397 disables printer forwarding with shadow servers (fails silently - why was I expecting anything more helpful from apple?) - will follow up in #1170
  • r12391 fixes a hard crash in netifaces.gateways()
  • r12392 should workaround NSCFData being passed to the network layer (but apparently does not.. will fix once I manage to reproduce reliably)
  • the ability to start a shadow via ssh is in #1169
  • keyboard improvements is now in #1172
  • sound in #1205

@afarr: this is a FYI, feel free to close.

Last edited 16 months ago by Antoine Martin (previous) (diff)

comment:13 Changed 17 months ago by Antoine Martin

Summary: osx shadow server improvementsosx shadow server improvements: mdns, keyboard support, etc

comment:14 Changed 16 months ago by alas

Resolution: fixed
Status: newclosed

Ok, thanks for info.

I actually gave it a shot, some luck with tcp, not so much with ssh... details of that failure in #1169.

This one looks like it's time it got closed.

comment:15 Changed 16 months ago by Antoine Martin

You must be doing something wrong.
I've just re-tested against 10.6.x, 10.9.x and 10.10.x and it shadowed the existing display in all cases.

comment:16 Changed 12 months ago by Antoine Martin

Follow up: #1321, #1322

Note: See TracTickets for help on using tickets.