Hi,

I wanted to try it out to possibly apply it, but when I
copied the patch into a file and used git apply, I got:
"error: corrupt patch at line 11" although it did
not look corrupted to me?

>From what I see it would couple the esc key in all panels
with the ok button, but some might also have a cancel button,
which is the more natural fit for the esc key and having the
key activate ok in that case may confuse users. Though
I'm not sure atm if its only dialogs that have a cancel button
in FreeCol or if theres also some panels. Did you check for this?

Btw., have you tested already if all panels still work correctly?


Greetings,

wintertime


> Gesendet: Donnerstag, 02. Februar 2017 um 16:34 Uhr
> Von: "Enrico Weigelt, metux IT consult" <enrico.weig...@gr13.net>
> An: Freecol-developers@lists.sourceforge.net
> Betreff: [Freecol-developers] [PATCH] client: gui: panel: harmonize close 
> behavior of panels - enable ESC for all
>
> ---
>  src/net/sf/freecol/client/gui/panel/ColonyPanel.java  |  8 --------
>  src/net/sf/freecol/client/gui/panel/FreeColPanel.java | 12 ++++++++++++
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/src/net/sf/freecol/client/gui/panel/ColonyPanel.java 
> b/src/net/sf/freecol/client/gui/panel/ColonyPanel.java
> index 62429528198..7fce63942dd 100644
> --- a/src/net/sf/freecol/client/gui/panel/ColonyPanel.java
> +++ b/src/net/sf/freecol/client/gui/panel/ColonyPanel.java
> @@ -271,14 +271,6 @@ public final class ColonyPanel extends PortPanel
>              traceWorkButton = 
> Utility.localizedButton("colonyPanel.traceWork");
>          }
>  
> -        // Use ESCAPE for closing the ColonyPanel:
> -        InputMap closeIM = new ComponentInputMap(okButton);
> -        closeIM.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
> -                    "pressed");
> -        closeIM.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true),
> -                    "released");
> -        SwingUtilities.replaceUIInputMap(okButton,
> -            JComponent.WHEN_IN_FOCUSED_WINDOW, closeIM);
>          okButton.setText(Messages.message("close"));
>  
>          InputMap unloadIM = new ComponentInputMap(unloadButton);
> diff --git a/src/net/sf/freecol/client/gui/panel/FreeColPanel.java 
> b/src/net/sf/freecol/client/gui/panel/FreeColPanel.java
> index 5f04eead564..6bc301eb1ee 100644
> --- a/src/net/sf/freecol/client/gui/panel/FreeColPanel.java
> +++ b/src/net/sf/freecol/client/gui/panel/FreeColPanel.java
> @@ -31,10 +31,12 @@ import net.sf.freecol.common.model.Specification;
>  
>  import javax.swing.AbstractButton;
>  import javax.swing.Action;
> +import javax.swing.ComponentInputMap;
>  import javax.swing.InputMap;
>  import javax.swing.JButton;
>  import javax.swing.JComponent;
>  import javax.swing.KeyStroke;
> +import javax.swing.SwingUtilities;
>  import java.awt.FlowLayout;
>  import java.awt.LayoutManager;
>  import java.awt.event.ActionEvent;
> @@ -208,6 +210,16 @@ public abstract class FreeColPanel extends MigPanel 
> implements ActionListener {
>          inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true),
>                       "release");
>  
> +        // Use ESCAPE for closing the panel
> +        InputMap closeIM = new ComponentInputMap(okButton);
> +        closeIM.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false),
> +                    "pressed");
> +        closeIM.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true),
> +                    "released");
> +
> +        SwingUtilities.replaceUIInputMap(okButton,
> +            JComponent.WHEN_IN_FOCUSED_WINDOW, closeIM);
> +
>          Action cancelAction = cancelButton.getAction();
>          getActionMap().put("release", cancelAction);
>      }
> -- 
> 2.11.0.rc0.7.gbe5a750
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Freecol-developers mailing list
> Freecol-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freecol-developers
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to