More on focus issues of a QXEmbed window

Koos Vriezen koos.vriezen at xs4all.nl
Sun Jul 21 22:04:19 BST 2002


Hi,

There are still focus problems when having two or more applets with form
elements. The focus seems to stay in one of the applets, if an applet
gets the focus.

I've attached a patch with fixes it for java. It sends a
XFocusInEvent/XFocusOutEvent to the embedded window if the QXEmbed widget
gets/looses the focus.

Tested it with two 'Application launcher' applets in kicker. No problem
here.

Tested with two flash objects with form elements. These had problems and
now still have :(. Focus still seems to follow the mouse and
problems getting focus after deactivating/activating the browser.

Regards,

Koos Vriezen
-------------- next part --------------
Index: kdeui/qxembed.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/qxembed.cpp,v
retrieving revision 1.30
diff -u -3 -p -r1.30 qxembed.cpp
--- kdeui/qxembed.cpp	2002/07/17 18:02:39	1.30
+++ kdeui/qxembed.cpp	2002/07/21 21:03:23
@@ -599,6 +599,9 @@ void QXEmbed::focusInEvent( QFocusEvent 
 void QXEmbed::focusOutEvent( QFocusEvent * ){
     if (!window)
         return;
+    XFocusInEvent outev = { XFocusOut, 0, TRUE, qt_xdisplay(), window, 
+                            NotifyNormal, NotifyPointer };
+    XSendEvent(qt_xdisplay(), window, TRUE, FocusChangeMask, (XEvent*) &outev);
     send_xembed_message( window, XEMBED_FOCUS_OUT );
 }
 
@@ -745,12 +748,15 @@ bool QXEmbed::x11Event( XEvent* e)
             embed( window );
         }
         break;
-    case ButtonPress:
+    case ButtonPress: {
+        XFocusInEvent inev = { XFocusIn, 0, TRUE, qt_xdisplay(), e->xbutton.subwindow, NotifyNormal, NotifyPointer };
+        XSendEvent(qt_xdisplay(), e->xbutton.subwindow, TRUE, FocusChangeMask, (XEvent*) &inev);
         QFocusEvent::setReason( QFocusEvent::Mouse );
         setFocus();
         QFocusEvent::resetReason();
         XAllowEvents(qt_xdisplay(), ReplayPointer, CurrentTime);
         return TRUE;
+    }
     case ButtonRelease:
         XAllowEvents(qt_xdisplay(), SyncPointer, CurrentTime);
         break;


More information about the kfm-devel mailing list