nsIBidiKeyboard 编辑
widget/public/nsIBidiKeyboard.idl
Scriptable 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
Attribute | Type | Description |
haveBidiKeyboards | boolean | 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 throwsNS_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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论