From 93f89de503945b702c4e92fa91b868241719d6af Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Tue, 22 Apr 2008 05:20:42 -0700 Subject: [PATCH] [qt] fix up AppShell to use postEvent --- widget/src/qt/nsAppShell.cpp | 23 ++++++++++++++++------- widget/src/qt/nsAppShell.h | 6 +----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/widget/src/qt/nsAppShell.cpp b/widget/src/qt/nsAppShell.cpp index 84f1665f1f80..253d5a4cf742 100644 --- a/widget/src/qt/nsAppShell.cpp +++ b/widget/src/qt/nsAppShell.cpp @@ -56,11 +56,7 @@ PRLogModuleInfo *gWidgetIMLog = nsnull; PRLogModuleInfo *gWidgetDrawLog = nsnull; #endif -void nsAppShell::EventNativeCallback() -{ - NativeEventCallback(); - return; -} +static int sPokeEvent; nsAppShell::~nsAppShell() { @@ -80,14 +76,16 @@ nsAppShell::Init() gWidgetDrawLog = PR_NewLogModule("WidgetDraw"); #endif - connect (this, SIGNAL(activated()), SLOT(EventNativeCallback())); + sPokeEvent = QEvent::registerEventType(); + return nsBaseAppShell::Init(); } void nsAppShell::ScheduleNativeEventCallback() { - emit activated(); + QCoreApplication::postEvent(this, + new QEvent((QEvent::Type) sPokeEvent)); } PRBool @@ -101,3 +99,14 @@ nsAppShell::ProcessNextNativeEvent(PRBool mayWait) qApp->processEvents(flags); return PR_TRUE; } + +bool +nsAppShell::event (QEvent *e) +{ + if (e->type() == sPokeEvent) { + NativeEventCallback(); + return true; + } + + return false; +} diff --git a/widget/src/qt/nsAppShell.h b/widget/src/qt/nsAppShell.h index 49bf3cb2946e..29ecf81d0b91 100644 --- a/widget/src/qt/nsAppShell.h +++ b/widget/src/qt/nsAppShell.h @@ -58,11 +58,7 @@ public: nsresult Init(); -signals: - void activated(); - -private slots: - void EventNativeCallback(); + virtual bool event (QEvent *e); protected: virtual void ScheduleNativeEventCallback();