Comment by that_jojo
6 years ago
It's kind of interesting, when you compare WinAPI to classic Mac Toolbox, how incredibly similar their core concepts are.
Especially when you take into account that the first GUI application MS made was Excel for the Macintosh. And then they more-or-less wrote Windows as a runtime environment for porting Excel to PCs.
Not getting into any of that old-school MS-stole-the-GUI flamewar business, I just think it's genuinely historically interesting to note the parallels when you play with each.
A big difference is that Windows used inversion of control. You give the system a callback and it calls you with an event. The Mac toolbox was written with the idea that each application had full control of the machine. This made multiprogramming ... interesting. On the Mac, for example, when you pressed down on a button, it would go into a mode where the button’s code would take all the events until the mouseUp event.
> You give the system a callback and it calls you with an event
Maybe I haven't done enough WinAPI programming, but where is that true? I know there are a few helper functions that automatically dispatch an event to a callback, but I thought in general all events had to be intercepted and dispatched in the message loop
Yes but windows calls your event loop directly for WM_PAINT as well as the event loop calling a system function that calls your window procedure, again investing control. On the Mac you used to hit test the event yourself and figure out which window it was meant for.