Dark Mode Change While Asleep?

  1. 3 weeks ago

    Stephen D

    Nov 27 Pre-Release Testers, Xojo Pro

    Has anyone else noticed that if the computer is asleep when the dark mode context switch happens, that Xojo apps don't update properly? That is, you don't get the app.appearancechange event when the computer wakes up. I could create a timer to watch for the change but I think some built in controls also don't update...

    Still on R2019r1.1

  2. Rick A

    Nov 27 Pre-Release Testers (Brazil. UTC-3:00)
    Edited 3 weeks ago

    I think Xojo must implement some sort of sleeping/wakeup events. So you can do things like store some sort of info before sleeping, and restoring states after returning. In a wakeup_event, instead of pooling states, you could handle things of appearance change. https://docs.microsoft.com/en-us/windows/win32/power/system-wake-up-events

  3. Rick A

    Nov 27 Pre-Release Testers (Brazil. UTC-3:00)

    When dealing with mobile OS's like Android, Xojo probable will handle things like that, events like suspend and resume. A similar counterpart kind of mimicking the behavior of suspension/resume could exist for desktop.

  4. Norman P

    Nov 27 Pre-Release Testers, Xojo Pro under THE bus

    do other apps pick up the chnaged appearance properly ?
    that is a real edge case and I wonder how the notification is handled when the app resumes

  5. Rick A

    Nov 27 Pre-Release Testers (Brazil. UTC-3:00)
    Edited 3 weeks ago

    @Norman P do other apps pick up the chnaged appearance properly ?

    In the event you can do anything. Consult any property and statuses and adjust whatever you need.

    But... In the above Dark mode losing the context, as the "Dark mode" is something Xojo implemented by itself, they need to intercept such conditions and context aberrations as reported (if I understood correctly, the dark mode changed in the "suspend event" and the GUI returned crazy after resume), and handle them (like fire a timer event to an internal ReadjustThingsInCaseOfDarkModeChange()), BEFORE bubling up the resume event to the user. In such case, the "dark mode" inconsistencies should work without the user intervention.

  6. Norman P

    Nov 27 Pre-Release Testers, Xojo Pro under THE bus
    Edited 3 weeks ago

    dark mode is not something xojo implemented on their own
    its actually tied into the macOS notification the OS sends out that says "hey we switched into dark mode" or out of it which ever the case may be
    https://developer.apple.com/documentation/foundation/nsdistributednotificationcenter

    I wonder if when the app registers for notifications if it ncludes a suspesion behaviour that tells the OS to defer a switch to dark mode until the app re-awakens
    https://developer.apple.com/documentation/foundation/nsdistributednotificationcenter/1414136-addobserver?language=objc

    perhaps they need to register with a "hold" behaviour

    EDIT : for rick its basically the code Sam posted here
    https://forum.xojo.com/conversation/post/390715

  7. Rick A

    Nov 27 Pre-Release Testers (Brazil. UTC-3:00)
    Edited 3 weeks ago

    @Norman P dark mode is not something xojo implemented on their own

    But I've read that some controls are not native, not auto responding the UI changes, and need Xojo side treatment, am I wrong that such parts needs differentiated treatment?

    @Norman Palardy I wonder if when the app registers for notifications if it ncludes a suspesion behaviour that tells the OS to defer a switch to dark mode until the app re-awakens

    Who knows. A Xojo tester must experiment this mix of dark mode vs suspension/resume in a interface full of controls, and look for flaws.

  8. Norman P

    Nov 27 Pre-Release Testers, Xojo Pro under THE bus

    Rick
    Reread the original post
    He's not asking about why doesnt a listbox update etc
    Its the entire app

    @Stephen D That is, you don't get the app.appearancechange event when the computer wakes up.

    And that is, I suspect, related to how the app registers for notifications that may be sent out when the app is asleep like this change to dark mode
    That would make the most sense to me that the notifications simply get dropped and so its not switching on wake

  9. 2 weeks ago

    Stephen D

    Nov 28 Pre-Release Testers, Xojo Pro

    It's a cumbersome one to test as you can't change your clock while asleep. Does anyone know of a way to make a Parallels VM actually sleep?

  10. Beatrix W

    Nov 28 Pre-Release Testers, Third Party Store Europe (Germany)

    Can't you change your location in the VM? The VM should fall asleep like a normal OS.

  11. Stephen D

    Nov 28 Pre-Release Testers, Xojo Pro

    Yes, but Parallels seems to "Suspend" the VM instead of allowing it to sleep.

    I'm just going to code in the bind and see what happens this eve! ;)

or Sign Up to reply!