mouseHandler module

mouseHandler.lastMouseEventTime = 0

The time (in seconds) at which the last mouse event occurred. @type: float

mouseHandler.updateMouseShape(name)
mouseHandler.ignoreInjection()

Context manager that allows ignoring injected mouse events temporarily by using a with statement.

mouseHandler.playAudioCoordinates(x, y, screenWidth, screenHeight, screenMinPos, detectBrightness=True, blurFactor=0)

play audio coordinates: - left to right adjusting the volume between left and right speakers - top to bottom adjusts the pitch of the sound - brightness adjusts the volume of the sound Coordinates (x, y) are absolute, and can be negative.

mouseHandler.internal_mouseEvent(msg, x, y, injected)

Event called by winInputHook when it receives a mouse event.

mouseHandler.executeMouseEvent(flags, x, y, data=0)

Mouse events generated with this rapper for L{winUser.mouse_event} will be ignored by NVDA. Consult https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-mouse_event for detailed parameter documentation. @param flags: Controls various aspects of mouse motion and button clicking.

The supplied value should be one or a combination of the C{winUser.MOUSEEVENTF_*} constants.

@type flags: int @param x: The mouse’s absolute position along the x-axis

or its amount of motion since the last mouse event was generated.

@type x: int @param y: The mouse’s absolute position along the y-axis

or its amount of motion since the last mouse event was generated.

@type y: int @param data: Additional data depending on what flags are specified.

This defaults to 0.

@type data: int

mouseHandler.getMouseRestrictedToScreens(x, y, displays)

Ensures that the mouse position is within the area of one of the displays, relative to (0,0) but not necessarily positive (which is as expected for mouse coordinates)

We need to first get the closest point on the edge of each display rectangle (if the mouse is outside the rectangle). This is done by clamping the mouse position to the extents of each screen. The distance from this point to the actual mouse position can then be calculated. The smallest adjustment to get the mouse within the screen bounds is desired.

mouseHandler.getMinMaxPoints(screenRect)
mouseHandler.getTotalWidthAndHeightAndMinimumPosition(displays)

Calculate the total screen width and height.

Depending on screen layouts the rectangles may overlap on the vertical or horizontal axis. Screens may also have a gap between them. In the case where there is a gap in between we count that as contributing to the full virtual space

mouseHandler.executeMouseMoveEvent(x, y)
mouseHandler.initialize()
mouseHandler._reportShape()
mouseHandler.pumpAll()
mouseHandler.terminate()
class mouseHandler.LogicalButtonFlags(primaryDown: int, primaryUp: int, secondaryDown: int, secondaryUp: int)

Bases: object

A container for holding the flags denoting the primary and secondary buttons on a mouse. See L{GetLogicalButtonFlags}.

primaryDown: int
primaryUp: int
secondaryDown: int
secondaryUp: int
mouseHandler.getLogicalButtonFlags() LogicalButtonFlags

Fills and returns a LogicalButtonFlags object with the appropriate MOUSEEVENTF_* button flags taking into account the Windows user setting for which button (left or right) is primary and which is secondary.

mouseHandler._doClick(downFlag: int, upFlag: int, releaseDelay: float | None = None)
mouseHandler.doPrimaryClick(releaseDelay: float | None = None)

Performs a primary mouse click at the current mouse pointer location. The primary button is the one that usually activates or selects an item. This function honors the Windows user setting for which button (left or right) is classed as the primary button. @ param releaseDelay: optional float in seconds of how long NVDA should sleep between pressing down and then releasing up the primary button.

mouseHandler.doSecondaryClick(releaseDelay: float | None = None)

Performs a secondary mouse click at the current mouse pointer location. The secondary button is the one that usually displays a context menu for an item when clicked. This function honors the Windows user setting for which button (left or right) is classed as the secondary button. @ param releaseDelay: optional float in seconds of how long NVDA should sleep between pressing down and then releasing up the primary button.

mouseHandler.isLeftMouseButtonLocked()

Tests if the left mouse button is locked

mouseHandler.lockLeftMouseButton()

Locks the left mouse button

mouseHandler.unlockLeftMouseButton()

Unlocks the left mouse button

mouseHandler.isRightMouseButtonLocked()

Tests if the right mouse button is locked

mouseHandler.lockRightMouseButton()

Locks the right mouse button

mouseHandler.unlockRightMouseButton()

Unlocks the right mouse button

mouseHandler.scrollMouseWheel(scrollSteps: int, isVertical: bool = True) None

Scrolls the mouse wheel either vertically or horizontally, controlling the direction and amount of scrolling. More details on mouse events can be found at: https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel

Parameters:
  • scrollSteps – The number of steps to scroll. Each step should correspond to a fraction or multiple of WHEEL_DELTA, which is typically set to 120. This defines the standard increment or decrement in scrolling position.

  • isVertical – Determines the direction of the scrolling; vertical if True, horizontal if False.

Returns:

None