Drafted because there's some minor cleanup to do here and possibly other aspects I haven't considered, but I wanted to get some feedback on this before investing more time into it.
Addresses #1553, a long-outstanding issue that made using extensions feel particularly janky.
Before, Inkscape would block and go unresponsive while running extensions, as it would run a separate event loop with a different context, I assume to stop interactions with the UI. As a side effect, this also prevented interaction with the dialog that is supposed to allow users to cancel a running extension.
With GTK 4 at least, it's possible to instead block UI interaction by using set_transient_for on the Dialog (or, rather, a chain of set_transient_for from the dialog, to the settings window if present, back to the main window). Then we can just use the main context, and that means that the cancel button will now be handled. A couple of minor tweaks to related code were needed to get termination working correctly on Windows.
For normal applications that do not use implements-custom-gui nor pipe-diffs, the cancel button now works and when clicked immediately kills the extension and allows Inkscape to resume normal functioning.
For now, I left extensions using implements-custom-gui as-is, so they still cause Inkscape to go unresponsive. I think that it it might be a better user experience to present the user with the same "running/cancel" dialog to clue them in to why they can't interact with Inkscape, and allow them to kill misbehaving extensions with custom UIs just like other extensions. It would be an easy change from here (though it would mean that the only thing that implements-custom-gui would change would be preventing the settings window from showing up).
Extensions with pipe-diffs work as before, as they already used the main context and let UI interactions occur.
Tested on Linux (Lubuntu 24.04.1) and Windows 10. I don't have a Mac to test with, unfortunately. I tested it with this collection of test extensions, which cover normal, implements-custom-gui, and pipe-diffs cases (the latter copied from !6958 (merged)).

























