xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Opened 5 months ago

Last modified 3 months ago

#2955 assigned task

replace deprecated event api on macos

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: minor Milestone: 4.2
Component: platforms Version: 3.0.x
Keywords: Cc:

Description

ie: CGPostMouseEvent: This function is not recommended for general use because of undocumented special cases and undesirable side effects. The recommended replacement for this function is CGEventCreateMouseEvent, which allows you to create a mouse event and customize the event before posting it to the event system.

Also CGPostScrollWheelEvent.

Change History (2)

comment:1 Changed 5 months ago by Antoine Martin

Status: newassigned

Example code:

    def move(self, x, y):
        CGWarpMouseCursorPosition((float(x), float(y)))

    def double_click(self, x, y, button=1):
        """button parameter is not currently used."""
        event = CGEventCreateMouseEvent(
                        None,
                        kCGEventLeftMouseDown,
                        (x, y),
                        kCGMouseButtonLeft)

        CGEventSetIntegerValueField(event, kCGMouseEventClickState, 2)
        CGEventPost(kCGHIDEventTap, event)

        CGEventSetType(event, kCGEventLeftMouseUp)
        CGEventPost(kCGHIDEventTap, event)
        CGEventSetType(event, kCGEventLeftMouseDown)
        CGEventPost(kCGHIDEventTap, event)
        CGEventSetType(event, kCGEventLeftMouseUp)
        CGEventPost(kCGHIDEventTap, event)

comment:2 Changed 3 months ago by migration script

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2955

Note: See TracTickets for help on using tickets.