detached 1a6c6c9

xdgtoplevelicon_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: xdg_toplevel_icon_v1
3// Source: xdg-toplevel-icon-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2023-2024 Matthias Klumpp
7// Copyright ©      2024 David Edmundson
8//
9// Permission is hereby granted, free of charge, to any person obtaining a
10// copy of this software and associated documentation files (the "Software"),
11// to deal in the Software without restriction, including without limitation
12// the rights to use, copy, modify, merge, publish, distribute, sublicense,
13// and/or sell copies of the Software, and to permit persons to whom the
14// Software is furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice (including the next
17// paragraph) shall be included in all copies or substantial portions of the
18// Software.
19//
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 xdgtoplevelicon
29
30import (
31	"sync"
32
33	cross_wl_buffer "github.com/bnema/go-wayland-bindings/client/wayland"
34	cross_xdg_toplevel "github.com/bnema/go-wayland-bindings/client/xdgshell"
35	"github.com/bnema/wlturbo/wl"
36)
37
38// ERROR_INVALID_BUFFER is the error invalid_buffer value.
39const ERROR_INVALID_BUFFER = 1
40
41// ERROR_IMMUTABLE is the error immutable value.
42const ERROR_IMMUTABLE = 2
43
44// ERROR_NO_BUFFER is the error no_buffer value.
45const ERROR_NO_BUFFER = 3
46
47// XdgToplevelIconManagerInterface is the protocol interface name.
48const XdgToplevelIconManagerInterface = "xdg_toplevel_icon_manager_v1"
49
50// XdgToplevelIconManager is the generated binding for xdg_toplevel_icon_manager_v1 version 1.
51type XdgToplevelIconManager struct {
52	wl.BaseProxy
53	// handlersMu guards the handler slices: a client may register or replace
54	// handlers while another goroutine dispatches events.
55	handlersMu sync.Mutex
56	onIconSize []func(size int32)
57	onDone     []func()
58}
59
60// NewXdgToplevelIconManager returns an unbound XdgToplevelIconManager.
61func NewXdgToplevelIconManager(ctx *wl.Context) *XdgToplevelIconManager {
62	obj := &XdgToplevelIconManager{}
63	obj.SetContext(ctx)
64	ctx.Register(obj)
65	return obj
66}
67
68// Destroy the toplevel icon manager. This does not destroy objects created with the manager.
69func (o *XdgToplevelIconManager) Destroy() error {
70	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_toplevel_icon_manager_v1.destroy", Destructor: true}); err != nil {
71		return err
72	}
73	return nil
74}
75
76// Creates a new icon object. This icon can then be attached to a xdg_toplevel via the 'set_icon' request.
77func (o *XdgToplevelIconManager) CreateIcon() (*XdgToplevelIcon, error) {
78	child := &XdgToplevelIcon{}
79	child.SetContext(o.Context())
80	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_toplevel_icon_manager_v1.create_icon", Child: child}, wl.ArgObject(child)); err != nil {
81		return nil, err
82	}
83	return child, nil
84}
85
86// This request assigns the icon 'icon' to 'toplevel', or clears the toplevel icon if 'icon' was null. This state is double-buffered and is applied on the next wl_surface.commit of the toplevel. After making this call, the xdg_toplevel_icon_v1 provided as 'icon' can be destroyed by the client without 'toplevel' losing its icon. The xdg_toplevel_icon_v1 is immutable from this point, and any future attempts to change it must raise the 'xdg_toplevel_icon_v1.immutable' protocol error. The compositor must set the toplevel icon from either the pixel data the icon provides, or by loading a stock icon using the icon name. See the description of 'xdg_toplevel_icon_v1' for details. If 'icon' is set to null, the icon of the respective toplevel is reset to its default icon (usually the icon of the application, derived from its desktop-entry file, or a placeholder icon). If this request is passed an icon with no pixel buffers or icon name assigned, the icon must be reset just like if 'icon' was null.
87func (o *XdgToplevelIconManager) SetIcon(toplevel *cross_xdg_toplevel.XdgToplevel, icon *XdgToplevelIcon) error {
88	var arg0 wl.Object
89	if toplevel != nil {
90		arg0 = toplevel
91	}
92	var arg1 wl.Object
93	if icon != nil {
94		arg1 = icon
95	}
96	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_toplevel_icon_manager_v1.set_icon"}, wl.ArgObject(arg0), wl.ArgObject(arg1)); err != nil {
97		return err
98	}
99	return nil
100}
101
102// OnIconSize registers a handler for the icon_size 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 *XdgToplevelIconManager) OnIconSize(handler func(size int32)) {
107	if handler == nil {
108		return
109	}
110	o.handlersMu.Lock()
111	defer o.handlersMu.Unlock()
112	o.onIconSize = append(o.onIconSize, handler)
113}
114
115// handlersForIconSize returns the handlers registered for icon_size, taken
116// under the lock so a handler may register another handler while events are
117// being dispatched.
118func (o *XdgToplevelIconManager) handlersForIconSize() []func(size int32) {
119	o.handlersMu.Lock()
120	defer o.handlersMu.Unlock()
121	return o.onIconSize
122}
123
124// OnDone registers a handler for the done 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 *XdgToplevelIconManager) OnDone(handler func()) {
129	if handler == nil {
130		return
131	}
132	o.handlersMu.Lock()
133	defer o.handlersMu.Unlock()
134	o.onDone = append(o.onDone, handler)
135}
136
137// handlersForDone returns the handlers registered for done, taken
138// under the lock so a handler may register another handler while events are
139// being dispatched.
140func (o *XdgToplevelIconManager) handlersForDone() []func() {
141	o.handlersMu.Lock()
142	defer o.handlersMu.Unlock()
143	return o.onDone
144}
145
146// EventSignature returns the declared event argument types in wire order.
147func (o *XdgToplevelIconManager) EventSignature(opcode uint16) (string, bool) {
148	switch opcode {
149	case 0:
150		return "int,", true
151	case 1:
152		return "", true
153	default:
154		return "", false
155	}
156}
157
158// Dispatch decodes one event on xdg_toplevel_icon_manager_v1 and calls the registered handlers.
159func (o *XdgToplevelIconManager) Dispatch(event *wl.Event) {
160	switch event.Opcode {
161	case 0: // icon_size
162		size := event.Int32()
163
164		for i, handler := range o.handlersForIconSize() {
165			_ = i
166			handler(size)
167		}
168	case 1: // done
169
170		for i, handler := range o.handlersForDone() {
171			_ = i
172			handler()
173		}
174	default:
175	}
176}
177
178// XdgToplevelIconInterface is the protocol interface name.
179const XdgToplevelIconInterface = "xdg_toplevel_icon_v1"
180
181// XdgToplevelIcon is the generated binding for xdg_toplevel_icon_v1 version 1.
182type XdgToplevelIcon struct {
183	wl.BaseProxy
184}
185
186// NewXdgToplevelIcon returns an unbound XdgToplevelIcon.
187func NewXdgToplevelIcon(ctx *wl.Context) *XdgToplevelIcon {
188	obj := &XdgToplevelIcon{}
189	obj.SetContext(ctx)
190	ctx.Register(obj)
191	return obj
192}
193
194// Destroys the 'xdg_toplevel_icon_v1' object. The icon must still remain set on every toplevel it was assigned to, until the toplevel icon is reset explicitly.
195func (o *XdgToplevelIcon) Destroy() error {
196	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_toplevel_icon_v1.destroy", Destructor: true}); err != nil {
197		return err
198	}
199	return nil
200}
201
202// This request assigns an icon name to this icon. Any previously set name is overridden. The compositor must resolve 'icon_name' according to the lookup rules described in the XDG icon theme specification[1] using the environment's current icon theme. If the compositor does not support icon names or cannot resolve 'icon_name' according to the XDG icon theme specification it must fall back to using pixel buffer data instead. If this request is made after the icon has been assigned to a toplevel via 'set_icon', an 'immutable' error must be raised. [1]: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
203func (o *XdgToplevelIcon) SetName(iconName string) error {
204	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_toplevel_icon_v1.set_name"}, wl.ArgString(iconName)); err != nil {
205		return err
206	}
207	return nil
208}
209
210// This request adds pixel data supplied as wl_buffer to the icon. The client should add pixel data for all icon sizes and scales that it can provide, or which are explicitly requested by the compositor via 'icon_size' events on xdg_toplevel_icon_manager_v1. The wl_buffer supplying pixel data as 'buffer' must be backed by wl_shm and must be a square (width and height being equal). If any of these buffer requirements are not fulfilled, a 'invalid_buffer' error must be raised. If this icon instance already has a buffer of the same size and scale from a previous 'add_buffer' request, data from the last request overrides the preexisting pixel data. The wl_buffer must be kept alive for as long as the xdg_toplevel_icon it is associated with is not destroyed, otherwise a 'no_buffer' error is raised. The buffer contents must not be modified after it was assigned to the icon. As a result, the region of the wl_shm_pool's backing storage used for the wl_buffer must not be modified after this request is sent. The wl_buffer.release event is unused. If this request is made after the icon has been assigned to a toplevel via 'set_icon', an 'immutable' error must be raised.
211func (o *XdgToplevelIcon) AddBuffer(buffer *cross_wl_buffer.Buffer, scale int32) error {
212	var arg0 wl.Object
213	if buffer != nil {
214		arg0 = buffer
215	}
216	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_toplevel_icon_v1.add_buffer"}, wl.ArgObject(arg0), wl.ArgInt(scale)); err != nil {
217		return err
218	}
219	return nil
220}
221
222// EventSignature returns the declared event argument types in wire order.
223func (o *XdgToplevelIcon) EventSignature(opcode uint16) (string, bool) {
224	switch opcode {
225	default:
226		return "", false
227	}
228}
229
230// Dispatch decodes one event on xdg_toplevel_icon_v1 and calls the registered handlers.
231func (o *XdgToplevelIcon) Dispatch(event *wl.Event) {
232	switch event.Opcode {
233	default:
234	}
235}

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