[kaffe] CVS kaffe (jserv): clickToFocus fix to MouseEvt & boundary check for PaintEvt

Fabien Renaud renaud at nentec.de
Thu Jul 15 06:16:53 PDT 2004


Kaffe CVS wrote:

>PatchSet 4972 
>Date: 2004/07/15 04:19:15
>Author: jserv
>Branch: HEAD
>Tag: (none) 
>Log:
>clickToFocus fix to MouseEvt & boundary check for PaintEvt
>
>	* libraries/javalib/java/awt/MouseEvt.java
>	(clickToFocus): JDK allows components which are not
>	isFocusTraversable() to gain the focus by means of
>	explicit requestFocus().
>
>	* libraries/javalib/java/awt/PaintEvt.java
>	(dispatch): Boundary check performed.
>
>Members: 
>	ChangeLog:1.2536->1.2537 
>	libraries/javalib/java/awt/MouseEvt.java:1.9->1.10 
>	libraries/javalib/java/awt/PaintEvt.java:1.7->1.8 
>
>Index: kaffe/ChangeLog
>diff -u kaffe/ChangeLog:1.2536 kaffe/ChangeLog:1.2537
>--- kaffe/ChangeLog:1.2536	Wed Jul 14 18:57:16 2004
>+++ kaffe/ChangeLog	Thu Jul 15 04:19:15 2004
>@@ -1,3 +1,13 @@
>+2004-07-15  Jim Huang  <jserv at kaffe.org>
>+
>+	* libraries/javalib/java/awt/MouseEvt.java
>+	(clickToFocus): JDK allows components which are not 
>+	isFocusTraversable() to gain the focus by means of 
>+	explicit requestFocus().
>+	
>+	* libraries/javalib/java/awt/PaintEvt.java
>+	(dispatch): Boundary check performed.
>+	
> 2004-07-14  Guilhem Lavaux  <guilhem at kaffe.org>
> 
> 	* kaffe/kaffevm/ksem.c (ksemGet): Readded jmutex_lock.
>Index: kaffe/libraries/javalib/java/awt/MouseEvt.java
>diff -u kaffe/libraries/javalib/java/awt/MouseEvt.java:1.9 kaffe/libraries/javalib/java/awt/MouseEvt.java:1.10
>--- kaffe/libraries/javalib/java/awt/MouseEvt.java:1.9	Sun May 23 15:16:09 2004
>+++ kaffe/libraries/javalib/java/awt/MouseEvt.java	Thu Jul 15 04:19:14 2004
>@@ -1,18 +1,22 @@
>-package java.awt;
>-
>-import java.awt.event.MouseEvent;
>-import java.util.Stack;
>-
>-/**
>+/*
>  *
>  * Copyright (c) 1998
>- *   Transvirtual Technologies Inc.  All rights reserved.
>+ *	Transvirtual Technologies Inc.  All rights reserved.
>+ *
>+ * Copyright (c) 2004
>+ *	Kaffe.org contributors. See ChangeLog for details.
>  *
>  * See the file "license.terms" for information on usage and redistribution
>  * of this file.
>  *
>  * @author P.C.Mehlitz
>  */
>+
>+package java.awt;
>+
>+import java.awt.event.MouseEvent;
>+import java.util.Stack;
>+
> class MouseEvt
>   extends MouseEvent
> {
>@@ -50,9 +54,13 @@
> 	// focus events will be processed AFTER the mouse event. This is the opposite order
> 	// compared to native handling (for toplevels). We try to be compatible with
> 	// lightweight behavior
>-	
>-	//if ( newKeyTgt.isFocusTraversable() )
>-	//	newKeyTgt.requestFocus();
>+
>+	// note that the JDK allows components which are not isFocusTraversable() to gain
>+	// the focus by means of explicit requestFocus() (not very intuitive) OR by means of
>+	// mouseclicks (even on components which are not mouse aware, which sounds silly)
>+
>+	if ( ((newKeyTgt.flags & Component.IS_NATIVE_LIKE) != 0) && newKeyTgt.isFocusTraversable() )
>+		newKeyTgt.requestFocus();	
> }
> 
> static Component computeMouseTarget ( Container toplevel, int x, int y ) {
>Index: kaffe/libraries/javalib/java/awt/PaintEvt.java
>diff -u kaffe/libraries/javalib/java/awt/PaintEvt.java:1.7 kaffe/libraries/javalib/java/awt/PaintEvt.java:1.8
>--- kaffe/libraries/javalib/java/awt/PaintEvt.java:1.7	Tue Feb 19 00:48:07 2002
>+++ kaffe/libraries/javalib/java/awt/PaintEvt.java	Thu Jul 15 04:19:14 2004
>@@ -1,16 +1,21 @@
>-package java.awt;
>-
>-import java.awt.event.PaintEvent;
>-
>-/**
>+/*
>+ * PaintEvt
>  *
>  * Copyright (c) 1998
>- *   Transvirtual Technologies Inc.  All rights reserved.
>+ *	Transvirtual Technologies Inc.  All rights reserved.
>+ *
>+ * Copyright (c) 2004
>+ *	Kaffe.org contributors. See ChangeLog for details.
>  *
>  * See the file "license.terms" for information on usage and redistribution
>  * of this file.
>  * @author P.C.Mehlitz
>  */
>+
>+package java.awt;
>+
>+import java.awt.event.PaintEvent;
>+
> class PaintEvt
>   extends PaintEvent
> {
>@@ -28,8 +33,12 @@
> }
> 
> protected void dispatch () {
>-	((Component)source).processPaintEvent( id, x, y, width, height);
>-
>+	if ( (width > 0) && (height > 0) ) {
>+		Component c = (Component) source;
>+		if ( (c.flags & Component.IS_SHOWING) == Component.IS_SHOWING ) {
>+			c.processPaintEvent( id, x, y, width, height);
>+		}
>+	}
> 	recycle();
> }
> 
>

Hi !

Thanks for the patch but I still have the same problems. I´ll try with 
everything up-to-date but I don´t think that will change something.

BTW ,
With WidgetsDemo, I still have the problem with the window creation 
(after some windows creation/destruction, I cannot create no more 
windows  unless I resize the window).
With the same prog, the transvirtual logo appears shifted down.
Unfornately, I cannot take screenshots :(


Cheers,
Fabien

>
>_______________________________________________
>kaffe mailing list
>kaffe at kaffe.org
>http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
>
>
>  
>






More information about the kaffe mailing list