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));
|
("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
|
void
|
||||||
IMContextWrapper::OnDestroyWindow(nsWindow* aWindow)
|
IMContextWrapper::OnDestroyWindow(nsWindow* aWindow)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,8 @@ public:
|
|||||||
// I.e., the focus is in the normal editors.
|
// I.e., the focus is in the normal editors.
|
||||||
bool IsEnabled() const;
|
bool IsEnabled() const;
|
||||||
|
|
||||||
|
nsIMEUpdatePreference GetIMEUpdatePreference() const;
|
||||||
|
|
||||||
// OnFocusWindow is a notification that aWindow is going to be focused.
|
// OnFocusWindow is a notification that aWindow is going to be focused.
|
||||||
void OnFocusWindow(nsWindow* aWindow);
|
void OnFocusWindow(nsWindow* aWindow);
|
||||||
// OnBlurWindow is a notification that aWindow is going to be unfocused.
|
// OnBlurWindow is a notification that aWindow is going to be unfocused.
|
||||||
|
@ -6028,14 +6028,10 @@ nsWindow::GetInputContext()
|
|||||||
nsIMEUpdatePreference
|
nsIMEUpdatePreference
|
||||||
nsWindow::GetIMEUpdatePreference()
|
nsWindow::GetIMEUpdatePreference()
|
||||||
{
|
{
|
||||||
nsIMEUpdatePreference updatePreference(
|
if (!mIMContext) {
|
||||||
nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
|
return nsIMEUpdatePreference();
|
||||||
nsIMEUpdatePreference::NOTIFY_POSITION_CHANGE);
|
}
|
||||||
// We shouldn't notify IME of selection change caused by changes of
|
return mIMContext->GetIMEUpdatePreference();
|
||||||
// composition string. Therefore, we don't need to be notified selection
|
|
||||||
// changes which are caused by compositionchange events handled.
|
|
||||||
updatePreference.DontNotifyChangesCausedByComposition();
|
|
||||||
return updatePreference;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -151,15 +151,16 @@ nsBaseWidget::nsBaseWidget()
|
|||||||
, mLayerManager(nullptr)
|
, mLayerManager(nullptr)
|
||||||
, mCompositorVsyncDispatcher(nullptr)
|
, mCompositorVsyncDispatcher(nullptr)
|
||||||
, mCursor(eCursor_standard)
|
, mCursor(eCursor_standard)
|
||||||
, mUpdateCursor(true)
|
|
||||||
, mBorderStyle(eBorderStyle_none)
|
, mBorderStyle(eBorderStyle_none)
|
||||||
, mUseAttachedEvents(false)
|
|
||||||
, mBounds(0,0,0,0)
|
, mBounds(0,0,0,0)
|
||||||
, mOriginalBounds(nullptr)
|
, mOriginalBounds(nullptr)
|
||||||
, mClipRectCount(0)
|
, mClipRectCount(0)
|
||||||
, mSizeMode(nsSizeMode_Normal)
|
, mSizeMode(nsSizeMode_Normal)
|
||||||
, mPopupLevel(ePopupLevelTop)
|
, mPopupLevel(ePopupLevelTop)
|
||||||
, mPopupType(ePopupTypeAny)
|
, mPopupType(ePopupTypeAny)
|
||||||
|
, mUpdateCursor(true)
|
||||||
|
, mUseAttachedEvents(false)
|
||||||
|
, mIMEHasFocus(false)
|
||||||
{
|
{
|
||||||
#ifdef NOISY_WIDGET_LEAKS
|
#ifdef NOISY_WIDGET_LEAKS
|
||||||
gNumWidgets++;
|
gNumWidgets++;
|
||||||
@ -1560,7 +1561,7 @@ nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY)
|
|||||||
mWidgetListener->WindowMoved(this, aX, aY);
|
mWidgetListener->WindowMoved(this, aX, aY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetIMEUpdatePreference().WantPositionChanged()) {
|
if (mIMEHasFocus && GetIMEUpdatePreference().WantPositionChanged()) {
|
||||||
NotifyIME(IMENotification(IMEMessage::NOTIFY_IME_OF_POSITION_CHANGE));
|
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.
|
// Otherwise, it should be handled by native IME.
|
||||||
return NotifyIMEInternal(aIMENotification);
|
return NotifyIMEInternal(aIMENotification);
|
||||||
case NOTIFY_IME_OF_FOCUS:
|
case NOTIFY_IME_OF_FOCUS:
|
||||||
case NOTIFY_IME_OF_BLUR:
|
mIMEHasFocus = true;
|
||||||
// If the notification is a notification which is supported by
|
// We should notify TextEventDispatcher of focus notification, first.
|
||||||
// nsITextInputProcessorCallback, we should notify the
|
// After that, notify native IME too.
|
||||||
// TextEventDispatcher, first. After that, notify native IME too.
|
|
||||||
if (mTextEventDispatcher) {
|
if (mTextEventDispatcher) {
|
||||||
mTextEventDispatcher->NotifyIME(aIMENotification);
|
mTextEventDispatcher->NotifyIME(aIMENotification);
|
||||||
}
|
}
|
||||||
return NotifyIMEInternal(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:
|
default:
|
||||||
// Otherwise, notify only native IME for now.
|
// Otherwise, notify only native IME for now.
|
||||||
return NotifyIMEInternal(aIMENotification);
|
return NotifyIMEInternal(aIMENotification);
|
||||||
|
@ -502,9 +502,7 @@ protected:
|
|||||||
nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
|
nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
|
||||||
nsRefPtr<TextEventDispatcher> mTextEventDispatcher;
|
nsRefPtr<TextEventDispatcher> mTextEventDispatcher;
|
||||||
nsCursor mCursor;
|
nsCursor mCursor;
|
||||||
bool mUpdateCursor;
|
|
||||||
nsBorderStyle mBorderStyle;
|
nsBorderStyle mBorderStyle;
|
||||||
bool mUseAttachedEvents;
|
|
||||||
nsIntRect mBounds;
|
nsIntRect mBounds;
|
||||||
nsIntRect* mOriginalBounds;
|
nsIntRect* mOriginalBounds;
|
||||||
// When this pointer is null, the widget is not clipped
|
// When this pointer is null, the widget is not clipped
|
||||||
@ -515,6 +513,10 @@ protected:
|
|||||||
nsPopupType mPopupType;
|
nsPopupType mPopupType;
|
||||||
SizeConstraints mSizeConstraints;
|
SizeConstraints mSizeConstraints;
|
||||||
|
|
||||||
|
bool mUpdateCursor;
|
||||||
|
bool mUseAttachedEvents;
|
||||||
|
bool mIMEHasFocus;
|
||||||
|
|
||||||
static nsIRollupListener* gRollupListener;
|
static nsIRollupListener* gRollupListener;
|
||||||
|
|
||||||
// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
|
// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
|
||||||
|
Loading…
Reference in New Issue
Block a user