__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:FightstickDisplay 作者: calexil 项目源码 文件源码
def set_exclusive_mouse(self, exclusive=True):
        if self._exclusive_mouse == exclusive and \
           self._exclusive_mouse_focus == self._has_focus:
            return

        if exclusive and self._has_focus:
            # Move mouse to the center of the window.
            self._reset_exclusive_mouse_screen()
            x, y = self._exclusive_mouse_screen
            self.set_mouse_position(x, y, absolute=True)

            # Clip to client area, to prevent large mouse movements taking
            # it outside the client area.
            rect = RECT()
            _user32.GetClientRect(self._view_hwnd, byref(rect))
            _user32.MapWindowPoints(self._view_hwnd, HWND_DESKTOP,
                                    byref(rect), 2)
            _user32.ClipCursor(byref(rect))
        else:
            # Release clip
            _user32.ClipCursor(None)

        self._exclusive_mouse = exclusive
        self._exclusive_mouse_focus = self._has_focus
        self.set_mouse_platform_visible()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号