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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Jun 26 17:57:44 UTC 2011


Revision: 3701
          http://rkward.svn.sourceforge.net/rkward/?rev=3701&view=rev
Author:   tfry
Date:     2011-06-26 17:57:44 +0000 (Sun, 26 Jun 2011)

Log Message:
-----------
Be careful when handling enter events under focus follows mouse policy: This could cause active popup menus to be deleted.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/windows/rkmdiwindow.cpp
    trunk/rkward/rkward/windows/rkmdiwindow.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-06-24 18:32:55 UTC (rev 3700)
+++ trunk/rkward/ChangeLog	2011-06-26 17:57:44 UTC (rev 3701)
@@ -1,3 +1,5 @@
+- Fixed: Some plugin dialogs would not become visible, or be shown in very small size, with some window managers
+- Fixed: Potential crash when using context menus with "focus follows mouse" window activation policy
 - Add shortcut Ctrl+Enter to insert a linebreak and submit from a script editor
 - Reduce CPU usage while idle
 - Pareto-plot plugin gains more tabulation options				TODO: also use in piechart, barplot

Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp	2011-06-24 18:32:55 UTC (rev 3700)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp	2011-06-26 17:57:44 UTC (rev 3701)
@@ -256,12 +256,24 @@
 	if (active || (!isAttached ())) update ();
 }
 
+void RKMDIWindow::slotActivate () {
+	RK_TRACE (APP);
+
+	activate (true);
+}
+
 void RKMDIWindow::enterEvent (QEvent *event) {
 	RK_TRACE (APP);
 
 	if (!isActive ()) {
 		if (RKSettingsModuleGeneral::mdiFocusPolicy () == RKSettingsModuleGeneral::RKMDIFocusFollowsMouse) {
-			activate (true);
+			if (!QApplication::activePopupWidget ()) {
+				// see https://sourceforge.net/tracker/?func=detail&atid=459007&aid=3327985&group_id=50231
+				// enter events may be delivered while a popup-menu (in a different window) is executing. If we activate in this case, the popup-menu might get deleted
+				// while still handling events. Similar problems seem to occur, when the popup menu has just finished (by the user selecting an action) and this results
+				// in the mouse entering this widget. To prevent crashes in this second case, we delay the activation until the next iteration of the event loop.
+				QTimer::singleShot (0, this, SLOT (slotActivate()));
+			}
 		}
 	}
 

Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h	2011-06-24 18:32:55 UTC (rev 3700)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h	2011-06-26 17:57:44 UTC (rev 3701)
@@ -130,6 +130,8 @@
 friend class RKWorkplace;
 /** type of this window */
 	int type;
+private slots:
+	void slotActivate ();
 private:
 friend class RKToolWindowBar;
 /** state of this window (attached / detached). This is usually set from the RKWorkplace */


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