diff options
author | Fernando Nasser <fnasser@redhat.com> | 2003-12-03 22:29:31 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@gcc.gnu.org> | 2003-12-03 22:29:31 +0000 |
commit | 26d86d940ebeffe2e360292bbba54a7d6eb33ef5 (patch) | |
tree | b75204d393a2829db912a2473c226aecac90c2fb /libjava/gnu | |
parent | b7e0ff45386b3dad465c97cc59f54368bb33d61f (diff) | |
download | gcc-26d86d940ebeffe2e360292bbba54a7d6eb33ef5.zip gcc-26d86d940ebeffe2e360292bbba54a7d6eb33ef5.tar.gz gcc-26d86d940ebeffe2e360292bbba54a7d6eb33ef5.tar.bz2 |
GtkListPeer.java (handleEvent): Fix generation of ActionEvents.
2003-12-02 Fernando Nasser <fnasser@redhat.com>
* gnu/java/awt/peer/gtk/GtkListPeer.java (handleEvent): Fix generation
of ActionEvents.
From-SVN: r74248
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkListPeer.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java index f90497e..31f9852 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java @@ -128,10 +128,12 @@ public class GtkListPeer extends GtkComponentPeer { if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled ()) { + /* Only generate the ActionEvent on the second click of + a multiple click */ MouseEvent me = (MouseEvent) e; if (!me.isConsumed () && (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0 - && me.getClickCount() > 1) + && me.getClickCount() == 2) postActionEvent (((List)awtComponent).getSelectedItem (), me.getModifiers ()); } @@ -140,8 +142,13 @@ public class GtkListPeer extends GtkComponentPeer { KeyEvent ke = (KeyEvent) e; if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_ENTER) - postActionEvent (((List)awtComponent).getSelectedItem (), - ke.getModifiers ()); + { + String selectedItem = ((List)awtComponent).getSelectedItem (); + + /* Enter only generates an Action event if something is selected */ + if (selectedItem != null) + postActionEvent (selectedItem, ke.getModifiers ()); + } } super.handleEvent (e); |