Fixed: transient popovers broke modal windows.
Fixed: transient popovers broke modal windows.

Without this fix, opening a transient popover would allow windows other than the modal window (or its children) to be interacted with.

In general, setCallback:forNextEventMatchingMask: did not work right if more than 1 callback was installed.

In the popover case the modal window would install its "any event" callback to control the event loop, but then the popover would add a second callback for mouse down to detect clicks outside of it. This would disrupt the modal event handling and allow mouse clicks (and presumably other events) to escape the modal event catcher.

This fix makes multiple nextEvent callbacks work as one would expect, with later ones taking priority over older ones and reinserted callbacks remaining at a stable priority.

This allows the modal window callback to be at the "bottom" of the handler stack and the popover event handler to be "on top" of that, and to remain that way. In theory more layers of event handling could be layered on top such as 2 simultaneous popovers.

This fix also fixes the dequeue argument in forNextEvent callbacks.

primalmotion/cappuccino,cacaodev/cappuccino,rgv151/cappuccino,zittix/cappuccino,rgv151/cappuccino,tancred/cappuccino,mrcarlberg/cappuccino,zittix/cappuccino,tancred/cappuccino,cappuccino/cappuccino,cappuccino/cappuccino,deltaprojects/cappuccino,wangshijin/cappuccino,daboe01/cappuccino,daboe01/cappuccino,Rosch/cappuccino,AlexanderMazaletskiy/cappuccino,zittix/cappuccino,kidaa/cappuccino,krodelin/cappuccino,koamac/Cappuccino,wangshijin/cappuccino,primalmotion/cappuccino,rgv151/cappuccino,zittix/cappuccino,enquora/cappuccino,FrankReh/cappuccino,koamac/Cappuccino,krodelin/cappuccino,deltaprojects/cappuccino,deltaprojects/cappuccino,cacaodev/cappuccino,wangshijin/cappuccino,daboe01/cappuccino,primalmotion/cappuccino,zittix/cappuccino,FrankReh/cappuccino,koamac/Cappuccino,koamac/Cappuccino,cacaodev/cappuccino,enquora/cappuccino,AlexanderMazaletskiy/cappuccino,Dogild/cappuccino,koamac/Cappuccino,Rosch/cappuccino,daboe01/cappuccino,rgv151/cappuccino,rgv151/cappuccino,enquora/cappuccino,krodelin/cappuccino,Dogild/cappuccino,cappuccino/cappuccino,deltaprojects/cappuccino,deltaprojects/cappuccino,mrcarlberg/cappuccino,Dogild/cappuccino,deltaprojects/cappuccino,kidaa/cappuccino,tancred/cappuccino,krodelin/cappuccino,FrankReh/cappuccino,FrankReh/cappuccino,mrcarlberg/cappuccino,krodelin/cappuccino,primalmotion/cappuccino,tancred/cappuccino,AlexanderMazaletskiy/cappuccino,cacaodev/cappuccino,primalmotion/cappuccino,enquora/cappuccino,krodelin/cappuccino,enquora/cappuccino,AlexanderMazaletskiy/cappuccino,zittix/cappuccino,kidaa/cappuccino,Dogild/cappuccino,daboe01/cappuccino,wangshijin/cappuccino,cappuccino/cappuccino,Rosch/cappuccino,koamac/Cappuccino,Dogild/cappuccino,daboe01/cappuccino,cacaodev/cappuccino,tancred/cappuccino,mrcarlberg/cappuccino,cappuccino/cappuccino,cacaodev/cappuccino,primalmotion/cappuccino,wangshijin/cappuccino,Rosch/cappuccino,enquora/cappuccino,mrcarlberg/cappuccino,tancred/cappuccino,Rosch/cappuccino,krodelin/cappuccino,daboe01/cappuccino,Rosch/cappuccino,FrankReh/cappuccino,cappuccino/cappuccino,AlexanderMazaletskiy/cappuccino,enquora/cappuccino,deltaprojects/cappuccino,primalmotion/cappuccino,cacaodev/cappuccino,FrankReh/cappuccino,rgv151/cappuccino,mrcarlberg/cappuccino,FrankReh/cappuccino,mrcarlberg/cappuccino,rgv151/cappuccino,AlexanderMazaletskiy/cappuccino,Dogild/cappuccino,Dogild/cappuccino,kidaa/cappuccino,kidaa/cappuccino,wangshijin/cappuccino,kidaa/cappuccino,FrankReh/cappuccino,mrcarlberg/cappuccino,cappuccino/cappuccino,Rosch/cappuccino,zittix/cappuccino