[PATCH] #69559

Koos Vriezen koos.vriezen at xs4all.nl
Wed Dec 10 17:04:26 GMT 2003


On Wed, Dec 10, 2003 at 02:45:23PM +0100, David Faure wrote:
> If all the testcases in khtmltests/ecma/events* work we should be quite fine :)
> This change is only about form elements... 
> Hmm, hold on, what else is RenderReplaced used for?
> RenderImage, no problem there, and RenderWidget, used for
> applets and embedded kpart objects (like ksvg once we fix it).

Btw, do you think the posted patch for using KImageIO::typeForMime was correct
(subject of thread was [patch] Cannot display embedded svg images if 'type'
is specified)?

Btw2, I sent the attached patch to Rob, but couldn't really explain if it's
correct. At first I thought it has something to do with a PartManager, but
browsing through the kparts code, the only thing I could find that making
a kpart a child of another kpart was when setting the active part. And there
is of course the destruction order, if a kpart is a child of its parent kparts
view, than it will be deleted before the parent kpart (if that one is
destructed by the widgetDestroyed signal).
So other then comparing with other kparts implementations, I couldn't find
a good reason. But if this patch is correct though, 
http://phil.freehackers.org/kde/kpart-techno/kpart-techno.html is wrong.
So, should a kpart pass the QObject parent to KParts::ReadOnlyPart base class,
or does that not matter (ie. could be the parent widget as well)?

(I'm sure you already regret asking me something :-)

> So one would need to test that applets and embedded kparts get their
> key events even without this code. Koos? :)

Well, with commenting out the QEvent::KeyPress/QEvent::KeyRelease cases it
works for me (like posted earlier). Key events do work for applets and
kmplayer (F for fullscreen).
Sounds worrying though that this is the way to prove its correctness though :)
.. ok, adding a kdBacktrace in there

3: (KMPlayerView::fullScreen()+0x119) [0x40648e79]
4: (KMPlayerView::qt_invoke(int, QUObject*)+0x99) [0x4064a80f]
5: (QObject::activate_signal(QConnectionList*, QUObject*)+0x135) [0x4e66c7d9]
6: (QSignal::signal(QVariant const&)+0x7a) [0x4e9903fa]
7: (QSignal::activate()+0x35) [0x4e6857e1]
8: (QPopupMenu::accelActivated(int)+0x9f) [0x4e771fcb]
9: (QPopupMenu::qt_invoke(int, QUObject*)+0x76) [0x4e9a2b26]
10: (QObject::activate_signal(QConnectionList*, QUObject*)+0x135) [0x4e66c7d9]
11: (QObject::activate_signal(int, int)+0xc0) [0x4e66c90c]
12: (QAccel::activated(int)+0x25) [0x4e98aa89]
13: (QAccelPrivate::activate(QAccelItem*)+0x55) [0x4e608e15]
14: (QAccelManager::dispatchAccelEvent(QWidget*, QKeyEvent*)+0x472) [0x4e607292]
15: (qt_dispatchAccelEvent(QWidget*, QKeyEvent*)+0x35) [0x4e6061e1]
16: (QApplication::notify(QObject*, QEvent*)+0xeb) [0x4e60eac3]
17: /usr/local/kde3/lib/libkdecore.so.4(KApplication::notify(QObject*, QEvent*)+0xae) [0x4298cc68]
18: (QAccelManager::tryAccelEvent(QWidget*, QKeyEvent*)+0x96) [0x4e606772]
19: (qt_tryAccelEvent(QWidget*, QKeyEvent*)+0x35) [0x4e606105]
20: (QETWidget::translateKeyEvent(_XEvent const*, bool)+0xa06) [0x4e5a7fa6]
21: (QApplication::x11ProcessEvent(_XEvent*)+0x488) [0x4e5a3c8c]
22: (QEventLoop::processEvents(unsigned)+0x7b9) [0x4e5b945d]
23: (QEventLoop::enterLoop()+0xdb) [0x4e62313b]
24: (QEventLoop::exec()+0x24) [0x4e623000]
25: (QApplication::exec()+0x20) [0x4e60f6a8]
26: /usr/local/kde3/lib/libkdeinit_konqueror.so(kdemain+0x6b6) [0x4e1bcffa]
27: konqueror(kdemain+0xdb) [0x804865f]
28: /lib/tls/libc.so.6(__libc_start_main+0xf0) [0x927750]
29: konqueror(kdemain+0x31) [0x80485b5]

So there isn't any khtml activity here. Ah yes, there isn't an event filter
installed for these. So if they have the focus, they should just work ..

