[rkward-cvs] SF.net SVN: rkward:[3525] trunk/rkward/rkward/windows

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Apr 25 09:23:55 UTC 2011


Revision: 3525
          http://rkward.svn.sourceforge.net/rkward/?rev=3525&view=rev
Author:   tfry
Date:     2011-04-25 09:23:54 +0000 (Mon, 25 Apr 2011)

Log Message:
-----------
Fix attaching/detaching graphics windows

Modified Paths:
--------------
    trunk/rkward/rkward/windows/rkwindowcatcher.cpp
    trunk/rkward/rkward/windows/rkwindowcatcher.h

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2011-04-24 11:55:25 UTC (rev 3524)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2011-04-25 09:23:54 UTC (rev 3525)
@@ -2,7 +2,7 @@
                           rwindowcatcher.cpp  -  description
                              -------------------
     begin                : Wed May 4 2005
-    copyright            : (C) 2005, 2006, 2007, 2009, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -138,6 +138,7 @@
 RKCaughtX11Window::RKCaughtX11Window (WId window_to_embed, int device_number) : RKMDIWindow (0, X11Window), RCommandReceiver () {
 	RK_TRACE (MISC);
 
+	capture = 0;
 	killed_in_r = false;
 	embedded = window_to_embed;
 	RKCaughtX11Window::device_number = device_number;
@@ -231,7 +232,7 @@
 	RK_ASSERT (device_windows.contains (device_number));
 	device_windows.remove (device_number);
 
-	capture->close ();
+	close (false);
 #ifdef Q_WS_X11
 	RKWardApplication::getApp ()->unregisterNameWatcher (embedded);
 #endif
@@ -253,18 +254,33 @@
 	return false;
 }
 
+void RKCaughtX11Window::reEmbed () {
+	RK_TRACE (MISC);
+
+#ifdef Q_WS_X11
+	if (!capture) return;
+// somehow, since some version of Qt, the QX11EmbedContainer would loose its client while reparenting. This allows us to circumvent the problem.
+	capture->discardClient ();
+	capture->deleteLater ();
+	RKWardApplication::getApp ()->unregisterNameWatcher (embedded);
+	QTimer::singleShot (0, this, SLOT(doEmbed()));
+#endif
+}
+
 void RKCaughtX11Window::prepareToBeAttached () {
 	RK_TRACE (MISC);
 
 	dynamic_size_action->setChecked (false);
 	fixedSizeToggled ();
 	dynamic_size_action->setEnabled (false);
+	reEmbed ();
 }
 
 void RKCaughtX11Window::prepareToBeDetached () {
 	RK_TRACE (MISC);
 
 	dynamic_size_action->setEnabled (true);
+	reEmbed ();
 }
 
 void RKCaughtX11Window::fixedSizeToggled () {

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.h
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.h	2011-04-24 11:55:25 UTC (rev 3524)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.h	2011-04-25 09:23:54 UTC (rev 3525)
@@ -2,7 +2,7 @@
                           rwindowcatcher.h  -  description
                              -------------------
     begin                : Wed May 4 2005
-    copyright            : (C) 2005, 2006, 2009, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2009, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -155,6 +155,7 @@
 private slots:
 	void doEmbed ();
 private:
+	void reEmbed ();
 	void rCommandDone (RCommand *command);
 	friend class RKCaughtX11WindowPart;	// needs access to the actions
 	int device_number;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list