Comment #28 on issue 74 by jhuangjiahua: java 程序当中无法做到光标跟随
http://code.google.com/p/ibus/issues/detail?id=74
好的
{{{
def move(self, x, y):
# 区分下 不能光标跟随 和 能光标跟随 程序
##
# __prev_cursor_location 是上一次手工拖动扳手时的光标位置
# __prev_panel_position 是上一次手工拖动扳手后的候选字条位置
# __prev_move_position 是上一次移动命令位置值
##
# 如果还没有拖动过候选字条,则设为本次的移动位置
if not self.__prev_panel_position:
self.__prev_panel_position = (x, y)
# 将两次位置相同的情况视为程序无法光标跟随(两次都获得一个错误光标位
置)
##
# 先确保几个 位置值 都不是 (0, 0)
if self.__prev_cursor_location and self.__prev_panel_position and
self.__prev_move_position \
# 如果 上一次移动命令的位置跟这次一样
and self.__prev_move_position == (x, y) \
# 用光标位置来确保 现在是在同一个 不能光标跟随的程序里,避免
正常程序候选条位置跳动
# 如果 上一次手工拖动扳手时的光标位置 跟 现在相同位置
and self.__prev_cursor_location == self.__cursor_location:
# 在 不能光标跟随 的程序里,将移动值改为 上一次手工拖动位置
x, y = self.__prev_panel_position
else:
# 在 正常(光标跟随)程序里,记录下 移动命令位置值,以供下次判断
self.__prev_move_position = (x, y)
# 先前的移动,移动到拖动位置(不能光标跟随)或光标适应位置(正常程序
)
self.__toplevel.move(x, y)
}}}
Attachments:
move.py 1.7 KB
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google
Groups "ibus-devel" group.
iBus project web page: http://code.google.com/p/ibus/
iBus dev group: http://groups.google.com/group/ibus-devel?hl=en