EVALUATION
This should be awt 's regression bug, it can only be reproduced on mozilla gtk1.2 build, can't be reproduced on mozilla gtk2.0 build.
###@###.### 2003-06-16
Sounds similar to other bugs reported when using Mozilla. Hopefully this can
be resolved by the XEmbed work.
###@###.### 2003-06-17
Name: dmR10075 Date: 06/25/2003
I verified that XEmbed(Mozilla from Robin, XAWT/XEmbed) fixes it.
###@###.### 2003-06-25
======================================================================
Name: dmR10075 Date: 06/26/2003
As far as I understood so far, the bug can be reproduced with the following sequence:
- start applet, see comments for TestFocus.java/html
- click on it, another frame will appear
- click on button in another frame, it will be hidden
- reload applet
- can't give focus to applet.
###@###.### 2003-06-26
======================================================================
Name: dmR10075 Date: 06/27/2003
When the problem happens, focus stops working. In normal situation, when I move mouse
into applet, textfield draws focus rectangle indicating it is focused and it really is
- on Java level it is focus owner.
When the problem happens, as I see from debug output and server logs, the native
focus and java focus are set correctly - browser's top-level has native focus and
Java textfield is focus owner. But when I move mouse into the applet nothing
happens. I didn't find the difference in focus states or sequence of events
between two cases so far.
###@###.### 2003-06-27
======================================================================
Name: dmR10075 Date: 06/27/2003
I noticed that when some applet is being loaded it doesn't receive native
FocusIn(targeted to browser) which we use to detect focus state of browser and
active state of applet. After adding the sending of such event on
EmbeddedFramePeer.setVisible(true) the problem disappeared.
###@###.### 2003-06-27
======================================================================
|
SUGGESTED FIX
Name: dmR10075 Date: 06/27/2003
(diffs below are incomplete because of unresolved externals and provided only to demonstrate the fix for the problem.
for complete diffs, see attached webrev)
Generate synthetic FocusIn for embedded frame and dispatch it when embedded frame becomes visible.
*** /home/dom/bugs/4878303/src/solaris/classes/sun/awt/motif/MEmbeddedFramePeer.java- Fri Jun 27 17:11:10 2003
--- /home/dom/bugs/4878303/src/solaris/classes/sun/awt/motif/MEmbeddedFramePeer.java Fri Jun 27 17:11:10 2003
***************
*** 20,23 ****
--- 20,33 ----
}
native void NEFcreate(MComponentPeer parent, long handle);
native void pShow();
+
+ public void setVisible(boolean vis) {
+ super.setVisible(vis);
+ if (vis) {
+ // Fix for 4878303 - generate WINDOW_GAINED_FOCUS and update if we were focused
+ // since noone will do it for us(WM does it for regular top-levels)
+ synthesizeFocusIn();
+ }
+ }
+ native void synthesizeFocusIn();
}
*** /home/dom/bugs/4878303/src/solaris/native/sun/awt/awt_TopLevel.c- Fri Jun 27 17:11:12 2003
--- /home/dom/bugs/4878303/src/solaris/native/sun/awt/awt_TopLevel.c Fri Jun 27 17:11:11 2003
***************
*** 62,67 ****
--- 62,68 ----
#include "awt_util.h"
#include "img_util.h"
#include "awt_wm.h"
+ #include "awt_util.h"
#ifdef __linux__
void adjustStatusWindow(Widget shell);
***************
*** 78,83 ****
--- 79,85 ----
jint x, jint y, jint w, jint h, Boolean setXY);
Widget findTopLevelByShell(Widget widget);
+ extern EmbeddedFrame *theEmbeddedFrameList;
extern struct ComponentIDs componentIDs;
extern struct MMenuBarPeerIDs mMenuBarPeerIDs;
extern struct MComponentPeerIDs mComponentPeerIDs;
***************
*** 4115,4120 ****
--- 4117,4148 ----
(*env)->SetObjectField(env, self, fid, lpeer);
}
+
+ JNIEXPORT void JNICALL
+ Java_sun_awt_motif_MEmbeddedFramePeer_synthesizeFocusIn(JNIEnv *env, jobject this) {
+ EmbeddedFrame *ef;
+ Boolean dummy;
+
+ AWT_LOCK();
+ ef = theEmbeddedFrameList;
+ while (ef != NULL) {
+ if ((*env)->IsSameObject(env, ef->javaRef, this)) {
+ XFocusChangeEvent xev;
+ xev.display = awt_display;
+ xev.serial = 0;
+ xev.type = FocusIn;
+ xev.send_event = False;
+ xev.window = XtWindow(ef->embeddedFrame);
+ xev.mode = NotifyNormal;
+ xev.detail = NotifyNonlinear;
+ shellEH(ef->embeddedFrame, this, (XEvent*)&xev, &dummy);
+ break;
+ }
+ ef = ef->next;
+ }
+ AWT_UNLOCK();
+ }
+
JNIEXPORT void JNICALL
Java_sun_awt_motif_MEmbeddedFramePeer_NEFcreate(JNIEnv *env, jobject this,
jobject parent, jlong handle)
###@###.### 2003-06-27
======================================================================
|