detached 1a6c6c9

extworkspace_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: ext_workspace_v1
3// Source: ext-workspace-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2019 Christopher Billington
7// Copyright © 2020 Ilia Bozhinov
8// Copyright © 2022 Victoria Brekenfeld
9//
10// Permission to use, copy, modify, distribute, and sell this
11// software and its documentation for any purpose is hereby granted
12// without fee, provided that the above copyright notice appear in
13// all copies and that both that copyright notice and this permission
14// notice appear in supporting documentation, and that the name of
15// the copyright holders not be used in advertising or publicity
16// pertaining to distribution of the software without specific,
17// written prior permission.  The copyright holders make no
18// representations about the suitability of this software for any
19// purpose.  It is provided "as is" without express or implied
20// warranty.
21//
22// THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
23// SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
24// FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
25// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
26// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
27// AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
29// THIS SOFTWARE.
30
31package extworkspace
32
33import (
34	"sync"
35
36	"github.com/bnema/wlturbo/wl"
37)
38
39// GROUP_CAPABILITIES_CREATE_WORKSPACE is the group_capabilities create_workspace value.
40const GROUP_CAPABILITIES_CREATE_WORKSPACE = 1
41
42// STATE_ACTIVE is the state active value.
43const STATE_ACTIVE = 1
44
45// STATE_URGENT is the state urgent value.
46const STATE_URGENT = 2
47
48// STATE_HIDDEN is the state hidden value.
49const STATE_HIDDEN = 4
50
51// WORKSPACE_CAPABILITIES_ACTIVATE is the workspace_capabilities activate value.
52const WORKSPACE_CAPABILITIES_ACTIVATE = 1
53
54// WORKSPACE_CAPABILITIES_DEACTIVATE is the workspace_capabilities deactivate value.
55const WORKSPACE_CAPABILITIES_DEACTIVATE = 2
56
57// WORKSPACE_CAPABILITIES_REMOVE is the workspace_capabilities remove value.
58const WORKSPACE_CAPABILITIES_REMOVE = 4
59
60// WORKSPACE_CAPABILITIES_ASSIGN is the workspace_capabilities assign value.
61const WORKSPACE_CAPABILITIES_ASSIGN = 8
62
63// ExtWorkspaceManagerInterface is the protocol interface name.
64const ExtWorkspaceManagerInterface = "ext_workspace_manager_v1"
65
66// ExtWorkspaceManager is the generated binding for ext_workspace_manager_v1 version 1.
67type ExtWorkspaceManager struct {
68	wl.BaseProxy
69	// handlersMu guards the handler slices: a client may register or replace
70	// handlers while another goroutine dispatches events.
71	handlersMu       sync.Mutex
72	onWorkspaceGroup []func(workspaceGroupObject *ExtWorkspaceGroupHandle)
73	onWorkspace      []func(workspaceObject *ExtWorkspaceHandle)
74	onDone           []func()
75	onFinished       []func()
76}
77
78// NewExtWorkspaceManager returns an unbound ExtWorkspaceManager.
79func NewExtWorkspaceManager(ctx *wl.Context) *ExtWorkspaceManager {
80	obj := &ExtWorkspaceManager{}
81	obj.SetContext(ctx)
82	ctx.Register(obj)
83	return obj
84}
85
86// The client must send this request after it has finished sending other requests. The compositor must process a series of requests preceding a commit request atomically. This allows changes to the workspace properties to be seen as atomic, even if they happen via multiple events, and even if they involve multiple ext_workspace_handle_v1 objects, for example, deactivating one workspace and activating another.
87func (o *ExtWorkspaceManager) Commit() error {
88	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "ext_workspace_manager_v1.commit"}); err != nil {
89		return err
90	}
91	return nil
92}
93
94// Indicates the client no longer wishes to receive events for new workspace groups. However the compositor may emit further workspace events, until the finished event is emitted. The compositor is expected to send the finished event eventually once the stop request has been processed. The client must not send any requests after this one, doing so will raise a wl_display invalid_object error.
95func (o *ExtWorkspaceManager) Stop() error {
96	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "ext_workspace_manager_v1.stop"}); err != nil {
97		return err
98	}
99	return nil
100}
101
102// OnWorkspaceGroup registers a handler for the workspace_group event.
103//
104// Handlers are appended, so a second call adds another handler rather than
105// replacing the first. Registration is safe while another goroutine dispatches.
106func (o *ExtWorkspaceManager) OnWorkspaceGroup(handler func(workspaceGroupObject *ExtWorkspaceGroupHandle)) {
107	if handler == nil {
108		return
109	}
110	o.handlersMu.Lock()
111	defer o.handlersMu.Unlock()
112	o.onWorkspaceGroup = append(o.onWorkspaceGroup, handler)
113}
114
115// handlersForWorkspaceGroup returns the handlers registered for workspace_group, taken
116// under the lock so a handler may register another handler while events are
117// being dispatched.
118func (o *ExtWorkspaceManager) handlersForWorkspaceGroup() []func(workspaceGroupObject *ExtWorkspaceGroupHandle) {
119	o.handlersMu.Lock()
120	defer o.handlersMu.Unlock()
121	return o.onWorkspaceGroup
122}
123
124// OnWorkspace registers a handler for the workspace event.
125//
126// Handlers are appended, so a second call adds another handler rather than
127// replacing the first. Registration is safe while another goroutine dispatches.
128func (o *ExtWorkspaceManager) OnWorkspace(handler func(workspaceObject *ExtWorkspaceHandle)) {
129	if handler == nil {
130		return
131	}
132	o.handlersMu.Lock()
133	defer o.handlersMu.Unlock()
134	o.onWorkspace = append(o.onWorkspace, handler)
135}
136
137// handlersForWorkspace returns the handlers registered for workspace, taken
138// under the lock so a handler may register another handler while events are
139// being dispatched.
140func (o *ExtWorkspaceManager) handlersForWorkspace() []func(workspaceObject *ExtWorkspaceHandle) {
141	o.handlersMu.Lock()
142	defer o.handlersMu.Unlock()
143	return o.onWorkspace
144}
145
146// OnDone registers a handler for the done event.
147//
148// Handlers are appended, so a second call adds another handler rather than
149// replacing the first. Registration is safe while another goroutine dispatches.
150func (o *ExtWorkspaceManager) OnDone(handler func()) {
151	if handler == nil {
152		return
153	}
154	o.handlersMu.Lock()
155	defer o.handlersMu.Unlock()
156	o.onDone = append(o.onDone, handler)
157}
158
159// handlersForDone returns the handlers registered for done, taken
160// under the lock so a handler may register another handler while events are
161// being dispatched.
162func (o *ExtWorkspaceManager) handlersForDone() []func() {
163	o.handlersMu.Lock()
164	defer o.handlersMu.Unlock()
165	return o.onDone
166}
167
168// OnFinished registers a handler for the finished event.
169//
170// Handlers are appended, so a second call adds another handler rather than
171// replacing the first. Registration is safe while another goroutine dispatches.
172func (o *ExtWorkspaceManager) OnFinished(handler func()) {
173	if handler == nil {
174		return
175	}
176	o.handlersMu.Lock()
177	defer o.handlersMu.Unlock()
178	o.onFinished = append(o.onFinished, handler)
179}
180
181// handlersForFinished returns the handlers registered for finished, taken
182// under the lock so a handler may register another handler while events are
183// being dispatched.
184func (o *ExtWorkspaceManager) handlersForFinished() []func() {
185	o.handlersMu.Lock()
186	defer o.handlersMu.Unlock()
187	return o.onFinished
188}
189
190// EventSignature returns the declared event argument types in wire order.
191func (o *ExtWorkspaceManager) EventSignature(opcode uint16) (string, bool) {
192	switch opcode {
193	case 0:
194		return "new_id,", true
195	case 1:
196		return "new_id,", true
197	case 2:
198		return "", true
199	case 3:
200		return "", true
201	default:
202		return "", false
203	}
204}
205
206// Dispatch decodes one event on ext_workspace_manager_v1 and calls the registered handlers.
207func (o *ExtWorkspaceManager) Dispatch(event *wl.Event) {
208	switch event.Opcode {
209	case 0: // workspace_group
210		workspaceGroupID := event.Uint32()
211		workspaceGroupObject := &ExtWorkspaceGroupHandle{}
212		workspaceGroupObject.SetContext(o.Context())
213		workspaceGroupObject.SetID(workspaceGroupID)
214		workspaceGroupObject.SetVersion(o.Version())
215		o.Context().Register(workspaceGroupObject)
216
217		for i, handler := range o.handlersForWorkspaceGroup() {
218			_ = i
219			handler(workspaceGroupObject)
220		}
221	case 1: // workspace
222		workspaceID := event.Uint32()
223		workspaceObject := &ExtWorkspaceHandle{}
224		workspaceObject.SetContext(o.Context())
225		workspaceObject.SetID(workspaceID)
226		workspaceObject.SetVersion(o.Version())
227		o.Context().Register(workspaceObject)
228
229		for i, handler := range o.handlersForWorkspace() {
230			_ = i
231			handler(workspaceObject)
232		}
233	case 2: // done
234
235		for i, handler := range o.handlersForDone() {
236			_ = i
237			handler()
238		}
239	case 3: // finished
240
241		for i, handler := range o.handlersForFinished() {
242			_ = i
243			handler()
244		}
245		o.Context().Unregister(o)
246	default:
247	}
248}
249
250// ExtWorkspaceGroupHandleInterface is the protocol interface name.
251const ExtWorkspaceGroupHandleInterface = "ext_workspace_group_handle_v1"
252
253// ExtWorkspaceGroupHandle is the generated binding for ext_workspace_group_handle_v1 version 1.
254type ExtWorkspaceGroupHandle struct {
255	wl.BaseProxy
256	// handlersMu guards the handler slices: a client may register or replace
257	// handlers while another goroutine dispatches events.
258	handlersMu       sync.Mutex
259	onCapabilities   []func(capabilities uint32)
260	onOutputEnter    []func(outputID uint32)
261	onOutputLeave    []func(outputID uint32)
262	onWorkspaceEnter []func(workspaceID uint32)
263	onWorkspaceLeave []func(workspaceID uint32)
264	onRemoved        []func()
265}
266
267// NewExtWorkspaceGroupHandle returns an unbound ExtWorkspaceGroupHandle.
268func NewExtWorkspaceGroupHandle(ctx *wl.Context) *ExtWorkspaceGroupHandle {
269	obj := &ExtWorkspaceGroupHandle{}
270	obj.SetContext(ctx)
271	ctx.Register(obj)
272	return obj
273}
274
275// Request that the compositor create a new workspace with the given name and assign it to this group. There is no guarantee that the compositor will create a new workspace, or that the created workspace will have the provided name.
276func (o *ExtWorkspaceGroupHandle) CreateWorkspace(workspace string) error {
277	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "ext_workspace_group_handle_v1.create_workspace"}, wl.ArgString(workspace)); err != nil {
278		return err
279	}
280	return nil
281}
282
283// Destroys the ext_workspace_group_handle_v1 object. This request should be send either when the client does not want to use the workspace group object any more or after the removed event to finalize the destruction of the object.
284func (o *ExtWorkspaceGroupHandle) Destroy() error {
285	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "ext_workspace_group_handle_v1.destroy", Destructor: true}); err != nil {
286		return err
287	}
288	return nil
289}
290
291// OnCapabilities registers a handler for the capabilities event.
292//
293// Handlers are appended, so a second call adds another handler rather than
294// replacing the first. Registration is safe while another goroutine dispatches.
295func (o *ExtWorkspaceGroupHandle) OnCapabilities(handler func(capabilities uint32)) {
296	if handler == nil {
297		return
298	}
299	o.handlersMu.Lock()
300	defer o.handlersMu.Unlock()
301	o.onCapabilities = append(o.onCapabilities, handler)
302}
303
304// handlersForCapabilities returns the handlers registered for capabilities, taken
305// under the lock so a handler may register another handler while events are
306// being dispatched.
307func (o *ExtWorkspaceGroupHandle) handlersForCapabilities() []func(capabilities uint32) {
308	o.handlersMu.Lock()
309	defer o.handlersMu.Unlock()
310	return o.onCapabilities
311}
312
313// OnOutputEnter registers a handler for the output_enter event.
314//
315// Handlers are appended, so a second call adds another handler rather than
316// replacing the first. Registration is safe while another goroutine dispatches.
317func (o *ExtWorkspaceGroupHandle) OnOutputEnter(handler func(outputID uint32)) {
318	if handler == nil {
319		return
320	}
321	o.handlersMu.Lock()
322	defer o.handlersMu.Unlock()
323	o.onOutputEnter = append(o.onOutputEnter, handler)
324}
325
326// handlersForOutputEnter returns the handlers registered for output_enter, taken
327// under the lock so a handler may register another handler while events are
328// being dispatched.
329func (o *ExtWorkspaceGroupHandle) handlersForOutputEnter() []func(outputID uint32) {
330	o.handlersMu.Lock()
331	defer o.handlersMu.Unlock()
332	return o.onOutputEnter
333}
334
335// OnOutputLeave registers a handler for the output_leave event.
336//
337// Handlers are appended, so a second call adds another handler rather than
338// replacing the first. Registration is safe while another goroutine dispatches.
339func (o *ExtWorkspaceGroupHandle) OnOutputLeave(handler func(outputID uint32)) {
340	if handler == nil {
341		return
342	}
343	o.handlersMu.Lock()
344	defer o.handlersMu.Unlock()
345	o.onOutputLeave = append(o.onOutputLeave, handler)
346}
347
348// handlersForOutputLeave returns the handlers registered for output_leave, taken
349// under the lock so a handler may register another handler while events are
350// being dispatched.
351func (o *ExtWorkspaceGroupHandle) handlersForOutputLeave() []func(outputID uint32) {
352	o.handlersMu.Lock()
353	defer o.handlersMu.Unlock()
354	return o.onOutputLeave
355}
356
357// OnWorkspaceEnter registers a handler for the workspace_enter event.
358//
359// Handlers are appended, so a second call adds another handler rather than
360// replacing the first. Registration is safe while another goroutine dispatches.
361func (o *ExtWorkspaceGroupHandle) OnWorkspaceEnter(handler func(workspaceID uint32)) {
362	if handler == nil {
363		return
364	}
365	o.handlersMu.Lock()
366	defer o.handlersMu.Unlock()
367	o.onWorkspaceEnter = append(o.onWorkspaceEnter, handler)
368}
369
370// handlersForWorkspaceEnter returns the handlers registered for workspace_enter, taken
371// under the lock so a handler may register another handler while events are
372// being dispatched.
373func (o *ExtWorkspaceGroupHandle) handlersForWorkspaceEnter() []func(workspaceID uint32) {
374	o.handlersMu.Lock()
375	defer o.handlersMu.Unlock()
376	return o.onWorkspaceEnter
377}
378
379// OnWorkspaceLeave registers a handler for the workspace_leave event.
380//
381// Handlers are appended, so a second call adds another handler rather than
382// replacing the first. Registration is safe while another goroutine dispatches.
383func (o *ExtWorkspaceGroupHandle) OnWorkspaceLeave(handler func(workspaceID uint32)) {
384	if handler == nil {
385		return
386	}
387	o.handlersMu.Lock()
388	defer o.handlersMu.Unlock()
389	o.onWorkspaceLeave = append(o.onWorkspaceLeave, handler)
390}
391
392// handlersForWorkspaceLeave returns the handlers registered for workspace_leave, taken
393// under the lock so a handler may register another handler while events are
394// being dispatched.
395func (o *ExtWorkspaceGroupHandle) handlersForWorkspaceLeave() []func(workspaceID uint32) {
396	o.handlersMu.Lock()
397	defer o.handlersMu.Unlock()
398	return o.onWorkspaceLeave
399}
400
401// OnRemoved registers a handler for the removed event.
402//
403// Handlers are appended, so a second call adds another handler rather than
404// replacing the first. Registration is safe while another goroutine dispatches.
405func (o *ExtWorkspaceGroupHandle) OnRemoved(handler func()) {
406	if handler == nil {
407		return
408	}
409	o.handlersMu.Lock()
410	defer o.handlersMu.Unlock()
411	o.onRemoved = append(o.onRemoved, handler)
412}
413
414// handlersForRemoved returns the handlers registered for removed, taken
415// under the lock so a handler may register another handler while events are
416// being dispatched.
417func (o *ExtWorkspaceGroupHandle) handlersForRemoved() []func() {
418	o.handlersMu.Lock()
419	defer o.handlersMu.Unlock()
420	return o.onRemoved
421}
422
423// EventSignature returns the declared event argument types in wire order.
424func (o *ExtWorkspaceGroupHandle) EventSignature(opcode uint16) (string, bool) {
425	switch opcode {
426	case 0:
427		return "uint,", true
428	case 1:
429		return "object,", true
430	case 2:
431		return "object,", true
432	case 3:
433		return "object,", true
434	case 4:
435		return "object,", true
436	case 5:
437		return "", true
438	default:
439		return "", false
440	}
441}
442
443// Dispatch decodes one event on ext_workspace_group_handle_v1 and calls the registered handlers.
444func (o *ExtWorkspaceGroupHandle) Dispatch(event *wl.Event) {
445	switch event.Opcode {
446	case 0: // capabilities
447		capabilities := event.Uint32()
448
449		for i, handler := range o.handlersForCapabilities() {
450			_ = i
451			handler(capabilities)
452		}
453	case 1: // output_enter
454		outputID := event.Uint32()
455
456		for i, handler := range o.handlersForOutputEnter() {
457			_ = i
458			handler(outputID)
459		}
460	case 2: // output_leave
461		outputID := event.Uint32()
462
463		for i, handler := range o.handlersForOutputLeave() {
464			_ = i
465			handler(outputID)
466		}
467	case 3: // workspace_enter
468		workspaceID := event.Uint32()
469
470		for i, handler := range o.handlersForWorkspaceEnter() {
471			_ = i
472			handler(workspaceID)
473		}
474	case 4: // workspace_leave
475		workspaceID := event.Uint32()
476
477		for i, handler := range o.handlersForWorkspaceLeave() {
478			_ = i
479			handler(workspaceID)
480		}
481	case 5: // removed
482
483		for i, handler := range o.handlersForRemoved() {
484			_ = i
485			handler()
486		}
487	default:
488	}
489}
490
491// ExtWorkspaceHandleInterface is the protocol interface name.
492const ExtWorkspaceHandleInterface = "ext_workspace_handle_v1"
493
494// ExtWorkspaceHandle is the generated binding for ext_workspace_handle_v1 version 1.
495type ExtWorkspaceHandle struct {
496	wl.BaseProxy
497	// handlersMu guards the handler slices: a client may register or replace
498	// handlers while another goroutine dispatches events.
499	handlersMu     sync.Mutex
500	onId           []func(id string)
501	onName         []func(name string)
502	onCoordinates  []func(coordinates []byte)
503	onState        []func(state uint32)
504	onCapabilities []func(capabilities uint32)
505	onRemoved      []func()
506}
507
508// NewExtWorkspaceHandle returns an unbound ExtWorkspaceHandle.
509func NewExtWorkspaceHandle(ctx *wl.Context) *ExtWorkspaceHandle {
510	obj := &ExtWorkspaceHandle{}
511	obj.SetContext(ctx)
512	ctx.Register(obj)
513	return obj
514}
515
516// Destroys the ext_workspace_handle_v1 object. This request should be made either when the client does not want to use the workspace object any more or after the remove event to finalize the destruction of the object.
517func (o *ExtWorkspaceHandle) Destroy() error {
518	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "ext_workspace_handle_v1.destroy", Destructor: true}); err != nil {
519		return err
520	}
521	return nil
522}
523
524// Request that this workspace be activated. There is no guarantee the workspace will be actually activated, and behaviour may be compositor-dependent. For example, activating a workspace may or may not deactivate all other workspaces in the same group.
525func (o *ExtWorkspaceHandle) Activate() error {
526	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "ext_workspace_handle_v1.activate"}); err != nil {
527		return err
528	}
529	return nil
530}
531
532// Request that this workspace be deactivated. There is no guarantee the workspace will be actually deactivated.
533func (o *ExtWorkspaceHandle) Deactivate() error {
534	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "ext_workspace_handle_v1.deactivate"}); err != nil {
535		return err
536	}
537	return nil
538}
539
540// Requests that this workspace is assigned to the given workspace group. There is no guarantee the workspace will be assigned.
541func (o *ExtWorkspaceHandle) Assign(workspaceGroup *ExtWorkspaceGroupHandle) error {
542	var arg0 wl.Object
543	if workspaceGroup != nil {
544		arg0 = workspaceGroup
545	}
546	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "ext_workspace_handle_v1.assign"}, wl.ArgObject(arg0)); err != nil {
547		return err
548	}
549	return nil
550}
551
552// Request that this workspace be removed. There is no guarantee the workspace will be actually removed.
553func (o *ExtWorkspaceHandle) Remove() error {
554	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 4, Name: "ext_workspace_handle_v1.remove"}); err != nil {
555		return err
556	}
557	return nil
558}
559
560// OnId registers a handler for the id event.
561//
562// Handlers are appended, so a second call adds another handler rather than
563// replacing the first. Registration is safe while another goroutine dispatches.
564func (o *ExtWorkspaceHandle) OnId(handler func(id string)) {
565	if handler == nil {
566		return
567	}
568	o.handlersMu.Lock()
569	defer o.handlersMu.Unlock()
570	o.onId = append(o.onId, handler)
571}
572
573// handlersForId returns the handlers registered for id, taken
574// under the lock so a handler may register another handler while events are
575// being dispatched.
576func (o *ExtWorkspaceHandle) handlersForId() []func(id string) {
577	o.handlersMu.Lock()
578	defer o.handlersMu.Unlock()
579	return o.onId
580}
581
582// OnName registers a handler for the name event.
583//
584// Handlers are appended, so a second call adds another handler rather than
585// replacing the first. Registration is safe while another goroutine dispatches.
586func (o *ExtWorkspaceHandle) OnName(handler func(name string)) {
587	if handler == nil {
588		return
589	}
590	o.handlersMu.Lock()
591	defer o.handlersMu.Unlock()
592	o.onName = append(o.onName, handler)
593}
594
595// handlersForName returns the handlers registered for name, taken
596// under the lock so a handler may register another handler while events are
597// being dispatched.
598func (o *ExtWorkspaceHandle) handlersForName() []func(name string) {
599	o.handlersMu.Lock()
600	defer o.handlersMu.Unlock()
601	return o.onName
602}
603
604// OnCoordinates registers a handler for the coordinates event.
605//
606// Handlers are appended, so a second call adds another handler rather than
607// replacing the first. Registration is safe while another goroutine dispatches.
608func (o *ExtWorkspaceHandle) OnCoordinates(handler func(coordinates []byte)) {
609	if handler == nil {
610		return
611	}
612	o.handlersMu.Lock()
613	defer o.handlersMu.Unlock()
614	o.onCoordinates = append(o.onCoordinates, handler)
615}
616
617// handlersForCoordinates returns the handlers registered for coordinates, taken
618// under the lock so a handler may register another handler while events are
619// being dispatched.
620func (o *ExtWorkspaceHandle) handlersForCoordinates() []func(coordinates []byte) {
621	o.handlersMu.Lock()
622	defer o.handlersMu.Unlock()
623	return o.onCoordinates
624}
625
626// OnState registers a handler for the state event.
627//
628// Handlers are appended, so a second call adds another handler rather than
629// replacing the first. Registration is safe while another goroutine dispatches.
630func (o *ExtWorkspaceHandle) OnState(handler func(state uint32)) {
631	if handler == nil {
632		return
633	}
634	o.handlersMu.Lock()
635	defer o.handlersMu.Unlock()
636	o.onState = append(o.onState, handler)
637}
638
639// handlersForState returns the handlers registered for state, taken
640// under the lock so a handler may register another handler while events are
641// being dispatched.
642func (o *ExtWorkspaceHandle) handlersForState() []func(state uint32) {
643	o.handlersMu.Lock()
644	defer o.handlersMu.Unlock()
645	return o.onState
646}
647
648// OnCapabilities registers a handler for the capabilities event.
649//
650// Handlers are appended, so a second call adds another handler rather than
651// replacing the first. Registration is safe while another goroutine dispatches.
652func (o *ExtWorkspaceHandle) OnCapabilities(handler func(capabilities uint32)) {
653	if handler == nil {
654		return
655	}
656	o.handlersMu.Lock()
657	defer o.handlersMu.Unlock()
658	o.onCapabilities = append(o.onCapabilities, handler)
659}
660
661// handlersForCapabilities returns the handlers registered for capabilities, taken
662// under the lock so a handler may register another handler while events are
663// being dispatched.
664func (o *ExtWorkspaceHandle) handlersForCapabilities() []func(capabilities uint32) {
665	o.handlersMu.Lock()
666	defer o.handlersMu.Unlock()
667	return o.onCapabilities
668}
669
670// OnRemoved registers a handler for the removed event.
671//
672// Handlers are appended, so a second call adds another handler rather than
673// replacing the first. Registration is safe while another goroutine dispatches.
674func (o *ExtWorkspaceHandle) OnRemoved(handler func()) {
675	if handler == nil {
676		return
677	}
678	o.handlersMu.Lock()
679	defer o.handlersMu.Unlock()
680	o.onRemoved = append(o.onRemoved, handler)
681}
682
683// handlersForRemoved returns the handlers registered for removed, taken
684// under the lock so a handler may register another handler while events are
685// being dispatched.
686func (o *ExtWorkspaceHandle) handlersForRemoved() []func() {
687	o.handlersMu.Lock()
688	defer o.handlersMu.Unlock()
689	return o.onRemoved
690}
691
692// EventSignature returns the declared event argument types in wire order.
693func (o *ExtWorkspaceHandle) EventSignature(opcode uint16) (string, bool) {
694	switch opcode {
695	case 0:
696		return "string,", true
697	case 1:
698		return "string,", true
699	case 2:
700		return "array,", true
701	case 3:
702		return "uint,", true
703	case 4:
704		return "uint,", true
705	case 5:
706		return "", true
707	default:
708		return "", false
709	}
710}
711
712// Dispatch decodes one event on ext_workspace_handle_v1 and calls the registered handlers.
713func (o *ExtWorkspaceHandle) Dispatch(event *wl.Event) {
714	switch event.Opcode {
715	case 0: // id
716		id := event.String()
717
718		for i, handler := range o.handlersForId() {
719			_ = i
720			handler(id)
721		}
722	case 1: // name
723		name := event.String()
724
725		for i, handler := range o.handlersForName() {
726			_ = i
727			handler(name)
728		}
729	case 2: // coordinates
730		coordinates := event.Array()
731
732		for i, handler := range o.handlersForCoordinates() {
733			_ = i
734			handler(coordinates)
735		}
736	case 3: // state
737		state := event.Uint32()
738
739		for i, handler := range o.handlersForState() {
740			_ = i
741			handler(state)
742		}
743	case 4: // capabilities
744		capabilities := event.Uint32()
745
746		for i, handler := range o.handlersForCapabilities() {
747			_ = i
748			handler(capabilities)
749		}
750	case 5: // removed
751
752		for i, handler := range o.handlersForRemoved() {
753			_ = i
754			handler()
755		}
756	default:
757	}
758}

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