210 lines
7.0 KiB
Python
210 lines
7.0 KiB
Python
# 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 __future__ import annotations
|
|
|
|
import enum
|
|
|
|
from pywayland.protocol_core import (
|
|
Argument,
|
|
ArgumentType,
|
|
Global,
|
|
Interface,
|
|
Proxy,
|
|
Resource,
|
|
)
|
|
|
|
|
|
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
|
|
|
|
class source(enum.IntEnum):
|
|
finger = 1
|
|
|
|
|
|
class ZwpTabletPadRingV2Proxy(Proxy[ZwpTabletPadRingV2]):
|
|
interface = ZwpTabletPadRingV2
|
|
|
|
@ZwpTabletPadRingV2.request(
|
|
Argument(ArgumentType.String),
|
|
Argument(ArgumentType.Uint),
|
|
)
|
|
def set_feedback(self, description: str, serial: int) -> None:
|
|
"""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:
|
|
`ArgumentType.String`
|
|
:param serial:
|
|
serial of the mode switch event
|
|
:type serial:
|
|
`ArgumentType.Uint`
|
|
"""
|
|
self._marshal(0, description, serial)
|
|
|
|
@ZwpTabletPadRingV2.request()
|
|
def destroy(self) -> None:
|
|
"""Destroy the ring object
|
|
|
|
This destroys the client's resource for this ring object.
|
|
"""
|
|
self._marshal(1)
|
|
self._destroy()
|
|
|
|
|
|
class ZwpTabletPadRingV2Resource(Resource):
|
|
interface = ZwpTabletPadRingV2
|
|
|
|
@ZwpTabletPadRingV2.event(
|
|
Argument(ArgumentType.Uint),
|
|
)
|
|
def source(self, source: int) -> None:
|
|
"""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:
|
|
`ArgumentType.Uint`
|
|
"""
|
|
self._post_event(0, source)
|
|
|
|
@ZwpTabletPadRingV2.event(
|
|
Argument(ArgumentType.Fixed),
|
|
)
|
|
def angle(self, degrees: float) -> None:
|
|
"""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:
|
|
`ArgumentType.Fixed`
|
|
"""
|
|
self._post_event(1, degrees)
|
|
|
|
@ZwpTabletPadRingV2.event()
|
|
def stop(self) -> None:
|
|
"""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(
|
|
Argument(ArgumentType.Uint),
|
|
)
|
|
def frame(self, time: int) -> None:
|
|
"""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:
|
|
`ArgumentType.Uint`
|
|
"""
|
|
self._post_event(3, time)
|
|
|
|
|
|
class ZwpTabletPadRingV2Global(Global):
|
|
interface = ZwpTabletPadRingV2
|
|
|
|
|
|
ZwpTabletPadRingV2._gen_c()
|
|
ZwpTabletPadRingV2.proxy_class = ZwpTabletPadRingV2Proxy
|
|
ZwpTabletPadRingV2.resource_class = ZwpTabletPadRingV2Resource
|
|
ZwpTabletPadRingV2.global_class = ZwpTabletPadRingV2Global
|