This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix for List ActionEvent generation


I fixed this for key events but it can also happen for mouse events
as the Gtk LAF allows for List deselection.

2003-12-17 Fernando Nasser <fnasser@redhat.com>

* gnu/java/awt/peer/gtk/GtkListPeer.java (handleEvent): Fix generation
of ActionEvents for mouse double-clicks.



-- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9
Index: gnu/java/awt/peer/gtk/GtkListPeer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java,v
retrieving revision 1.5
diff -c -p -r1.5 GtkListPeer.java
*** gnu/java/awt/peer/gtk/GtkListPeer.java	11 Dec 2003 13:50:50 -0000	1.5
--- gnu/java/awt/peer/gtk/GtkListPeer.java	15 Dec 2003 20:30:41 -0000
*************** public class GtkListPeer extends GtkComp
*** 135,142 ****
  	if (!me.isConsumed ()
  	    && (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0
  	    && me.getClickCount() == 2)
! 	  postActionEvent (((List)awtComponent).getSelectedItem (), 
! 			   me.getModifiers ());
        }
  
      if (e.getID () == KeyEvent.KEY_PRESSED)
--- 135,149 ----
  	if (!me.isConsumed ()
  	    && (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0
  	    && me.getClickCount() == 2)
! 	  {
!             String selectedItem = ((List)awtComponent).getSelectedItem ();
! 
!             /* Double-click only generates an Action event
! 	       if something is selected */
!             if (selectedItem != null)
! 	      postActionEvent (((List)awtComponent).getSelectedItem (), 
! 			       me.getModifiers ());
! 	  }
        }
  
      if (e.getID () == KeyEvent.KEY_PRESSED)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]