v0.5.0 089fa12

primary-selection-unstable-v1_generated.go RawHistoryFolder

1// Code generated by wlturbo-scanner. DO NOT EDIT.
2// Protocol: wp_primary_selection_unstable_v1
3// Source: primary-selection-unstable-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2015, 2016 Red Hat
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 primaryselection
28
29import (
30	"sync"
31
32	cross_wl_seat "github.com/bnema/wlturbo/protocol/core"
33	"github.com/bnema/wlturbo/wl"
34)
35
36// PrimarySelectionDeviceManagerInterface is the protocol interface name.
37const PrimarySelectionDeviceManagerInterface = "zwp_primary_selection_device_manager_v1"
38
39// PrimarySelectionDeviceManager is the generated binding for zwp_primary_selection_device_manager_v1 version 1.
40type PrimarySelectionDeviceManager struct {
41	wl.BaseProxy
42}
43
44// NewPrimarySelectionDeviceManager returns an unbound PrimarySelectionDeviceManager.
45func NewPrimarySelectionDeviceManager(ctx *wl.Context) *PrimarySelectionDeviceManager {
46	obj := &PrimarySelectionDeviceManager{}
47	obj.SetContext(ctx)
48	ctx.Register(obj)
49	return obj
50}
51
52// Create a new primary selection source.
53func (o *PrimarySelectionDeviceManager) CreateSource() (*PrimarySelectionSource, error) {
54	child := &PrimarySelectionSource{}
55	child.SetContext(o.Context())
56	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_primary_selection_device_manager_v1.create_source", Child: child}, wl.ArgObject(child)); err != nil {
57		return nil, err
58	}
59	return child, nil
60}
61
62// Create a new data device for a given seat.
63func (o *PrimarySelectionDeviceManager) GetDevice(seat *cross_wl_seat.Seat) (*PrimarySelectionDevice, error) {
64	var arg1 wl.Object
65	if seat != nil {
66		arg1 = seat
67	}
68	child := &PrimarySelectionDevice{}
69	child.SetContext(o.Context())
70	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_primary_selection_device_manager_v1.get_device", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
71		return nil, err
72	}
73	return child, nil
74}
75
76// Destroy the primary selection device manager.
77func (o *PrimarySelectionDeviceManager) Destroy() error {
78	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_primary_selection_device_manager_v1.destroy", Destructor: true}); err != nil {
79		return err
80	}
81	return nil
82}
83
84// EventSignature returns the declared event argument types in wire order.
85func (o *PrimarySelectionDeviceManager) EventSignature(opcode uint16) (string, bool) {
86	switch opcode {
87	default:
88		return "", false
89	}
90}
91
92// Dispatch decodes one event on zwp_primary_selection_device_manager_v1 and calls the registered handlers.
93func (o *PrimarySelectionDeviceManager) Dispatch(event *wl.Event) {
94	switch event.Opcode {
95	default:
96	}
97}
98
99// PrimarySelectionDeviceInterface is the protocol interface name.
100const PrimarySelectionDeviceInterface = "zwp_primary_selection_device_v1"
101
102// PrimarySelectionDevice is the generated binding for zwp_primary_selection_device_v1 version 1.
103type PrimarySelectionDevice struct {
104	wl.BaseProxy
105	// handlersMu guards the handler slices: a client may register or replace
106	// handlers while another goroutine dispatches events.
107	handlersMu  sync.Mutex
108	onDataOffer []func(offerObject *PrimarySelectionOffer)
109	onSelection []func(idID uint32)
110}
111
112// NewPrimarySelectionDevice returns an unbound PrimarySelectionDevice.
113func NewPrimarySelectionDevice(ctx *wl.Context) *PrimarySelectionDevice {
114	obj := &PrimarySelectionDevice{}
115	obj.SetContext(ctx)
116	ctx.Register(obj)
117	return obj
118}
119
120// Replaces the current selection. The previous owner of the primary selection will receive a wp_primary_selection_source.cancelled event. To unset the selection, set the source to NULL.
121func (o *PrimarySelectionDevice) SetSelection(source *PrimarySelectionSource, serial uint32) error {
122	var arg0 wl.Object
123	if source != nil {
124		arg0 = source
125	}
126	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_primary_selection_device_v1.set_selection"}, wl.ArgObject(arg0), wl.ArgUint(serial)); err != nil {
127		return err
128	}
129	return nil
130}
131
132// Destroy the primary selection device.
133func (o *PrimarySelectionDevice) Destroy() error {
134	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_primary_selection_device_v1.destroy", Destructor: true}); err != nil {
135		return err
136	}
137	return nil
138}
139
140// OnDataOffer registers a handler for the data_offer event.
141//
142// Handlers are appended, so a second call adds another handler rather than
143// replacing the first. Registration is safe while another goroutine dispatches.
144func (o *PrimarySelectionDevice) OnDataOffer(handler func(offerObject *PrimarySelectionOffer)) {
145	if handler == nil {
146		return
147	}
148	o.handlersMu.Lock()
149	defer o.handlersMu.Unlock()
150	o.onDataOffer = append(o.onDataOffer, handler)
151}
152
153// handlersForDataOffer returns the handlers registered for data_offer, taken
154// under the lock so a handler may register another handler while events are
155// being dispatched.
156func (o *PrimarySelectionDevice) handlersForDataOffer() []func(offerObject *PrimarySelectionOffer) {
157	o.handlersMu.Lock()
158	defer o.handlersMu.Unlock()
159	return o.onDataOffer
160}
161
162// OnSelection registers a handler for the selection event.
163//
164// Handlers are appended, so a second call adds another handler rather than
165// replacing the first. Registration is safe while another goroutine dispatches.
166func (o *PrimarySelectionDevice) OnSelection(handler func(idID uint32)) {
167	if handler == nil {
168		return
169	}
170	o.handlersMu.Lock()
171	defer o.handlersMu.Unlock()
172	o.onSelection = append(o.onSelection, handler)
173}
174
175// handlersForSelection returns the handlers registered for selection, taken
176// under the lock so a handler may register another handler while events are
177// being dispatched.
178func (o *PrimarySelectionDevice) handlersForSelection() []func(idID uint32) {
179	o.handlersMu.Lock()
180	defer o.handlersMu.Unlock()
181	return o.onSelection
182}
183
184// EventSignature returns the declared event argument types in wire order.
185func (o *PrimarySelectionDevice) EventSignature(opcode uint16) (string, bool) {
186	switch opcode {
187	case 0:
188		return "new_id,", true
189	case 1:
190		return "object,", true
191	default:
192		return "", false
193	}
194}
195
196// Dispatch decodes one event on zwp_primary_selection_device_v1 and calls the registered handlers.
197func (o *PrimarySelectionDevice) Dispatch(event *wl.Event) {
198	switch event.Opcode {
199	case 0: // data_offer
200		offerID := event.Uint32()
201		offerObject := &PrimarySelectionOffer{}
202		offerObject.SetContext(o.Context())
203		offerObject.SetID(offerID)
204		offerObject.SetVersion(o.Version())
205		o.Context().Register(offerObject)
206
207		for i, handler := range o.handlersForDataOffer() {
208			_ = i
209			handler(offerObject)
210		}
211	case 1: // selection
212		idID := event.Uint32()
213
214		for i, handler := range o.handlersForSelection() {
215			_ = i
216			handler(idID)
217		}
218	default:
219	}
220}
221
222// PrimarySelectionOfferInterface is the protocol interface name.
223const PrimarySelectionOfferInterface = "zwp_primary_selection_offer_v1"
224
225// PrimarySelectionOffer is the generated binding for zwp_primary_selection_offer_v1 version 1.
226type PrimarySelectionOffer struct {
227	wl.BaseProxy
228	// handlersMu guards the handler slices: a client may register or replace
229	// handlers while another goroutine dispatches events.
230	handlersMu sync.Mutex
231	onOffer    []func(mimeType string)
232}
233
234// NewPrimarySelectionOffer returns an unbound PrimarySelectionOffer.
235func NewPrimarySelectionOffer(ctx *wl.Context) *PrimarySelectionOffer {
236	obj := &PrimarySelectionOffer{}
237	obj.SetContext(ctx)
238	ctx.Register(obj)
239	return obj
240}
241
242// To transfer the contents of the primary selection clipboard, the client issues this request and indicates the mime type that it wants to receive. The transfer happens through the passed file descriptor (typically created with the pipe system call). The source client writes the data in the mime type representation requested and then closes the file descriptor. The receiving client reads from the read end of the pipe until EOF and closes its end, at which point the transfer is complete.
243func (o *PrimarySelectionOffer) Receive(mimeType string, fd int) error {
244	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_primary_selection_offer_v1.receive", FDs: []int{fd}}, wl.ArgString(mimeType), wl.ArgFD()); err != nil {
245		return err
246	}
247	return nil
248}
249
250// Destroy the primary selection offer.
251func (o *PrimarySelectionOffer) Destroy() error {
252	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_primary_selection_offer_v1.destroy", Destructor: true}); err != nil {
253		return err
254	}
255	return nil
256}
257
258// OnOffer registers a handler for the offer event.
259//
260// Handlers are appended, so a second call adds another handler rather than
261// replacing the first. Registration is safe while another goroutine dispatches.
262func (o *PrimarySelectionOffer) OnOffer(handler func(mimeType string)) {
263	if handler == nil {
264		return
265	}
266	o.handlersMu.Lock()
267	defer o.handlersMu.Unlock()
268	o.onOffer = append(o.onOffer, handler)
269}
270
271// handlersForOffer returns the handlers registered for offer, taken
272// under the lock so a handler may register another handler while events are
273// being dispatched.
274func (o *PrimarySelectionOffer) handlersForOffer() []func(mimeType string) {
275	o.handlersMu.Lock()
276	defer o.handlersMu.Unlock()
277	return o.onOffer
278}
279
280// EventSignature returns the declared event argument types in wire order.
281func (o *PrimarySelectionOffer) EventSignature(opcode uint16) (string, bool) {
282	switch opcode {
283	case 0:
284		return "string,", true
285	default:
286		return "", false
287	}
288}
289
290// Dispatch decodes one event on zwp_primary_selection_offer_v1 and calls the registered handlers.
291func (o *PrimarySelectionOffer) Dispatch(event *wl.Event) {
292	switch event.Opcode {
293	case 0: // offer
294		mimeType := event.String()
295
296		for i, handler := range o.handlersForOffer() {
297			_ = i
298			handler(mimeType)
299		}
300	default:
301	}
302}
303
304// PrimarySelectionSourceInterface is the protocol interface name.
305const PrimarySelectionSourceInterface = "zwp_primary_selection_source_v1"
306
307// PrimarySelectionSource is the generated binding for zwp_primary_selection_source_v1 version 1.
308type PrimarySelectionSource struct {
309	wl.BaseProxy
310	// handlersMu guards the handler slices: a client may register or replace
311	// handlers while another goroutine dispatches events.
312	handlersMu  sync.Mutex
313	onSend      []func(mimeType string, fd *wl.OwnedFD)
314	onCancelled []func()
315}
316
317// NewPrimarySelectionSource returns an unbound PrimarySelectionSource.
318func NewPrimarySelectionSource(ctx *wl.Context) *PrimarySelectionSource {
319	obj := &PrimarySelectionSource{}
320	obj.SetContext(ctx)
321	ctx.Register(obj)
322	return obj
323}
324
325// This request adds a mime type to the set of mime types advertised to targets. Can be called several times to offer multiple types.
326func (o *PrimarySelectionSource) Offer(mimeType string) error {
327	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_primary_selection_source_v1.offer"}, wl.ArgString(mimeType)); err != nil {
328		return err
329	}
330	return nil
331}
332
333// Destroy the primary selection source.
334func (o *PrimarySelectionSource) Destroy() error {
335	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_primary_selection_source_v1.destroy", Destructor: true}); err != nil {
336		return err
337	}
338	return nil
339}
340
341// OnSend registers a handler for the send event.
342//
343// Handlers are appended, so a second call adds another handler rather than
344// replacing the first. Registration is safe while another goroutine dispatches.
345func (o *PrimarySelectionSource) OnSend(handler func(mimeType string, fd *wl.OwnedFD)) {
346	if handler == nil {
347		return
348	}
349	o.handlersMu.Lock()
350	defer o.handlersMu.Unlock()
351	o.onSend = append(o.onSend, handler)
352}
353
354// handlersForSend returns the handlers registered for send, taken
355// under the lock so a handler may register another handler while events are
356// being dispatched.
357func (o *PrimarySelectionSource) handlersForSend() []func(mimeType string, fd *wl.OwnedFD) {
358	o.handlersMu.Lock()
359	defer o.handlersMu.Unlock()
360	return o.onSend
361}
362
363// OnCancelled registers a handler for the cancelled event.
364//
365// Handlers are appended, so a second call adds another handler rather than
366// replacing the first. Registration is safe while another goroutine dispatches.
367func (o *PrimarySelectionSource) OnCancelled(handler func()) {
368	if handler == nil {
369		return
370	}
371	o.handlersMu.Lock()
372	defer o.handlersMu.Unlock()
373	o.onCancelled = append(o.onCancelled, handler)
374}
375
376// handlersForCancelled returns the handlers registered for cancelled, taken
377// under the lock so a handler may register another handler while events are
378// being dispatched.
379func (o *PrimarySelectionSource) handlersForCancelled() []func() {
380	o.handlersMu.Lock()
381	defer o.handlersMu.Unlock()
382	return o.onCancelled
383}
384
385// EventSignature returns the declared event argument types in wire order.
386func (o *PrimarySelectionSource) EventSignature(opcode uint16) (string, bool) {
387	switch opcode {
388	case 0:
389		return "string,fd,", true
390	case 1:
391		return "", true
392	default:
393		return "", false
394	}
395}
396
397// Dispatch decodes one event on zwp_primary_selection_source_v1 and calls the registered handlers.
398func (o *PrimarySelectionSource) Dispatch(event *wl.Event) {
399	switch event.Opcode {
400	case 0: // send
401		mimeType := event.String()
402		fd := event.FD()
403		ownedfd := fd
404		defer ownedfd.Close()
405
406		for i, handler := range o.handlersForSend() {
407			if i > 0 {
408				fd = nil
409			}
410			handler(mimeType, fd)
411		}
412	case 1: // cancelled
413
414		for i, handler := range o.handlersForCancelled() {
415			_ = i
416			handler()
417		}
418	default:
419	}
420}

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 8

↑↓ moveenter openesc close