Closed
Bug 327003
Opened 20 years ago
Closed 19 years ago
Don't commit the IME composition string when Mozilla is deactivated
Categories
(Core :: Internationalization, defect)
Core
Internationalization
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
(Keywords: inputmethod, intl, jp-critical)
Attachments
(1 file, 8 obsolete files)
37.23 KB,
patch
|
Details | Diff | Splinter Review |
Now, we commit the IME composition string at the editor lost focus.
# In nsTextEditorFocusListener::Blur
http://lxr.mozilla.org/mozilla/source/editor/libeditor/text/nsEditorEventListeners.cpp#1078
But this is not good for some WM of the Linux. Because on some WM, the IME candidate list window steals the focus from Mozilla.
Therefore, we need to move the commiting code from editor to ESM. We should commit the IME only when the another Mozilla widget steals the focus.
Assignee | ||
Updated•19 years ago
|
Keywords: jp-critical
Assignee | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•19 years ago
|
||
This patch has |nsIMEStateManager| that is separating the IME managed code from ESM for readability.
roc:
If you grant to this approach, I'll request additional review to timeless(editor) and Masaki Katakai-san(gtk2).
Attachment #216228 -
Flags: superreview?(roc)
Attachment #216228 -
Flags: review?(roc)
Assignee | ||
Comment 2•19 years ago
|
||
roc:
> If you grant to this approach,
"If you agree to this approach,"
Assignee | ||
Comment 3•19 years ago
|
||
This patch also fixes bug 278802.
(In reply to comment #1)
> Created an attachment (id=216228) [edit]
> Patch rv1.0
It reject by the following files.
(bug330710)
patching file content/events/public/Makefile.inpatching file content/events/public/nsIIMEStateManager.h
patching file content/events/src/Makefile.in
patching file content/events/src/nsEventStateManager.cpp
patching file content/events/src/nsEventStateManager.h
patching file content/events/src/nsIMEStateManager.cpp
patching file content/events/src/nsIMEStateManager.h
patching file editor/libeditor/base/nsEditor.cpp
patching file editor/libeditor/text/nsEditorEventListeners.cpp
Hunk #2 FAILED at 1088.
1 out of 2 hunks FAILED -- saving rejects to file editor/libeditor/text/nsEditorEventListeners.cpp.rej
patching file widget/src/gtk2/nsWindow.cpp
patching file widget/src/gtk2/nsWindow.h
Assignee | ||
Comment 5•19 years ago
|
||
updating.
Attachment #216228 -
Attachment is obsolete: true
Attachment #216293 -
Flags: superreview?(roc)
Attachment #216293 -
Flags: review?(roc)
Attachment #216228 -
Flags: superreview?(roc)
Attachment #216228 -
Flags: review?(roc)
Assignee | ||
Comment 6•19 years ago
|
||
Sorry, new files dropped.
Attachment #216293 -
Attachment is obsolete: true
Attachment #216295 -
Flags: superreview?(roc)
Attachment #216295 -
Flags: review?(roc)
Attachment #216293 -
Flags: superreview?(roc)
Attachment #216293 -
Flags: review?(roc)
Assignee | ||
Comment 7•19 years ago
|
||
maybe, this fixes the crash on soralis.
Attachment #216295 -
Attachment is obsolete: true
Attachment #216315 -
Flags: superreview?(roc)
Attachment #216315 -
Flags: review?(roc)
Attachment #216295 -
Flags: superreview?(roc)
Attachment #216295 -
Flags: review?(roc)
Assignee | ||
Comment 8•19 years ago
|
||
Sorry, this is better.
Attachment #216315 -
Attachment is obsolete: true
Attachment #216316 -
Flags: superreview?(roc)
Attachment #216316 -
Flags: review?(roc)
Attachment #216315 -
Flags: superreview?(roc)
Attachment #216315 -
Flags: review?(roc)
+ nsIViewManager* GetViewManager() {
+ return GetPresShell() ? GetPresShell()->GetViewManager() : nsnull;
+ }
I'd prefer that you did not do this. I assume you were crashing during presshell/prescontext destruction. Can you find a way to get around the crash without making this change?
+ static nsIMEStateManager sISM;
That's a cute trick but it's not really needed here. The static instance could be a regular static variable and it's probably slightly more efficient to make it one.
I think we don't need nsIIMEStateManager. Just use nsIMEStateManager.h directly. Does that need to be in EXPORTS? It's not used outside content/events/src, is it? nsIMEStateManager doesn't need to have an IID or inherit from nsISupports.
Assignee | ||
Comment 10•19 years ago
|
||
roc:
Thank you for your review. I'll recreate a new patch. But I have another problem that is nsPresContext of background tab in active window returns true on nsIMEStateManager::IsActive. This is not good. We need to check the focus controller's active flag. But the flag is not correct on activate/deactivate...
If you have a good idea for this problem, please tell me.
You might get some help by QI'ing the presshell to nsIViewObserver and calling IsVisible(). This is set to false on background tabs.
Assignee | ||
Comment 12•19 years ago
|
||
Attachment #216316 -
Attachment is obsolete: true
Attachment #217193 -
Flags: superreview?(roc)
Attachment #217193 -
Flags: review?(roc)
Attachment #216316 -
Flags: superreview?(roc)
Attachment #216316 -
Flags: review?(roc)
+ virtual ~nsIMEStateManager();
+
+ NS_IMETHOD OnDestroyPresContext(nsPresContext* aPresContext);
+ NS_IMETHOD OnRemoveContent(nsPresContext* aPresContext, nsIContent* aContent);
+ NS_IMETHOD OnChangeFocus(nsPresContext* aPresContext, nsIContent* aContent);
+ NS_IMETHOD OnActivate(nsPresContext* aPresContext);
+ NS_IMETHOD OnDeactivate(nsPresContext* aPresContext);
These don't need to be virtual. In fact, they can be static, and the fields of this class can be static too. Then you don't need an instance of nsIMEStateManager at all, and you don't need constructors and destructors.
+ nsCOMPtr<nsPresContext> context = shell->GetPresContext();
This doesn't need to be a strong reference since we're already holding a strong ref to the presshell, and the presshell strongly references the prescontext.
Assignee | ||
Comment 14•19 years ago
|
||
changing to static.
Attachment #217193 -
Attachment is obsolete: true
Attachment #217289 -
Flags: superreview?(roc)
Attachment #217289 -
Flags: review?(roc)
Attachment #217193 -
Flags: superreview?(roc)
Attachment #217193 -
Flags: review?(roc)
GetKBStateControl can just return a non-addrefed pointer directly. There is no need to return an addrefed pointer here; you're not doing anything that could destroy the widget, right? Return nsnull if there's an error.
Why do we need nsEventStateManager to have the new NotifyDestroyPresContext method? Is it too late to do that stuff when SetPresContext(nsnull) gets called?
Assignee | ||
Comment 16•19 years ago
|
||
(In reply to comment #15)
> Why do we need nsEventStateManager to have the new NotifyDestroyPresContext
> method? Is it too late to do that stuff when SetPresContext(nsnull) gets
> called?
Maybe, 'Yes'. It's too late. Because the view manager of the presShell is released after here, but before SetPresContext(nsnull). Do you have better idea? I don't have better idea.(I don't like this approach too.)
Assignee | ||
Comment 17•19 years ago
|
||
And see previous my comment for |NotifyDestroyPresContext|.
Attachment #217289 -
Attachment is obsolete: true
Attachment #217356 -
Flags: superreview?(roc)
Attachment #217356 -
Flags: review?(roc)
Attachment #217289 -
Flags: superreview?(roc)
Attachment #217289 -
Flags: review?(roc)
Attachment #217356 -
Flags: superreview?(roc)
Attachment #217356 -
Flags: superreview+
Attachment #217356 -
Flags: review?(roc)
Attachment #217356 -
Flags: review+
Assignee | ||
Comment 18•19 years ago
|
||
Comment on attachment 217356 [details] [diff] [review]
Patch rv3.1
timeless:
Would you review the editor code?
I removed to call |ForceCompositionEnd()| from |nsEditor::PostCreate()| this is added by bug 17419. But I think that this code is not needed for the bug. But If it's needed for that bug, maybe it is wrong. We should find another way.
Attachment #217356 -
Flags: review?(timeless)
Assignee | ||
Comment 19•19 years ago
|
||
Comment on attachment 217356 [details] [diff] [review]
Patch rv3.1
Katakai-san:
Would you review gtk2 widget code?
Attachment #217356 -
Flags: review?(masaki.katakai)
Comment 20•19 years ago
|
||
Comment on attachment 217356 [details] [diff] [review]
Patch rv3.1
> if (focusedIm && focusedIm == window->mIMEData->mContext) {
> // Release current IME focus if IME is enabled.
>- if (window->mIMEData->mEnabled)
>+ if (window->mIMEData->mEnabled) {
>+ focusedWin->ResetInputState();
> focusedWin->IMELoseFocus();
>+ }
Hi Nakako-san,
focusedWin->ResetInputState() was not in the patch for bug 321468, but it's newly added for this patch.
Any reason?
Assignee | ||
Comment 21•19 years ago
|
||
(In reply to comment #20)
> (From update of attachment 217356 [details] [diff] [review] [edit])
> > if (focusedIm && focusedIm == window->mIMEData->mContext) {
> > // Release current IME focus if IME is enabled.
> >- if (window->mIMEData->mEnabled)
> >+ if (window->mIMEData->mEnabled) {
> >+ focusedWin->ResetInputState();
> > focusedWin->IMELoseFocus();
> >+ }
>
> Hi Nakako-san,
>
> focusedWin->ResetInputState() was not in the patch for bug 321468, but it's
> newly added for this patch.
> Any reason?
It was removed by your advice, because it commited at the window is activating. But it's necessary and this patch removes the problem.(at the window is activating, |SetIMEEnabled| is not called by this patch.)
Comment 22•19 years ago
|
||
> It was removed by your advice, because it commited at the window is activating.
> But it's necessary and this patch removes the problem.(at the window is
> activating, |SetIMEEnabled| is not called by this patch.)
Which bug can be fixed by that line? I need a reason why this line is necessary, any bugid or example step?
Assignee | ||
Comment 23•19 years ago
|
||
(In reply to comment #22)
> > It was removed by your advice, because it commited at the window is activating.
> > But it's necessary and this patch removes the problem.(at the window is
> > activating, |SetIMEEnabled| is not called by this patch.)
>
> Which bug can be fixed by that line? I need a reason why this line is
> necessary, any bugid or example step?
>
There is no bug. But I think that we should ensure that there is not IM transaction while IM is disabled on the widget. If there is a IM transaction but the IM is disabled on the widget, user cannot commit the IM transaction, because the widget doesn't send key events to IM while IM is disabled.
Comment 24•19 years ago
|
||
Comment on attachment 217356 [details] [diff] [review]
Patch rv3.1
Thank you Nakano-san for clarification. I understand now.
Attachment #217356 -
Flags: review?(masaki.katakai) → review+
Comment 25•19 years ago
|
||
Comment on attachment 217356 [details] [diff] [review]
Patch rv3.1
>Index: content/events/public/nsIEventStateManager.h
> class nsIEventStateManager : public nsISupports {
>+ NS_IMETHOD NotifyDestroyPresContext(nsPresContext* aPresContext) = 0;
> NS_IMETHOD SetPresContext(nsPresContext* aPresContext) = 0;
normally we add methods to the end, but since you're bumping the iid i suppose it doesn't matter.
but that's not my part of the code area :).
changes seem fine.
Attachment #217356 -
Flags: review?(timeless) → review+
Assignee | ||
Comment 26•19 years ago
|
||
checked-in, thank you.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 27•19 years ago
|
||
Attachment #217356 -
Attachment is obsolete: true
Assignee | ||
Updated•15 years ago
|
Keywords: inputmethod
You need to log in
before you can comment on or make changes to this bug.
Description
•