v0.3.0 96f3aeb

fractional-scale-v1_generated.go RawHistoryFolder

1// Code generated by wlturbo-scanner. DO NOT EDIT.
2// Protocol: fractional_scale_v1
3// Source: fractional-scale-v1.xml
4
5package fractionalscale
6
7import (
8	"sync"
9
10	cross_wl_surface "github.com/bnema/wlturbo/protocol/core"
11	"github.com/bnema/wlturbo/wl"
12)
13
14// ERROR_FRACTIONAL_SCALE_EXISTS is the error fractional_scale_exists value.
15const ERROR_FRACTIONAL_SCALE_EXISTS = 0
16
17// WpFractionalScaleManagerInterface is the protocol interface name.
18const WpFractionalScaleManagerInterface = "wp_fractional_scale_manager_v1"
19
20// WpFractionalScaleManager is the generated binding for wp_fractional_scale_manager_v1 version 1.
21type WpFractionalScaleManager struct {
22	wl.BaseProxy
23}
24
25// NewWpFractionalScaleManager returns an unbound WpFractionalScaleManager.
26func NewWpFractionalScaleManager(ctx *wl.Context) *WpFractionalScaleManager {
27	obj := &WpFractionalScaleManager{}
28	obj.SetContext(ctx)
29	ctx.Register(obj)
30	return obj
31}
32
33// Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_fractional_scale_v1 objects included.
34func (o *WpFractionalScaleManager) Destroy() error {
35	if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_fractional_scale_manager_v1.destroy", Destructor: true}); err != nil {
36		return err
37	}
38	return nil
39}
40
41// Create an add-on object for the the wl_surface to let the compositor request fractional scales. If the given wl_surface already has a wp_fractional_scale_v1 object associated, the fractional_scale_exists protocol error is raised.
42func (o *WpFractionalScaleManager) GetFractionalScale(surface *cross_wl_surface.Surface) (*WpFractionalScale, error) {
43	var arg1 wl.Object
44	if surface != nil {
45		arg1 = surface
46	}
47	child := &WpFractionalScale{}
48	child.SetContext(o.Context())
49	if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_fractional_scale_manager_v1.get_fractional_scale", Child: child}, child, arg1); err != nil {
50		return nil, err
51	}
52	return child, nil
53}
54
55// EventSignature returns the declared event argument types in wire order.
56func (o *WpFractionalScaleManager) EventSignature(opcode uint16) (string, bool) {
57	switch opcode {
58	default:
59		return "", false
60	}
61}
62
63// Dispatch decodes one event on wp_fractional_scale_manager_v1 and calls the registered handlers.
64func (o *WpFractionalScaleManager) Dispatch(event *wl.Event) {
65	switch event.Opcode {
66	default:
67	}
68}
69
70// WpFractionalScaleInterface is the protocol interface name.
71const WpFractionalScaleInterface = "wp_fractional_scale_v1"
72
73// WpFractionalScale is the generated binding for wp_fractional_scale_v1 version 1.
74type WpFractionalScale struct {
75	wl.BaseProxy
76	// handlersMu guards the handler slices: a client may register or replace
77	// handlers while another goroutine dispatches events.
78	handlersMu       sync.Mutex
79	onPreferredScale []func(scale uint32)
80}
81
82// NewWpFractionalScale returns an unbound WpFractionalScale.
83func NewWpFractionalScale(ctx *wl.Context) *WpFractionalScale {
84	obj := &WpFractionalScale{}
85	obj.SetContext(ctx)
86	ctx.Register(obj)
87	return obj
88}
89
90// Destroy the fractional scale object. When this object is destroyed, preferred_scale events will no longer be sent.
91func (o *WpFractionalScale) Destroy() error {
92	if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_fractional_scale_v1.destroy", Destructor: true}); err != nil {
93		return err
94	}
95	return nil
96}
97
98// OnPreferredScale registers a handler for the preferred_scale event.
99//
100// Handlers are appended, so a second call adds another handler rather than
101// replacing the first. Registration is safe while another goroutine dispatches.
102func (o *WpFractionalScale) OnPreferredScale(handler func(scale uint32)) {
103	if handler == nil {
104		return
105	}
106	o.handlersMu.Lock()
107	defer o.handlersMu.Unlock()
108	o.onPreferredScale = append(o.onPreferredScale, handler)
109}
110
111// handlersForPreferredScale returns the handlers registered for preferred_scale, taken
112// under the lock so a handler may register another handler while events are
113// being dispatched.
114func (o *WpFractionalScale) handlersForPreferredScale() []func(scale uint32) {
115	o.handlersMu.Lock()
116	defer o.handlersMu.Unlock()
117	return o.onPreferredScale
118}
119
120// EventSignature returns the declared event argument types in wire order.
121func (o *WpFractionalScale) EventSignature(opcode uint16) (string, bool) {
122	switch opcode {
123	case 0:
124		return "uint,", true
125	default:
126		return "", false
127	}
128}
129
130// Dispatch decodes one event on wp_fractional_scale_v1 and calls the registered handlers.
131func (o *WpFractionalScale) Dispatch(event *wl.Event) {
132	switch event.Opcode {
133	case 0: // preferred_scale
134		scale := event.Uint32()
135
136		for i, handler := range o.handlersForPreferredScale() {
137			_ = i
138			handler(scale)
139		}
140	default:
141	}
142}

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