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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Apr 24 12:00:24 UTC 2007


Revision: 1840
          http://svn.sourceforge.net/rkward/?rev=1840&view=rev
Author:   tfry
Date:     2007-04-24 05:00:24 -0700 (Tue, 24 Apr 2007)

Log Message:
-----------
Make focus indication work in detached windows, and fix to activating detached windows programmatically

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

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2007-04-24 10:11:59 UTC (rev 1839)
+++ trunk/rkward/ChangeLog	2007-04-24 12:00:24 UTC (rev 1840)
@@ -1,3 +1,4 @@
+- show the focus indication (thin red border) also for detached windows
 - tool windows can be closed and detached in the same way as regular windows
 - fix a crash with detached tool windows
 - add command line option --disable-stack-check for systems where R C stack checking is buggy

Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-04-24 10:11:59 UTC (rev 1839)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-04-24 12:00:24 UTC (rev 1840)
@@ -62,6 +62,13 @@
 	emit (captionChanged (this));
 }
 
+bool RKMDIWindow::isActive () {
+	// don't trace, called pretty often
+
+	if (!topLevelWidget ()->isActiveWindow ()) return false;
+	return (active || (!isAttached ()));
+}
+
 void RKMDIWindow::activate (bool with_focus) {
 	RK_TRACE (APP);
 
@@ -82,8 +89,10 @@
 		topLevelWidget ()->raise ();
 	}
 
-	if (with_focus) setFocus();
-	else {
+	if (with_focus) {
+		topLevelWidget ()->setActiveWindow ();
+		setFocus();
+	} else {
 		if (old_focus) old_focus->setFocus ();
 	}
 }
@@ -200,5 +209,11 @@
 	static_cast<KDockWidget *> (wrapper->wrapperWidget ())->setEnableDocking (KDockWidget::DockFullSite);
 }
 
+void RKMDIWindow::windowActivationChange (bool) {
+	RK_TRACE (APP);
 
+	// NOTE: active is NOT the same as isActive(). Active just means that this window *would* be active, if its toplevel window is active.
+	if (active || (!isAttached ())) update ();
+}
+
 #include "rkmdiwindow.moc"

Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h	2007-04-24 10:11:59 UTC (rev 1839)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h	2007-04-24 12:00:24 UTC (rev 1840)
@@ -88,7 +88,7 @@
 	bool eventFilter (QObject *watched, QEvent *e);
 	bool acceptsEventsFor (QObject *object);
 /** Whether the window is active. This seems to be more reliable than hasFocus () */
-	bool isActive () { return active; };
+	bool isActive ();
 signals:
 /** This signal is emitted, whenever the window caption was changed.
 @param RKMDIWindow* a pointer to this window */
@@ -99,6 +99,7 @@
 	void setPart (KParts::Part *p) { part = p; };
 	void initializeActivationSignals ();
 	void paintEvent (QPaintEvent *e);
+	void windowActivationChange (bool);
 friend class RKWorkplace;
 /** type of this window */
 	Type type;


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