[kaffe] CVS kaffe (jserv): clickToFocus fix to MouseEvt & boundary check for PaintEvt
Kaffe CVS
cvs-commits at kaffe.org
Wed Jul 14 21:25:35 PDT 2004
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();
}
More information about the kaffe
mailing list