Xpra: Ticket #1137: fix and restore the osx power handler

Split from #924 which ended up disabling the code.



Fri, 18 Mar 2016 11:42:24 GMT - Antoine Martin:

Some related changes in r12162: different import using AppKit instead of Foundation. As per #924, one can re-enable the power event handler with:

XPRA_OSX_SLEEP_HANDLER=1 Xpra ...

Tue, 29 Mar 2016 05:05:02 GMT - Antoine Martin: attachment set

example code found here: http://stackoverflow.com/questions/31091413/


Tue, 29 Mar 2016 05:07:44 GMT - Antoine Martin: attachment set

example code found here: ​https://mail.python.org/pipermail/pythonmac-sig/2011-February/022916.html


Tue, 29 Mar 2016 07:19:25 GMT - Antoine Martin: owner changed

Based on the small differences between our code and the two examples above and also seeing the changes in #965, I believe r12268 + r12269 makes our code more likely to handle the power events properly and reliably, hopefully without crashing.. (see commit messages for details). Tested OK on a mac mini by clicking on "Sleep" in the Apple menu then waiting until the network packets stop coming through to the server, which seems to be the sign that the machine has been put to sleep proper. So r12271 enables the power event handling code by default again, you can disable it using XPRA_OSX_SLEEP_HANDLER=0.


Does this work for you? (new osx beta uploaded):

Wishlist level: when we are suspending, we should stop querying the clipboard using the timer (timer_clipboard_check). Meh.


If there is still a problem with power events (not seen at all or causing crashes), please try both code examples attached to this ticket from a terminal in the GUI session (NOT from ssh, sudo or su,..)

ie:

./Desktop/Xpra.app/Contents/Helpers/Python ./osx_sleepwake_notification.py

Do you get sleep / wake notifications with either of them? Do you get crashes?


Sun, 10 Apr 2016 06:18:37 GMT - Antoine Martin: priority, milestone changed

Raising: this should be included in 0.17 if we can.


Wed, 13 Apr 2016 21:30:30 GMT - alas: status changed; resolution set

Tested with osx 0.17.0 r12380 client against 0.17.0 r12380 fedora 23 server.

Works like a charm... both when inducing sleep with the apple menu and when just setting the sleep preferences in the system preferences.

One detail that might be worth noting - if the client machine doesn't have the "Wake for network access" box checked then the client connection will timeout after 60 seconds while asleep. Checking the box though, the client seems to suspend indefinitely without timing out (maybe the clipboard querying is an awkward bonus?).

I'll go ahead and take the liberty of closing this one (also confirmed that #965 is still fixed).


Tue, 06 Sep 2016 10:00:06 GMT - Antoine Martin:

#1277 changes this power event delegate code to avoid warnings.


Sat, 23 Jan 2021 05:16:00 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1137