diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 65ddb9f297a2..e9851f277053 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -166,9 +166,8 @@ NS_IMETHODIMP nsCaret::Init(nsIPresShell *inPresShell) #ifdef IBMBIDI PRBool isRTL = PR_FALSE; mBidiKeyboard = do_GetService("@mozilla.org/widget/bidikeyboard;1"); - if (mBidiKeyboard) - mBidiKeyboard->IsLangRTL(&isRTL); - mKeyboardRTL = isRTL; + if (mBidiKeyboard && NS_SUCCEEDED(mBidiKeyboard->IsLangRTL(&isRTL))) + mKeyboardRTL = isRTL; #endif return NS_OK; @@ -1084,8 +1083,11 @@ nsresult nsCaret::UpdateHookRect(nsPresContext* aPresContext) // Simon -- make a hook to draw to the left or right of the caret to show keyboard language direction PRBool bidiEnabled; PRBool isCaretRTL=PR_FALSE; - if (mBidiKeyboard) - mBidiKeyboard->IsLangRTL(&isCaretRTL); + if (!mBidiKeyboard || NS_FAILED(mBidiKeyboard->IsLangRTL(&isCaretRTL))) + // if mBidiKeyboard->IsLangRTL() failed, there is no way to tell the + // keyboard direction, or the user has no right-to-left keyboard + // installed, so we never draw the hook. + return NS_OK; if (isCaretRTL) { bidiEnabled = PR_TRUE; diff --git a/widget/public/nsIBidiKeyboard.idl b/widget/public/nsIBidiKeyboard.idl index a462d6d62ea5..0a6b45a62845 100644 --- a/widget/public/nsIBidiKeyboard.idl +++ b/widget/public/nsIBidiKeyboard.idl @@ -39,17 +39,19 @@ #include "nsISupports.idl" -[scriptable, uuid(BB961AE1-7432-11d4-B77A-00104B4119F8)] +[scriptable, uuid(0D8F8F10-C92D-4A6A-B2BB-E1921F3F4DDA)] interface nsIBidiKeyboard : nsISupports { /** * Determines if the current keyboard language is right-to-left + * @throws NS_ERROR_FAILURE if no right-to-left keyboards are installed */ - void isLangRTL(out PRBool aIsRTL); + boolean isLangRTL(); /** * Sets the keyboard language to left-to-right or right-to-left * @param aLevel - if odd set the keyboard to RTL, if even set LTR + * @throws NS_ERROR_FAILURE if no right-to-left keyboards are installed */ void setLangFromBidiLevel(in PRUint8 aLevel); }; diff --git a/widget/public/nsWidgetsCID.h b/widget/public/nsWidgetsCID.h index 7268a082bf72..8da81b484c49 100644 --- a/widget/public/nsWidgetsCID.h +++ b/widget/public/nsWidgetsCID.h @@ -137,9 +137,9 @@ #define NS_SOUND_CID \ { 0xb148eed2, 0x236d, 0x11d3, { 0xb3, 0x5c, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } } -// {2572E6B0-7439-11d4-B77A-00104B4119F8} +// {9f1800ab-f428-4207-b40c-e832e77b01fc} #define NS_BIDIKEYBOARD_CID \ -{ 0x2572e6b0, 0x7439, 0x11d4, { 0xb7, 0x7a, 0x0, 0x10, 0x4b, 0x41, 0x19, 0xf8 } } +{ 0x9f1800ab, 0xf428, 0x4207, { 0xb4, 0x0c, 0xe8, 0x32, 0xe7, 0x7b, 0x01, 0xfc } } #define NS_SCREENMANAGER_CID \ { 0xc401eb80, 0xf9ea, 0x11d3, { 0xbb, 0x6f, 0xe7, 0x32, 0xb7, 0x3e, 0xbe, 0x7c } } diff --git a/widget/src/beos/nsBidiKeyboard.cpp b/widget/src/beos/nsBidiKeyboard.cpp index 8a3e478dcd14..c1e4b61b7b43 100644 --- a/widget/src/beos/nsBidiKeyboard.cpp +++ b/widget/src/beos/nsBidiKeyboard.cpp @@ -53,11 +53,11 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) { *aIsRTL = PR_FALSE; // XXX Insert platform specific code to determine keyboard direction - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) { // XXX Insert platform specific code to set keyboard language - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/widget/src/gtk/nsBidiKeyboard.cpp b/widget/src/gtk/nsBidiKeyboard.cpp index 8a3e478dcd14..c1e4b61b7b43 100644 --- a/widget/src/gtk/nsBidiKeyboard.cpp +++ b/widget/src/gtk/nsBidiKeyboard.cpp @@ -53,11 +53,11 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) { *aIsRTL = PR_FALSE; // XXX Insert platform specific code to determine keyboard direction - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) { // XXX Insert platform specific code to set keyboard language - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/widget/src/gtk2/nsBidiKeyboard.cpp b/widget/src/gtk2/nsBidiKeyboard.cpp index 58bdcc1260cf..ce2762175e83 100644 --- a/widget/src/gtk2/nsBidiKeyboard.cpp +++ b/widget/src/gtk2/nsBidiKeyboard.cpp @@ -52,11 +52,11 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) { *aIsRTL = PR_FALSE; // XXX Insert platform specific code to determine keyboard direction - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) { // XXX Insert platform specific code to set keyboard language - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/widget/src/os2/nsBidiKeyboard.cpp b/widget/src/os2/nsBidiKeyboard.cpp index 8a3e478dcd14..c1e4b61b7b43 100644 --- a/widget/src/os2/nsBidiKeyboard.cpp +++ b/widget/src/os2/nsBidiKeyboard.cpp @@ -53,11 +53,11 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) { *aIsRTL = PR_FALSE; // XXX Insert platform specific code to determine keyboard direction - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) { // XXX Insert platform specific code to set keyboard language - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/widget/src/photon/nsBidiKeyboard.cpp b/widget/src/photon/nsBidiKeyboard.cpp index d206dc97ffb4..ecc3e20d997b 100644 --- a/widget/src/photon/nsBidiKeyboard.cpp +++ b/widget/src/photon/nsBidiKeyboard.cpp @@ -53,7 +53,7 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) #ifdef IBMBIDI // XXX Insert platform specific code to determine keyboard direction #endif - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) @@ -61,5 +61,5 @@ NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) #ifdef IBMBIDI // XXX Insert platform specific code to set keyboard language #endif - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/widget/src/qt/nsBidiKeyboard.cpp b/widget/src/qt/nsBidiKeyboard.cpp index 44464632ee90..98c5c6b69808 100644 --- a/widget/src/qt/nsBidiKeyboard.cpp +++ b/widget/src/qt/nsBidiKeyboard.cpp @@ -53,11 +53,11 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) { *aIsRTL = PR_FALSE; // XXX Insert platform specific code to determine keyboard direction - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) { // XXX Insert platform specific code to set keyboard language - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/widget/src/xlib/nsBidiKeyboard.cpp b/widget/src/xlib/nsBidiKeyboard.cpp index 8a3e478dcd14..c1e4b61b7b43 100644 --- a/widget/src/xlib/nsBidiKeyboard.cpp +++ b/widget/src/xlib/nsBidiKeyboard.cpp @@ -53,11 +53,11 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) { *aIsRTL = PR_FALSE; // XXX Insert platform specific code to determine keyboard direction - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) { // XXX Insert platform specific code to set keyboard language - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; }