detached 1a6c6c9

wlroutputpowermanagement_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: wlr_output_power_management_unstable_v1
3// Source: wlr-output-power-management-unstable-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2019 Purism SPC
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 wlroutputpowermanagement
28
29import (
30	"sync"
31
32	cross_wl_output "github.com/bnema/go-wayland-bindings/client/wayland"
33	"github.com/bnema/wlturbo/wl"
34)
35
36// MODE_OFF is the mode off value.
37const MODE_OFF = 0
38
39// MODE_ON is the mode on value.
40const MODE_ON = 1
41
42// ERROR_INVALID_MODE is the error invalid_mode value.
43const ERROR_INVALID_MODE = 1
44
45// OutputPowerManagerInterface is the protocol interface name.
46const OutputPowerManagerInterface = "zwlr_output_power_manager_v1"
47
48// OutputPowerManager is the generated binding for zwlr_output_power_manager_v1 version 1.
49type OutputPowerManager struct {
50	wl.BaseProxy
51}
52
53// NewOutputPowerManager returns an unbound OutputPowerManager.
54func NewOutputPowerManager(ctx *wl.Context) *OutputPowerManager {
55	obj := &OutputPowerManager{}
56	obj.SetContext(ctx)
57	ctx.Register(obj)
58	return obj
59}
60
61// Create an output power management mode control that can be used to adjust the power management mode for a given output.
62func (o *OutputPowerManager) GetOutputPower(output *cross_wl_output.Output) (*OutputPower, error) {
63	var arg1 wl.Object
64	if output != nil {
65		arg1 = output
66	}
67	child := &OutputPower{}
68	child.SetContext(o.Context())
69	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwlr_output_power_manager_v1.get_output_power", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
70		return nil, err
71	}
72	return child, nil
73}
74
75// All objects created by the manager will still remain valid, until their appropriate destroy request has been called.
76func (o *OutputPowerManager) Destroy() error {
77	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwlr_output_power_manager_v1.destroy", Destructor: true}); err != nil {
78		return err
79	}
80	return nil
81}
82
83// EventSignature returns the declared event argument types in wire order.
84func (o *OutputPowerManager) EventSignature(opcode uint16) (string, bool) {
85	switch opcode {
86	default:
87		return "", false
88	}
89}
90
91// Dispatch decodes one event on zwlr_output_power_manager_v1 and calls the registered handlers.
92func (o *OutputPowerManager) Dispatch(event *wl.Event) {
93	switch event.Opcode {
94	default:
95	}
96}
97
98// OutputPowerInterface is the protocol interface name.
99const OutputPowerInterface = "zwlr_output_power_v1"
100
101// OutputPower is the generated binding for zwlr_output_power_v1 version 1.
102type OutputPower struct {
103	wl.BaseProxy
104	// handlersMu guards the handler slices: a client may register or replace
105	// handlers while another goroutine dispatches events.
106	handlersMu sync.Mutex
107	onMode     []func(mode uint32)
108	onFailed   []func()
109}
110
111// NewOutputPower returns an unbound OutputPower.
112func NewOutputPower(ctx *wl.Context) *OutputPower {
113	obj := &OutputPower{}
114	obj.SetContext(ctx)
115	ctx.Register(obj)
116	return obj
117}
118
119// Set an output's power save mode to the given mode. The mode change is effective immediately. If the output does not support the given mode a failed event is sent.
120func (o *OutputPower) SetMode(mode uint32) error {
121	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwlr_output_power_v1.set_mode"}, wl.ArgUint(mode)); err != nil {
122		return err
123	}
124	return nil
125}
126
127// Destroys the output power management mode control object.
128func (o *OutputPower) Destroy() error {
129	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwlr_output_power_v1.destroy", Destructor: true}); err != nil {
130		return err
131	}
132	return nil
133}
134
135// OnMode registers a handler for the mode event.
136//
137// Handlers are appended, so a second call adds another handler rather than
138// replacing the first. Registration is safe while another goroutine dispatches.
139func (o *OutputPower) OnMode(handler func(mode uint32)) {
140	if handler == nil {
141		return
142	}
143	o.handlersMu.Lock()
144	defer o.handlersMu.Unlock()
145	o.onMode = append(o.onMode, handler)
146}
147
148// handlersForMode returns the handlers registered for mode, taken
149// under the lock so a handler may register another handler while events are
150// being dispatched.
151func (o *OutputPower) handlersForMode() []func(mode uint32) {
152	o.handlersMu.Lock()
153	defer o.handlersMu.Unlock()
154	return o.onMode
155}
156
157// OnFailed registers a handler for the failed event.
158//
159// Handlers are appended, so a second call adds another handler rather than
160// replacing the first. Registration is safe while another goroutine dispatches.
161func (o *OutputPower) OnFailed(handler func()) {
162	if handler == nil {
163		return
164	}
165	o.handlersMu.Lock()
166	defer o.handlersMu.Unlock()
167	o.onFailed = append(o.onFailed, handler)
168}
169
170// handlersForFailed returns the handlers registered for failed, taken
171// under the lock so a handler may register another handler while events are
172// being dispatched.
173func (o *OutputPower) handlersForFailed() []func() {
174	o.handlersMu.Lock()
175	defer o.handlersMu.Unlock()
176	return o.onFailed
177}
178
179// EventSignature returns the declared event argument types in wire order.
180func (o *OutputPower) EventSignature(opcode uint16) (string, bool) {
181	switch opcode {
182	case 0:
183		return "uint,", true
184	case 1:
185		return "", true
186	default:
187		return "", false
188	}
189}
190
191// Dispatch decodes one event on zwlr_output_power_v1 and calls the registered handlers.
192func (o *OutputPower) Dispatch(event *wl.Event) {
193	switch event.Opcode {
194	case 0: // mode
195		mode := event.Uint32()
196
197		for i, handler := range o.handlersForMode() {
198			_ = i
199			handler(mode)
200		}
201	case 1: // failed
202
203		for i, handler := range o.handlersForFailed() {
204			_ = i
205			handler()
206		}
207	default:
208	}
209}

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