detached 1a6c6c9

xdgsessionmanagement_generated.go RawHistoryFolder

1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright 2018 Mike Blumenkrantz
5// Copyright 2018 Samsung Electronics Co., Ltd
6// Copyright 2018 Red Hat Inc.
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 xdgsessionmanagement
28
29import (
30	"fmt"
31	xdgshell "github.com/bnema/go-wayland-bindings/server/xdgshell"
32	"github.com/bnema/purego-libwayland/server"
33	"runtime"
34)
35
36var SessionManagerV1Interface *server.Interface
37var SessionV1Interface *server.Interface
38var ToplevelSessionV1Interface *server.Interface
39
40func init() {
41	SessionManagerV1Interface = &server.Interface{Name: "xdg_session_manager_v1", Version: 1}
42	SessionV1Interface = &server.Interface{Name: "xdg_session_v1", Version: 1}
43	ToplevelSessionV1Interface = &server.Interface{Name: "xdg_toplevel_session_v1", Version: 1}
44	SessionManagerV1Interface.Requests = []server.Message{
45		{Name: "destroy", Signature: "", Types: []*server.Interface{}},
46		{Name: "get_session", Signature: "nu?s", Types: []*server.Interface{SessionV1Interface, nil, nil}},
47	}
48	SessionManagerV1Interface.Events = []server.Message{}
49	SessionV1Interface.Requests = []server.Message{
50		{Name: "destroy", Signature: "", Types: []*server.Interface{}},
51		{Name: "remove", Signature: "", Types: []*server.Interface{}},
52		{Name: "add_toplevel", Signature: "nos", Types: []*server.Interface{ToplevelSessionV1Interface, xdgshell.ToplevelInterface, nil}},
53		{Name: "restore_toplevel", Signature: "nos", Types: []*server.Interface{ToplevelSessionV1Interface, xdgshell.ToplevelInterface, nil}},
54		{Name: "remove_toplevel", Signature: "s", Types: []*server.Interface{nil}},
55	}
56	SessionV1Interface.Events = []server.Message{
57		{Name: "created", Signature: "s", Types: []*server.Interface{nil}},
58		{Name: "restored", Signature: "", Types: []*server.Interface{}},
59		{Name: "replaced", Signature: "", Types: []*server.Interface{}},
60	}
61	ToplevelSessionV1Interface.Requests = []server.Message{
62		{Name: "destroy", Signature: "", Types: []*server.Interface{}},
63		{Name: "rename", Signature: "s", Types: []*server.Interface{nil}},
64	}
65	ToplevelSessionV1Interface.Events = []server.Message{
66		{Name: "restored", Signature: "", Types: []*server.Interface{}},
67	}
68	if err := server.NewInterfaces(SessionManagerV1Interface, SessionV1Interface, ToplevelSessionV1Interface); err != nil {
69		panic(err)
70	}
71}
72
73// SessionManagerV1 manage sessions for applications.
74type SessionManagerV1 struct{ *server.Resource }
75
76func WrapSessionManagerV1(r *server.Resource) *SessionManagerV1 {
77	if r == nil {
78		return nil
79	}
80	return &SessionManagerV1{r}
81}
82
83const SessionManagerV1RequestDestroy uint32 = 0
84const SessionManagerV1RequestGetSession uint32 = 1
85
86// SessionManagerV1Error .
87type SessionManagerV1Error uint32
88
89const (
90	SessionManagerV1ErrorInUse            SessionManagerV1Error = 1
91	SessionManagerV1ErrorInvalidSessionId SessionManagerV1Error = 2
92	SessionManagerV1ErrorInvalidReason    SessionManagerV1Error = 3
93)
94
95// SessionManagerV1Reason reason for getting a session.
96type SessionManagerV1Reason uint32
97
98const (
99	SessionManagerV1ReasonLaunch         SessionManagerV1Reason = 1
100	SessionManagerV1ReasonRecover        SessionManagerV1Reason = 2
101	SessionManagerV1ReasonSessionRestore SessionManagerV1Reason = 3
102)
103
104// SessionManagerV1Handler handles xdg_session_manager_v1 requests.
105type SessionManagerV1Handler interface {
106	Destroy(self *SessionManagerV1)
107	GetSession(self *SessionManagerV1, id uint32, reason uint32, sessionId string)
108}
109
110func NewSessionManagerV1(c server.Client, version int32, id uint32, h SessionManagerV1Handler) (*SessionManagerV1, error) {
111	if h == nil {
112		return nil, fmt.Errorf("purego-libwayland: nil handler for xdg_session_manager_v1")
113	}
114	var self *SessionManagerV1
115	r, err := c.CreateResource(SessionManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
116		switch opcode {
117		case 0:
118			h.Destroy(self)
119			self.Destroy()
120		case 1:
121			h.GetSession(self, args[0].NewID(), args[1].Uint(), args[2].String())
122		}
123	})
124	if err != nil {
125		return nil, err
126	}
127	self = WrapSessionManagerV1(r)
128	r.Data = self
129	return self, nil
130}
131func NewSessionManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
132	return d.CreateGlobal(SessionManagerV1Interface, version, bind)
133}
134
135// SessionV1 A session for an application.
136type SessionV1 struct{ *server.Resource }
137
138func WrapSessionV1(r *server.Resource) *SessionV1 {
139	if r == nil {
140		return nil
141	}
142	return &SessionV1{r}
143}
144
145const SessionV1RequestDestroy uint32 = 0
146const SessionV1RequestRemove uint32 = 1
147const SessionV1RequestAddToplevel uint32 = 2
148const SessionV1RequestRestoreToplevel uint32 = 3
149const SessionV1RequestRemoveToplevel uint32 = 4
150const SessionV1EventCreated uint32 = 0
151const SessionV1EventRestored uint32 = 1
152const SessionV1EventReplaced uint32 = 2
153
154// SessionV1Error .
155type SessionV1Error uint32
156
157const (
158	SessionV1ErrorNameInUse     SessionV1Error = 1
159	SessionV1ErrorAlreadyMapped SessionV1Error = 2
160	SessionV1ErrorInvalidName   SessionV1Error = 3
161	SessionV1ErrorAlreadyAdded  SessionV1Error = 4
162)
163
164// SessionV1Handler handles xdg_session_v1 requests.
165type SessionV1Handler interface {
166	Destroy(self *SessionV1)
167	Remove(self *SessionV1)
168	AddToplevel(self *SessionV1, id uint32, toplevel *xdgshell.Toplevel, name string)
169	RestoreToplevel(self *SessionV1, id uint32, toplevel *xdgshell.Toplevel, name string)
170	RemoveToplevel(self *SessionV1, name string)
171}
172
173func NewSessionV1(c server.Client, version int32, id uint32, h SessionV1Handler) (*SessionV1, error) {
174	if h == nil {
175		return nil, fmt.Errorf("purego-libwayland: nil handler for xdg_session_v1")
176	}
177	var self *SessionV1
178	r, err := c.CreateResource(SessionV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
179		switch opcode {
180		case 0:
181			h.Destroy(self)
182			self.Destroy()
183		case 1:
184			h.Remove(self)
185			self.Destroy()
186		case 2:
187			h.AddToplevel(self, args[0].NewID(), xdgshell.WrapToplevel(args[1].Resource()), args[2].String())
188		case 3:
189			h.RestoreToplevel(self, args[0].NewID(), xdgshell.WrapToplevel(args[1].Resource()), args[2].String())
190		case 4:
191			h.RemoveToplevel(self, args[0].String())
192		}
193	})
194	if err != nil {
195		return nil, err
196	}
197	self = WrapSessionV1(r)
198	r.Data = self
199	return self, nil
200}
201
202// SendCreated newly-created session id.
203func (self *SessionV1) SendCreated(sessionId string) {
204	var p runtime.Pinner
205	defer p.Unpin()
206	self.PostEvent(SessionV1EventCreated, server.String(&p, sessionId, false))
207}
208
209// SendRestored the session has been restored.
210func (self *SessionV1) SendRestored() {
211	self.PostEvent(SessionV1EventRestored)
212}
213
214// SendReplaced the session has been replaced.
215func (self *SessionV1) SendReplaced() {
216	self.PostEvent(SessionV1EventReplaced)
217}
218func NewSessionV1Global(d *server.Display, version int32, bind server.BindFunc) error {
219	return d.CreateGlobal(SessionV1Interface, version, bind)
220}
221
222// ToplevelSessionV1 A session for an application.
223type ToplevelSessionV1 struct{ *server.Resource }
224
225func WrapToplevelSessionV1(r *server.Resource) *ToplevelSessionV1 {
226	if r == nil {
227		return nil
228	}
229	return &ToplevelSessionV1{r}
230}
231
232const ToplevelSessionV1RequestDestroy uint32 = 0
233const ToplevelSessionV1RequestRename uint32 = 1
234const ToplevelSessionV1EventRestored uint32 = 0
235
236// ToplevelSessionV1Handler handles xdg_toplevel_session_v1 requests.
237type ToplevelSessionV1Handler interface {
238	Destroy(self *ToplevelSessionV1)
239	Rename(self *ToplevelSessionV1, name string)
240}
241
242func NewToplevelSessionV1(c server.Client, version int32, id uint32, h ToplevelSessionV1Handler) (*ToplevelSessionV1, error) {
243	if h == nil {
244		return nil, fmt.Errorf("purego-libwayland: nil handler for xdg_toplevel_session_v1")
245	}
246	var self *ToplevelSessionV1
247	r, err := c.CreateResource(ToplevelSessionV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
248		switch opcode {
249		case 0:
250			h.Destroy(self)
251			self.Destroy()
252		case 1:
253			h.Rename(self, args[0].String())
254		}
255	})
256	if err != nil {
257		return nil, err
258	}
259	self = WrapToplevelSessionV1(r)
260	r.Data = self
261	return self, nil
262}
263
264// SendRestored a toplevel's session has been restored.
265func (self *ToplevelSessionV1) SendRestored() {
266	self.PostEvent(ToplevelSessionV1EventRestored)
267}
268func NewToplevelSessionV1Global(d *server.Display, version int32, bind server.BindFunc) error {
269	return d.CreateGlobal(ToplevelSessionV1Interface, version, bind)
270}
271func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
272	if v == nil {
273		return nil
274	}
275	return v.GetResource()
276}
277func (self *SessionManagerV1) GetResource() *server.Resource {
278	if self == nil {
279		return nil
280	}
281	return self.Resource
282}
283func (self *SessionV1) GetResource() *server.Resource {
284	if self == nil {
285		return nil
286	}
287	return self.Resource
288}
289func (self *ToplevelSessionV1) GetResource() *server.Resource {
290	if self == nil {
291		return nil
292	}
293	return self.Resource
294}

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