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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jun 8 19:53:00 UTC 2009


Revision: 2519
          http://rkward.svn.sourceforge.net/rkward/?rev=2519&view=rev
Author:   tfry
Date:     2009-06-08 19:53:00 +0000 (Mon, 08 Jun 2009)

Log Message:
-----------
Next round of windows porting.
- Graphics device works (but causes a mysterious hang on exit, somehow).
- Display of help file in internal browser works.
- Fix duplicate inclusion of required .pluginmaps.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugin/rkcomponentmap.cpp
    trunk/rkward/rkward/qwinhost/README.txt
    trunk/rkward/rkward/qwinhost/qwinhost.cpp
    trunk/rkward/rkward/qwinhost/qwinhost.h
    trunk/rkward/rkward/rbackend/rinterface.cpp
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
    trunk/rkward/rkward/rbackend/rthread.cpp
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h
    trunk/rkward/rkward/rkwardapplication.cpp
    trunk/rkward/rkward/rkwardapplication.h
    trunk/rkward/rkward/settings/rksettingsmoduler.cpp
    trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp
    trunk/rkward/rkward/windows/rkhelpsearchwindow.h
    trunk/rkward/rkward/windows/rkmdiwindow.h
    trunk/rkward/rkward/windows/rkwindowcatcher.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/ChangeLog	2009-06-08 19:53:00 UTC (rev 2519)
@@ -1,5 +1,5 @@
 TODO: add notice on differing licences/copyrights in subdirs
-- Remove support for R 2.6.x and earlier		TODO: clean up more (options ("browser"), internal.R, RData?), adjust debian control
+- Remove support for R 2.6.x and earlier		TODO: clean up more (internal.R, RData?), adjust debian control
 - Add basic checks for a correct installation of the RKWard resource files
 - Remove "What to expect" dialog at startup
 - Make keyboard shorcuts configurable

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -32,7 +32,7 @@
 #include "../rkward.h"
 
 QString RKPluginMapFile::makeFileName (const QString &filename) {
-	return QDir (basedir).filePath (filename);
+	return QDir::cleanPath (QDir (basedir).filePath (filename));
 }
 
 RKComponentGUIXML::RKComponentGUIXML () {

Modified: trunk/rkward/rkward/qwinhost/README.txt
===================================================================
--- trunk/rkward/rkward/qwinhost/README.txt	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/qwinhost/README.txt	2009-06-08 19:53:00 UTC (rev 2519)
@@ -23,4 +23,6 @@
 2009-06-05:
 - Support for auto-destruction of client
 - Notification when client is destroyed
-- Notification when client window title changes
\ No newline at end of file
+- Notification when client window title changes
+- Asynchronous handling of client focus changes
+- Do not rely on GetParent() to return the right thing for captured windows

Modified: trunk/rkward/rkward/qwinhost/qwinhost.cpp
===================================================================
--- trunk/rkward/rkward/qwinhost/qwinhost.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/qwinhost/qwinhost.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -53,6 +53,7 @@
 #include "qwinhost.h"
 
 #include <QtCore/QEvent>
+#include <QtCore/QTimer>
 
 //static
 QMap<HWND, QWinHost*> QWinHost::winhosts;
@@ -93,6 +94,8 @@
 {
     setAttribute(Qt::WA_NoBackground);
     setAttribute(Qt::WA_NoSystemBackground);
+
+    connect(this, SIGNAL(clientFocused()), this, SLOT(setFocusSlot()), Qt::QueuedConnection);
 }
 
 /*!
@@ -126,7 +129,6 @@
 	setAutoDestruct(false);
 	SendMessage(hwnd, WM_CLOSE, 0, 0);
 	DestroyWindow(hwnd);
-qDebug ("destruct");
     }
 }
 
@@ -215,13 +217,20 @@
     return host ? host->wndproc : 0;
 }
 
+/*! just a thin wrapper around QWidget::setFocus(). Needed to handle focus asynchronously. */
+void QWinHost::setFocusSlot() {
+	if(!hasFocus())	{
+		setFocus(Qt::MouseFocusReason);
+		activateWindow();
+	}
+}
+
 bool QWinHost::handleWindowCallback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
-qDebug ("%p, %x, %x, %x", hwnd, msg, wParam, lParam);
 	switch(msg) {
+		case WM_SETFOCUS:
 		case WM_LBUTTONDOWN:
-			if (::GetFocus() != hwnd && (focusPolicy() & Qt::ClickFocus)) {
-#warning TODO: async handling!
-				setFocus(Qt::MouseFocusReason);
+			if (!hasFocus () && (focusPolicy() & Qt::ClickFocus)) {
+				emit (clientFocused());		// handled asynchronously
 			}
 			break;
 
@@ -247,12 +256,12 @@
 			clientTitleChanged((char *) lParam);
 			break;
 		case WM_DESTROY:
-qDebug ("client destruct");
 			clientDestroyed();
 			break;
 		default:
 			break;
 	}
+	return true;	// regular handling should happen, too
 }
 
 
@@ -277,6 +286,14 @@
     })
 }
 
+QString QWinHost::getClientTitle() const {
+	if (!hwnd) return QString();
+
+	char buffer[256];
+	::GetWindowText(hwnd, buffer, 255);
+	return (QString(buffer));
+}
+
 /*!
     Ensures that the window provided a child of this widget, unless
     it is a WS_OVERLAPPED window.

Modified: trunk/rkward/rkward/qwinhost/qwinhost.h
===================================================================
--- trunk/rkward/rkward/qwinhost/qwinhost.h	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/qwinhost/qwinhost.h	2009-06-08 19:53:00 UTC (rev 2519)
@@ -85,10 +85,15 @@
 
     static QWinHost *findHost(HWND);
 
-    virtual bool handleWindowCallback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+    bool handleWindowCallback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+    QString getClientTitle() const;
+public slots:
+    void setFocusSlot();
 signals:
     void clientDestroyed();
     void clientTitleChanged(const QString& new_title);
+    void clientFocused();
 protected:
     virtual HWND createWindow(HWND parent, HINSTANCE instance);
 

Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -399,6 +399,12 @@
 		} else {
 			RK_ASSERT (false);
 		}
+	} else if (call == "showHTML") {
+		if (request->call.count () == 2) {
+			RKWorkplace::mainWorkplace ()->openHelpWindow (request->call[1]);
+		} else {
+			RK_ASSERT (false);
+		}
 	} else {
 		issueCommand (".rk.set.reply (\"Unrecognized call '" + call + "'. Ignoring\")", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
 	}

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2009-06-08 19:53:00 UTC (rev 2519)
@@ -145,7 +145,11 @@
 	.rk.do.call ("startOpenX11", as.character (dev.cur ()));
 
 	if (!exists (".rk.default.device")) {
-		device <- grDevices::x11
+		if (base::.Platform$OS.type == "unix") {
+			device <- grDevices::x11
+		} else {
+			device <- grDevices::windows
+		}
 	} else {
 		device <- .rk.default.device
 		if (is.character (.rk.default.device)) {
@@ -163,6 +167,11 @@
 
 "X11" <- x11
 
+if (base::.Platform$OS.type == "windows") {
+	  "windows" = rk.screen.device
+	  "win.graph" = rk.screen.device
+}
+
 # set from rkward the application:
 # options(device="rk.screen.device")
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R	2009-06-08 19:53:00 UTC (rev 2519)
@@ -320,6 +320,10 @@
 	.Call ("rk.edit.files", file, title, name)
 }
 
+"rk.show.html" <- function (url) {
+	.rk.do.call ("showHTML", as.character (url));
+}
+
 "rk.call.plugin" <- function (plugin, ..., submit.mode = c ("manual", "auto", "submit")) {
 	# prepare arguments
 	settings <- list (...)

Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rbackend/rthread.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -30,8 +30,6 @@
 #include <klocale.h>
 
 #include <qstring.h>
-#include <qapplication.h>
-#include <QDBusConnection>
 #include <QList>
 #include <QFileInfo>
 
@@ -545,11 +543,6 @@
 	if (error) status |= SinkFail;
 	runCommandInternal ("rk.set.output.html.file (\"" + RKSettingsModuleGeneral::filesPath () + "/rk_out.html\")\n", &error);
 	if (error) status |= SinkFail;
-#warning TODO: we can/should set an R function, instead, since R 2.7.0
-	runCommandInternal ("options (htmlhelp=TRUE); options (browser=\"qdbus " + QDBusConnection::sessionBus ().baseService () + " /MainApplication net.sf.rkward.openHTMLHelp\")", &error);
-	if (error) status |= OtherFail;
-/*	runCommandInternal (".rk.default.device <- \"x11\"\n", &error);
-	if (error) status |= OtherFail; */
 
 	MUTEX_LOCK;
 	flushOutput ();

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rkward.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -98,18 +98,6 @@
 	new RKEditObjectAgent (QStringList (), 0);
 }
 
