client_events.go RawHistoryFolder
1package ports
2
3// ClientEvent carries wayland → core notifications.
4type ClientEvent interface{ clientEvent() }
5
6// WindowMapped carries wayland → core mapping.
7type WindowMapped struct {
8 ID WindowID
9 AppID string
10 // Slot is the SlotEnv value of the client process, empty if none.
11 Slot string
12 // PID is the client process, 0 when unknown.
13 PID int
14 // Floating windows are dialogs (a parent) or fixed-size windows such
15 // as splash screens: core shows them over the columns at their own
16 // size, Width×Height logical (0 when unknown).
17 Floating bool
18 Width, Height int
19 // Parent is the window a dialog belongs to (xdg_toplevel.set_parent or
20 // xdg-foreign), 0 when none. A dialog of a fullscreen window shows over
21 // it.
22 Parent WindowID
23 // Positioned windows are placed by core: it sends PlaceWindow with the
24 // client rect origin. Set only by the X11 host, false for xdg.
25 Positioned bool
26 // Remap is set when the toplevel mapped before and was unmapped (a tray
27 // app restored): window rules only place its first map.
28 Remap bool
29 // Modal is set for a dialog that blocks its parent (xdg_dialog_v1):
30 // focusing the parent focuses the dialog.
31 Modal bool
32 // Fullscreen is set when the client asked for fullscreen before mapping
33 // (X11 _NET_WM_STATE_FULLSCREEN): core maps it as a tile covering its
34 // screen, without the fullscreen grace of later requests.
35 Fullscreen bool
36 // HasAt asks for the screen containing the layout point (AtX, AtY) when
37 // no rule sets a monitor: the X11 host sets it for a window that maps at
38 // exactly one output's rect.
39 HasAt bool
40 AtX, AtY int
41}
42
43// SlotEnv is the environment variable neferwl sets on processes it spawns
44// for a slot. The client's value maps its windows to the slot.
45const SlotEnv = "NEFERWL_SLOT"
46
47func (WindowMapped) clientEvent() {}
48
49// InputRegionChanged replaces the surface-local hit area for a mapped surface.
50// All means the full hit rectangle; otherwise Rects is the exact union.
51type InputRegionChanged struct {
52 ID WindowID
53 All bool
54 Rects []Rect
55}
56
57func (InputRegionChanged) clientEvent() {}
58
59// WindowUnmapped carries wayland → core removal.
60type WindowUnmapped struct{ ID WindowID }
61
62func (WindowUnmapped) clientEvent() {}
63
64// UnmanagedMapped carries wayland → core that an override-redirect X11 window
65// shows. The rect is its place in the layout (logical coordinates). NoInput
66// windows (tooltips, drag icons, notifications) never take the pointer.
67type UnmanagedMapped struct {
68 ID WindowID
69 X, Y, Width, Height int
70 NoInput bool
71}
72
73func (UnmanagedMapped) clientEvent() {}
74
75// UnmanagedMoved carries wayland → core a move and/or resize of a mapped
76// unmanaged window.
77type UnmanagedMoved struct {
78 ID WindowID
79 X, Y, Width, Height int
80}
81
82func (UnmanagedMoved) clientEvent() {}
83
84// UnmanagedUnmapped carries wayland → core that an unmanaged window is gone.
85type UnmanagedUnmapped struct{ ID WindowID }
86
87func (UnmanagedUnmapped) clientEvent() {}
88
89// ShortcutsInhibit carries wayland → core that a window asks for (Active)
90// or stops asking for all keys, compositor binds included, while it has
91// keyboard focus (zwp_keyboard_shortcuts_inhibit_v1).
92type ShortcutsInhibit struct {
93 Window WindowID
94 Active bool
95}
96
97func (ShortcutsInhibit) clientEvent() {}
98
99// IdleInhibit carries wayland → core that a window keeps (Active) or
100// stops keeping the session from going idle (zwp_idle_inhibit_v1).
101type IdleInhibit struct {
102 Window WindowID
103 Active bool
104}
105
106func (IdleInhibit) clientEvent() {}
107
108// OutputPower carries wayland → core a client turning a display off or
109// back on (zwlr_output_power_v1).
110type OutputPower struct {
111 Output string
112 On bool
113}
114
115func (OutputPower) clientEvent() {}
116
117// ResizeEdges are the window edges a pointer resize moves, as bit flags
118// (the xdg_toplevel resize_edge values).
119type ResizeEdges uint32
120
121const (
122 ResizeTop ResizeEdges = 1
123 ResizeBottom ResizeEdges = 2
124 ResizeLeft ResizeEdges = 4
125 ResizeRight ResizeEdges = 8
126)
127
128// WindowMoveRequest carries wayland → core xdg_toplevel move and resize
129// requests answering the client's current press: core starts a pointer
130// drag of the window with the held button.
131type WindowMoveRequest struct {
132 ID WindowID
133 Resize bool
134 Edges ResizeEdges
135}
136
137func (WindowMoveRequest) clientEvent() {}
138
139// WindowFullscreenRequest carries wayland → core fullscreen requests.
140// External is set when another client (a taskbar, through foreign
141// toplevel) asks for it, not the window itself.
142type WindowFullscreenRequest struct {
143 ID WindowID
144 Fullscreen bool
145 External bool
146}
147
148func (WindowFullscreenRequest) clientEvent() {}
149
150// WindowActivate carries wayland → core a valid xdg-activation request:
151// show the window's workspace and focus it.
152type WindowActivate struct{ ID WindowID }
153
154func (WindowActivate) clientEvent() {}
155
156// WindowAppID carries wayland → core an app ID set after the window mapped.
157type WindowAppID struct {
158 ID WindowID
159 AppID string
160}
161
162func (WindowAppID) clientEvent() {}
163
164// WindowParent carries the new parent of a mapped dialog (0: none), after
165// set_parent or an xdg-foreign import changed or ended the relationship.
166type WindowParent struct {
167 ID, Parent WindowID
168}
169
170func (WindowParent) clientEvent() {}
171
172// WindowModal carries a mapped dialog's new modal state (xdg_dialog_v1).
173type WindowModal struct {
174 ID WindowID
175 Modal bool
176}
177
178func (WindowModal) clientEvent() {}
179
180// WindowResized carries wayland → core the new size of a floating window.
181type WindowResized struct {
182 ID WindowID
183 Width, Height int
184}
185
186func (WindowResized) clientEvent() {}