# -*- coding: utf-8 -*-
# This file has been autogenerated by the pywayland scanner

# Copyright 2015 Sean Vig
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from pywayland.interface import Interface
from ..wayland import WlSurface


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 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 = 2


@ZwpPointerGestureSwipeV1.request("", [])
def destroy(self):
    """Destroy the pointer swipe gesture object
    """
    self._marshal(0)
    self._destroy()


@ZwpPointerGestureSwipeV1.event("uuou", [None, None, WlSurface, None])
def begin(self, serial, time, surface, fingers):
    """Multi-finger swipe begin

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

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


@ZwpPointerGestureSwipeV1.event("uff", [None, None, None])
def update(self, time, dx, dy):
    """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: `uint`
    :param dx:
        delta x coordinate in surface coordinate space
    :type dx: `fixed`
    :param dy:
        delta y coordinate in surface coordinate space
    :type dy: `fixed`
    """
    self._post_event(1, time, dx, dy)


@ZwpPointerGestureSwipeV1.event("uui", [None, None, None])
def end(self, serial, time, cancelled):
    """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: `uint`
    :param time:
        timestamp with millisecond granularity
    :type time: `uint`
    :param cancelled:
        1 if the gesture was cancelled, 0 otherwise
    :type cancelled: `int`
    """
    self._post_event(2, serial, time, cancelled)


ZwpPointerGestureSwipeV1._gen_c()
