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