main 5004296

extsessionlock_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: ext_session_lock_v1
3// Source: ext-session-lock-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright 2021 Isaac Freund
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 shall be included in
16// all copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24// THE SOFTWARE.
25
26package extsessionlock
27
28import (
29	"sync"
30
31	cross_wl_output "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// ERROR_INVALID_DESTROY is the error invalid_destroy value.
37const ERROR_INVALID_DESTROY = 0
38
39// ERROR_INVALID_UNLOCK is the error invalid_unlock value.
40const ERROR_INVALID_UNLOCK = 1
41
42// ERROR_ROLE is the error role value.
43const ERROR_ROLE = 2
44
45// ERROR_DUPLICATE_OUTPUT is the error duplicate_output value.
46const ERROR_DUPLICATE_OUTPUT = 3
47
48// ERROR_ALREADY_CONSTRUCTED is the error already_constructed value.
49const ERROR_ALREADY_CONSTRUCTED = 4
50
51// ERROR_COMMIT_BEFORE_FIRST_ACK is the error commit_before_first_ack value.
52const ERROR_COMMIT_BEFORE_FIRST_ACK = 0
53
54// ERROR_NULL_BUFFER is the error null_buffer value.
55const ERROR_NULL_BUFFER = 1
56
57// ERROR_DIMENSIONS_MISMATCH is the error dimensions_mismatch value.
58const ERROR_DIMENSIONS_MISMATCH = 2
59
60// ERROR_INVALID_SERIAL is the error invalid_serial value.
61const ERROR_INVALID_SERIAL = 3
62
63// ExtSessionLockManagerInterface is the protocol interface name.
64const ExtSessionLockManagerInterface = "ext_session_lock_manager_v1"
65
66// ExtSessionLockManager is the generated binding for ext_session_lock_manager_v1 version 1.
67type ExtSessionLockManager struct {
68	wl.BaseProxy
69}
70
71// NewExtSessionLockManager returns an unbound ExtSessionLockManager.
72func NewExtSessionLockManager(ctx *wl.Context) *ExtSessionLockManager {
73	obj := &ExtSessionLockManager{}
74	obj.SetContext(ctx)
75	ctx.Register(obj)
76	return obj
77}
78
79// This informs the compositor that the session lock manager object will no longer be used. Existing objects created through this interface remain valid.
80func (o *ExtSessionLockManager) Destroy() error {
81	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "ext_session_lock_manager_v1.destroy", Destructor: true}); err != nil {
82		return err
83	}
84	return nil
85}
86
87// This request creates a session lock and asks the compositor to lock the session. The compositor will send either the ext_session_lock_v1.locked or ext_session_lock_v1.finished event on the created object in response to this request.
88func (o *ExtSessionLockManager) Lock() (*ExtSessionLock, error) {
89	child := &ExtSessionLock{}
90	child.SetContext(o.Context())
91	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "ext_session_lock_manager_v1.lock", Child: child}, wl.ArgObject(child)); err != nil {
92		return nil, err
93	}
94	return child, nil
95}
96
97// EventSignature returns the declared event argument types in wire order.
98func (o *ExtSessionLockManager) EventSignature(opcode uint16) (string, bool) {
99	switch opcode {
100	default:
101		return "", false
102	}
103}
104
105// Dispatch decodes one event on ext_session_lock_manager_v1 and calls the registered handlers.
106func (o *ExtSessionLockManager) Dispatch(event *wl.Event) {
107	switch event.Opcode {
108	default:
109	}
110}
111
112// ExtSessionLockInterface is the protocol interface name.
113const ExtSessionLockInterface = "ext_session_lock_v1"
114
115// ExtSessionLock is the generated binding for ext_session_lock_v1 version 1.
116type ExtSessionLock struct {
117	wl.BaseProxy
118	// handlersMu guards the handler slices: a client may register or replace
119	// handlers while another goroutine dispatches events.
120	handlersMu sync.Mutex
121	onLocked   []func()
122	onFinished []func()
123}
124
125// NewExtSessionLock returns an unbound ExtSessionLock.
126func NewExtSessionLock(ctx *wl.Context) *ExtSessionLock {
127	obj := &ExtSessionLock{}
128	obj.SetContext(ctx)
129	ctx.Register(obj)
130	return obj
131}
132
133// This informs the compositor that the lock object will no longer be used. Existing objects created through this interface remain valid. After this request is made, lock surfaces created through this object should be destroyed by the client as they will no longer be used by the compositor. It is a protocol error to make this request if the locked event was sent, the unlock_and_destroy request must be used instead.
134func (o *ExtSessionLock) Destroy() error {
135	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "ext_session_lock_v1.destroy", Destructor: true}); err != nil {
136		return err
137	}
138	return nil
139}
140
141// The client is expected to create lock surfaces for all outputs currently present and any new outputs as they are advertised. These won't be displayed by the compositor unless the lock is successful and the locked event is sent. Providing a wl_surface which already has a role or already has a buffer attached or committed is a protocol error, as is attaching/committing a buffer before the first ext_session_lock_surface_v1.configure event. Attempting to create more than one lock surface for a given output is a duplicate_output protocol error.
142func (o *ExtSessionLock) GetLockSurface(surface *cross_wl_surface.Surface, output *cross_wl_output.Output) (*ExtSessionLockSurface, error) {
143	var arg1 wl.Object
144	if surface != nil {
145		arg1 = surface
146	}
147	var arg2 wl.Object
148	if output != nil {
149		arg2 = output
150	}
151	child := &ExtSessionLockSurface{}
152	child.SetContext(o.Context())
153	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "ext_session_lock_v1.get_lock_surface", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1), wl.ArgObject(arg2)); err != nil {
154		return nil, err
155	}
156	return child, nil
157}
158
159// This request indicates that the session should be unlocked, for example because the user has entered their password and it has been verified by the client. This request also informs the compositor that the lock object will no longer be used and should be destroyed. Existing objects created through this interface remain valid. After this request is made, lock surfaces created through this object should be destroyed by the client as they will no longer be used by the compositor. It is a protocol error to make this request if the locked event has not been sent. In that case, the lock object must be destroyed using the destroy request. Note that a correct client that wishes to exit directly after unlocking the session must use the wl_display.sync request to ensure the server receives and processes the unlock_and_destroy request. Otherwise there is no guarantee that the server has unlocked the session due to the asynchronous nature of the Wayland protocol. For example, the server might terminate the client with a protocol error before it processes the unlock_and_destroy request.
160func (o *ExtSessionLock) UnlockAndDestroy() error {
161	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "ext_session_lock_v1.unlock_and_destroy", Destructor: true}); err != nil {
162		return err
163	}
164	return nil
165}
166
167// OnLocked registers a handler for the locked event.
168//
169// Handlers are appended, so a second call adds another handler rather than
170// replacing the first. Registration is safe while another goroutine dispatches.
171func (o *ExtSessionLock) OnLocked(handler func()) {
172	if handler == nil {
173		return
174	}
175	o.handlersMu.Lock()
176	defer o.handlersMu.Unlock()
177	o.onLocked = append(o.onLocked, handler)
178}
179
180// handlersForLocked returns the handlers registered for locked, taken
181// under the lock so a handler may register another handler while events are
182// being dispatched.
183func (o *ExtSessionLock) handlersForLocked() []func() {
184	o.handlersMu.Lock()
185	defer o.handlersMu.Unlock()
186	return o.onLocked
187}
188
189// OnFinished registers a handler for the finished event.
190//
191// Handlers are appended, so a second call adds another handler rather than
192// replacing the first. Registration is safe while another goroutine dispatches.
193func (o *ExtSessionLock) OnFinished(handler func()) {
194	if handler == nil {
195		return
196	}
197	o.handlersMu.Lock()
198	defer o.handlersMu.Unlock()
199	o.onFinished = append(o.onFinished, handler)
200}
201
202// handlersForFinished returns the handlers registered for finished, taken
203// under the lock so a handler may register another handler while events are
204// being dispatched.
205func (o *ExtSessionLock) handlersForFinished() []func() {
206	o.handlersMu.Lock()
207	defer o.handlersMu.Unlock()
208	return o.onFinished
209}
210
211// EventSignature returns the declared event argument types in wire order.
212func (o *ExtSessionLock) EventSignature(opcode uint16) (string, bool) {
213	switch opcode {
214	case 0:
215		return "", true
216	case 1:
217		return "", true
218	default:
219		return "", false
220	}
221}
222
223// Dispatch decodes one event on ext_session_lock_v1 and calls the registered handlers.
224func (o *ExtSessionLock) Dispatch(event *wl.Event) {
225	switch event.Opcode {
226	case 0: // locked
227
228		for i, handler := range o.handlersForLocked() {
229			_ = i
230			handler()
231		}
232	case 1: // finished
233
234		for i, handler := range o.handlersForFinished() {
235			_ = i
236			handler()
237		}
238	default:
239	}
240}
241
242// ExtSessionLockSurfaceInterface is the protocol interface name.
243const ExtSessionLockSurfaceInterface = "ext_session_lock_surface_v1"
244
245// ExtSessionLockSurface is the generated binding for ext_session_lock_surface_v1 version 1.
246type ExtSessionLockSurface struct {
247	wl.BaseProxy
248	// handlersMu guards the handler slices: a client may register or replace
249	// handlers while another goroutine dispatches events.
250	handlersMu  sync.Mutex
251	onConfigure []func(serial uint32, width uint32, height uint32)
252}
253
254// NewExtSessionLockSurface returns an unbound ExtSessionLockSurface.
255func NewExtSessionLockSurface(ctx *wl.Context) *ExtSessionLockSurface {
256	obj := &ExtSessionLockSurface{}
257	obj.SetContext(ctx)
258	ctx.Register(obj)
259	return obj
260}
261
262// This informs the compositor that the lock surface object will no longer be used. It is recommended for a lock client to destroy lock surfaces if their corresponding wl_output global is removed. If a lock surface on an active output is destroyed before the ext_session_lock_v1.unlock_and_destroy event is sent, the compositor must fall back to rendering a solid color.
263func (o *ExtSessionLockSurface) Destroy() error {
264	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "ext_session_lock_surface_v1.destroy", Destructor: true}); err != nil {
265		return err
266	}
267	return nil
268}
269
270// When a configure event is received, if a client commits the surface in response to the configure event, then the client must make an ack_configure request sometime before the commit request, passing along the serial of the configure event. If the client receives multiple configure events before it can respond to one, it only has to ack the last configure event. A client is not required to commit immediately after sending an ack_configure request - it may even ack_configure several times before its next surface commit. 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 configure event referenced by the given serial, as well as all older configure events sent on this object. It is a protocol error to issue multiple ack_configure requests referencing the same configure event or to issue an ack_configure request referencing a configure event older than the last configure event acked for a given lock surface.
271func (o *ExtSessionLockSurface) AckConfigure(serial uint32) error {
272	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "ext_session_lock_surface_v1.ack_configure"}, wl.ArgUint(serial)); err != nil {
273		return err
274	}
275	return nil
276}
277
278// OnConfigure registers a handler for the configure event.
279//
280// Handlers are appended, so a second call adds another handler rather than
281// replacing the first. Registration is safe while another goroutine dispatches.
282func (o *ExtSessionLockSurface) OnConfigure(handler func(serial uint32, width uint32, height uint32)) {
283	if handler == nil {
284		return
285	}
286	o.handlersMu.Lock()
287	defer o.handlersMu.Unlock()
288	o.onConfigure = append(o.onConfigure, handler)
289}
290
291// handlersForConfigure returns the handlers registered for configure, taken
292// under the lock so a handler may register another handler while events are
293// being dispatched.
294func (o *ExtSessionLockSurface) handlersForConfigure() []func(serial uint32, width uint32, height uint32) {
295	o.handlersMu.Lock()
296	defer o.handlersMu.Unlock()
297	return o.onConfigure
298}
299
300// EventSignature returns the declared event argument types in wire order.
301func (o *ExtSessionLockSurface) EventSignature(opcode uint16) (string, bool) {
302	switch opcode {
303	case 0:
304		return "uint,uint,uint,", true
305	default:
306		return "", false
307	}
308}
309
310// Dispatch decodes one event on ext_session_lock_surface_v1 and calls the registered handlers.
311func (o *ExtSessionLockSurface) Dispatch(event *wl.Event) {
312	switch event.Opcode {
313	case 0: // configure
314		serial := event.Uint32()
315		width := event.Uint32()
316		height := event.Uint32()
317
318		for i, handler := range o.handlersForConfigure() {
319			_ = i
320			handler(serial, width, height)
321		}
322	default:
323	}
324}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 1

↑↓ moveenter openesc close