Embedding multible java applets and focus problems

Koos Vriezen koos.vriezen at xs4all.nl
Mon Oct 13 18:47:52 BST 2003


On Mon, 13 Oct 2003, Lubos Lunak wrote:

> On Monday 13 of October 2003 18:15, Koos Vriezen wrote:
> > On Mon, 13 Oct 2003, Lubos Lunak wrote:
> [snip]
> > > > If ReparentNotify is a guaranteed event, I think second patch is
> > > > preferable (might make QApplication::syncX() not needed any more ...
> > > > yes work like before).
> > >
> > >  ReparentNotify is a guaranteed event, you'll get it after doing
> > > XReparentWindow() into the embedder. However, given my comment above,
> > > wouldn't it be simpler to add 'if( w == window ) return;' at the top of
> > > embed()?
> >
> > My first thought too, but ReparentNotify does
> >             window = e->xreparent.window;
> >             embed( window );
> > and assuming this code is there for a good reason, I made those two
> > alternative patches.
>
>  Aha, I haven't noticed this. Well, as I've already said, more comments
> wouldn't hurt. I'd support Leon's idea of splitting embed() then.

Ok, attached what might be a beginning of this split.
To prevent flashing windows after closing konqueror, both java and
nsplugin should call destroyWithParent(true) on the qxembed widget.

[..]
>  That patch is to blame only for the taskbar entry blinking. But Konqueror
> HEAD doesn't work, regardless of the window manager - it doesn't work with
> KWin HEAD, KWin from 3.1, Metacity or FVWM2, so don't blame it on KWin. But I
> have no idea who to blame instead.

Hmm, probably khtml I guess. Previewing an applet in konqueror (by adding
the appletviewer as the embedded viewer for x-java) does get the focus
right indeed...

Koos
-------------- next part --------------
Index: qxembed.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/qxembed.cpp,v
retrieving revision 1.44
diff -u -3 -p -r1.44 qxembed.cpp
--- qxembed.cpp	25 Sep 2003 18:16:54 -0000	1.44
+++ qxembed.cpp	13 Oct 2003 17:32:01 -0000
@@ -98,6 +98,7 @@ public:
     QXEmbedData(){ 
         autoDelete = true;
         xplain = false;
+        destroyWithParent = false;
         xgrab = false;
         lastPos = QPoint(0,0);
     }
@@ -106,6 +107,7 @@ public:
     
     bool autoDelete;
     bool xplain;
+    bool destroyWithParent;
     bool xgrab;
     QWidget* focusProxy;
     QPoint lastPos;
@@ -735,7 +737,8 @@ void QXEmbed::embed(WId w)
     kdDebug() << "************************** Embed "<< QString("0x%1").arg(w, 0, 16) << " into " << QString("0x%1").arg(winId(), 0, 16) << " window=" << QString("0x%1").arg(window, 0, 16) << " **********" << endl; 
     if (!w)
         return;
-    XAddToSaveSet( qt_xdisplay(), w );
+    if (!d->destroyWithParent)
+        XAddToSaveSet( qt_xdisplay(), w );
     bool has_window =  w == window;
     window = w;
     if ( !has_window ) {
@@ -758,7 +761,8 @@ void QXEmbed::embed(WId w)
             kdDebug() << QString(">>> Loop %1: reparent of 0x%2 into 0x%3 failed").arg(i).arg(w, 0, 16).arg(winId(), 0, 16) << endl;
             USLEEP(1000);
         }
-        QApplication::syncX();
+        //QApplication::syncX();
+        return; // lets ReparentNotify finish the job
     }
 
     XResizeWindow(qt_xdisplay(), w, width(), height());
@@ -793,6 +797,13 @@ WId QXEmbed::embeddedWinId() const
     return window;
 }
 
+/*
+ * Sets the use of XAddToSaveSet call in embed()
+ */
+void QXEmbed::destroyWithParent(bool b)
+{
+    d->destroyWithParent = b;
+}
 
 /*!\reimp
  */
Index: qxembed.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/qxembed.h,v
retrieving revision 1.21
diff -u -3 -p -r1.21 qxembed.h
--- qxembed.h	21 Aug 2003 09:51:37 -0000	1.21
+++ qxembed.h	13 Oct 2003 17:32:02 -0000
@@ -136,6 +136,13 @@ public:
     WId embeddedWinId() const;
 
     /**
+     * Default the embedded window is reparented to the root window when
+     * this widget gets deleted.
+     * Calling destroyWithParent(true), destroys the embedded window
+     **/
+    void destroyWithParent( bool = true );
+
+    /**
      * A function for clients that embed themselves. The widget
      * client will be embedded in the window window. The application has
      * to ensure that window is the handle of the window identifier of
-------------- next part --------------
_______________________________________________
Kwin mailing list
Kwin at mail.kde.org
http://mail.kde.org/mailman/listinfo/kwin


More information about the kfm-devel mailing list