1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: xwayland_shell_v1
3// Source: xwayland-shell-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2022 Joshua Ashton
7//
8// Permission is hereby granted, free of charge, to any person obtaining a
9// copy of this software and associated documentation files (the "Software"),
10// to deal in the Software without restriction, including without limitation
11// the rights to use, copy, modify, merge, publish, distribute, sublicense,
12// and/or sell copies of the Software, and to permit persons to whom the
13// Software is furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice (including the next
16// paragraph) shall be included in all copies or substantial portions of the
17// Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26
27package xwaylandshell
28
29import (
30 cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
31 "github.com/bnema/wlturbo/wl"
32)
33
34// ERROR_ROLE is the error role value.
35const ERROR_ROLE = 0
36
37// ERROR_ALREADY_ASSOCIATED is the error already_associated value.
38const ERROR_ALREADY_ASSOCIATED = 0
39
40// ERROR_INVALID_SERIAL is the error invalid_serial value.
41const ERROR_INVALID_SERIAL = 1
42
43// XwaylandShellInterface is the protocol interface name.
44const XwaylandShellInterface = "xwayland_shell_v1"
45
46// XwaylandShell is the generated binding for xwayland_shell_v1 version 1.
47type XwaylandShell struct {
48 wl.BaseProxy
49}
50
51// NewXwaylandShell returns an unbound XwaylandShell.
52func NewXwaylandShell(ctx *wl.Context) *XwaylandShell {
53 obj := &XwaylandShell{}
54 obj.SetContext(ctx)
55 ctx.Register(obj)
56 return obj
57}
58
59// Destroy the xwayland_shell_v1 object. The child objects created via this interface are unaffected.
60func (o *XwaylandShell) Destroy() error {
61 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "xwayland_shell_v1.destroy", Destructor: true}); err != nil {
62 return err
63 }
64 return nil
65}
66
67// Create an xwayland_surface_v1 interface for a given wl_surface object and gives it the xwayland_surface role. It is illegal to create an xwayland_surface_v1 for a wl_surface which already has an assigned role and this will result in the `role` protocol error. See the documentation of xwayland_surface_v1 for more details about what an xwayland_surface_v1 is and how it is used.
68func (o *XwaylandShell) GetXwaylandSurface(surface *cross_wl_surface.Surface) (*XwaylandSurface, error) {
69 var arg1 wl.Object
70 if surface != nil {
71 arg1 = surface
72 }
73 child := &XwaylandSurface{}
74 child.SetContext(o.Context())
75 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "xwayland_shell_v1.get_xwayland_surface", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
76 return nil, err
77 }
78 return child, nil
79}
80
81// EventSignature returns the declared event argument types in wire order.
82func (o *XwaylandShell) EventSignature(opcode uint16) (string, bool) {
83 switch opcode {
84 default:
85 return "", false
86 }
87}
88
89// Dispatch decodes one event on xwayland_shell_v1 and calls the registered handlers.
90func (o *XwaylandShell) Dispatch(event *wl.Event) {
91 switch event.Opcode {
92 default:
93 }
94}
95
96// XwaylandSurfaceInterface is the protocol interface name.
97const XwaylandSurfaceInterface = "xwayland_surface_v1"
98
99// XwaylandSurface is the generated binding for xwayland_surface_v1 version 1.
100type XwaylandSurface struct {
101 wl.BaseProxy
102}
103
104// NewXwaylandSurface returns an unbound XwaylandSurface.
105func NewXwaylandSurface(ctx *wl.Context) *XwaylandSurface {
106 obj := &XwaylandSurface{}
107 obj.SetContext(ctx)
108 ctx.Register(obj)
109 return obj
110}
111
112// Associates an Xwayland window to a wl_surface. The association state is double-buffered, see wl_surface.commit. The `serial_lo` and `serial_hi` parameters specify a non-zero monotonic serial number which is entirely unique and provided by the Xwayland server equal to the serial value provided by a client message with a message type of the `WL_SURFACE_SERIAL` atom on the X11 window for this surface to be associated to. The serial value in the `WL_SURFACE_SERIAL` client message is specified as having the lo-bits specified in `l[0]` and the hi-bits specified in `l[1]`. If the serial value provided by `serial_lo` and `serial_hi` is not valid, the `invalid_serial` protocol error will be raised. An X11 window may be associated with multiple surfaces throughout its lifespan. (eg. unmapping and remapping a window). For each wl_surface, this state must not be committed more than once, otherwise the `already_associated` protocol error will be raised.
113func (o *XwaylandSurface) SetSerial(serialLo uint32, serialHi uint32) error {
114 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "xwayland_surface_v1.set_serial"}, wl.ArgUint(serialLo), wl.ArgUint(serialHi)); err != nil {
115 return err
116 }
117 return nil
118}
119
120// Destroy the xwayland_surface_v1 object. Any already existing associations are unaffected by this action.
121func (o *XwaylandSurface) Destroy() error {
122 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "xwayland_surface_v1.destroy", Destructor: true}); err != nil {
123 return err
124 }
125 return nil
126}
127
128// EventSignature returns the declared event argument types in wire order.
129func (o *XwaylandSurface) EventSignature(opcode uint16) (string, bool) {
130 switch opcode {
131 default:
132 return "", false
133 }
134}
135
136// Dispatch decodes one event on xwayland_surface_v1 and calls the registered handlers.
137func (o *XwaylandSurface) Dispatch(event *wl.Event) {
138 switch event.Opcode {
139 default:
140 }
141}