mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1191213 nsBaseWidget::NotifyWindowMoved() shouldn't notify IME when native IME handler doesn't have focus r=m_kato
This commit is contained in:
parent
03d472ba33
commit
855a8206b8
@ -200,6 +200,23 @@ IMContextWrapper::~IMContextWrapper()
|
||||
("GTKIM: %p ~IMContextWrapper()", this));
|
||||
}
|
||||
|
||||
nsIMEUpdatePreference
|
||||
IMContextWrapper::GetIMEUpdatePreference() const
|
||||
{
|
||||
nsIMEUpdatePreference::Notifications notifications =
|
||||
nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE;
|
||||
// If it's not enabled, we don't need position change notification.
|
||||
if (IsEnabled()) {
|
||||
notifications |= nsIMEUpdatePreference::NOTIFY_POSITION_CHANGE;
|
||||
}
|
||||
nsIMEUpdatePreference updatePreference(notifications);
|
||||
// We shouldn't notify IME of selection change caused by changes of
|
||||
// composition string. Therefore, we don't need to be notified selection
|
||||
// changes which are caused by compositionchange events handled.
|
||||
updatePreference.DontNotifyChangesCausedByComposition();
|
||||
return updatePreference;
|
||||
}
|
||||
|
||||
void
|
||||
IMContextWrapper::OnDestroyWindow(nsWindow* aWindow)
|
||||
{
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
// I.e., the focus is in the normal editors.
|
||||
bool IsEnabled() const;
|
||||
|
||||
nsIMEUpdatePreference GetIMEUpdatePreference() const;
|
||||
|
||||
// OnFocusWindow is a notification that aWindow is going to be focused.
|
||||
void OnFocusWindow(nsWindow* aWindow);
|
||||
// OnBlurWindow is a notification that aWindow is going to be unfocused.
|
||||
|
@ -6028,14 +6028,10 @@ nsWindow::GetInputContext()
|
||||
nsIMEUpdatePreference
|
||||
nsWindow::GetIMEUpdatePreference()
|
||||
{
|
||||
nsIMEUpdatePreference updatePreference(
|
||||
nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
|
||||
nsIMEUpdatePreference::NOTIFY_POSITION_CHANGE);
|
||||
// We shouldn't notify IME of selection change caused by changes of
|
||||
// composition string. Therefore, we don't need to be notified selection
|
||||
// changes which are caused by compositionchange events handled.
|
||||
updatePreference.DontNotifyChangesCausedByComposition();
|
||||
return updatePreference;
|
||||
if (!mIMContext) {
|
||||
return nsIMEUpdatePreference();
|
||||
}
|
||||
return mIMContext->GetIMEUpdatePreference();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -151,15 +151,16 @@ nsBaseWidget::nsBaseWidget()
|
||||
, mLayerManager(nullptr)
|
||||
, mCompositorVsyncDispatcher(nullptr)
|
||||
, mCursor(eCursor_standard)
|
||||
, mUpdateCursor(true)
|
||||
, mBorderStyle(eBorderStyle_none)
|
||||
, mUseAttachedEvents(false)
|
||||
, mBounds(0,0,0,0)
|
||||
, mOriginalBounds(nullptr)
|
||||
, mClipRectCount(0)
|
||||
, mSizeMode(nsSizeMode_Normal)
|
||||
, mPopupLevel(ePopupLevelTop)
|
||||
, mPopupType(ePopupTypeAny)
|
||||
, mUpdateCursor(true)
|
||||
, mUseAttachedEvents(false)
|
||||
, mIMEHasFocus(false)
|
||||
{
|
||||
#ifdef NOISY_WIDGET_LEAKS
|
||||
gNumWidgets++;
|
||||
@ -1560,7 +1561,7 @@ nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY)
|
||||
mWidgetListener->WindowMoved(this, aX, aY);
|
||||
}
|
||||
|
||||
if (GetIMEUpdatePreference().WantPositionChanged()) {
|
||||
if (mIMEHasFocus && GetIMEUpdatePreference().WantPositionChanged()) {
|
||||
NotifyIME(IMENotification(IMEMessage::NOTIFY_IME_OF_POSITION_CHANGE));
|
||||
}
|
||||
}
|
||||
@ -1617,14 +1618,23 @@ nsBaseWidget::NotifyIME(const IMENotification& aIMENotification)
|
||||
// Otherwise, it should be handled by native IME.
|
||||
return NotifyIMEInternal(aIMENotification);
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
// If the notification is a notification which is supported by
|
||||
// nsITextInputProcessorCallback, we should notify the
|
||||
// TextEventDispatcher, first. After that, notify native IME too.
|
||||
mIMEHasFocus = true;
|
||||
// We should notify TextEventDispatcher of focus notification, first.
|
||||
// After that, notify native IME too.
|
||||
if (mTextEventDispatcher) {
|
||||
mTextEventDispatcher->NotifyIME(aIMENotification);
|
||||
}
|
||||
return NotifyIMEInternal(aIMENotification);
|
||||
case NOTIFY_IME_OF_BLUR: {
|
||||
// We should notify TextEventDispatcher of blur notification, first.
|
||||
// After that, notify native IME too.
|
||||
if (mTextEventDispatcher) {
|
||||
mTextEventDispatcher->NotifyIME(aIMENotification);
|
||||
}
|
||||
nsresult rv = NotifyIMEInternal(aIMENotification);
|
||||
mIMEHasFocus = false;
|
||||
return rv;
|
||||
}
|
||||
default:
|
||||
// Otherwise, notify only native IME for now.
|
||||
return NotifyIMEInternal(aIMENotification);
|
||||
|
@ -502,9 +502,7 @@ protected:
|
||||
nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
|
||||
nsRefPtr<TextEventDispatcher> mTextEventDispatcher;
|
||||
nsCursor mCursor;
|
||||
bool mUpdateCursor;
|
||||
nsBorderStyle mBorderStyle;
|
||||
bool mUseAttachedEvents;
|
||||
nsIntRect mBounds;
|
||||
nsIntRect* mOriginalBounds;
|
||||
// When this pointer is null, the widget is not clipped
|
||||
@ -515,6 +513,10 @@ protected:
|
||||
nsPopupType mPopupType;
|
||||
SizeConstraints mSizeConstraints;
|
||||
|
||||
bool mUpdateCursor;
|
||||
bool mUseAttachedEvents;
|
||||
bool mIMEHasFocus;
|
||||
|
||||
static nsIRollupListener* gRollupListener;
|
||||
|
||||
// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
|
||||
|
Loading…
Reference in New Issue
Block a user