Closed Bug 276727 Opened 21 years ago Closed 20 years ago

Implement disable/enable IME API

Categories

(Core :: Internationalization, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

(Keywords: inputmethod, intl)

Attachments

(8 files, 23 obsolete files)

1.24 KB, patch
roc
: review+
Details | Diff | Splinter Review
3.77 KB, patch
mikepinkerton
: review+
Details | Diff | Splinter Review
1.89 KB, patch
amardare
: review+
Details | Diff | Splinter Review
1.88 KB, patch
masaki.katakai
: review+
Details | Diff | Splinter Review
42.20 KB, patch
timeless
: review+
Details | Diff | Splinter Review
1.86 KB, patch
Details | Diff | Splinter Review
51.44 KB, patch
timeless
: review+
Details | Diff | Splinter Review
1008 bytes, patch
timeless
: review+
Details | Diff | Splinter Review
We need to disable/enable IME API for bug 55751 and bug 113187. These API should be implmented in nsIKBStateControl.
Keywords: intl
Priority: -- → P4
Target Milestone: --- → mozilla1.9alpha
Attached patch Patch rv1.0 for Cocoa (obsolete) — Splinter Review
Attachment #178815 - Flags: review?(pinkerton)
Attached patch Patch rv1.0 for GTK (obsolete) — Splinter Review
Attachment #178816 - Flags: review?(pavlov)
Attached patch Patch rv1.0 for Mac (obsolete) — Splinter Review
Attachment #178817 - Flags: review?(pinkerton)
Attached patch Patch rv1.0 for Photon (obsolete) — Splinter Review
Attachment #178819 - Flags: review?(amardare)
Attached patch Patch rv1.0 for Windows (obsolete) — Splinter Review
Attachment #178821 - Flags: review?(timeless)
Attached patch Patch rv1.1 (obsolete) — Splinter Review
Attachment #178813 - Attachment is obsolete: true
Attached patch Patch rv1.1 for Windows (obsolete) — Splinter Review
Attachment #178821 - Attachment is obsolete: true
Attachment #178838 - Flags: review?(timeless)
Attached patch Patch rv1.2 (obsolete) — Splinter Review
Attachment #178837 - Attachment is obsolete: true
Attached patch Patch rv1.2 for Windows (obsolete) — Splinter Review
Attachment #178838 - Attachment is obsolete: true
Attachment #178843 - Flags: review?(timeless)
Attachment #178814 - Flags: superreview?(roc)
Attachment #178814 - Flags: superreview+
Attachment #178814 - Flags: review?(roc)
Attachment #178814 - Flags: review+
Comment on attachment 178814 [details] [diff] [review] Patch rv1.0 for nsIKBStateControl >Index: widget/public/nsIKBStateControl.h at some point we need to expose this stuff to js so that pure xul/js apps can toggle it...
Comment on attachment 178843 [details] [diff] [review] Patch rv1.2 for Windows >Index: widget/src/windows/nsWindow.cpp >+NS_IMETHODIMP nsWindow::SetIMEEnableState(PRBool aState) i really am not fond of these method names. (SetEnableIME/GetEnableIME or SetIMEEnabled/GetIMEEnabled) >+ if (!theWinNLS.LoadedWINNLSEnableIME()) >+ return NS_ERROR_FAILURE; if there's a more specific message available, please use it. >+ BOOL rv = theWinNLS.WINNLSEnableIME(mWnd, aState ? TRUE : FALSE); don't label booleans 'rv', only use that for 'nsresult' type variables. >+ *aState = theWinNLS.WINNLSGetEnableStatus(mWnd) ? PR_TRUE : PR_FALSE; personally i prefer !!, instead of ? PR_TRUE : PR_FALSE, but that's just me. >Index: widget/src/windows/nsWindow.h > /** >+* Native WinNLS wrapper >+*/ please align the *'s with the first * in /* (see below) >+class nsWinNLS >+{ ... >+ nsWinNLS(const char* aModuleName="USER32.DLL") { use spaces around assignment/comparison operators >+#ifndef WINCE >+ mInstance=::LoadLibrary(aModuleName); >+ NS_ASSERTION(mInstance!=NULL, "nsWinNLS.LoadLibrary failed."); i don't like this at all. i'd much prefer standard mozilla xpcom practices with an nsresult Init method ... oh, and don't use an assertion, those will eventually cause crashes in debug builds, and it's legal for a library to fail for lack of system resources. >+ mWINNLSEnableIME=(mInstance) ? (WINNLSEnableIMEPtr)GetProcAddress(mInstance,"WINNLSEnableIME") : 0; don't exceed 80cols, and please use spaces i'd rather you use an inializer mWINNLSEnableIME(0) and do: if (mInstance) { mWINNLSEnableIME = ...; mWINNLSGetEnableStatus = ...; } >+ NS_ASSERTION(mWINNLSEnableIME!=NULL, "nsWinNLS.WINNLSEnableIME failed."); >+ mWINNLSGetEnableStatus=(mInstance) ? (WINNLSGetEnableStatusPtr)GetProcAddress(mInstance,"WINNLSGetEnableStatus") : 0; >+ NS_ASSERTION(mWINNLSGetEnableStatus!=NULL, "nsWinNLS.WINNLSGetEnableStatus failed."); >+#elif WINCE_EMULATOR all of these: >+ mInstance=NULL; >+ mWINNLSEnableIME=NULL; >+ mWINNLSGetEnableStatus=NULL; should be initializers. (and most can be shared) >+#else // WinCE >+ mInstance=NULL; >+ >+ // XXX If WINNLSEnableIME can be used on WinCE, Here should be hacked. why did you special case WINCE_EMULATOR? >+ mWINNLSEnableIME=NULL; //(WINNLSEnableIMEPtr)WINNLSEnableIME; >+ // XXX If WINNLSGetEnableStatus can be used on WinCE, Here should be hacked. >+ mWINNLSGetEnableStatus=NULL; //(WINNLSGetEnableStatusPtr)WINNLSGetEnableStatus; >+#endif >+ } since these are all properties of an object, do we really need "WINNLS" in their names? >+ BOOL WINNLSEnableIME(HWND h, BOOL b) { >+ BOOL WINNLSGetEnableStatus(HWND h) { >+ PRBool LoadedWINNLSEnableIME() { >+ PRBool LoadedWINNLSGetEnableStatus() { note how the *'s align here (compare with your new comment block above): >+/** > * Native WIN32 window wrapper. > */
Attachment #178843 - Flags: review?(timeless) → review-
timeless: thank you for your review. >>+ *aState = theWinNLS.WINNLSGetEnableStatus(mWnd) ? PR_TRUE : PR_FALSE; > personally i prefer !!, instead of ? PR_TRUE : PR_FALSE, but that's just me. Sorry, I cannot understand. What should I do?
Attached patch Patch rv1.3 (obsolete) — Splinter Review
Attachment #178842 - Attachment is obsolete: true
Attached patch Patch rv1.3 (obsolete) — Splinter Review
Attachment #178895 - Attachment is obsolete: true
Attachment #178815 - Attachment is obsolete: true
Attachment #178817 - Attachment is obsolete: true
Attachment #178898 - Flags: review?(pinkerton)
Attached patch Patch rv1.3 for GTK (obsolete) — Splinter Review
Attachment #178816 - Attachment is obsolete: true
Attachment #178899 - Flags: review?(pavlov)
Attachment #178819 - Attachment is obsolete: true
Attachment #178900 - Flags: review?(amardare)
Attached patch Patch rv1.3 for Windows (obsolete) — Splinter Review
Attachment #178843 - Attachment is obsolete: true
Attachment #178901 - Flags: review?(timeless)
Attachment #178900 - Flags: review?(amardare) → review+
my style is: *aState = !!theWinNLS.WINNLSGetEnableStatus(mWnd);
Attached patch Patch rv1.4 for Windows (obsolete) — Splinter Review
Attachment #178901 - Attachment is obsolete: true
Attachment #179044 - Flags: review?(timeless)
Attached patch Patch rv1.4 (obsolete) — Splinter Review
Attachment #178897 - Attachment is obsolete: true
Attachment #179044 - Flags: review?(timeless) → review?(dean_tessman)
Comment on attachment 178898 [details] [diff] [review] Patch rv1.3 for Cocoa and Mac um sure. r=pink. who's going to implement these routines?
Attachment #178898 - Flags: review?(pinkerton) → review+
Comment on attachment 179044 [details] [diff] [review] Patch rv1.4 for Windows >Index: widget/src/windows/nsWindow.h >+ >+ nsWinNLS(const char* aModuleName = "USER32.DLL") { .... That's a lot of code for a header file. Shouldn't it go into the .cpp file? >+ // XXX If WINNLSEnableIME can be used on WinCE, Here should be hacked. >+ mWINNLSEnableIME = NULL; // (WINNLSEnableIMEPtr)WINNLSEnableIME; >+ // XXX If WINNLSGetEnableStatus can be used on WinCE, Here should be hacked. >+ mWINNLSGetEnableStatus = NULL; >+ // (WINNLSGetEnableStatusPtr)WINNLSGetEnableStatus; What's this dangling line for? >+ ~nsWinNLS() { >+ if(mInstance) { >+ ::FreeLibrary(mInstance); Should set mInstance to NULL, since you've set an example of checking if mInstance is not NULL. >+ BOOL EnableIME(HWND h, BOOL b) { >+ return (mWINNLSEnableIME) ? mWINNLSEnableIME(h, b) : TRUE; >+ } >+ BOOL GetEnableStatus(HWND h) { >+ return (mWINNLSGetEnableStatus) ? mWINNLSGetEnableStatus(h) : TRUE; >+ } >+ >+ PRBool LoadedEnableIME() { >+ return (mWINNLSEnableIME) ? PR_TRUE : PR_FALSE; >+ } >+ PRBool LoadedGetEnableStatus() { >+ return (mWINNLSGetEnableStatus) ? PR_TRUE : PR_FALSE; >+ } 1. Blank line between methods. 2. Better variable names, please. eg. BOOL EnableIME(HWND aWnd, BOOL aState) 3. The method names are a little confusing. After reading through a few times I get what they mean, and I realize some come from User32.dll, but can we name ours a little more clearly? 4. Why do EnableIME and GetEnableStatus return TRUE when the proc address wasn't found, instead of FALSE? 5. Use PR_TRUE instead of TRUE. >+ NS_IMETHOD SetIMEEnable(PRBool aState); >+ NS_IMETHOD GetIMEEnable(PRBool* aState); These should be named SetIMEEnabled and GetIMEEnabled instead of "...Enable", shouldn't they?
Attachment #179044 - Flags: review?(dean_tessman) → review-
Dean: Thank you for your review. But I have two counterargument. (In reply to comment #25) > That's a lot of code for a header file. Shouldn't it go into the .cpp file? I think so too. However, |nsIMM| that is similar this class is written in nsWindow.h. Should these classes be written in same file? Or shuld I move |nsIMM| to .cpp file too? > >+ BOOL EnableIME(HWND h, BOOL b) { > >+ return (mWINNLSEnableIME) ? mWINNLSEnableIME(h, b) : TRUE; > >+ } > >+ BOOL GetEnableStatus(HWND h) { > >+ return (mWINNLSGetEnableStatus) ? mWINNLSGetEnableStatus(h) : TRUE; > >+ } > >+ > >+ PRBool LoadedEnableIME() { > >+ return (mWINNLSEnableIME) ? PR_TRUE : PR_FALSE; > >+ } > >+ PRBool LoadedGetEnableStatus() { > >+ return (mWINNLSGetEnableStatus) ? PR_TRUE : PR_FALSE; > >+ } > 4. Why do EnableIME and GetEnableStatus return TRUE when the proc address > wasn't found, instead of FALSE? If these proc is not loaded, we cannot control IME enable state. So, the IME enable state is always TRUE. Therefore I returns TRUE when the procs are not loaded.
Attached patch Patch rv1.5 for Windows (obsolete) — Splinter Review
Attachment #179044 - Attachment is obsolete: true
Attachment #181619 - Flags: review?(dean_tessman)
Attachment #181619 - Flags: review?(dean_tessman)
Attached patch Patch rv1.5 for Windows (obsolete) — Splinter Review
Attachment #181619 - Attachment is obsolete: true
Attachment #181620 - Flags: review?(dean_tessman)
Attached patch Patch rv1.5 (obsolete) — Splinter Review
Attachment #179045 - Attachment is obsolete: true
Attachment #178899 - Attachment is obsolete: true
Attachment #181622 - Flags: review?(pavlov)
Status: NEW → ASSIGNED
Attachment #181622 - Flags: review?(pavlov) → review?(blizzard)
Attachment #181620 - Flags: review?(dean_tessman)
Attachment #181620 - Attachment is obsolete: true
Attachment #182054 - Flags: review?(dean_tessman)
Attached patch Patch rv1.6 (obsolete) — Splinter Review
Attachment #181621 - Attachment is obsolete: true
Severity: enhancement → normal
Priority: P4 → P1
Comment on attachment 182054 [details] [diff] [review] Patch rv1.6 for Windows I tried and I tried, but I haven't been able to set aside time to give this the proper review it deserves. timeless, care to look?
Attachment #182054 - Flags: review?(dean_tessman) → review?(timeless)
Comment on attachment 181622 [details] [diff] [review] Patch rv1.5 for GTK roc: Could you review it?
Attachment #181622 - Flags: review?(blizzard) → review?(roc)
Attachment #182054 - Attachment is obsolete: true
Attachment #189779 - Flags: review?(timeless)
Attached patch Patch rv1.7 (obsolete) — Splinter Review
Attachment #182055 - Attachment is obsolete: true
Comment on attachment 189779 [details] [diff] [review] Patch rv1.7 for Windows please fix the spelling of Enable: + // If mWINNLSEnablIME wasn't loaded, we should return PR_TRUE. + // If we cannot load it, maybe we cannot load mWINNLSEnablIME too. + // So, if mWINNLSEnablIME wasn't loaded, the IME enable state is always TRUE. please fix the spelling of reconversion: +// VC++5.0 header doesn't have reconvertion structure and message. please make these warnings: + NS_ERROR("WINNLSEnableIME API is not loaded.");
Attachment #189779 - Flags: review?(timeless) → review+
timeless: Thank you for your review! (In reply to comment #37) > please make these warnings: > + NS_ERROR("WINNLSEnableIME API is not loaded."); > Where need it? I inserted the assertion when the nsWinNLS class is initialized. And if the platform is WinCE, the API is always not loaded. So, we should not insert to |SetIMEEnableStatus| and |GetIMEEnableStatus|.
(In reply to comment #38) > timeless: > > Thank you for your review! > > (In reply to comment #37) > > please make these warnings: > > + NS_ERROR("WINNLSEnableIME API is not loaded."); > > > > Where need it? > I inserted the assertion when the nsWinNLS class is initialized. > And if the platform is WinCE, the API is always not loaded. So, we should not > insert to |SetIMEEnableStatus| and |GetIMEEnableStatus|. Oops... I understand it, you said for nsWindow.cpp. But I cannot understand what should I do?
>> please make these warnings: Should I use NS_WARNING instead of NS_ERROR?
Attached patch Patch rv1.8 (obsolete) — Splinter Review
Attachment #189780 - Attachment is obsolete: true
Comment on attachment 181622 [details] [diff] [review] Patch rv1.5 for GTK Katakai-san, Please check it.
Attachment #181622 - Flags: review?(roc) → review?(katakai)
Comment on attachment 181622 [details] [diff] [review] Patch rv1.5 for GTK OK for GTK. It's OK for GTK side to return NS_ERROR_NOT_IMPLEMENTED now.
Attachment #181622 - Flags: review?(katakai) → review+
Comment on attachment 189904 [details] [diff] [review] Patch rv1.8 all review is cleared. Could you sr?
Attachment #189904 - Flags: superreview?(bzbarsky)
Attachment #189904 - Flags: review+
It'll take me some time (on the order of several weeks) to get to this....
Comment on attachment 189904 [details] [diff] [review] Patch rv1.8 roc: Could you sr it?
Attachment #189904 - Flags: superreview?(bzbarsky) → superreview?(roc)
Attachment #189904 - Flags: superreview?(roc) → superreview+
checked-in. Thank you, everyone.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Backed-out cause by Tb bustage.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
This patch fixes the bustage with VC++6.0. Diff from previous is only following: In nsToolkit.h: > #include "nsIToolkit.h" > > struct IActiveIMMApp; > > #include "nsWindowAPI.h" > #include "nsITimer.h" > #include "nsCOMPtr.h" > > +// objbase.h must be declared before initguid.h to use the |DEFINE_GUID|'s in aimm.h > +#include <objbase.h> > +#include <initguid.h> > +#include "aimm.h" > +#include <imm.h> > + to > #include "nsIToolkit.h" > > -struct IActiveIMMApp; > - > #include "nsWindowAPI.h" > #include "nsITimer.h" > #include "nsCOMPtr.h" > > +#include "aimm.h" > + We don't need objbase.h and initguid.h. These files are needed by older version of aimm.h. Currently version doesn't need these. And imm.h is included in aimm.h, so it is not needed after aimm.h. # And I added changing IID of nsIKBStateControl. It is my mistake in previous.
Attachment #189904 - Attachment is obsolete: true
Attachment #193096 - Flags: review?(timeless)
Comment on attachment 193096 [details] [diff] [review] vs previous patch Oops... Sorry.
Attachment #193096 - Attachment is obsolete: true
Attachment #193096 - Flags: review?(timeless)
Attachment #193097 - Flags: review?(timeless) → review+
Comment on attachment 193097 [details] [diff] [review] fix bustage with VC6.0 roc: Please sr it. See attachment 193096 [details] [diff] [review] for diff from previous patch.
Attachment #193097 - Flags: superreview?(roc)
Attachment #193096 - Attachment description: fix bustage with VC6.0 → vs previous patch
Attachment #193096 - Attachment is obsolete: false
Attachment #193097 - Flags: superreview?(roc) → superreview+
checked-in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Could this have caused a jump in the reported memory leakage from balsa? See bug 305612 comment 2.
Excuse me, but I think the last patch/checkin is the reason why I can not build firefox (trunk) with mingw gcc anymore. It fails while making the firefox.exe error output: ../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x169c): undefined reference to `IID_IActiveIMMApp' ../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x16b3): undefined reference to `CLSID_CActiveIMM' ../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x175c): undefined reference to `IID_IActiveIMMApp' ../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x1773): undefined reference to `CLSID_CActiveIMM' ../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x1ea2): undefined reference to `IID_IActiveIMMApp' ../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x1eb9): undefined reference to `CLSID_CActiveIMM' collect2: ld returned 1 exit status make[4]: *** [firefox.exe] Error 1 make[3]: *** [libs] Error 2 make[2]: *** [tier_99] Error 2 make[1]: *** [default] Error 2 make: *** [build] Error 2
../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x169c): > undefined reference to `IID_IActiveIMMApp' > ../../dist/lib/components/libgkwidget.a(nsToolkit.o):nsToolkit.cpp:(.text+0x16b3): > undefined reference to `CLSID_CActiveIMM' In MinGW, These values are difined where? Please tell me the header file name.
Ronny Perinke: Please test this patch(attachment 193910 [details] [diff] [review]). I cannot have the environment that can build with MinGW.
(In reply to comment #58) > Ronny Perinke: > > Please test this patch(attachment 193910 [details] [diff] [review] [edit]). > I cannot have the environment that can build with MinGW. It works. I had to rebuild my whole objdir but it works now. thanks :)
Attachment #193910 - Attachment description: Maybe, fix bustage of MinGW → fix bustage of MinGW
Attachment #193910 - Flags: superreview?(roc)
Attachment #193910 - Flags: review?(timeless)
Attachment #193910 - Flags: review?(timeless) → review+
Attachment #193910 - Flags: superreview?(roc) → superreview+
Just a fyi for other people who might experience this problem. I got build errors in my mingw Firefox1.8.1 build: c:/mozilla181/mozilla/widget/src/windows/nsWindow.cpp:593: error: redefinition of `struct tagRECONVERTSTRING' c:/mozilla181/mozilla/widget/src/windows/nsWindow.cpp:604: error: redefinition of `struct tagIMECHARPOSITION' After I removed those definitions, my build compiled fine. I have a very recent mingw package. I guess it is already defined in there.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: