# This file has been autogenerated by the pywayland scanner

# Copyright © 2015, 2021 Red Hat Inc.
#
# Permission to use, copy, modify, distribute, and sell this
# software and its documentation for any purpose is hereby granted
# without fee, provided that the above copyright notice appear in
# all copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of
# the copyright holders not be used in advertising or publicity
# pertaining to distribution of the software without specific,
# written prior permission.  The copyright holders make no
# representations about the suitability of this software for any
# purpose.  It is provided "as is" without express or implied
# warranty.
#
# THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
# THIS SOFTWARE.

from __future__ import annotations

from pywayland.protocol_core import Argument, ArgumentType, Global, Interface, Proxy, Resource

from .wayland import WlPointer
from .wayland import WlPointerProxy
from .wayland import WlSurface


class ZwpPointerGestureHoldV1(Interface):
    """A hold gesture object

    A hold gesture object notifies a client about a single- or multi-finger
    hold gesture detected on an indirect input device such as a touchpad. The
    gesture is usually initiated by one or more fingers being held down without
    significant movement. The precise conditions of when such a gesture is
    detected are implementation-dependent.

    In particular, this gesture may be used to cancel kinetic scrolling.

    A hold gesture consists of two stages: begin and end. Unlike pinch and
    swipe there is no update stage. There cannot be multiple simultaneous hold,
    pinch or swipe gestures on a same pointer/seat, how compositors prevent
    these situations is implementation-dependent.

    A gesture may be cancelled by the compositor or the hardware. Clients
    should not consider performing permanent or irreversible actions until the
    end of a gesture has been received.
    """

    name = "zwp_pointer_gesture_hold_v1"
    version = 3


class ZwpPointerGesturePinchV1(Interface):
    """A pinch gesture object

    A pinch gesture object notifies a client about a multi-finger pinch gesture
    detected on an indirect input device such as a touchpad. The gesture is
    usually initiated by multiple fingers moving towards each other or away
    from each other, or by two or more fingers rotating around a logical center
    of gravity. The precise conditions of when such a gesture is detected are
    implementation-dependent.

    A gesture consists of three stages: begin, update (optional) and end. There
    cannot be multiple simultaneous hold, pinch or swipe gestures on a same
    pointer/seat, how compositors prevent these situations is implementation-
    dependent.

    A gesture may be cancelled by the compositor or the hardware. Clients
    should not consider performing permanent or irreversible actions until the
    end of a gesture has been received.
    """

    name = "zwp_pointer_gesture_pinch_v1"
    version = 3


class ZwpPointerGestureSwipeV1(Interface):
    """A swipe gesture object

    A swipe gesture object notifies a client about a multi-finger swipe gesture
    detected on an indirect input device such as a touchpad. The gesture is
    usually initiated by multiple fingers moving in the same direction but once
    initiated the direction may change. The precise conditions of when such a
    gesture is detected are implementation-dependent.

    A gesture consists of three stages: begin, update (optional) and end. There
    cannot be multiple simultaneous hold, pinch or swipe gestures on a same
    pointer/seat, how compositors prevent these situations is implementation-
    dependent.

    A gesture may be cancelled by the compositor or the hardware. Clients
    should not consider performing permanent or irreversible actions until the
    end of a gesture has been received.
    """

    name = "zwp_pointer_gesture_swipe_v1"
    version = 3


class ZwpPointerGesturesV1(Interface):
    """Touchpad gestures

    A global interface to provide semantic touchpad gestures for a given
    pointer.

    Three gestures are currently supported: swipe, pinch, and hold. Pinch and
    swipe gestures follow a three-stage cycle: begin, update, end. Hold
    gestures follow a two-stage cycle: begin and end. All gestures are
    identified by a unique id.

    Warning! The protocol described in this file is experimental and backward
    incompatible changes may be made. Backward compatible changes may be added
    together with the corresponding interface version bump. Backward
    incompatible changes are done by bumping the version number in the protocol
    and interface names and resetting the interface version. Once the protocol
    is to be declared stable, the 'z' prefix and the version number in the
    protocol and interface names are removed and the interface version number
    is reset.
    """

    name = "zwp_pointer_gestures_v1"
    version = 3


