зеркало из https://github.com/mozilla/gecko-dev.git
[qt] fix up AppShell to use postEvent
This commit is contained in:
Родитель
9c90f600c7
Коммит
93f89de503
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче