Only display a bidirectional caret on platforms that implement nsIBidiKeyboard. Bug 272096, r+sr=roc

This commit is contained in:
smontagu%smontagu.org 2006-07-06 08:29:53 +00:00
parent ecbd24f472
commit 952a1a4a12
10 changed files with 27 additions and 23 deletions

View File

@ -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;

View File

@ -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);
};

View File

@ -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 } }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}