зеркало из https://github.com/mozilla/gecko-dev.git
Bug 690656 - Don't Init XAtom and XEvents listener in non-main thread r=dougt
This commit is contained in:
Родитель
e898a9c599
Коммит
5ec1284a87
|
@ -131,8 +131,9 @@ using namespace QtMobility;
|
||||||
#include "keysym2ucs.h"
|
#include "keysym2ucs.h"
|
||||||
#if MOZ_PLATFORM_MAEMO == 6
|
#if MOZ_PLATFORM_MAEMO == 6
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
static Atom sPluginIMEAtom;
|
static Atom sPluginIMEAtom = nsnull;
|
||||||
#define PLUGIN_VKB_REQUEST_PROP "_NPAPI_PLUGIN_REQUEST_VKB"
|
#define PLUGIN_VKB_REQUEST_PROP "_NPAPI_PLUGIN_REQUEST_VKB"
|
||||||
|
#include <QThread>
|
||||||
#endif
|
#endif
|
||||||
#endif //MOZ_X11
|
#endif //MOZ_X11
|
||||||
|
|
||||||
|
@ -258,7 +259,10 @@ nsWindow::nsWindow()
|
||||||
gGlobalsInitialized = PR_TRUE;
|
gGlobalsInitialized = PR_TRUE;
|
||||||
|
|
||||||
#if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
|
#if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
|
||||||
sPluginIMEAtom = XInternAtom(QX11Info::display(), PLUGIN_VKB_REQUEST_PROP, False);
|
// This cannot be called on non-main thread
|
||||||
|
if (QThread::currentThread() == qApp->thread()) {
|
||||||
|
sPluginIMEAtom = XInternAtom(QX11Info::display(), PLUGIN_VKB_REQUEST_PROP, False);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
// It's OK if either of these fail, but it may not be one day.
|
// It's OK if either of these fail, but it may not be one day.
|
||||||
initialize_prefs();
|
initialize_prefs();
|
||||||
|
@ -3236,19 +3240,21 @@ nsWindow::SetInputMode(const IMEContext& aContext)
|
||||||
mIMEContext = aContext;
|
mIMEContext = aContext;
|
||||||
|
|
||||||
#if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
|
#if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
|
||||||
static QCoreApplication::EventFilter currentEventFilter = NULL;
|
if (sPluginIMEAtom) {
|
||||||
if (mIMEContext.mStatus == nsIWidget::IME_STATUS_PLUGIN && currentEventFilter != x11EventFilter) {
|
static QCoreApplication::EventFilter currentEventFilter = NULL;
|
||||||
// Install event filter for listening Plugin IME state changes
|
if (mIMEContext.mStatus == nsIWidget::IME_STATUS_PLUGIN && currentEventFilter != x11EventFilter) {
|
||||||
previousEventFilter = QCoreApplication::instance()->setEventFilter(x11EventFilter);
|
// Install event filter for listening Plugin IME state changes
|
||||||
currentEventFilter = x11EventFilter;
|
previousEventFilter = QCoreApplication::instance()->setEventFilter(x11EventFilter);
|
||||||
} else if (mIMEContext.mStatus != nsIWidget::IME_STATUS_PLUGIN && currentEventFilter == x11EventFilter) {
|
currentEventFilter = x11EventFilter;
|
||||||
// Remove event filter
|
} else if (mIMEContext.mStatus != nsIWidget::IME_STATUS_PLUGIN && currentEventFilter == x11EventFilter) {
|
||||||
QCoreApplication::instance()->setEventFilter(previousEventFilter);
|
// Remove event filter
|
||||||
currentEventFilter = previousEventFilter;
|
QCoreApplication::instance()->setEventFilter(previousEventFilter);
|
||||||
previousEventFilter = NULL;
|
currentEventFilter = previousEventFilter;
|
||||||
QWidget* view = GetViewWidget();
|
previousEventFilter = NULL;
|
||||||
if (view) {
|
QWidget* view = GetViewWidget();
|
||||||
SetVKBState(view->winId(), VKBUndefined);
|
if (view) {
|
||||||
|
SetVKBState(view->winId(), VKBUndefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3291,7 +3297,7 @@ nsWindow::SetSoftwareKeyboardState(bool aOpen)
|
||||||
}
|
}
|
||||||
#if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
|
#if defined(MOZ_X11) && (MOZ_PLATFORM_MAEMO == 6)
|
||||||
// doen't open VKB if plugin did set closed state
|
// doen't open VKB if plugin did set closed state
|
||||||
else {
|
else if (sPluginIMEAtom) {
|
||||||
QWidget* view = GetViewWidget();
|
QWidget* view = GetViewWidget();
|
||||||
if (view && GetPluginVKBState(view->winId()) == VKBClose) {
|
if (view && GetPluginVKBState(view->winId()) == VKBClose) {
|
||||||
return;
|
return;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче