1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 00:38:44 +00:00

(Wayland) Build pointer-constraints and relative-pointer protocols (#15071)

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
This commit is contained in:
Colin Kinloch 2023-03-09 18:54:36 +00:00 committed by GitHub
parent e99efba2b9
commit 297aa1ff72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 769 additions and 63 deletions

4
.gitignore vendored
View File

@ -207,6 +207,10 @@ gfx/common/wayland/xdg-decoration-unstable-v1.h
gfx/common/wayland/xdg-decoration-unstable-v1.c
gfx/common/wayland/xdg-shell.c
gfx/common/wayland/xdg-shell.h
gfx/common/wayland/pointer-constraints-unstable-v1.c
gfx/common/wayland/pointer-constraints-unstable-v1.h
gfx/common/wayland/relative-pointer-unstable-v1.c
gfx/common/wayland/relative-pointer-unstable-v1.h
# libretro-common samples
libretro-common/samples/streams/rzip/rzip

View File

@ -1233,7 +1233,9 @@ ifeq ($(HAVE_WAYLAND), 1)
gfx/common/wayland_common.o \
gfx/common/wayland/xdg-shell.o \
gfx/common/wayland/idle-inhibit-unstable-v1.o \
gfx/common/wayland/xdg-decoration-unstable-v1.o
gfx/common/wayland/xdg-decoration-unstable-v1.o \
gfx/common/wayland/pointer-constraints-unstable-v1.o \
gfx/common/wayland/relative-pointer-unstable-v1.o
ifeq ($(HAVE_VULKAN), 1)
OBJ += gfx/drivers_context/wayland_vk_ctx.o

View File

@ -2,4 +2,4 @@ xdg shell protocol
Maintainers:
Jonas Ådahl <jadahl@gmail.com>
Mike Blumenkrantz <zmike@osg.samsung.com>
Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

View File

@ -29,7 +29,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="xdg_wm_base" version="2">
<interface name="xdg_wm_base" version="5">
<description summary="create desktop-style surfaces">
The xdg_wm_base interface is exposed as a global object enabling clients
to turn their wl_surfaces into windows in a desktop environment. It
@ -50,6 +50,8 @@
summary="the client provided an invalid surface state"/>
<entry name="invalid_positioner" value="5"
summary="the client provided an invalid positioner"/>
<entry name="unresponsive" value="6"
summary="the client didnt respond to a ping event in time"/>
</enum>
<request name="destroy" type="destructor">
@ -58,7 +60,7 @@
Destroying a bound xdg_wm_base object while there are surfaces
still alive created by this xdg_wm_base object instance is illegal
and will result in a protocol error.
and will result in a defunct_surfaces error.
</description>
</request>
@ -75,7 +77,9 @@
<description summary="create a shell surface from a surface">
This creates an xdg_surface for the given surface. While xdg_surface
itself is not a role, the corresponding surface may only be assigned
a role extending xdg_surface, such as xdg_toplevel or xdg_popup.
a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is
illegal to create an xdg_surface for a wl_surface which already has an
assigned role and this will result in a role error.
This creates an xdg_surface for the given surface. An xdg_surface is
used as basis to define a role to a given surface, such as xdg_toplevel
@ -92,7 +96,8 @@
<request name="pong">
<description summary="respond to a ping event">
A client must respond to a ping event with a pong request or
the client may be deemed unresponsive. See xdg_wm_base.ping.
the client may be deemed unresponsive. See xdg_wm_base.ping
and xdg_wm_base.error.unresponsive.
</description>
<arg name="serial" type="uint" summary="serial of the ping event"/>
</request>
@ -101,12 +106,14 @@
<description summary="check if the client is alive">
The ping event asks the client if it's still alive. Pass the
serial specified in the event back to the compositor by sending
a "pong" request back with the specified serial. See xdg_wm_base.ping.
a "pong" request back with the specified serial. See xdg_wm_base.pong.
Compositors can use this to determine if the client is still
alive. It's unspecified what will happen if the client doesn't
respond to the ping request, or in what timeframe. Clients should
try to respond in a reasonable amount of time.
try to respond in a reasonable amount of time. The “unresponsive”
error is provided for compositors that wish to disconnect unresponsive
clients.
A compositor is free to ping in any way it wants, but a client must
always respond to any xdg_wm_base object it created.
@ -115,7 +122,7 @@
</event>
</interface>
<interface name="xdg_positioner" version="2">
<interface name="xdg_positioner" version="5">
<description summary="child surface positioner">
The xdg_positioner provides a collection of rules for the placement of a
child surface relative to a parent surface. Rules can be defined to ensure
@ -135,7 +142,7 @@
For an xdg_positioner object to be considered complete, it must have a
non-zero size set by set_size, and a non-zero anchor rectangle set by
set_anchor_rect. Passing an incomplete xdg_positioner object when
positioning a surface raises an error.
positioning a surface raises an invalid_positioner error.
</description>
<enum name="error">
@ -223,7 +230,8 @@
specified (e.g. 'bottom_right' or 'top_left'), then the child surface
will be placed towards the specified gravity; otherwise, the child
surface will be centered over the anchor point on any axis that had no
gravity specified.
gravity specified. If the gravity is not in the gravity enum, an
invalid_input error is raised.
</description>
<arg name="gravity" type="uint" enum="gravity"
summary="gravity direction"/>
@ -357,9 +365,49 @@
<arg name="x" type="int" summary="surface position x offset"/>
<arg name="y" type="int" summary="surface position y offset"/>
</request>
<!-- Version 3 additions -->
<request name="set_reactive" since="3">
<description summary="continuously reconstrain the surface">
When set reactive, the surface is reconstrained if the conditions used
for constraining changed, e.g. the parent window moved.
If the conditions changed and the popup was reconstrained, an
xdg_popup.configure event is sent with updated geometry, followed by an
xdg_surface.configure event.
</description>
</request>
<request name="set_parent_size" since="3">
<description summary="">
Set the parent window geometry the compositor should use when
positioning the popup. The compositor may use this information to
determine the future state the popup should be constrained using. If
this doesn't match the dimension of the parent the popup is eventually
positioned against, the behavior is undefined.
The arguments are given in the surface-local coordinate space.
</description>
<arg name="parent_width" type="int"
summary="future window geometry width of parent"/>
<arg name="parent_height" type="int"
summary="future window geometry height of parent"/>
</request>
<request name="set_parent_configure" since="3">
<description summary="set parent configure this is a response to">
Set the serial of an xdg_surface.configure event this positioner will be
used in response to. The compositor may use this information together
with set_parent_size to determine what future state the popup should be
constrained using.
</description>
<arg name="serial" type="uint"
summary="serial of parent configure event"/>
</request>
</interface>
<interface name="xdg_surface" version="2">
<interface name="xdg_surface" version="5">
<description summary="desktop user interface surface base interface">
An interface that may be implemented by a wl_surface, for
implementations that provide a desktop-style user interface.
@ -386,6 +434,11 @@
manipulate a buffer prior to the first xdg_surface.configure call must
also be treated as errors.
After creating a role-specific object and setting it up, the client must
perform an initial commit without any buffer attached. The compositor
will reply with an xdg_surface.configure event. The client must
acknowledge it and is then allowed to attach a buffer to map the surface.
Mapping an xdg_surface-based role surface is defined as making it
possible for the surface to be shown by the compositor. Note that
a mapped surface is not guaranteed to be visible once it is mapped.
@ -399,19 +452,30 @@
A newly-unmapped surface is considered to have met condition (1) out
of the 3 required conditions for mapping a surface if its role surface
has not been destroyed.
has not been destroyed, i.e. the client must perform the initial commit
again before attaching a buffer.
</description>
<enum name="error">
<entry name="not_constructed" value="1"/>
<entry name="already_constructed" value="2"/>
<entry name="unconfigured_buffer" value="3"/>
<entry name="not_constructed" value="1"
summary="Surface was not fully constructed"/>
<entry name="already_constructed" value="2"
summary="Surface was already constructed"/>
<entry name="unconfigured_buffer" value="3"
summary="Attaching a buffer to an unconfigured surface"/>
<entry name="invalid_serial" value="4"
summary="Invalid serial number when acking a configure event"/>
<entry name="invalid_size" value="5"
summary="Width or height was zero or negative"/>
<entry name="defunct_role_object" value="6"
summary="Surface was destroyed before its role object"/>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the xdg_surface">
Destroy the xdg_surface object. An xdg_surface must only be destroyed
after its role object has been destroyed.
after its role object has been destroyed, otherwise
a defunct_role_object error is raised.
</description>
</request>
@ -469,10 +533,10 @@
the wl_surface associated with this xdg_surface.
The width and height must be greater than zero. Setting an invalid size
will raise an error. When applied, the effective window geometry will be
the set window geometry clamped to the bounding rectangle of the
combined geometry of the surface of the xdg_surface and the associated
subsurfaces.
will raise an invalid_size error. When applied, the effective window
geometry will be the set window geometry clamped to the bounding
rectangle of the combined geometry of the surface of the xdg_surface and
the associated subsurfaces.
</description>
<arg name="x" type="int"/>
<arg name="y" type="int"/>
@ -493,6 +557,8 @@
If the client receives multiple configure events before it
can respond to one, it only has to ack the last configure event.
Acking a configure event that was never sent raises an invalid_serial
error.
A client is not required to commit immediately after sending
an ack_configure request - it may even ack_configure several times
@ -501,6 +567,17 @@
A client may send multiple ack_configure requests before committing, but
only the last request sent before a commit indicates which configure
event the client really is responding to.
Sending an ack_configure request consumes the serial number sent with
the request, as well as serial numbers sent by all configure events
sent on this xdg_surface prior to the configure event referenced by
the committed serial.
It is an error to issue multiple ack_configure requests referencing a
serial from the same configure event, or to issue an ack_configure
request referencing a serial from a configure event issued before the
event identified by the last ack_configure request for the same
xdg_surface. Doing so will raise an invalid_serial error.
</description>
<arg name="serial" type="uint" summary="the serial from the configure event"/>
</request>
@ -526,9 +603,10 @@
</description>
<arg name="serial" type="uint" summary="serial of the configure event"/>
</event>
</interface>
<interface name="xdg_toplevel" version="2">
<interface name="xdg_toplevel" version="5">
<description summary="toplevel surface">
This interface defines an xdg_surface role which allows a surface to,
among other things, set window-like properties such as maximize,
@ -540,7 +618,11 @@
by the compositor until it is explicitly mapped again.
All active operations (e.g., move, resize) are canceled and all
attributes (e.g. title, state, stacking, ...) are discarded for
an xdg_toplevel surface when it is unmapped.
an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
the state it had right after xdg_surface.get_toplevel. The client
can re-map the toplevel by perfoming a commit without any buffer
attached, waiting for a configure event and handling it as usual (see
xdg_surface description).
Attaching a null buffer to a toplevel unmaps the surface.
</description>
@ -552,24 +634,37 @@
</description>
</request>
<enum name="error">
<entry name="invalid_resize_edge" value="0" summary="provided value is
not a valid variant of the resize_edge enum"/>
<entry name="invalid_parent" value="1"
summary="invalid parent toplevel"/>
<entry name="invalid_size" value="2"
summary="client provided an invalid min or max size"/>
</enum>
<request name="set_parent">
<description summary="set the parent of this surface">
Set the "parent" of this surface. This surface should be stacked
above the parent surface and all other ancestor surfaces.
Parent windows should be set on dialogs, toolboxes, or other
Parent surfaces should be set on dialogs, toolboxes, or other
"auxiliary" surfaces, so that the parent is raised when the dialog
is raised.
Setting a null parent for a child window removes any parent-child
relationship for the child. Setting a null parent for a window which
currently has no parent is a no-op.
Setting a null parent for a child surface unsets its parent. Setting
a null parent for a surface which currently has no parent is a no-op.
If the parent is unmapped then its children are managed as
though the parent of the now-unmapped parent has become the
parent of this surface. If no parent exists for the now-unmapped
parent then the children are managed as though they have no
parent surface.
Only mapped surfaces can have child surfaces. Setting a parent which
is not mapped is equivalent to setting a null parent. If a surface
becomes unmapped, its children's parent is set to the parent of
the now-unmapped surface. If the now-unmapped surface has no parent,
its children's parent is unset. If the now-unmapped surface becomes
mapped again, its parent-child relationship is not restored.
The parent toplevel must not be one of the child toplevel's
descendants, and the parent must be different from the child toplevel,
otherwise the invalid_parent protocol error is raised.
</description>
<arg name="parent" type="object" interface="xdg_toplevel" allow-null="true"/>
</request>
@ -604,11 +699,14 @@
For example, "org.freedesktop.FooViewer" where the .desktop file is
"org.freedesktop.FooViewer.desktop".
Like other properties, a set_app_id request can be sent after the
xdg_toplevel has been mapped to update the property.
See the desktop-entry specification [0] for more details on
application identifiers and how they relate to well-known D-Bus
names and .desktop files.
[0] http://standards.freedesktop.org/desktop-entry-spec/
[0] https://standards.freedesktop.org/desktop-entry-spec/
</description>
<arg name="app_id" type="string"/>
</request>
@ -622,7 +720,8 @@
This request asks the compositor to pop up such a window menu at
the given position, relative to the local surface coordinates of
the parent surface. There are no guarantees as to what menu items
the window menu contains.
the window menu contains, or even if a window menu will be drawn
at all.
This request must be used in response to some sort of user action
like a button press, key press, or touch down event.
@ -698,16 +797,17 @@
guarantee that the device focus will return when the resize is
completed.
The edges parameter specifies how the surface should be resized,
and is one of the values of the resize_edge enum. The compositor
may use this information to update the surface position for
example when dragging the top left corner. The compositor may also
use this information to adapt its behavior, e.g. choose an
appropriate cursor image.
The edges parameter specifies how the surface should be resized, and
is one of the values of the resize_edge enum. Values not matching
a variant of the enum will cause a protocol error. The compositor
may use this information to update the surface position for example
when dragging the top left corner. The compositor may also use
this information to adapt its behavior, e.g. choose an appropriate
cursor image.
</description>
<arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
<arg name="serial" type="uint" summary="the serial of the user event"/>
<arg name="edges" type="uint" summary="which edge or corner is being dragged"/>
<arg name="edges" type="uint" enum="resize_edge" summary="which edge or corner is being dragged"/>
</request>
<enum name="state">
@ -754,25 +854,25 @@
</description>
</entry>
<entry name="tiled_left" value="5" since="2">
<description summary="the surface is tiled">
<description summary="the surfaces left edge is tiled">
The window is currently in a tiled layout and the left edge is
considered to be adjacent to another part of the tiling grid.
</description>
</entry>
<entry name="tiled_right" value="6" since="2">
<description summary="the surface is tiled">
<description summary="the surfaces right edge is tiled">
The window is currently in a tiled layout and the right edge is
considered to be adjacent to another part of the tiling grid.
</description>
</entry>
<entry name="tiled_top" value="7" since="2">
<description summary="the surface is tiled">
<description summary="the surfaces top edge is tiled">
The window is currently in a tiled layout and the top edge is
considered to be adjacent to another part of the tiling grid.
</description>
</entry>
<entry name="tiled_bottom" value="8" since="2">
<description summary="the surface is tiled">
<description summary="the surfaces bottom edge is tiled">
The window is currently in a tiled layout and the bottom edge is
considered to be adjacent to another part of the tiling grid.
</description>
@ -810,11 +910,11 @@
request.
Requesting a maximum size to be smaller than the minimum size of
a surface is illegal and will result in a protocol error.
a surface is illegal and will result in an invalid_size error.
The width and height must be greater than or equal to zero. Using
strictly negative values for width and height will result in a
protocol error.
strictly negative values for width or height will result in a
invalid_size error.
</description>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
@ -851,11 +951,11 @@
request.
Requesting a minimum size to be larger than the maximum size of
a surface is illegal and will result in a protocol error.
a surface is illegal and will result in an invalid_size error.
The width and height must be greater than or equal to zero. Using
strictly negative values for width and height will result in a
protocol error.
invalid_size error.
</description>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
@ -1014,9 +1114,68 @@
a dialog to ask the user to save their data, etc.
</description>
</event>
<!-- Version 4 additions -->
<event name="configure_bounds" since="4">
<description summary="recommended window geometry bounds">
The configure_bounds event may be sent prior to a xdg_toplevel.configure
event to communicate the bounds a window geometry size is recommended
to constrain to.
The passed width and height are in surface coordinate space. If width
and height are 0, it means bounds is unknown and equivalent to as if no
configure_bounds event was ever sent for this surface.
The bounds can for example correspond to the size of a monitor excluding
any panels or other shell components, so that a surface isn't created in
a way that it cannot fit.
The bounds may change at any point, and in such a case, a new
xdg_toplevel.configure_bounds will be sent, followed by
xdg_toplevel.configure and xdg_surface.configure.
</description>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
</event>
<!-- Version 5 additions -->
<enum name="wm_capabilities" since="5">
<entry name="window_menu" value="1" summary="show_window_menu is available"/>
<entry name="maximize" value="2" summary="set_maximized and unset_maximized are available"/>
<entry name="fullscreen" value="3" summary="set_fullscreen and unset_fullscreen are available"/>
<entry name="minimize" value="4" summary="set_minimized is available"/>
</enum>
<event name="wm_capabilities" since="5">
<description summary="compositor capabilities">
This event advertises the capabilities supported by the compositor. If
a capability isn't supported, clients should hide or disable the UI
elements that expose this functionality. For instance, if the
compositor doesn't advertise support for minimized toplevels, a button
triggering the set_minimized request should not be displayed.
The compositor will ignore requests it doesn't support. For instance,
a compositor which doesn't advertise support for minimized will ignore
set_minimized requests.
Compositors must send this event once before the first
xdg_surface.configure event. When the capabilities change, compositors
must send this event again and then send an xdg_surface.configure
event.
The configured state should not be applied immediately. See
xdg_surface.configure for details.
The capabilities are sent as an array of 32-bit unsigned integers in
native endianness.
</description>
<arg name="capabilities" type="array" summary="array of 32-bit capabilities"/>
</event>
</interface>
<interface name="xdg_popup" version="2">
<interface name="xdg_popup" version="5">
<description summary="short-lived, popup surfaces for menus">
A popup surface is a short-lived, temporary surface. It can be used to
implement for example menus, popovers, tooltips and other similar user
@ -1040,12 +1199,6 @@
The parent of an xdg_popup must be mapped (see the xdg_surface
description) before the xdg_popup itself.
The x and y arguments passed when creating the popup object specify
where the top left of the popup should be placed, relative to the
local surface coordinates of the parent surface. See
xdg_surface.get_popup. An xdg_popup must intersect with or be at least
partially adjacent to its parent surface.
The client must call wl_surface.commit on the corresponding wl_surface
for the xdg_popup state to take effect.
</description>
@ -1093,10 +1246,6 @@
nested grabbing popup as well. When a compositor dismisses popups, it
will follow the same dismissing order as required from the client.
The parent of a grabbing popup must either be another xdg_popup with an
active explicit grab, or an xdg_popup or xdg_toplevel, if there are no
explicit grabs already taken.
If the topmost grabbing popup is destroyed, the grab will be returned to
the parent of the popup, if that parent previously had an explicit grab.
@ -1123,6 +1272,11 @@
The x and y arguments represent the position the popup was placed at
given the xdg_positioner rule, relative to the upper left corner of the
window geometry of the parent surface.
For version 2 or older, the configure event for an xdg_popup is only
ever sent once for the initial configuration. Starting with version 3,
it may be sent again if the popup is setup with an xdg_positioner with
set_reactive requested, or in response to xdg_popup.reposition requests.
</description>
<arg name="x" type="int"
summary="x position relative to parent surface window geometry"/>
@ -1140,5 +1294,58 @@
</description>
</event>
<!-- Version 3 additions -->
<request name="reposition" since="3">
<description summary="recalculate the popup's location">
Reposition an already-mapped popup. The popup will be placed given the
details in the passed xdg_positioner object, and a
xdg_popup.repositioned followed by xdg_popup.configure and
xdg_surface.configure will be emitted in response. Any parameters set
by the previous positioner will be discarded.
The passed token will be sent in the corresponding
xdg_popup.repositioned event. The new popup position will not take
effect until the corresponding configure event is acknowledged by the
client. See xdg_popup.repositioned for details. The token itself is
opaque, and has no other special meaning.
If multiple reposition requests are sent, the compositor may skip all
but the last one.
If the popup is repositioned in response to a configure event for its
parent, the client should send an xdg_positioner.set_parent_configure
and possibly an xdg_positioner.set_parent_size request to allow the
compositor to properly constrain the popup.
If the popup is repositioned together with a parent that is being
resized, but not in response to a configure event, the client should
send an xdg_positioner.set_parent_size request.
</description>
<arg name="positioner" type="object" interface="xdg_positioner"/>
<arg name="token" type="uint" summary="reposition request token"/>
</request>
<event name="repositioned" since="3">
<description summary="signal the completion of a repositioned request">
The repositioned event is sent as part of a popup configuration
sequence, together with xdg_popup.configure and lastly
xdg_surface.configure to notify the completion of a reposition request.
The repositioned event is to notify about the completion of a
xdg_popup.reposition request. The token argument is the token passed
in the xdg_popup.reposition request.
Immediately after this event is emitted, xdg_popup.configure and
xdg_surface.configure will be sent with the updated size and position,
as well as a new configure serial.
The client should optionally update the content of the popup, but must
acknowledge the new popup configuration for the new position to take
effect. See xdg_surface.ack_configure for details.
</description>
<arg name="token" type="uint" summary="reposition request token"/>
</event>
</interface>
</protocol>

View File

@ -0,0 +1,4 @@
Pointer constraints protocol
Maintainers:
Jonas Ådahl <jadahl@gmail.com>

View File

@ -0,0 +1,339 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="pointer_constraints_unstable_v1">
<copyright>
Copyright © 2014 Jonas Ådahl
Copyright © 2015 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.
</copyright>
<description summary="protocol for constraining pointer motions">
This protocol specifies a set of interfaces used for adding constraints to
the motion of a pointer. Possible constraints include confining pointer
motions to a given region, or locking it to its current position.
In order to constrain the pointer, a client must first bind the global
interface "wp_pointer_constraints" which, if a compositor supports pointer
constraints, is exposed by the registry. Using the bound global object, the
client uses the request that corresponds to the type of constraint it wants
to make. See wp_pointer_constraints for more details.
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.
</description>
<interface name="zwp_pointer_constraints_v1" version="1">
<description summary="constrain the movement of a pointer">
The global interface exposing pointer constraining functionality. It
exposes two requests: lock_pointer for locking the pointer to its
position, and confine_pointer for locking the pointer to a region.
The lock_pointer and confine_pointer requests create the objects
wp_locked_pointer and wp_confined_pointer respectively, and the client can
use these objects to interact with the lock.
For any surface, only one lock or confinement may be active across all
wl_pointer objects of the same seat. If a lock or confinement is requested
when another lock or confinement is active or requested on the same surface
and with any of the wl_pointer objects of the same seat, an
'already_constrained' error will be raised.
</description>
<enum name="error">
<description summary="wp_pointer_constraints error values">
These errors can be emitted in response to wp_pointer_constraints
requests.
</description>
<entry name="already_constrained" value="1"
summary="pointer constraint already requested on that surface"/>
</enum>
<enum name="lifetime">
<description summary="constraint lifetime">
These values represent different lifetime semantics. They are passed
as arguments to the factory requests to specify how the constraint
lifetimes should be managed.
</description>
<entry name="oneshot" value="1">
<description summary="the pointer constraint is defunct once deactivated">
A oneshot pointer constraint will never reactivate once it has been
deactivated. See the corresponding deactivation event
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
details.
</description>
</entry>
<entry name="persistent" value="2">
<description summary="the pointer constraint may reactivate">
A persistent pointer constraint may again reactivate once it has
been deactivated. See the corresponding deactivation event
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
details.
</description>
</entry>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the pointer constraints manager object">
Used by the client to notify the server that it will no longer use this
pointer constraints object.
</description>
</request>
<request name="lock_pointer">
<description summary="lock pointer to a position">
The lock_pointer request lets the client request to disable movements of
the virtual pointer (i.e. the cursor), effectively locking the pointer
to a position. This request may not take effect immediately; in the
future, when the compositor deems implementation-specific constraints
are satisfied, the pointer lock will be activated and the compositor
sends a locked event.
The protocol provides no guarantee that the constraints are ever
satisfied, and does not require the compositor to send an error if the
constraints cannot ever be satisfied. It is thus possible to request a
lock that will never activate.
There may not be another pointer constraint of any kind requested or
active on the surface for any of the wl_pointer objects of the seat of
the passed pointer when requesting a lock. If there is, an error will be
raised. See general pointer lock documentation for more details.
The intersection of the region passed with this request and the input
region of the surface is used to determine where the pointer must be
in order for the lock to activate. It is up to the compositor whether to
warp the pointer or require some kind of user interaction for the lock
to activate. If the region is null the surface input region is used.
A surface may receive pointer focus without the lock being activated.
The request creates a new object wp_locked_pointer which is used to
interact with the lock as well as receive updates about its state. See
the the description of wp_locked_pointer for further information.
Note that while a pointer is locked, the wl_pointer objects of the
corresponding seat will not emit any wl_pointer.motion events, but
relative motion events will still be emitted via wp_relative_pointer
objects of the same seat. wl_pointer.axis and wl_pointer.button events
are unaffected.
</description>
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
<arg name="surface" type="object" interface="wl_surface"
summary="surface to lock pointer to"/>
<arg name="pointer" type="object" interface="wl_pointer"
summary="the pointer that should be locked"/>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
</request>
<request name="confine_pointer">
<description summary="confine pointer to a region">
The confine_pointer request lets the client request to confine the
pointer cursor to a given region. This request may not take effect
immediately; in the future, when the compositor deems implementation-
specific constraints are satisfied, the pointer confinement will be
activated and the compositor sends a confined event.
The intersection of the region passed with this request and the input
region of the surface is used to determine where the pointer must be
in order for the confinement to activate. It is up to the compositor
whether to warp the pointer or require some kind of user interaction for
the confinement to activate. If the region is null the surface input
region is used.
The request will create a new object wp_confined_pointer which is used
to interact with the confinement as well as receive updates about its
state. See the the description of wp_confined_pointer for further
information.
</description>
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
<arg name="surface" type="object" interface="wl_surface"
summary="surface to lock pointer to"/>
<arg name="pointer" type="object" interface="wl_pointer"
summary="the pointer that should be confined"/>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
</request>
</interface>
<interface name="zwp_locked_pointer_v1" version="1">
<description summary="receive relative pointer motion events">
The wp_locked_pointer interface represents a locked pointer state.
While the lock of this object is active, the wl_pointer objects of the
associated seat will not emit any wl_pointer.motion events.
This object will send the event 'locked' when the lock is activated.
Whenever the lock is activated, it is guaranteed that the locked surface
will already have received pointer focus and that the pointer will be
within the region passed to the request creating this object.
To unlock the pointer, send the destroy request. This will also destroy
the wp_locked_pointer object.
If the compositor decides to unlock the pointer the unlocked event is
sent. See wp_locked_pointer.unlock for details.
When unlocking, the compositor may warp the cursor position to the set
cursor position hint. If it does, it will not result in any relative
motion events emitted via wp_relative_pointer.
If the surface the lock was requested on is destroyed and the lock is not
yet activated, the wp_locked_pointer object is now defunct and must be
destroyed.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the locked pointer object">
Destroy the locked pointer object. If applicable, the compositor will
unlock the pointer.
</description>
</request>
<request name="set_cursor_position_hint">
<description summary="set the pointer cursor position hint">
Set the cursor position hint relative to the top left corner of the
surface.
If the client is drawing its own cursor, it should update the position
hint to the position of its own cursor. A compositor may use this
information to warp the pointer upon unlock in order to avoid pointer
jumps.
The cursor position hint is double buffered. The new hint will only take
effect when the associated surface gets it pending state applied. See
wl_surface.commit for details.
</description>
<arg name="surface_x" type="fixed"
summary="surface-local x coordinate"/>
<arg name="surface_y" type="fixed"
summary="surface-local y coordinate"/>
</request>
<request name="set_region">
<description summary="set a new lock region">
Set a new region used to lock the pointer.
The new lock region is double-buffered. The new lock region will
only take effect when the associated surface gets its pending state
applied. See wl_surface.commit for details.
For details about the lock region, see wp_locked_pointer.
</description>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
</request>
<event name="locked">
<description summary="lock activation event">
Notification that the pointer lock of the seat's pointer is activated.
</description>
</event>
<event name="unlocked">
<description summary="lock deactivation event">
Notification that the pointer lock of the seat's pointer is no longer
active. If this is a oneshot pointer lock (see
wp_pointer_constraints.lifetime) this object is now defunct and should
be destroyed. If this is a persistent pointer lock (see
wp_pointer_constraints.lifetime) this pointer lock may again
reactivate in the future.
</description>
</event>
</interface>
<interface name="zwp_confined_pointer_v1" version="1">
<description summary="confined pointer object">
The wp_confined_pointer interface represents a confined pointer state.
This object will send the event 'confined' when the confinement is
activated. Whenever the confinement is activated, it is guaranteed that
the surface the pointer is confined to will already have received pointer
focus and that the pointer will be within the region passed to the request
creating this object. It is up to the compositor to decide whether this
requires some user interaction and if the pointer will warp to within the
passed region if outside.
To unconfine the pointer, send the destroy request. This will also destroy
the wp_confined_pointer object.
If the compositor decides to unconfine the pointer the unconfined event is
sent. The wp_confined_pointer object is at this point defunct and should
be destroyed.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the confined pointer object">
Destroy the confined pointer object. If applicable, the compositor will
unconfine the pointer.
</description>
</request>
<request name="set_region">
<description summary="set a new confine region">
Set a new region used to confine the pointer.
The new confine region is double-buffered. The new confine region will
only take effect when the associated surface gets its pending state
applied. See wl_surface.commit for details.
If the confinement is active when the new confinement region is applied
and the pointer ends up outside of newly applied region, the pointer may
warped to a position within the new confinement region. If warped, a
wl_pointer.motion event will be emitted, but no
wp_relative_pointer.relative_motion event.
The compositor may also, instead of using the new region, unconfine the
pointer.
For details about the confine region, see wp_confined_pointer.
</description>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
</request>
<event name="confined">
<description summary="pointer confined">
Notification that the pointer confinement of the seat's pointer is
activated.
</description>
</event>
<event name="unconfined">
<description summary="pointer unconfined">
Notification that the pointer confinement of the seat's pointer is no
longer active. If this is a oneshot pointer confinement (see
wp_pointer_constraints.lifetime) this object is now defunct and should
be destroyed. If this is a persistent pointer confinement (see
wp_pointer_constraints.lifetime) this pointer confinement may again
reactivate in the future.
</description>
</event>
</interface>
</protocol>

View File

@ -0,0 +1,4 @@
Relative pointer protocol
Maintainers:
Jonas Ådahl <jadahl@gmail.com>

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="relative_pointer_unstable_v1">
<copyright>
Copyright © 2014 Jonas Ådahl
Copyright © 2015 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.
</copyright>
<description summary="protocol for relative pointer motion events">
This protocol specifies a set of interfaces used for making clients able to
receive relative pointer events not obstructed by barriers (such as the
monitor edge or other pointer barriers).
To start receiving relative pointer events, a client must first bind the
global interface "wp_relative_pointer_manager" which, if a compositor
supports relative pointer motion events, is exposed by the registry. After
having created the relative pointer manager proxy object, the client uses
it to create the actual relative pointer object using the
"get_relative_pointer" request given a wl_pointer. The relative pointer
motion events will then, when applicable, be transmitted via the proxy of
the newly created relative pointer object. See the documentation of the
relative pointer interface for more details.
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.
</description>
<interface name="zwp_relative_pointer_manager_v1" version="1">
<description summary="get relative pointer objects">
A global interface used for getting the relative pointer object for a
given pointer.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the relative pointer manager object">
Used by the client to notify the server that it will no longer use this
relative pointer manager object.
</description>
</request>
<request name="get_relative_pointer">
<description summary="get a relative pointer object">
Create a relative pointer interface given a wl_pointer object. See the
wp_relative_pointer interface for more details.
</description>
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
<arg name="pointer" type="object" interface="wl_pointer"/>
</request>
</interface>
<interface name="zwp_relative_pointer_v1" version="1">
<description summary="relative pointer object">
A wp_relative_pointer object is an extension to the wl_pointer interface
used for emitting relative pointer events. It shares the same focus as
wl_pointer objects of the same seat and will only emit events when it has
focus.
</description>
<request name="destroy" type="destructor">
<description summary="release the relative pointer object"/>
</request>
<event name="relative_motion">
<description summary="relative pointer motion">
Relative x/y pointer motion from the pointer of the seat associated with
this object.
A relative motion is in the same dimension as regular wl_pointer motion
events, except they do not represent an absolute position. For example,
moving a pointer from (x, y) to (x', y') would have the equivalent
relative motion (x' - x, y' - y). If a pointer motion caused the
absolute pointer position to be clipped by for example the edge of the
monitor, the relative motion is unaffected by the clipping and will
represent the unclipped motion.
This event also contains non-accelerated motion deltas. The
non-accelerated delta is, when applicable, the regular pointer motion
delta as it was before having applied motion acceleration and other
transformations such as normalization.
Note that the non-accelerated delta does not represent 'raw' events as
they were read from some device. Pointer motion acceleration is device-
and configuration-specific and non-accelerated deltas and accelerated
deltas may have the same value on some devices.
Relative motions are not coupled to wl_pointer.motion events, and can be
sent in combination with such events, but also independently. There may
also be scenarios where wl_pointer.motion is sent, but there is no
relative motion. The order of an absolute and relative motion event
originating from the same physical motion is not guaranteed.
If the client needs button events or focus state, it can receive them
from a wl_pointer object of the same seat that the wp_relative_pointer
object is associated with.
</description>
<arg name="utime_hi" type="uint"
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
<arg name="utime_lo" type="uint"
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
<arg name="dx" type="fixed"
summary="the x component of the motion vector"/>
<arg name="dy" type="fixed"
summary="the y component of the motion vector"/>
<arg name="dx_unaccel" type="fixed"
summary="the x component of the unaccelerated motion vector"/>
<arg name="dy_unaccel" type="fixed"
summary="the y component of the unaccelerated motion vector"/>
</event>
</interface>
</protocol>

View File

@ -113,7 +113,7 @@
that the client prefers the provided decoration mode.
After requesting a decoration mode, the compositor will respond by
emitting a xdg_surface.configure event. The client should then update
emitting an xdg_surface.configure event. The client should then update
its content, drawing it without decorations if the received mode is
server-side decorations. The client must also acknowledge the configure
when committing the new content (see xdg_surface.ack_configure).
@ -122,7 +122,7 @@
different mode instead.
Clients whose decoration mode depend on the xdg_toplevel state may send
a set_mode request in response to a xdg_surface.configure event and wait
a set_mode request in response to an xdg_surface.configure event and wait
for the next xdg_surface.configure event to prevent unwanted state.
Such clients are responsible for preventing configure loops and must
make sure not to send multiple successive set_mode requests with the

View File

@ -58,6 +58,8 @@ fi
XDG_SHELL='stable/xdg-shell/xdg-shell.xml'
XDG_DECORATION_UNSTABLE='unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'
IDLE_INHIBIT_UNSTABLE='unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'
POINTER_CONSTRAINTS_UNSTABLE='unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'
RELATIVE_POINTER_UNSTABLE='unstable/relative-pointer/relative-pointer-unstable-v1.xml'
#Generate xdg-shell header and .c files
"$WAYSCAN" client-header "$WAYLAND_PROTOS/$XDG_SHELL" ./xdg-shell.h
@ -70,3 +72,11 @@ IDLE_INHIBIT_UNSTABLE='unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'
#Generate xdg-decoration header and .c files
"$WAYSCAN" client-header "$WAYLAND_PROTOS/$XDG_DECORATION_UNSTABLE" ./xdg-decoration-unstable-v1.h
"$WAYSCAN" $CODEGEN "$WAYLAND_PROTOS/$XDG_DECORATION_UNSTABLE" ./xdg-decoration-unstable-v1.c
#Generate pointer-constraints header and .c files
"$WAYSCAN" client-header "$WAYLAND_PROTOS/$POINTER_CONSTRAINTS_UNSTABLE" ./pointer-constraints-unstable-v1.h
"$WAYSCAN" $CODEGEN "$WAYLAND_PROTOS/$POINTER_CONSTRAINTS_UNSTABLE" ./pointer-constraints-unstable-v1.c
#Generate relative-pointer header and .c files
"$WAYSCAN" client-header "$WAYLAND_PROTOS/$RELATIVE_POINTER_UNSTABLE" ./relative-pointer-unstable-v1.h
"$WAYSCAN" $CODEGEN "$WAYLAND_PROTOS/$RELATIVE_POINTER_UNSTABLE" ./relative-pointer-unstable-v1.c