-/** DBUS interface **/
-
-RKWardDBUSInterface::RKWardDBUSInterface (QApplication *application) : QDBusAbstractAdaptor(application) {
-	RK_TRACE (APP);
-}
-
-void RKWardDBUSInterface::openHTMLHelp (const QString &url) {
-	RK_TRACE (APP);
-
-	RKWorkplace::mainWorkplace ()->openHelpWindow (url);
-}
-
 /** Main window **/
 
 //static
@@ -159,12 +147,6 @@
 	// When the manager says the active part changes,
 	// the builder updates (recreates) the GUI
 	connect (partManager (), SIGNAL (activePartChanged (KParts::Part *)), this, SLOT (partChanged (KParts::Part *)));
-
-	// create the DBUS adaptor:
-	new RKWardDBUSInterface (qApp);
-
-	// connect to D-Bus and register as an object:
-	QDBusConnection::sessionBus ().registerObject ("/MainApplication", qApp);
 }
 
 RKWardMainWindow::~RKWardMainWindow() {

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rkward.h	2009-06-08 19:53:00 UTC (rev 2519)
@@ -2,7 +2,7 @@
 			rkward.h  -  description
 			-------------------
 begin                : Tue Oct 29 20:06:08 CET 2002 
-copyright            : (C) 2002, 2005, 2006, 2007, 2008 by Thomas Friedrichsmeier 
+copyright            : (C) 2002, 2005, 2006, 2007, 2008, 2009 by Thomas Friedrichsmeier 
 email                : tfry at users.sourceforge.net
 ***************************************************************************/
 
@@ -18,31 +18,6 @@
 #ifndef RKWARD_H
 #define RKWARD_H
 
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include<QDBusAbstractAdaptor>
-
-class QApplication;
-
-/** This base provides the DBUS-Interface for RKWardMainWindow */
-class RKWardDBUSInterface : virtual public QDBusAbstractAdaptor {
-	Q_OBJECT
-	Q_CLASSINFO("D-Bus Interface", "net.sf.rkward")
-public:
-	RKWardDBUSInterface (QApplication *application);
-	~RKWardDBUSInterface () {};
-public slots:
-	/** Open the given html help page */
-	void openHTMLHelp (const QString &url);
-};
-
-
-// include files for Qt
-
-// include files for KDE 
 #include <kapplication.h>
 #include <kaction.h>
 #include <kurl.h>

Modified: trunk/rkward/rkward/rkwardapplication.cpp
===================================================================
--- trunk/rkward/rkward/rkwardapplication.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rkwardapplication.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -110,7 +110,15 @@
 	for (int i = 0; i < old_windows.size (); ++i) {
 		candidate_windows.removeAll (old_windows[i]);
 	}
-	// ideally we have a single candidate remaining, now
+	// ideally we have a single candidate remaining, now, but sometimes, additional
+	// invisible windows are created somehow (probably by R's graphapp)
+	for (int i = 0; i < candidate_windows.size (); ++i) {
+		HWND hwnd = candidate_windows[i];
+		if ((!IsWindow(hwnd)) || (!IsWindowVisible(hwnd))) {
+			 candidate_windows.removeAt (i);
+			 --i;
+		}
+	}
 
 	// we could do some more checking, e.g. based on whether the window belongs to our
 	// own process, and whether it appears to be of a sane size, but for now, we keep
@@ -118,9 +126,8 @@
 
 	if (candidate_windows.size ()) {
 		RK_ASSERT (candidate_windows.size () < 2);
-#warning TODO: the above assert fails. More windows get created. Sieve out the invisible ones, first?
 		return candidate_windows[0];
-	}	// else
+	}
 	return 0;
 #else	//Q_WS_WIN
 	if (!created_window) {
@@ -135,13 +142,12 @@
 #endif	//Q_WS_WIN
 }
 
+#ifndef Q_WS_WIN
 void RKWardApplication::registerNameWatcher (WId watched, RKMDIWindow *watcher) {
 	RK_TRACE (APP);
 	RK_ASSERT (!name_watchers_list.contains (watched));
 
-#ifndef Q_WS_WIN
 	XSelectInput (QX11Info::display (), watched, PropertyChangeMask);
-#endif	//nQ_WS_WIN
 	name_watchers_list.insert (watched, watcher);
 }
 
@@ -149,13 +155,10 @@
 	RK_TRACE (APP);
 	RK_ASSERT (name_watchers_list.contains (watched));
 
-#ifndef Q_WS_WIN
 	XSelectInput (QX11Info::display (), watched, NoEventMask);
-#endif	//nQ_WS_WIN
 	name_watchers_list.remove (watched);
 }
 
