你好,

我觉得,如果把光标移动出去不是太好,应为候选词窗口是支持鼠标按键的,例如用户可以点击翻页按钮,有可能以后还可以加入用户直接鼠标点击候选词功能。不知道有没有其他方法处理你说的问题?例如隐藏鼠标等等。

2009/1/18 Zhang Jie Jing <[email protected]>

>
> 大家好:
> 在出现侯选字的时候, 有时候鼠标的光标会挡住侯选字, 这个功能就是在光标进入候选框的时候把鼠标移出去, 这个功能就是在大字的时候把鼠标移开,
> 因为有的应用程序比如firefox或者是evlution 他们都不会在打字的时候把鼠标光标隐形。
>
> 因为我这里 ibus-setup 运行会报错(pull 的最新的代码), 所以没办法作成把这个功能作成一个选项,
> 我觉得这个功能作成一个选项会更好。
>
> 谢谢。 下面是patch 正文。
>
> From 9fda2a6ce1ecd6820107b7b76eff0d5bd1e4979d Mon Sep 17 00:00:00 2001
> From: ZhangJieJing<[email protected]>
> Date: Sun, 18 Jan 2009 18:20:59 +0800
> Subject: [PATCH] candidate panel: add a function, while mouse cursor
> on top of candidate pannel, move out the mouse for user can see the
> candidate, since some
>  applicatio such as Evolution cann't hide the mouse cursor while
> typing.
>
> ---
>  ui/gtk/candidatepanel.py |   29 ++++++++++++++++++++++++++++-
>  1 files changed, 28 insertions(+), 1 deletions(-)
>
> diff --git a/ui/gtk/candidatepanel.py b/ui/gtk/candidatepanel.py
> index 528c7e7..f09d44d 100644
> --- a/ui/gtk/candidatepanel.py
> +++ b/ui/gtk/candidatepanel.py
> @@ -145,11 +145,13 @@ class CandidatePanel(gtk.VBox):
>         self.__toplevel.add_events(
>             gdk.BUTTON_PRESS_MASK | \
>             gdk.BUTTON_RELEASE_MASK | \
> -            gdk.BUTTON1_MOTION_MASK)
> +            gdk.BUTTON1_MOTION_MASK | \
> +            gdk.ENTER_NOTIFY_MASK)
>         self.__begin_move = False
>         # self.__toplevel.connect("button-press-event",
> self.__button_press_event_cb)
>         # self.__toplevel.connect("button-release-event",
> self.__button_release_event_cb)
>         # self.__toplevel.connect("motion-notify-event",
> self.__motion_notify_event_cb)
> +        self.__toplevel.connect("enter-notify-event",
> self.__enter_notify_event_cb)
>         self.__toplevel.connect("size-allocate", lambda w, a:
> self.__check_position())
>
>         self.__orientation = gtk.ORIENTATION_HORIZONTAL
> @@ -459,6 +461,31 @@ class CandidatePanel(gtk.VBox):
>             return True
>         return False
>
> +    def __enter_notify_event_cb(self, widget, event):
> +        """ Move out the mouse cursor to avoid the the candidatepanel
> blocking
> +        """
> +        dx =  dy = 0
> +        cursor_width = 20
> +        cursor_height = 20
> +        # TODO: this mouse cursor 's width should be dynamic get
> +
> +        width = self.__toplevel.allocation.width
> +        height = self.__toplevel.allocation.height
> +        if event.x > width/2:
> +            dx = width - event.x
> +        else:
> +            dx = -event.x - cursor_width
> +            # - cursor_width for let cursor more get away from panel
> +        if event.y > height/2:
> +            dy = height - event.y + cursor_height
> +        else:
> +            dy = -event.y
> +        screen = gdk.screen_get_default()
> +        gdk.Display.warp_pointer(widget.get_display(),          \
> +                                     screen,                    \
> +                                     int(event.x_root + dx),    \
> +                                     int(event.y_root + dy))
> +
>     def __motion_notify_event_cb(self, widget, event):
>         if self.__begin_move != True:
>             return False
> --
> 1.5.4.3
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

回复