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

# Copyright 2014 © Stephen "Lyude" Chandler Paul
# Copyright 2015-2016 © Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial
# portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from pywayland.interface import Interface

import enum


class ZwpTabletPadRingV2(Interface):
    """Pad ring

    A circular interaction area, such as the touch ring on the Wacom Intuos Pro
    series tablets.

    Events on a ring are logically grouped by the wl_tablet_pad_ring.frame
    event.
    """
    name = "zwp_tablet_pad_ring_v2"
    version = 1

    source = enum.Enum("source", {
        "finger": 1,
    })


@ZwpTabletPadRingV2.request("su", [None, None])
def set_feedback(self, description, serial):
    """Set compositor feedback

    Request that the compositor use the provided feedback string associated
    with this ring. This request should be issued immediately after a
    wp_tablet_pad_group.mode_switch event from the corresponding group is
    received, or whenever the ring is mapped to a different action. See
    wp_tablet_pad_group.mode_switch for more details.

    Clients are encouraged to provide context-aware descriptions for the
    actions associated with the ring; compositors may use this information to
    offer visual feedback about the button layout (eg. on-screen displays).

    The provided string 'description' is a UTF-8 encoded string to be
    associated with this ring, and is considered user-visible; general
    internationalization rules apply.

    The serial argument will be that of the last
    wp_tablet_pad_group.mode_switch event received for the group of this ring.
    Requests providing other serials than the most recent one will be ignored.

    :param description:
        ring description
    :type description: `string`
    :param serial:
        serial of the mode switch event
    :type serial: `uint`
    """
    self._marshal(0, description, serial)


@ZwpTabletPadRingV2.request("", [])
def destroy(self):
    """Destroy the ring object

    This destroys the client's resource for this ring object.
    """
    self._marshal(1)
    self._destroy()


@ZwpTabletPadRingV2.event("u", [None])
def source(self, source):
    """Ring event source

    Source information for ring events.

    This event does not occur on its own. It is sent before a
    wp_tablet_pad_ring.frame event and carries the source information for all
    events within that frame.

    The source specifies how this event was generated. If the source is
    wp_tablet_pad_ring.source.finger, a wp_tablet_pad_ring.stop event will be
    sent when the user lifts the finger off the device.

    This event is optional. If the source is unknown for an interaction, no
    event is sent.

    :param source:
        the event source
    :type source: `uint`
    """
    self._post_event(0, source)


@ZwpTabletPadRingV2.event("f", [None])
def angle(self, degrees):
    """Angle changed

    Sent whenever the angle on a ring changes.

    The angle is provided in degrees clockwise from the logical north of the
    ring in the pad's current rotation.

    :param degrees:
        the current angle in degrees
    :type degrees: `fixed`
    """
    self._post_event(1, degrees)


@ZwpTabletPadRingV2.event("", [])
def stop(self):
    """Interaction stopped

    Stop notification for ring events.

    For some wp_tablet_pad_ring.source types, a wp_tablet_pad_ring.stop event
    is sent to notify a client that the interaction with the ring has
    terminated. This enables the client to implement kinetic scrolling. See the
    wp_tablet_pad_ring.source documentation for information on when this event
    may be generated.

    Any wp_tablet_pad_ring.angle events with the same source after this event
    should be considered as the start of a new interaction.
    """
    self._post_event(2)


@ZwpTabletPadRingV2.event("u", [None])
def frame(self, time):
    """End of a ring event sequence

    Indicates the end of a set of ring events that logically belong together. A
    client is expected to accumulate the data in all events within the frame
    before proceeding.

    All wp_tablet_pad_ring events before a wp_tablet_pad_ring.frame event
    belong logically together. For example, on termination of a finger
    interaction on a ring the compositor will send a wp_tablet_pad_ring.source
    event, a wp_tablet_pad_ring.stop event and a wp_tablet_pad_ring.frame
    event.

    A wp_tablet_pad_ring.frame event is sent for every logical event group,
    even if the group only contains a single wp_tablet_pad_ring event.
    Specifically, a client may get a sequence: angle, frame, angle, frame, etc.

    :param time:
        timestamp with millisecond granularity
    :type time: `uint`
    """
    self._post_event(3, time)


ZwpTabletPadRingV2._gen_c()