-#ifndef Q_WS_WIN
 bool RKWardApplication::x11EventFilter (XEvent *e) {
 	if (detect_x11_creations) {
 		if (e->type == CreateNotify) {

Modified: trunk/rkward/rkward/rkwardapplication.h
===================================================================
--- trunk/rkward/rkward/rkwardapplication.h	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/rkwardapplication.h	2009-06-08 19:53:00 UTC (rev 2519)
@@ -2,7 +2,7 @@
                           rkwardapplication  -  description
                              -------------------
     begin                : Sun Nov 26 2006
-    copyright            : (C) 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -34,21 +34,21 @@
 	/** like KApplication::kApplication () (and actually, this should always return the same pointer), but without the need to cast */
 	static RKWardApplication *getApp ();
 
-#ifndef Q_WS_WIN
-	/** reimplemented from KApplication to look for CreateNotify and PropertyNotify events */
-	bool x11EventFilter (XEvent *e);
-#endif
-
 	/** start looking for new top-level windows created on the screen */
 	void startWindowCreationDetection ();
 	/** stop looking for new top-level windows created on the screen
 	@returns the window id of the last top-level window created after the last call to startWindowCreation, hoping it was only one. 0 if no window was created/detected. */
 	WId endWindowCreationDetection ();
 
+#ifndef Q_WS_WIN
 	/** watch the given window for changes in its WM_NAME property (i.e. changes in caption). When a change is detected, the caption will be set on watcher. WARNING: Do not use to watch windows managed by Qt! Will override the event mask for this window (within qt_xdisplay ()). WARNING: Remember to call unregisterNameWatcher, when watcher is deleted! */
 	void registerNameWatcher (WId watched, RKMDIWindow *watcher);
 	/** remove a watch created with registerNameWatcher */
 	void unregisterNameWatcher (WId watched);
+
+	/** reimplemented from KApplication to look for CreateNotify and PropertyNotify events */
+	bool x11EventFilter (XEvent *e);
+#endif
 private:
 	static RKWardApplication *rkapp;
 	bool detect_x11_creations;

Modified: trunk/rkward/rkward/settings/rksettingsmoduler.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduler.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/settings/rksettingsmoduler.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -238,10 +238,12 @@
 	if (options_editor == builtin_editor) list.append ("options (editor=rk.edit.files)\n");
 	else list.append ("options (editor=\"" + options_editor + "\")\n");
 
-#warning TODO make configurable
+#warning TODO make the following options configurable
 	list.append ("options (device=\"rk.screen.device\")\n");
 	// register as interactive
 	list.append ("try (deviceIsInteractive(name=\"rk.screen.device\"))\n");
+	list.append ("options (htmlhelp=TRUE); options (chmhelp=FALSE)\n");
+	list.append ("options (browser=rk.show.html)\n");
 
 	return list;
 }

Modified: trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -2,7 +2,7 @@
                           rkhelpsearchwindow  -  description
                              -------------------
     begin                : Fri Feb 25 2005
-    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -149,9 +149,14 @@
 	getFunctionHelp (result);
 }
 
-void RKHelpSearchWindow::getFunctionHelp (const QString &function_name) {
+void RKHelpSearchWindow::getFunctionHelp (const QString &function_name, const QString &package) {
 	RK_TRACE (APP);
-	RKGlobals::rInterface ()->issueCommand ("help(\"" + function_name + "\", htmlhelp=TRUE)[1]", RCommand::App | RCommand::GetStringVector, QString::null, this, GET_HELP_URL, 0);
+
+	QString command = "help(\"" + function_name + '\"';
+	if (!package.isEmpty ()) command.append (", package=" + package);
+	command.append (", chmhelp=FALSE, htmlhelp=TRUE)[1]");
+
+	RKGlobals::rInterface ()->issueCommand (command, RCommand::App | RCommand::GetStringVector, i18n ("Find HTML help for %1").arg (function_name), this, GET_HELP_URL);
 }
 
 void RKHelpSearchWindow::slotFindButtonClicked () {
@@ -193,12 +198,9 @@
 	int row = index.row ();
 	QString topic = results->data (results->index (row, COL_TOPIC)).toString ();
 	QString package = results->data (results->index (row, COL_PACKAGE)).toString ();
+	if (topic.isEmpty ()) return;
 
-	if (topic.isEmpty ()) return;
-	
-	QString command = "help(\"" + topic + "\", htmlhelp=TRUE, package= \"" + package + "\")";
-	
-	RKGlobals::rInterface ()->issueCommand (command, RCommand::App | RCommand::Sync | RCommand::GetStringVector, i18n ("Show help for %1 in package %2", topic, package), this, GET_HELP_URL);
+	getFunctionHelp (topic, package);
 }
 
 void RKHelpSearchWindow::rCommandDone (RCommand *command) {

Modified: trunk/rkward/rkward/windows/rkhelpsearchwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkhelpsearchwindow.h	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/windows/rkhelpsearchwindow.h	2009-06-08 19:53:00 UTC (rev 2519)
@@ -2,7 +2,7 @@
                           rkhelpsearchwindow  -  description
                              -------------------
     begin                : Fri Feb 25 2005
-    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -47,7 +47,7 @@
 @param cursor_pos cursor position in the current line
 Will figure out the word under the cursor, and provide help on that (if there is such a word, and such help exists) */
 	void getContextHelp (const QString &context_line, int cursor_pos);
-	void getFunctionHelp (const QString &function_name);
+	void getFunctionHelp (const QString &function_name, const QString &package=QString());
 	static RKHelpSearchWindow *mainHelpSearch () { return main_help_search; };
 public slots:
 	void slotFindButtonClicked();

Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h	2009-06-08 19:53:00 UTC (rev 2519)
@@ -68,6 +68,9 @@
 @param type Type of window (see RKMDIWindow::Type).*/
 	RKMDIWindow (QWidget *parent, int type, bool tool_window=false, const char *name=0);
 	virtual ~RKMDIWindow ();
+public slots:
+/** Reimplemented from QWidget::setCaption () to emit the signal captionChanged () when the caption is changed. */
+	void setCaption (const QString &caption);
 public:
 /** @returns true, if the window's document was modified (and would need to be saved) */
 	virtual bool isModified () { return false; };
@@ -80,8 +83,6 @@
 /** This is used in RKWorkplace::saveWorkplace () to save the info about the workplace. Make sure to add corresponding code to RKWorkplace::restoreWorkplace (), so your window(s) get restored when loading a Workspace
 @returns An internal descriptive string. */
 	virtual QString getDescription () { return QString (); };
-/** Reimplemented from QWidget::setCaption () to emit the signal captionChanged () when the caption is changed. */
-	void setCaption (const QString &caption);
 /** Is this window attached (or detached)?
 @returns true if attached, false if detached */
 	bool isAttached () const { return (state == Attached); };

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2009-06-05 20:42:07 UTC (rev 2518)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2009-06-08 19:53:00 UTC (rev 2519)
@@ -137,26 +137,26 @@
 	// somehow in Qt 4.4.3, when the RKCaughtWindow is reparented the first time, the QX11EmbedContainer may kill its client. Hence we delay the actual embedding until after the window was shown.
 	// In some previous version of Qt, this was not an issue, but I did not track the versions.
 	QTimer::singleShot (0, this, SLOT (doEmbed()));
-
-	RKWardApplication::getApp ()->registerNameWatcher (window_to_embed, this);
 }
 
 void RKCaughtX11Window::doEmbed () {
 	RK_TRACE (MISC);
 
 #ifdef Q_WS_WIN
-#	warning TODO: set name
 	capture = new QWinHost (xembed_container);
 	capture->setWindow (embedded);
+	capture->setFocusPolicy (Qt::ClickFocus);
 	capture->setAutoDestruct (true);
 	connect (capture, SIGNAL (clientDestroyed()), this, SLOT (deleteLater()), Qt::QueuedConnection);
-	connect (capture, SIGNAL (clientTitleChanged(const QString&)), this, SLOT (setWindowTitle(const QString&)), Qt::QueuedConnection);
+	connect (capture, SIGNAL (clientTitleChanged(const QString&)), this, SLOT (setCaption(const QString&)), Qt::QueuedConnection);
+
+	setCaption (capture->getClientTitle ());
 #else
 	capture = new QX11EmbedContainer (xembed_container);
-
 	capture->embedClient (embedded);
+	connect (capture, SIGNAL (clientClosed ()), this, SLOT (deleteLater ()));
 
-	connect (capture, SIGNAL (clientClosed ()), this, SLOT (deleteLater ()));
+	RKWardApplication::getApp ()->registerNameWatcher (embedded, this);
 #endif
 	// make xembed_container resizable, again, now that it actually has a content
 	dynamic_size_action->setChecked (true);
@@ -167,7 +167,9 @@
 	RK_TRACE (MISC);
 
 	capture->close ();
+#ifndef Q_WS_WIN
 	RKWardApplication::getApp ()->unregisterNameWatcher (embedded);
+#endif
 	error_dialog->autoDeleteWhenDone ();
 }
 


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