jcreedcmu / twelf-mac

Other
0 stars 1 forks source link

Twelf about box halts all computation when open #19

Closed agoode closed 6 months ago

agoode commented 6 months ago

Even the clock stops ticking.

Maybe it is calling GetNextEvent instead of WaitNextEvent?

jcreedcmu commented 6 months ago

Ha, it's just a busy loop.

 while (!Button())
    ;
  while (Button())
    ;

https://github.com/jcreedcmu/twelf-mac/blob/main/docker/twelf-app/menus.c#L152-L155

Replacing it with an actual event loop at that least handles idle events makes sense.

jcreedcmu commented 6 months ago

There is something very fishy going on. Even with WaitNextEvent, when I create the about box modelessly, relying on the main event loop, setting the about box's window's refCon to a sentinel value to exempt it from IsAppWindow (for IsAppWindow() = true generally means that docTE is assumed to exist) then the presence of a modeless about window also prevents background processes from ticking forward, or at least prevents them from visibly updating. I need to bisect between the 'good' state of creating a fully fledged document window (which demonstrably works, and doesn't disrupt background updates) and the 'bad' state of whatever the about window currently is.

jcreedcmu commented 6 months ago

Completely redoing how the about box is handled --- making it a distinct type of window, and making sure I'm handling both kinds correctly everywhere --- seems to solve the problem.

agoode commented 6 months ago

I do think it should be modal since that fits the classic mac style. And actually going to "About Finder..." (hold down Option) does freeze the clock. So maybe we actually want that? (Sorry)

jcreedcmu commented 6 months ago

Hmmmmmm. Interesting. I notice some variation.

About TextEdit: modeless About this Macintosh: modeless

About Script Editor: modal alert, (clock continues in background) but with a button that opens a modeless "credits" window that looks like a styled TextEdit with scrollbars.

About ResEdit: modal, click or keypress to dismiss (clock continues in background) About Stuffit Expander: modal, click to transition to a second screen, then click to dismiss (clock continues in background)

About Netscape: launches about page within browser

This is making me feel like a wide range of idiosyncratic things are reasonably acceptable. I do kind of like the idea of keeping open the possibility of modal with some animation that kicks in after a minute, like the "About Finder..." does, and which I feel some faint memory that I've seen other programs do that.

jcreedcmu commented 6 months ago

Current state of repo as of 7cac2a43886eeb4a6d4ac059300eeb2c3ebd7eb4 is "modal, allows background computation". Are we happy with this?

agoode commented 6 months ago

Oh I love the current behavior now!