1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: pointer_warp_v1
3// Source: pointer-warp-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2024 Neal Gompa
7// Copyright © 2024 Xaver Hugl
8// Copyright © 2024 Matthias Klumpp
9// Copyright © 2024 Vlad Zahorodnii
10//
11// Permission is hereby granted, free of charge, to any person obtaining a
12// copy of this software and associated documentation files (the "Software"),
13// to deal in the Software without restriction, including without limitation
14// the rights to use, copy, modify, merge, publish, distribute, sublicense,
15// and/or sell copies of the Software, and to permit persons to whom the
16// Software is furnished to do so, subject to the following conditions:
17// The above copyright notice and this permission notice (including the next
18// paragraph) shall be included in all copies or substantial portions of the
19// Software.
20// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26// DEALINGS IN THE SOFTWARE.
27
28package pointerwarp
29
30import (
31 cross_wl_pointer "github.com/bnema/go-wayland-bindings/client/wayland"
32 cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
33 "github.com/bnema/wlturbo/wl"
34)
35
36// WpPointerWarpInterface is the protocol interface name.
37const WpPointerWarpInterface = "wp_pointer_warp_v1"
38
39// WpPointerWarp is the generated binding for wp_pointer_warp_v1 version 1.
40type WpPointerWarp struct {
41 wl.BaseProxy
42}
43
44// NewWpPointerWarp returns an unbound WpPointerWarp.
45func NewWpPointerWarp(ctx *wl.Context) *WpPointerWarp {
46 obj := &WpPointerWarp{}
47 obj.SetContext(ctx)
48 ctx.Register(obj)
49 return obj
50}
51
52// Destroy the pointer warp manager.
53func (o *WpPointerWarp) Destroy() error {
54 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_pointer_warp_v1.destroy", Destructor: true}); err != nil {
55 return err
56 }
57 return nil
58}
59
60// Request the compositor to move the pointer to a surface-local position. Whether or not the compositor honors the request is implementation defined, but it should - honor it if the surface has pointer focus, including when it has an implicit pointer grab - reject it if the enter serial is incorrect - reject it if the requested position is outside of the surface Note that the enter serial is valid for any surface of the client, and does not have to be from the surface the pointer is warped to.
61func (o *WpPointerWarp) WarpPointer(surface *cross_wl_surface.Surface, pointer *cross_wl_pointer.Pointer, x wl.Fixed, y wl.Fixed, serial uint32) error {
62 var arg0 wl.Object
63 if surface != nil {
64 arg0 = surface
65 }
66 var arg1 wl.Object
67 if pointer != nil {
68 arg1 = pointer
69 }
70 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_pointer_warp_v1.warp_pointer"}, wl.ArgObject(arg0), wl.ArgObject(arg1), wl.ArgFixed(x), wl.ArgFixed(y), wl.ArgUint(serial)); err != nil {
71 return err
72 }
73 return nil
74}
75
76// EventSignature returns the declared event argument types in wire order.
77func (o *WpPointerWarp) EventSignature(opcode uint16) (string, bool) {
78 switch opcode {
79 default:
80 return "", false
81 }
82}
83
84// Dispatch decodes one event on wp_pointer_warp_v1 and calls the registered handlers.
85func (o *WpPointerWarp) Dispatch(event *wl.Event) {
86 switch event.Opcode {
87 default:
88 }
89}