From 15e68e1829f723072283a16b29f17b76cd992ae4 Mon Sep 17 00:00:00 2001 From: Mark Benson Date: Wed, 20 Nov 2024 23:46:56 +0000 Subject: [PATCH 1/2] Update DialogCloser.java --- .../main/java/VASSAL/tools/swing/DialogCloser.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java b/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java index b7c4aa4622..8444a01fd8 100644 --- a/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java +++ b/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java @@ -34,11 +34,12 @@ public DialogCloser(JDialog dialog, int ms) { @Override public void run() { - try { - Thread.sleep(ms); - } - catch (InterruptedException e) { - throw new RuntimeException(e); + if (ms > 1) { // Zero means no sleep - refresh only + try { + Thread.sleep(ms); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } dialog.setVisible(false); dialog.dispose(); From 5d9aa05b57a0b61c77c67830a1c90415aea10774 Mon Sep 17 00:00:00 2001 From: Mark Benson <58135975+riverwanderer@users.noreply.github.com> Date: Thu, 21 Nov 2024 00:07:30 +0000 Subject: [PATCH 2/2] Update DialogCloser.java Implements sleep bypass (screen dialog close only) for intervals of zero or less. --- .../src/main/java/VASSAL/tools/swing/DialogCloser.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java b/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java index 8444a01fd8..d0e08fabf4 100644 --- a/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java +++ b/vassal-app/src/main/java/VASSAL/tools/swing/DialogCloser.java @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2008-2023 by The VASSAL Development Team + * Copyright (c) 2008-2024 by The VASSAL Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,15 +29,16 @@ public class DialogCloser implements Runnable { public DialogCloser(JDialog dialog, int ms) { this.dialog = dialog; - this.ms = ms < 0 ? 500 : ms; + this.ms = ms; } @Override public void run() { - if (ms > 1) { // Zero means no sleep - refresh only + if (ms > 0) { try { Thread.sleep(ms); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { throw new RuntimeException(e); } }