[qt] fix up AppShell to use postEvent

This commit is contained in:
Vladimir Vukicevic 2008-04-22 05:20:42 -07:00
Родитель 9c90f600c7
Коммит 93f89de503
2 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -58,11 +58,7 @@ public:
nsresult Init();
signals:
void activated();
private slots:
void EventNativeCallback();
virtual bool event (QEvent *e);
protected:
virtual void ScheduleNativeEventCallback();