nsIBidiKeyboard 编辑

widget/public/nsIBidiKeyboard.idlScriptable This interface lets the application detect bidirectional writer users, and do some magic for them. A user is a bidirectional writer if they have keyboard layouts in both left-to-right and right-to-left directions (that is users who use Arabic, Iranian (Persian), or Israel (Hebrew) keyboard layout, beside an US (English) layout.) Inherits from: nsISupports Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6)

Method overview

boolean isLangRTL();
void setLangFromBidiLevel(in PRUint8 aLevel);

Attributes

AttributeTypeDescription
haveBidiKeyboardsboolean

Indicates whether or not the system has at least one keyboard for each direction (left-to-right and right-to-left) installed. Read only.

Note: This throws NS_ERROR_NOT_IMPLEMENTED if the widget layer doesn't provide this information.  Currently, this is only implemented on Windows.

Methods

isLangRTL()

Determines if the current keyboard language is right-to-left.

(supported on: win32, mac, gtk2)

Note: Prior to Gecko 1.9 this method used a parameter 'out PRBool aIsRTL' to return the value.
boolean isLangRTL();
Parameters

None.

Return value

true if the current keyboard is right-to-left, false if it is not.

Exceptions thrown
NS_ERROR_FAILURE
If no right-to-left keyboards are installed.

setLangFromBidiLevel()

Sets the keyboard language to left-to-right or right-to-left.

(supported on: win32)

void setLangFromBidiLevel(
  in PRUint8 aLevel
);
Parameters
aLevel
If odd set the keyboard to right-to-left, if even set left-to-right.
Exceptions thrown
NS_ERROR_FAILURE
If no right-to-left keyboards are installed.

Remarks

Implementation

Windows

This implementation uses win32 API to get the language of the keyboard layout, and the direction of those languages.

Linux

This implementation depends on the Gecko and GTK+ version.

In the Gecko 1.8 branch, just isLangRTL() had been implemented, and uses GDK's API to check the direction of keyboard layout, which has a problem with Hebrew language. The problem is fixed on GTK+ version 2.10.1 and 2.12.

In the Gecko 1.9 branch, we are going to implement all the interface, with XKB functions for xlib and gtk2 backends. On the gtk2 backend, we will have GTK+ version checking, to use GTK+ implementations, if the problem doesn't exist. Some other part of the code is going to be on GTK+ later, and we will use GTK+ API instead.

Both GTK+ and Gecko versions, check keysym's on keyboard layout to detect the direction of the layout. For GTK+ (>=2.10.1, >=2.12.0) and all Gecko versions, we check only the first shift-level of the layout, to fix the problem with Hebrew layouts.

More info: bug 348724, bug 348724, and Gnome bug: 116626

Mac

Only isLangRTL is supported on this platform. bug 266551

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:36 次

字数:5847

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文