class ZwpPointerGestureHoldV1Resource(Resource[ZwpPointerGestureHoldV1]):
    interface = ZwpPointerGestureHoldV1

    @ZwpPointerGestureHoldV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Object, interface=WlSurface),
        Argument(ArgumentType.Uint),
        version=3,
    )
    def begin(self, serial: int, time: int, surface: WlSurface, fingers: int) -> None:
        """Multi-finger hold begin

        This event is sent when a hold gesture is detected on the device.

        :param serial:
        :type serial:
            `ArgumentType.Uint`
        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param surface:
        :type surface:
            :class:`~pywayland.protocol.wayland.WlSurface`
        :param fingers:
            number of fingers
        :type fingers:
            `ArgumentType.Uint`
        """
        self._post_event(0, serial, time, surface, fingers)

    @ZwpPointerGestureHoldV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Int),
        version=3,
    )
    def end(self, serial: int, time: int, cancelled: int) -> None:
        """Multi-finger hold end

        This event is sent when a hold gesture ceases to be valid. This may
        happen when the holding fingers are lifted or the gesture is cancelled,
        for example if the fingers move past an implementation-defined
        threshold, the finger count changes or the hold gesture changes into a
        different type of gesture.

        When a gesture is cancelled, the client may need to undo state changes
        caused by this gesture. What causes a gesture to be cancelled is
        implementation-dependent.

        :param serial:
        :type serial:
            `ArgumentType.Uint`
        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param cancelled:
            1 if the gesture was cancelled, 0 otherwise
        :type cancelled:
            `ArgumentType.Int`
        """
        self._post_event(1, serial, time, cancelled)


class ZwpPointerGesturePinchV1Resource(Resource[ZwpPointerGesturePinchV1]):
    interface = ZwpPointerGesturePinchV1

    @ZwpPointerGesturePinchV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Object, interface=WlSurface),
        Argument(ArgumentType.Uint),
    )
    def begin(self, serial: int, time: int, surface: WlSurface, fingers: int) -> None:
        """Multi-finger pinch begin

        This event is sent when a multi-finger pinch gesture is detected on the
        device.

        :param serial:
        :type serial:
            `ArgumentType.Uint`
        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param surface:
        :type surface:
            :class:`~pywayland.protocol.wayland.WlSurface`
        :param fingers:
            number of fingers
        :type fingers:
            `ArgumentType.Uint`
        """
        self._post_event(0, serial, time, surface, fingers)

    @ZwpPointerGesturePinchV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Fixed),
        Argument(ArgumentType.Fixed),
        Argument(ArgumentType.Fixed),
        Argument(ArgumentType.Fixed),
    )
    def update(self, time: int, dx: float, dy: float, scale: float, rotation: float) -> None:
        """Multi-finger pinch motion

        This event is sent when a multi-finger pinch gesture changes the
        position of the logical center, the rotation or the relative scale.

        The dx and dy coordinates are relative coordinates in the surface
        coordinate space of the logical center of the gesture.

        The scale factor is an absolute scale compared to the
        pointer_gesture_pinch.begin event, e.g. a scale of 2 means the fingers
        are now twice as far apart as on pointer_gesture_pinch.begin.

        The rotation is the relative angle in degrees clockwise compared to the
        previous pointer_gesture_pinch.begin or pointer_gesture_pinch.update
        event.

        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param dx:
            delta x coordinate in surface coordinate space
        :type dx:
            `ArgumentType.Fixed`
        :param dy:
            delta y coordinate in surface coordinate space
        :type dy:
            `ArgumentType.Fixed`
        :param scale:
            scale relative to the initial finger position
        :type scale:
            `ArgumentType.Fixed`
        :param rotation:
            angle in degrees cw relative to the previous event
        :type rotation:
            `ArgumentType.Fixed`
        """
        self._post_event(1, time, dx, dy, scale, rotation)

    @ZwpPointerGesturePinchV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Int),
    )
    def end(self, serial: int, time: int, cancelled: int) -> None:
        """Multi-finger pinch end

        This event is sent when a multi-finger pinch gesture ceases to be
        valid. This may happen when one or more fingers are lifted or the
        gesture is cancelled.

        When a gesture is cancelled, the client should undo state changes
        caused by this gesture. What causes a gesture to be cancelled is
        implementation-dependent.

        :param serial:
        :type serial:
            `ArgumentType.Uint`
        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param cancelled:
            1 if the gesture was cancelled, 0 otherwise
        :type cancelled:
            `ArgumentType.Int`
        """
        self._post_event(2, serial, time, cancelled)


