BLCM / OpenBLCMM

OpenBLCMM - Borderlands Community Mod Manager
GNU General Public License v3.0
33 stars 2 forks source link

Allow closing dialogs via OS "window close" button #48

Closed apocalyptech closed 1 year ago

apocalyptech commented 1 year ago

There's various dialogs which don't close when the user hits the OS "window close" button -- have to use the Java-provided "OK" button or the like. Specifically:

The dialogs were honestly probably created like that more-or-less by default. We often want the result of one of the given buttons passed back. But there's mostly no good reason not to figure out having a default action fire when the dialog is told to close, instead of just denying the request. The behavior should probably ideally be:

  1. If the dialog has a "Cancel" button, send "Cancel" back
  2. If the dialog just has a single button which is "OK", send OK back
  3. In the absence of OK or Cancel, continue to deny the window-close request.

In terms of our newish AdHocDialog class, we've got four ButtonSets:

apocalyptech commented 1 year ago

Okay, yep, this turned out to be a pretty easy one. All instances where it wasn't working were using AdHocDialog, so adding support in there fixed all these up. Since we're using that dialog very heavily throughout the app, I expect this probably took care of nearly all cases.