Koos
-------------- next part --------------
Index: ksvg_factory.cpp
===================================================================
RCS file: /home/kde/kdegraphics/ksvg/plugin/ksvg_factory.cpp,v
retrieving revision 1.12
diff -u -3 -p -r1.12 ksvg_factory.cpp
--- ksvg_factory.cpp	13 Aug 2003 20:51:11 -0000	1.12
+++ ksvg_factory.cpp	25 Nov 2003 18:32:15 -0000
@@ -56,7 +56,7 @@ KSVGPluginFactory::~KSVGPluginFactory()
 	s_about = 0;
 }
 
-KParts::Part *KSVGPluginFactory::createPartObject(QWidget *parentWidget, const char *, QObject *, const char *name, const char *, const QStringList &args)
+KParts::Part *KSVGPluginFactory::createPartObject(QWidget *parentWidget, const char *wname, QObject *parent, const char *name, const char *, const QStringList &args)
 {
 	// Get the width and height of the <embed>
 	// TODO : <object>
@@ -72,7 +72,7 @@ KParts::Part *KSVGPluginFactory::createP
 			height = r2.cap(3).toUInt(&dummy);
 	}
 	
-	return new KSVGPlugin(parentWidget, name, width, height);
+	return new KSVGPlugin(parentWidget, wname, parent, name, width, height);
 }
 
 KInstance *KSVGPluginFactory::instance()
Index: ksvg_plugin.cpp
===================================================================
RCS file: /home/kde/kdegraphics/ksvg/plugin/ksvg_plugin.cpp,v
retrieving revision 1.107
diff -u -3 -p -r1.107 ksvg_plugin.cpp
--- ksvg_plugin.cpp	24 Nov 2003 21:49:55 -0000	1.107
+++ ksvg_plugin.cpp	25 Nov 2003 18:32:15 -0000
@@ -76,7 +76,7 @@ struct KSVGPlugin::Private 
 	unsigned int height;
 };
 
-KSVGPlugin::KSVGPlugin(QWidget *parent, const char *name, unsigned int width, unsigned int height) : KParts::ReadOnlyPart(parent, name)
+KSVGPlugin::KSVGPlugin(QWidget *wparent, const char *, QObject *parent, const char *name, unsigned int width, unsigned int height) : KParts::ReadOnlyPart(parent, name)
 {
 	kdDebug(26003) << "KSVGPlugin::KSVGPlugin" << endl;
 	setInstance(KSVGPluginFactory::instance());
@@ -90,7 +90,7 @@ KSVGPlugin::KSVGPlugin(QWidget *parent, 
 
 	ksvgd->doc = 0;
 
-	ksvgd->window = new KSVGWidget(this, parent, "Rendering Widget");
+	ksvgd->window = new KSVGWidget(this, wparent, "Rendering Widget");
 	connect(ksvgd->window, SIGNAL(browseURL(const QString &)), this, SLOT(browseURL(const QString &)));
 	ksvgd->window->show();
 
@@ -136,7 +136,7 @@ KSVGPlugin::KSVGPlugin(QWidget *parent, 
 	ksvgd->renderingBackendAction->setItems(items);
 	ksvgd->renderingBackendAction->setCurrentItem(KSVG::CanvasFactory::self()->itemInList(ksvgd->canvas));
 
-	ksvgd->aboutKSVG = new KAboutApplication(KSVGPluginFactory::instance()->aboutData(), parent);
+	ksvgd->aboutKSVG = new KAboutApplication(KSVGPluginFactory::instance()->aboutData(), wparent);
 
 	setXMLFile("ksvgplugin.rc");
 }
Index: ksvg_plugin.h
===================================================================
RCS file: /home/kde/kdegraphics/ksvg/plugin/ksvg_plugin.h,v
retrieving revision 1.36
diff -u -3 -p -r1.36 ksvg_plugin.h
--- ksvg_plugin.h	5 Oct 2003 14:17:59 -0000	1.36
+++ ksvg_plugin.h	25 Nov 2003 18:32:15 -0000
@@ -36,7 +36,7 @@ class KSVGPlugin : public KParts::ReadOn
 {
 Q_OBJECT
 public:
-	KSVGPlugin(QWidget *parent, const char *name, unsigned int width = 0, unsigned int height = 0);
+	KSVGPlugin(QWidget *wparent, const char *wname, QObject *parent, const char *name, unsigned int width = 0, unsigned int height = 0);
 	virtual ~KSVGPlugin();
 
 	virtual bool openFile() { return false; }


More information about the kfm-devel mailing list