class ZwpPointerGestureSwipeV1Resource(Resource[ZwpPointerGestureSwipeV1]):
    interface = ZwpPointerGestureSwipeV1

    @ZwpPointerGestureSwipeV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Object, interface=WlSurface),
        Argument(ArgumentType.Uint),
    )
    def begin(self, serial: int, time: int, surface: WlSurface, fingers: int) -> None:
        """Multi-finger swipe begin

        This event is sent when a multi-finger swipe gesture is detected on the
        device.

        :param serial:
        :type serial:
            `ArgumentType.Uint`
        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param surface:
        :type surface:
            :class:`~pywayland.protocol.wayland.WlSurface`
        :param fingers:
            number of fingers
        :type fingers:
            `ArgumentType.Uint`
        """
        self._post_event(0, serial, time, surface, fingers)

    @ZwpPointerGestureSwipeV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Fixed),
        Argument(ArgumentType.Fixed),
    )
    def update(self, time: int, dx: float, dy: float) -> None:
        """Multi-finger swipe motion

        This event is sent when a multi-finger swipe gesture changes the
        position of the logical center.

        The dx and dy coordinates are relative coordinates of the logical
        center of the gesture compared to the previous event.

        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param dx:
            delta x coordinate in surface coordinate space
        :type dx:
            `ArgumentType.Fixed`
        :param dy:
            delta y coordinate in surface coordinate space
        :type dy:
            `ArgumentType.Fixed`
        """
        self._post_event(1, time, dx, dy)

    @ZwpPointerGestureSwipeV1.event(
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Uint),
        Argument(ArgumentType.Int),
    )
    def end(self, serial: int, time: int, cancelled: int) -> None:
        """Multi-finger swipe end

        This event is sent when a multi-finger swipe gesture ceases to be
        valid. This may happen when one or more fingers are lifted or the
        gesture is cancelled.

        When a gesture is cancelled, the client should undo state changes
        caused by this gesture. What causes a gesture to be cancelled is
        implementation-dependent.

        :param serial:
        :type serial:
            `ArgumentType.Uint`
        :param time:
            timestamp with millisecond granularity
        :type time:
            `ArgumentType.Uint`
        :param cancelled:
            1 if the gesture was cancelled, 0 otherwise
        :type cancelled:
            `ArgumentType.Int`
        """
        self._post_event(2, serial, time, cancelled)


class ZwpPointerGesturesV1Resource(Resource[ZwpPointerGesturesV1]):
    interface = ZwpPointerGesturesV1


class ZwpPointerGestureHoldV1Proxy(Proxy[ZwpPointerGestureHoldV1]):
    interface = ZwpPointerGestureHoldV1

    @ZwpPointerGestureHoldV1.request(version=3)
    def destroy(self) -> None:
        """Destroy the hold gesture object
        """
        self._marshal(0)
        self._destroy()


class ZwpPointerGesturePinchV1Proxy(Proxy[ZwpPointerGesturePinchV1]):
    interface = ZwpPointerGesturePinchV1

    @ZwpPointerGesturePinchV1.request()
    def destroy(self) -> None:
        """Destroy the pinch gesture object
        """
        self._marshal(0)
        self._destroy()


class ZwpPointerGestureSwipeV1Proxy(Proxy[ZwpPointerGestureSwipeV1]):
    interface = ZwpPointerGestureSwipeV1

    @ZwpPointerGestureSwipeV1.request()
    def destroy(self) -> None:
        """Destroy the pointer swipe gesture object
        """
        self._marshal(0)
        self._destroy()


