mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1140832 Don't call gtk_im_context_reset() during "delete_surrounding" notification r=m_kato
This commit is contained in:
parent
d560040e6d
commit
23b86c9b04
@ -9,6 +9,7 @@
|
||||
|
||||
#include "nsGtkIMModule.h"
|
||||
#include "nsWindow.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MiscEvents.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -74,6 +75,7 @@ nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow)
|
||||
, mCompositionTargetOffset(UINT32_MAX)
|
||||
, mCompositionState(eCompositionState_NotComposing)
|
||||
, mIsIMFocused(false)
|
||||
, mIsDeletingSurrounding(false)
|
||||
{
|
||||
#ifdef PR_LOGGING
|
||||
if (!gGtkIMLog) {
|
||||
@ -670,8 +672,9 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller)
|
||||
|
||||
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
|
||||
("GtkIMModule(%p): OnSelectionChange(aCaller=0x%p), "
|
||||
"mCompositionState=%s",
|
||||
this, aCaller, GetCompositionStateName()));
|
||||
"mCompositionState=%s, mIsDeletingSurrounding=%s",
|
||||
this, aCaller, GetCompositionStateName(),
|
||||
mIsDeletingSurrounding ? "true" : "false"));
|
||||
|
||||
if (aCaller != mLastFocusedWindow) {
|
||||
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
|
||||
@ -681,6 +684,12 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller)
|
||||
return;
|
||||
}
|
||||
|
||||
// If the selection change is caused by deleting surrounding text,
|
||||
// we shouldn't need to notify IME of selection change.
|
||||
if (mIsDeletingSurrounding) {
|
||||
return;
|
||||
}
|
||||
|
||||
ResetIME();
|
||||
}
|
||||
|
||||
@ -850,6 +859,8 @@ nsGtkIMModule::OnDeleteSurroundingNative(GtkIMContext *aContext,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AutoRestore<bool> saveDeletingSurrounding(mIsDeletingSurrounding);
|
||||
mIsDeletingSurrounding = true;
|
||||
if (NS_SUCCEEDED(DeleteText(aContext, aOffset, (uint32_t)aNChars))) {
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -183,6 +183,9 @@ protected:
|
||||
// keypress event. If this is true, the keydown event has been dispatched.
|
||||
// Then, DispatchCompositionStart() doesn't dispatch keydown event.
|
||||
bool mKeyDownEventWasSent;
|
||||
// mIsDeletingSurrounding is true while OnDeleteSurroundingNative() is
|
||||
// trying to delete the surrounding text.
|
||||
bool mIsDeletingSurrounding;
|
||||
|
||||
// sLastFocusedModule is a pointer to the last focused instance of this
|
||||
// class. When a instance is destroyed and sLastFocusedModule refers it,
|
||||
|
Loading…
Reference in New Issue
Block a user