Exemple #1
0
 def applicationDidUnhide_(self, notification):
     if self._window._is_mouse_exclusive and quartz.CGCursorIsVisible():
         # The cursor should be hidden, but for some reason it's not;
         # try to force the cursor to hide (without over-hiding).
         SystemCursor.unhide()
         SystemCursor.hide()
         pass
     self._window.dispatch_event("on_show")
 def applicationDidUnhide_(self, notification):
     if self._window._is_mouse_exclusive and quartz.CGCursorIsVisible():
         # The cursor should be hidden, but for some reason it's not;
         # try to force the cursor to hide (without over-hiding).
         SystemCursor.unhide()
         SystemCursor.hide()
         pass
     self._window.dispatch_event("on_show")
Exemple #3
0
 def set_mouse_platform_visible(self, platform_visible=None):
     # When the platform_visible argument is supplied with a boolean, then this
     # method simply sets whether or not the platform mouse cursor is visible.
     if platform_visible is not None:
         if platform_visible:
             SystemCursor.unhide()
         else:
             SystemCursor.hide()
     # But if it has been called without an argument, it turns into
     # a completely different function.  Now we are trying to figure out
     # whether or not the mouse *should* be visible, and if so, what it should
     # look like.
     else:
         # If we are in mouse exclusive mode, then hide the mouse cursor.
         if self._is_mouse_exclusive:
             SystemCursor.hide()
         # If we aren't inside the window, then always show the mouse
         # and make sure that it is the default cursor.
         elif not self._mouse_in_content_rect():
             NSCursor.arrowCursor().set()
             SystemCursor.unhide()
         # If we are in the window, then what we do depends on both
         # the current pyglet-set visibility setting for the mouse and
         # the type of the mouse cursor.  If the cursor has been hidden
         # in the window with set_mouse_visible() then don't show it.
         elif not self._mouse_visible:
             SystemCursor.hide()
         # If the mouse is set as a system-defined cursor, then we
         # need to set the cursor and show the mouse.
         # *** FIX ME ***
         elif isinstance(self._mouse_cursor, CocoaMouseCursor):
             self._mouse_cursor.set()
             SystemCursor.unhide()
         # If the mouse cursor is drawable, then it we need to hide
         # the system mouse cursor, so that the cursor can draw itself.
         elif self._mouse_cursor.drawable:
             SystemCursor.hide()
         # Otherwise, show the default cursor.
         else:
             NSCursor.arrowCursor().set()
             SystemCursor.unhide()
Exemple #4
0
 def set_mouse_platform_visible(self, platform_visible=None):
     # When the platform_visible argument is supplied with a boolean, then this
     # method simply sets whether or not the platform mouse cursor is visible.
     if platform_visible is not None:
         if platform_visible:
             SystemCursor.unhide()
         else:
             SystemCursor.hide()
     # But if it has been called without an argument, it turns into
     # a completely different function.  Now we are trying to figure out
     # whether or not the mouse *should* be visible, and if so, what it should
     # look like.
     else:
         # If we are in mouse exclusive mode, then hide the mouse cursor.
         if self._is_mouse_exclusive:
             SystemCursor.hide()
         # If we aren't inside the window, then always show the mouse
         # and make sure that it is the default cursor.
         elif not self._mouse_in_content_rect():
             send_message(send_message('NSCursor', 'arrowCursor'), 'set')
             SystemCursor.unhide()
         # If we are in the window, then what we do depends on both
         # the current pyglet-set visibility setting for the mouse and
         # the type of the mouse cursor.  If the cursor has been hidden
         # in the window with set_mouse_visible() then don't show it.
         elif not self._mouse_visible:
             SystemCursor.hide()
         # If the mouse is set as a system-defined cursor, then we
         # need to set the cursor and show the mouse.
         # *** FIX ME ***
         elif isinstance(self._mouse_cursor, CocoaMouseCursor):
             self._mouse_cursor.set()
             SystemCursor.unhide()
         # If the mouse cursor is drawable, then it we need to hide
         # the system mouse cursor, so that the cursor can draw itself.
         elif self._mouse_cursor.drawable:
             SystemCursor.hide()
         # Otherwise, show the default cursor.
         else:
             send_message(send_message('NSCursor', 'arrowCursor'), 'set')
             SystemCursor.unhide()