class ZwpPointerGesturesV1Proxy(Proxy[ZwpPointerGesturesV1]):
    interface = ZwpPointerGesturesV1

    @ZwpPointerGesturesV1.request(
        Argument(ArgumentType.NewId, interface=ZwpPointerGestureSwipeV1),
        Argument(ArgumentType.Object, interface=WlPointer),
    )
    def get_swipe_gesture(self, pointer: WlPointerProxy) -> ZwpPointerGestureSwipeV1Proxy:
        """Get swipe gesture

        Create a swipe gesture object. See the wl_pointer_gesture_swipe
        interface for details.

        :param pointer:
        :type pointer:
            :class:`~pywayland.protocol.wayland.WlPointer`
        :returns:
            :class:`~pywayland.protocol.pointer_gestures_unstable_v1.ZwpPointerGestureSwipeV1`
        """
        id = self._marshal_constructor(0, ZwpPointerGestureSwipeV1, pointer)
        return id

    @ZwpPointerGesturesV1.request(
        Argument(ArgumentType.NewId, interface=ZwpPointerGesturePinchV1),
        Argument(ArgumentType.Object, interface=WlPointer),
    )
    def get_pinch_gesture(self, pointer: WlPointerProxy) -> ZwpPointerGesturePinchV1Proxy:
        """Get pinch gesture

        Create a pinch gesture object. See the wl_pointer_gesture_pinch
        interface for details.

        :param pointer:
        :type pointer:
            :class:`~pywayland.protocol.wayland.WlPointer`
        :returns:
            :class:`~pywayland.protocol.pointer_gestures_unstable_v1.ZwpPointerGesturePinchV1`
        """
        id = self._marshal_constructor(1, ZwpPointerGesturePinchV1, pointer)
        return id

    @ZwpPointerGesturesV1.request(version=2)
    def release(self) -> None:
        """Destroy the pointer gesture object

        Destroy the pointer gesture object. Swipe, pinch and hold objects
        created via this gesture object remain valid.
        """
        self._marshal(2)
        self._destroy()

    @ZwpPointerGesturesV1.request(
        Argument(ArgumentType.NewId, interface=ZwpPointerGestureHoldV1),
        Argument(ArgumentType.Object, interface=WlPointer),
        version=3,
    )
    def get_hold_gesture(self, pointer: WlPointerProxy) -> ZwpPointerGestureHoldV1Proxy:
        """Get hold gesture

        Create a hold gesture object. See the wl_pointer_gesture_hold interface
        for details.

        :param pointer:
        :type pointer:
            :class:`~pywayland.protocol.wayland.WlPointer`
        :returns:
            :class:`~pywayland.protocol.pointer_gestures_unstable_v1.ZwpPointerGestureHoldV1`
        """
        id = self._marshal_constructor(3, ZwpPointerGestureHoldV1, pointer)
        return id


class ZwpPointerGestureHoldV1Global(Global[ZwpPointerGestureHoldV1]):
    interface = ZwpPointerGestureHoldV1


class ZwpPointerGesturePinchV1Global(Global[ZwpPointerGesturePinchV1]):
    interface = ZwpPointerGesturePinchV1


class ZwpPointerGestureSwipeV1Global(Global[ZwpPointerGestureSwipeV1]):
    interface = ZwpPointerGestureSwipeV1


class ZwpPointerGesturesV1Global(Global[ZwpPointerGesturesV1]):
    interface = ZwpPointerGesturesV1


ZwpPointerGestureHoldV1._gen_c()
ZwpPointerGestureHoldV1.proxy_class = ZwpPointerGestureHoldV1Proxy
ZwpPointerGestureHoldV1.resource_class = ZwpPointerGestureHoldV1Resource
ZwpPointerGestureHoldV1.global_class = ZwpPointerGestureHoldV1Global


ZwpPointerGesturePinchV1._gen_c()
ZwpPointerGesturePinchV1.proxy_class = ZwpPointerGesturePinchV1Proxy
ZwpPointerGesturePinchV1.resource_class = ZwpPointerGesturePinchV1Resource
ZwpPointerGesturePinchV1.global_class = ZwpPointerGesturePinchV1Global


ZwpPointerGestureSwipeV1._gen_c()
ZwpPointerGestureSwipeV1.proxy_class = ZwpPointerGestureSwipeV1Proxy
ZwpPointerGestureSwipeV1.resource_class = ZwpPointerGestureSwipeV1Resource
ZwpPointerGestureSwipeV1.global_class = ZwpPointerGestureSwipeV1Global


ZwpPointerGesturesV1._gen_c()
ZwpPointerGesturesV1.proxy_class = ZwpPointerGesturesV1Proxy
ZwpPointerGesturesV1.resource_class = ZwpPointerGesturesV1Resource
ZwpPointerGesturesV1.global_class = ZwpPointerGesturesV1Global
