#1137 closed defect (fixed)
fix and restore the osx power handler
Reported by: | Antoine Martin | Owned by: | alas |
---|---|---|---|
Priority: | critical | Milestone: | 0.17 |
Component: | platforms | Version: | trunk |
Keywords: | osx | Cc: |
Description
Split from #924 which ended up disabling the code.
Attachments (2)
Change History (8)
comment:1 Changed 5 years ago by
Changed 5 years ago by
Attachment: | osx_sleepwake_notification.py added |
---|
example code found here: http://stackoverflow.com/questions/31091413/
Changed 5 years ago by
Attachment: | osx_sleep_notification.py added |
---|
example code found here: https://mail.python.org/pipermail/pythonmac-sig/2011-February/022916.html
comment:2 Changed 5 years ago by
Owner: | changed from Antoine Martin to alas |
---|
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):
- power events should be logged with
-d osx
, and look like this:... applicationDidFinishLaunching_(NSConcreteNotification 0x9eb5060 {name = NSApplicationDidFinishLaunchingNotification; object = <NSApplication: 0x4009a0>; userInfo = { NSApplicationLaunchIsDefaultLaunchKey = 1; }}) register_sleep_handlers() ... receiveSleepNotification_(NSConcreteNotification 0x1b4c170 {name = NSWorkspaceWillSleepNotification; object = <NSWorkspace: 0x9eb42c0>}) sleep_callback=<bound method XpraClient.suspend of gtk2.client> cb(sleep_callback)=<bound method XpraClient.suspend of gtk2.client> system is suspending ...
- it should not crash!
- it should still restore the windows when clicking on the dock (#965 - this code was modified)
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?
comment:3 Changed 5 years ago by
Milestone: | 1.0 → 0.17 |
---|---|
Priority: | major → critical |
Raising: this should be included in 0.17 if we can.
comment:4 Changed 5 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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).
comment:6 Changed 6 weeks ago by
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1137
Some related changes in r12162: different import using
AppKit
instead ofFoundation
.As per #924, one can re-enable the power event handler with: