src/aoikhotkey/event_manager_macos.py
def _handle_mouse_move_wheel_event(self, event, ns_event, propagate):
        """
        Mouse move or wheel event handler called by \
        :paramref:`_tap_callback_inner`.

        This handler translates platform-specific event to cross-platform event
        object. And then calls `self.MouseMove` or `self.MouseWheel` with the
        cross-platform event object.

        :param event: CGEvent object.

        :param ns_event: NSEvent object.

        :param propagate: Whether propagate the event.

        :return: Given event object to propagate the event, or None to \
        discard the event.
        """
        # Get event type
        event_type = ns_event.type()

        # Get event object's `Message` and `MessageName` field values, and
        # event handler attribute name
        message, message_name, handler_attr_name = \
            self._MOUSE_EVENT_TYPE_TO_INFO_TUPLE[event_type]

        # Get event handler
        event_handler = getattr(self, handler_attr_name, None)

        # If the event handler is not None
        if event_handler is not None:
            # Get location x coordinate
            location_x = ns_event.locationInWindow().x

            # Get location y coordinate
            location_y = ns_event.locationInWindow().y

            # Get position tuple
            position = (location_x, location_y)

            # Get mouse wheel's deltaY value
            wheel = int(ns_event.deltaY())

            # Get timestamp
            timestamp = self._system_up_timestamp + ns_event.timestamp()

            # Create event object
            hotkey_event = _Event()

            # Store the NSEvent
            hotkey_event.Event = ns_event

            # Store the message value
            hotkey_event.Message = message

            # Store the message name value
            hotkey_event.MessageName = message_name

            # Store the position tuple
            hotkey_event.Position = position

            # Set `ClickCount` field be 0
            hotkey_event.ClickCount = 0

            # Store the mouse wheel's deltaY value
            hotkey_event.Wheel = wheel

            # Store the timestamp
            hotkey_event.Time = timestamp

            # Call the event handler.
            # Use the call result to decide whether propagate the event.
            propagate = event_handler(hotkey_event)

        # Return whether propagate the event
        return propagate

        Mouse move or wheel event handler called by \
        :paramref:`_tap_callback_inner`.

        This handler translates platform-specific event to cross-platform event
        object. And then calls `self.MouseMove` or `self.MouseWheel` with the
        cross-platform event object.

        :param event: CGEvent object.

        :param ns_event: NSEvent object.

        :param propagate: Whether propagate the event.

        :return: Given event object to propagate the event, or None to \
        discard the event.
        
Mouse move or wheel event handler called by \
Mouse move or wheel event handler called by \
def _handle_mouse_move_wheel_event(self, event, ns_event, propagate):
        event_type = ns_event.type()
        message, message_name, handler_attr_name = \
            self._MOUSE_EVENT_TYPE_TO_INFO_TUPLE[event_type]
        event_handler = getattr(self, handler_attr_name, None)
        if event_handler is not None:
            location_x = ns_event.locationInWindow().x
            location_y = ns_event.locationInWindow().y
            position = (location_x, location_y)
            wheel = int(ns_event.deltaY())
            timestamp = self._system_up_timestamp + ns_event.timestamp()
            hotkey_event = _Event()
            hotkey_event.Event = ns_event
            hotkey_event.Message = message
            hotkey_event.MessageName = message_name
            hotkey_event.Position = position
            hotkey_event.ClickCount = 0
            hotkey_event.Wheel = wheel
            hotkey_event.Time = timestamp
            propagate = event_handler(hotkey_event)
        return propagate
def _handle_mouse_move_wheel_event ( self , event , ns_event , propagate ) : event_type = ns_event . type ( ) message , message_name , handler_attr_name = self . _MOUSE_EVENT_TYPE_TO_INFO_TUPLE [ event_type ] event_handler = getattr ( self , handler_attr_name , None ) if event_handler is not None : location_x = ns_event . locationInWindow ( ) . x location_y = ns_event . locationInWindow ( ) . y position = ( location_x , location_y ) wheel = int ( ns_event . deltaY ( ) ) timestamp = self . _system_up_timestamp + ns_event . timestamp ( ) hotkey_event = _Event ( ) hotkey_event . Event = ns_event hotkey_event . Message = message hotkey_event . MessageName = message_name hotkey_event . Position = position hotkey_event . ClickCount = 0 hotkey_event . Wheel = wheel hotkey_event . Time = timestamp propagate = event_handler ( hotkey_event ) return propagate
Mouse move or wheel event handler called by \
Mouse move or wheel event handler called by \
"""
        Mouse move or wheel event handler called by \
        :paramref:`_tap_callback_inner`.

        This handler translates platform-specific event to cross-platform event
        object. And then calls `self.MouseMove` or `self.MouseWheel` with the
        cross-platform event object.

        :param event: CGEvent object.

        :param ns_event: NSEvent object.

        :param propagate: Whether propagate the event.

        :return: Given event object to propagate the event, or None to \
        discard the event.
        """ # Get event type # Get event object's `Message` and `MessageName` field values, and # event handler attribute name # Get event handler # If the event handler is not None # Get location x coordinate # Get location y coordinate # Get position tuple # Get mouse wheel's deltaY value # Get timestamp # Create event object # Store the NSEvent # Store the message value # Store the message name value # Store the position tuple # Set `ClickCount` field be 0 # Store the mouse wheel's deltaY value # Store the timestamp # Call the event handler. # Use the call result to decide whether propagate the event. # Return whether propagate the event
Given event object to propagate the event, or None to \
discard the event.
Given event object to propagate the event or None to \ discard the event .
self
event
None
ns_event
None
propagate
Whether propagate the event.
Whether propagate the event .
paramref
None