detached ffc809d

chore(cef): fix lint and formatting issues

commit
ffc809dfa2e253542d2705d8dcb9efbfb6b58954
author
brice · · 2026-03-19 16:16 UTC
committer
brice · · 2026-03-28 04:35 UTC
parent
7d63e83
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
6 files · +158 -62
M .golangci.yml +10 -0
@@ -146,6 +146,11 @@ linters:
146146 - text: "G204:"
147147 linters:
148148 - gosec
149+ # CEF/OpenGL interop requires unsafe pointer arithmetic
150+ - path: internal/infrastructure/cef/
151+ text: "G103:"
152+ linters:
153+ - gosec
149154 - text: "G304:"
150155 linters:
151156 - gosec
@@ -171,6 +176,11 @@ linters:
171176 text: "unused-receiver"
172177 linters:
173178 - revive
179+ # CEF handler/stub methods must keep receivers for interface compliance
180+ - path: internal/infrastructure/cef/
181+ text: "unused-receiver"
182+ linters:
183+ - revive
174184
175185 run:
176186 timeout: 20m
@@ -146,6 +146,11 @@ linters:
146 - text: "G204:"146 - text: "G204:"
147 linters:147 linters:
148 - gosec148 - gosec
149+ # CEF/OpenGL interop requires unsafe pointer arithmetic
150+ - path: internal/infrastructure/cef/
151+ text: "G103:"
152+ linters:
153+ - gosec
149 - text: "G304:"154 - text: "G304:"
150 linters:155 linters:
151 - gosec156 - gosec
@@ -171,6 +176,11 @@ linters:
171 text: "unused-receiver"176 text: "unused-receiver"
172 linters:177 linters:
173 - revive178 - revive
179+ # CEF handler/stub methods must keep receivers for interface compliance
180+ - path: internal/infrastructure/cef/
181+ text: "unused-receiver"
182+ linters:
183+ - revive
174 184
175 run:185 run:
176 timeout: 20m186 timeout: 20m
M internal/infrastructure/cef/gl_loader.go +9 -3
@@ -45,9 +45,15 @@ type glLoader struct {
4545 genTextures func(n int32, textures *uint32)
4646 deleteTextures func(n int32, textures *uint32)
4747 bindTexture func(target uint32, texture uint32)
48- texImage2D func(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer)
49- texSubImage2D func(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer)
50- texParameteri func(target uint32, pname uint32, param int32)
48+ texImage2D func(
49+ target uint32, level, internalformat, width, height, border int32,
50+ format, xtype uint32, pixels unsafe.Pointer,
51+ )
52+ texSubImage2D func(
53+ target uint32, level, xoffset, yoffset, width, height int32,
54+ format, xtype uint32, pixels unsafe.Pointer,
55+ )
56+ texParameteri func(target uint32, pname uint32, param int32)
5157
5258 // PBO / buffer functions
5359 genBuffers func(n int32, buffers *uint32)
@@ -45,9 +45,15 @@ type glLoader struct {
45 genTextures func(n int32, textures *uint32)45 genTextures func(n int32, textures *uint32)
46 deleteTextures func(n int32, textures *uint32)46 deleteTextures func(n int32, textures *uint32)
47 bindTexture func(target uint32, texture uint32)47 bindTexture func(target uint32, texture uint32)
48- texImage2D func(target uint32, level int32, internalformat int32, width int32, height int32, border int32, format uint32, xtype uint32, pixels unsafe.Pointer)48+ texImage2D func(
49- texSubImage2D func(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, xtype uint32, pixels unsafe.Pointer)49+ target uint32, level, internalformat, width, height, border int32,
50- texParameteri func(target uint32, pname uint32, param int32)50+ format, xtype uint32, pixels unsafe.Pointer,
51+ )
52+ texSubImage2D func(
53+ target uint32, level, xoffset, yoffset, width, height int32,
54+ format, xtype uint32, pixels unsafe.Pointer,
55+ )
56+ texParameteri func(target uint32, pname uint32, param int32)
51 57
52 // PBO / buffer functions58 // PBO / buffer functions
53 genBuffers func(n int32, buffers *uint32)59 genBuffers func(n int32, buffers *uint32)
M internal/infrastructure/cef/input_bridge.go +86 -41
@@ -154,7 +154,7 @@ func (ib *inputBridge) onScroll(dx, dy float64) {
154154 host.SendMouseWheelEvent(&evt, deltaX, deltaY)
155155 }
156156
157-func (ib *inputBridge) onKeyPress(keyval, keycode uint, mods uint) {
157+func (ib *inputBridge) onKeyPress(keyval, keycode, mods uint) {
158158 ib.mu.Lock()
159159 host := ib.host
160160 ib.mu.Unlock()
@@ -175,7 +175,7 @@ func (ib *inputBridge) onKeyPress(keyval, keycode uint, mods uint) {
175175 }
176176 }
177177
178-func (ib *inputBridge) onKeyRelease(keyval, keycode uint, mods uint) {
178+func (ib *inputBridge) onKeyRelease(keyval, keycode, mods uint) {
179179 ib.mu.Lock()
180180 host := ib.host
181181 ib.mu.Unlock()
@@ -199,7 +199,7 @@ func buildMouseEvent(x, y float64, gdkMods uint, scale int32) purecef.MouseEvent
199199 }
200200 }
201201
202-func buildKeyEvent(keyval, keycode uint, gdkMods uint, eventType purecef.KeyEventType) purecef.KeyEvent {
202+func buildKeyEvent(keyval, keycode, gdkMods uint, eventType purecef.KeyEventType) purecef.KeyEvent {
203203 var evt purecef.KeyEvent
204204 evt.Size = unsafe.Sizeof(evt)
205205 // Use unsafe to set Type field — the underlying types are both int32 but
@@ -251,76 +251,121 @@ func translateMouseButton(gdkButton uint) purecef.MouseButtonType {
251251 }
252252 }
253253
254-// translateScrollDeltas converts GDK scroll deltas to CEF units (120 per notch).
254+// cefScrollUnitsPerNotch is the number of scroll units CEF expects per mouse wheel notch.
255+const cefScrollUnitsPerNotch = 120
256+
257+// translateScrollDeltas converts GDK scroll deltas to CEF units.
255258 func translateScrollDeltas(dx, dy float64) (int32, int32) {
256- return int32(dx * 120), int32(-dy * 120) // CEF: positive Y = scroll up
259+ return int32(dx * cefScrollUnitsPerNotch), int32(-dy * cefScrollUnitsPerNotch) // CEF: positive Y = scroll up
257260 }
258261
262+// GDK keyval constants for special keys.
263+const (
264+ gdkKeyReturn = 0xff0d
265+ gdkKeyTab = 0xff09
266+ gdkKeyBackSpace = 0xff08
267+ gdkKeyEscape = 0xff1b
268+ gdkKeyDelete = 0xffff
269+ gdkKeySpace = 0x020
270+ gdkKeyHome = 0xff50
271+ gdkKeyEnd = 0xff57
272+ gdkKeyPageUp = 0xff55
273+ gdkKeyPageDown = 0xff56
274+)
275+
259276 // keyvalToChar returns the UTF-16 character for a printable GDK keyval, or 0.
260277 func keyvalToChar(keyval uint) uint16 {
261278 // Printable ASCII range.
262279 if keyval >= 0x020 && keyval <= 0x07e {
263280 return uint16(keyval)
264281 }
265- // GDK_KEY_Return → carriage return
266- if keyval == 0xff0d {
282+ switch keyval {
283+ case gdkKeyReturn:
267284 return '\r'
268- }
269- // GDK_KEY_Tab
270- if keyval == 0xff09 {
285+ case gdkKeyTab:
271286 return '\t'
272- }
273- // GDK_KEY_BackSpace
274- if keyval == 0xff08 {
287+ case gdkKeyBackSpace:
275288 return '\b'
289+ default:
290+ return 0
276291 }
277- return 0
278292 }
279293
280294 // gdkKeyvalToWindowsVK translates a GDK keyval to a Windows virtual-key code.
281295 func gdkKeyvalToWindowsVK(keyval uint) int32 {
282- // Lowercase letters → uppercase VK codes (A-Z = 0x41-0x5A)
283- if keyval >= 0x061 && keyval <= 0x07a {
284- return int32(keyval-0x061) + 0x41
296+ if vk, ok := gdkKeyvalToVKRange(keyval); ok {
297+ return vk
285298 }
299+ return gdkKeyvalToVKSwitch(keyval)
300+}
301+
302+// GDK keyval range boundaries for contiguous mappings.
303+const (
304+ gdkKeyLowercaseAStart = 0x061
305+ gdkKeyLowercaseAEnd = 0x07a
306+ gdkKeyUppercaseAStart = 0x041
307+ gdkKeyUppercaseAEnd = 0x05a
308+ gdkKeyDigit0Start = 0x030
309+ gdkKeyDigit9End = 0x039
310+ gdkKeyF1Start = 0xffbe
311+ gdkKeyF12End = 0xffc9
312+ gdkKeyArrowStart = 0xff51
313+ gdkKeyArrowEnd = 0xff54
314+
315+ vkA = 0x41
316+ vkF1 = 0x70
317+ vkArrowLeft = 0x25
318+)
319+
320+// gdkKeyvalToVKRange handles contiguous GDK keyval ranges that map linearly
321+// to Windows virtual-key codes (letters, digits, F-keys, arrows).
322+func gdkKeyvalToVKRange(keyval uint) (int32, bool) {
323+ switch {
324+ // Lowercase letters -> uppercase VK codes (A-Z = 0x41-0x5A)
325+ case keyval >= gdkKeyLowercaseAStart && keyval <= gdkKeyLowercaseAEnd:
326+ return int32(keyval-gdkKeyLowercaseAStart) + vkA, true
286327 // Uppercase letters
287- if keyval >= 0x041 && keyval <= 0x05a {
288- return int32(keyval-0x041) + 0x41
289- }
328+ case keyval >= gdkKeyUppercaseAStart && keyval <= gdkKeyUppercaseAEnd:
329+ return int32(keyval-gdkKeyUppercaseAStart) + vkA, true
290330 // Digits 0-9 = 0x30-0x39
291- if keyval >= 0x030 && keyval <= 0x039 {
292- return int32(keyval)
293- }
294- // F1-F12: GDK 0xffbe-0xffc9 → VK 0x70-0x7B
295- if keyval >= 0xffbe && keyval <= 0xffc9 {
296- return int32(keyval-0xffbe) + 0x70
297- }
298- // Arrow keys: GDK 0xff51-0xff54 → VK Left=0x25, Up=0x26, Right=0x27, Down=0x28
299- if keyval >= 0xff51 && keyval <= 0xff54 {
300- return int32(keyval-0xff51) + 0x25
331+ case keyval >= gdkKeyDigit0Start && keyval <= gdkKeyDigit9End:
332+ return int32(keyval), true
333+ // F1-F12: GDK 0xffbe-0xffc9 -> VK 0x70-0x7B
334+ case keyval >= gdkKeyF1Start && keyval <= gdkKeyF12End:
335+ return int32(keyval-gdkKeyF1Start) + vkF1, true
336+ // Arrow keys: GDK 0xff51-0xff54 -> VK Left=0x25..Down=0x28
337+ case keyval >= gdkKeyArrowStart && keyval <= gdkKeyArrowEnd:
338+ return int32(keyval-gdkKeyArrowStart) + vkArrowLeft, true
339+ default:
340+ return 0, false
301341 }
342+}
302343
303- // Individual keys
344+// gdkKeyvalToVKSwitch handles individual GDK keyvals that map to specific
345+// Windows virtual-key codes.
346+//
347+//nolint:mnd // GDK keyval→VK code lookup table; named constants would hurt readability.
348+func gdkKeyvalToVKSwitch(keyval uint) int32 {
304349 switch keyval {
305- case 0xff0d: // Return
350+ case gdkKeyReturn:
306351 return 0x0D
307- case 0xff1b: // Escape
352+ case gdkKeyEscape:
308353 return 0x1B
309- case 0xff09: // Tab
354+ case gdkKeyTab:
310355 return 0x09
311- case 0xff08: // BackSpace
356+ case gdkKeyBackSpace:
312357 return 0x08
313- case 0xffff: // Delete
358+ case gdkKeyDelete:
314359 return 0x2E
315- case 0x020: // space
360+ case gdkKeySpace:
316361 return 0x20
317- case 0xff50: // Home
362+ case gdkKeyHome:
318363 return 0x24
319- case 0xff57: // End
364+ case gdkKeyEnd:
320365 return 0x23
321- case 0xff55: // Page_Up
366+ case gdkKeyPageUp:
322367 return 0x21
323- case 0xff56: // Page_Down
368+ case gdkKeyPageDown:
324369 return 0x22
325370 case 0xffe1, 0xffe2: // Shift_L, Shift_R
326371 return 0xA0
@@ -154,7 +154,7 @@ func (ib *inputBridge) onScroll(dx, dy float64) {
154 host.SendMouseWheelEvent(&evt, deltaX, deltaY)154 host.SendMouseWheelEvent(&evt, deltaX, deltaY)
155 }155 }
156 156
157-func (ib *inputBridge) onKeyPress(keyval, keycode uint, mods uint) {157+func (ib *inputBridge) onKeyPress(keyval, keycode, mods uint) {
158 ib.mu.Lock()158 ib.mu.Lock()
159 host := ib.host159 host := ib.host
160 ib.mu.Unlock()160 ib.mu.Unlock()
@@ -175,7 +175,7 @@ func (ib *inputBridge) onKeyPress(keyval, keycode uint, mods uint) {
175 }175 }
176 }176 }
177 177
178-func (ib *inputBridge) onKeyRelease(keyval, keycode uint, mods uint) {178+func (ib *inputBridge) onKeyRelease(keyval, keycode, mods uint) {
179 ib.mu.Lock()179 ib.mu.Lock()
180 host := ib.host180 host := ib.host
181 ib.mu.Unlock()181 ib.mu.Unlock()
@@ -199,7 +199,7 @@ func buildMouseEvent(x, y float64, gdkMods uint, scale int32) purecef.MouseEvent
199 }199 }
200 }200 }
201 201
202-func buildKeyEvent(keyval, keycode uint, gdkMods uint, eventType purecef.KeyEventType) purecef.KeyEvent {202+func buildKeyEvent(keyval, keycode, gdkMods uint, eventType purecef.KeyEventType) purecef.KeyEvent {
203 var evt purecef.KeyEvent203 var evt purecef.KeyEvent
204 evt.Size = unsafe.Sizeof(evt)204 evt.Size = unsafe.Sizeof(evt)
205 // Use unsafe to set Type field — the underlying types are both int32 but205 // Use unsafe to set Type field — the underlying types are both int32 but
@@ -251,76 +251,121 @@ func translateMouseButton(gdkButton uint) purecef.MouseButtonType {
251 }251 }
252 }252 }
253 253
254-// translateScrollDeltas converts GDK scroll deltas to CEF units (120 per notch).254+// cefScrollUnitsPerNotch is the number of scroll units CEF expects per mouse wheel notch.
255+const cefScrollUnitsPerNotch = 120
256+
257+// translateScrollDeltas converts GDK scroll deltas to CEF units.
255 func translateScrollDeltas(dx, dy float64) (int32, int32) {258 func translateScrollDeltas(dx, dy float64) (int32, int32) {
256- return int32(dx * 120), int32(-dy * 120) // CEF: positive Y = scroll up259+ return int32(dx * cefScrollUnitsPerNotch), int32(-dy * cefScrollUnitsPerNotch) // CEF: positive Y = scroll up
257 }260 }
258 261
262+// GDK keyval constants for special keys.
263+const (
264+ gdkKeyReturn = 0xff0d
265+ gdkKeyTab = 0xff09
266+ gdkKeyBackSpace = 0xff08
267+ gdkKeyEscape = 0xff1b
268+ gdkKeyDelete = 0xffff
269+ gdkKeySpace = 0x020
270+ gdkKeyHome = 0xff50
271+ gdkKeyEnd = 0xff57
272+ gdkKeyPageUp = 0xff55
273+ gdkKeyPageDown = 0xff56
274+)
275+
259 // keyvalToChar returns the UTF-16 character for a printable GDK keyval, or 0.276 // keyvalToChar returns the UTF-16 character for a printable GDK keyval, or 0.
260 func keyvalToChar(keyval uint) uint16 {277 func keyvalToChar(keyval uint) uint16 {
261 // Printable ASCII range.278 // Printable ASCII range.
262 if keyval >= 0x020 && keyval <= 0x07e {279 if keyval >= 0x020 && keyval <= 0x07e {
263 return uint16(keyval)280 return uint16(keyval)
264 }281 }
265- // GDK_KEY_Return → carriage return282+ switch keyval {
266- if keyval == 0xff0d {283+ case gdkKeyReturn:
267 return '\r'284 return '\r'
268- }285+ case gdkKeyTab:
269- // GDK_KEY_Tab
270- if keyval == 0xff09 {
271 return '\t'286 return '\t'
272- }287+ case gdkKeyBackSpace:
273- // GDK_KEY_BackSpace
274- if keyval == 0xff08 {
275 return '\b'288 return '\b'
289+ default:
290+ return 0
276 }291 }
277- return 0
278 }292 }
279 293
280 // gdkKeyvalToWindowsVK translates a GDK keyval to a Windows virtual-key code.294 // gdkKeyvalToWindowsVK translates a GDK keyval to a Windows virtual-key code.
281 func gdkKeyvalToWindowsVK(keyval uint) int32 {295 func gdkKeyvalToWindowsVK(keyval uint) int32 {
282- // Lowercase letters → uppercase VK codes (A-Z = 0x41-0x5A)296+ if vk, ok := gdkKeyvalToVKRange(keyval); ok {
283- if keyval >= 0x061 && keyval <= 0x07a {297+ return vk
284- return int32(keyval-0x061) + 0x41
285 }298 }
299+ return gdkKeyvalToVKSwitch(keyval)
300+}
301+
302+// GDK keyval range boundaries for contiguous mappings.
303+const (
304+ gdkKeyLowercaseAStart = 0x061
305+ gdkKeyLowercaseAEnd = 0x07a
306+ gdkKeyUppercaseAStart = 0x041
307+ gdkKeyUppercaseAEnd = 0x05a
308+ gdkKeyDigit0Start = 0x030
309+ gdkKeyDigit9End = 0x039
310+ gdkKeyF1Start = 0xffbe
311+ gdkKeyF12End = 0xffc9
312+ gdkKeyArrowStart = 0xff51
313+ gdkKeyArrowEnd = 0xff54
314+
315+ vkA = 0x41
316+ vkF1 = 0x70
317+ vkArrowLeft = 0x25
318+)
319+
320+// gdkKeyvalToVKRange handles contiguous GDK keyval ranges that map linearly
321+// to Windows virtual-key codes (letters, digits, F-keys, arrows).
322+func gdkKeyvalToVKRange(keyval uint) (int32, bool) {
323+ switch {
324+ // Lowercase letters -> uppercase VK codes (A-Z = 0x41-0x5A)
325+ case keyval >= gdkKeyLowercaseAStart && keyval <= gdkKeyLowercaseAEnd:
326+ return int32(keyval-gdkKeyLowercaseAStart) + vkA, true
286 // Uppercase letters327 // Uppercase letters
287- if keyval >= 0x041 && keyval <= 0x05a {328+ case keyval >= gdkKeyUppercaseAStart && keyval <= gdkKeyUppercaseAEnd:
288- return int32(keyval-0x041) + 0x41329+ return int32(keyval-gdkKeyUppercaseAStart) + vkA, true
289- }
290 // Digits 0-9 = 0x30-0x39330 // Digits 0-9 = 0x30-0x39
291- if keyval >= 0x030 && keyval <= 0x039 {331+ case keyval >= gdkKeyDigit0Start && keyval <= gdkKeyDigit9End:
292- return int32(keyval)332+ return int32(keyval), true
293- }333+ // F1-F12: GDK 0xffbe-0xffc9 -> VK 0x70-0x7B
294- // F1-F12: GDK 0xffbe-0xffc9 → VK 0x70-0x7B334+ case keyval >= gdkKeyF1Start && keyval <= gdkKeyF12End:
295- if keyval >= 0xffbe && keyval <= 0xffc9 {335+ return int32(keyval-gdkKeyF1Start) + vkF1, true
296- return int32(keyval-0xffbe) + 0x70336+ // Arrow keys: GDK 0xff51-0xff54 -> VK Left=0x25..Down=0x28
297- }337+ case keyval >= gdkKeyArrowStart && keyval <= gdkKeyArrowEnd:
298- // Arrow keys: GDK 0xff51-0xff54 → VK Left=0x25, Up=0x26, Right=0x27, Down=0x28338+ return int32(keyval-gdkKeyArrowStart) + vkArrowLeft, true
299- if keyval >= 0xff51 && keyval <= 0xff54 {339+ default:
300- return int32(keyval-0xff51) + 0x25340+ return 0, false
301 }341 }
342+}
302 343
303- // Individual keys344+// gdkKeyvalToVKSwitch handles individual GDK keyvals that map to specific
345+// Windows virtual-key codes.
346+//
347+//nolint:mnd // GDK keyval→VK code lookup table; named constants would hurt readability.
348+func gdkKeyvalToVKSwitch(keyval uint) int32 {
304 switch keyval {349 switch keyval {
305- case 0xff0d: // Return350+ case gdkKeyReturn:
306 return 0x0D351 return 0x0D
307- case 0xff1b: // Escape352+ case gdkKeyEscape:
308 return 0x1B353 return 0x1B
309- case 0xff09: // Tab354+ case gdkKeyTab:
310 return 0x09355 return 0x09
311- case 0xff08: // BackSpace356+ case gdkKeyBackSpace:
312 return 0x08357 return 0x08
313- case 0xffff: // Delete358+ case gdkKeyDelete:
314 return 0x2E359 return 0x2E
315- case 0x020: // space360+ case gdkKeySpace:
316 return 0x20361 return 0x20
317- case 0xff50: // Home362+ case gdkKeyHome:
318 return 0x24363 return 0x24
319- case 0xff57: // End364+ case gdkKeyEnd:
320 return 0x23365 return 0x23
321- case 0xff55: // Page_Up366+ case gdkKeyPageUp:
322 return 0x21367 return 0x21
323- case 0xff56: // Page_Down368+ case gdkKeyPageDown:
324 return 0x22369 return 0x22
325 case 0xffe1, 0xffe2: // Shift_L, Shift_R370 case 0xffe1, 0xffe2: // Shift_L, Shift_R
326 return 0xA0371 return 0xA0
M internal/infrastructure/cef/render_pipeline.go +18 -3
@@ -48,9 +48,24 @@ type renderPipeline struct {
4848 }
4949
5050 // Shader sources for the fullscreen textured quad.
51-const vertexShaderSource = "#version 330 core\nlayout(location=0) in vec2 aPos;\nlayout(location=1) in vec2 aUV;\nout vec2 vUV;\nvoid main() {\n gl_Position = vec4(aPos, 0.0, 1.0);\n vUV = aUV;\n}\x00"
52-
53-const fragmentShaderSource = "#version 330 core\nin vec2 vUV;\nout vec4 fragColor;\nuniform sampler2D tex;\nvoid main() {\n fragColor = texture(tex, vUV);\n}\x00"
51+const vertexShaderSource = "" +
52+ "#version 330 core\n" +
53+ "layout(location=0) in vec2 aPos;\n" +
54+ "layout(location=1) in vec2 aUV;\n" +
55+ "out vec2 vUV;\n" +
56+ "void main() {\n" +
57+ " gl_Position = vec4(aPos, 0.0, 1.0);\n" +
58+ " vUV = aUV;\n" +
59+ "}\x00"
60+
61+const fragmentShaderSource = "" +
62+ "#version 330 core\n" +
63+ "in vec2 vUV;\n" +
64+ "out vec4 fragColor;\n" +
65+ "uniform sampler2D tex;\n" +
66+ "void main() {\n" +
67+ " fragColor = texture(tex, vUV);\n" +
68+ "}\x00"
5469
5570 // Fullscreen quad: position (x,y) + UV (u,v), triangle strip.
5671 // UV Y is flipped because CEF's buffer origin is top-left, GL is bottom-left.
@@ -48,9 +48,24 @@ type renderPipeline struct {
48 }48 }
49 49
50 // Shader sources for the fullscreen textured quad.50 // Shader sources for the fullscreen textured quad.
51-const vertexShaderSource = "#version 330 core\nlayout(location=0) in vec2 aPos;\nlayout(location=1) in vec2 aUV;\nout vec2 vUV;\nvoid main() {\n gl_Position = vec4(aPos, 0.0, 1.0);\n vUV = aUV;\n}\x00"51+const vertexShaderSource = "" +
52-52+ "#version 330 core\n" +
53-const fragmentShaderSource = "#version 330 core\nin vec2 vUV;\nout vec4 fragColor;\nuniform sampler2D tex;\nvoid main() {\n fragColor = texture(tex, vUV);\n}\x00"53+ "layout(location=0) in vec2 aPos;\n" +
54+ "layout(location=1) in vec2 aUV;\n" +
55+ "out vec2 vUV;\n" +
56+ "void main() {\n" +
57+ " gl_Position = vec4(aPos, 0.0, 1.0);\n" +
58+ " vUV = aUV;\n" +
59+ "}\x00"
60+
61+const fragmentShaderSource = "" +
62+ "#version 330 core\n" +
63+ "in vec2 vUV;\n" +
64+ "out vec4 fragColor;\n" +
65+ "uniform sampler2D tex;\n" +
66+ "void main() {\n" +
67+ " fragColor = texture(tex, vUV);\n" +
68+ "}\x00"
54 69
55 // Fullscreen quad: position (x,y) + UV (u,v), triangle strip.70 // Fullscreen quad: position (x,y) + UV (u,v), triangle strip.
56 // UV Y is flipped because CEF's buffer origin is top-left, GL is bottom-left.71 // UV Y is flipped because CEF's buffer origin is top-left, GL is bottom-left.
M internal/infrastructure/cef/webview.go +1 -1
@@ -361,7 +361,7 @@ func (wv *WebView) updateProgress(progress float64) {
361361 }
362362 }
363363
364-func (wv *WebView) updateLoadState(loading bool, back bool, fwd bool) {
364+func (wv *WebView) updateLoadState(loading, back, fwd bool) {
365365 wv.mu.Lock()
366366 wv.isLoading = loading
367367 wv.canGoBack = back
@@ -361,7 +361,7 @@ func (wv *WebView) updateProgress(progress float64) {
361 }361 }
362 }362 }
363 363
364-func (wv *WebView) updateLoadState(loading bool, back bool, fwd bool) {364+func (wv *WebView) updateLoadState(loading, back, fwd bool) {
365 wv.mu.Lock()365 wv.mu.Lock()
366 wv.isLoading = loading366 wv.isLoading = loading
367 wv.canGoBack = back367 wv.canGoBack = back
M internal/infrastructure/cef/webview_handlers.go +34 -14
@@ -78,7 +78,7 @@ func (h *handlerSet) GetViewRect(_ purecef.Browser, rect *purecef.Rect) {
7878 rect.Height = ht
7979 }
8080
81-func (h *handlerSet) GetScreenPoint(_ purecef.Browser, _ int32, _ int32, _ unsafe.Pointer, _ unsafe.Pointer) int32 {
81+func (h *handlerSet) GetScreenPoint(_ purecef.Browser, _, _ int32, _, _ unsafe.Pointer) int32 {
8282 return 0
8383 }
8484
@@ -90,7 +90,10 @@ func (h *handlerSet) OnPopupSize(_ purecef.Browser, _ *purecef.Rect) {}
9090
9191 // OnPaint receives the BGRA pixel buffer from CEF and forwards dirty rects
9292 // to the render pipeline for GPU upload.
93-func (h *handlerSet) OnPaint(_ purecef.Browser, _ purecef.PaintElementType, dirtyRects []purecef.Rect, buffer unsafe.Pointer, width int32, height int32) {
93+func (h *handlerSet) OnPaint(
94+ _ purecef.Browser, _ purecef.PaintElementType,
95+ dirtyRects []purecef.Rect, buffer unsafe.Pointer, width, height int32,
96+) {
9497 rects := make([]rect, len(dirtyRects))
9598 for i, dr := range dirtyRects {
9699 rects[i] = rect{X: dr.X, Y: dr.Y, Width: dr.Width, Height: dr.Height}
@@ -106,13 +109,13 @@ func (h *handlerSet) GetTouchHandleSize(_ purecef.Browser, _ purecef.HorizontalA
106109
107110 func (h *handlerSet) OnTouchHandleStateChanged(_ purecef.Browser, _ *purecef.TouchHandleState) {}
108111
109-func (h *handlerSet) StartDragging(_ purecef.Browser, _ purecef.DragData, _ purecef.DragOperationsMask, _ int32, _ int32) int32 {
112+func (h *handlerSet) StartDragging(_ purecef.Browser, _ purecef.DragData, _ purecef.DragOperationsMask, _, _ int32) int32 {
110113 return 0
111114 }
112115
113116 func (h *handlerSet) UpdateDragCursor(_ purecef.Browser, _ purecef.DragOperationsMask) {}
114117
115-func (h *handlerSet) OnScrollOffsetChanged(_ purecef.Browser, _ float64, _ float64) {}
118+func (h *handlerSet) OnScrollOffsetChanged(_ purecef.Browser, _, _ float64) {}
116119
117120 func (h *handlerSet) OnImeCompositionRangeChanged(_ purecef.Browser, _ *purecef.Range, _ []purecef.Rect) {
118121 }
@@ -170,7 +173,7 @@ func (h *handlerSet) OnStatusMessage(_ purecef.Browser, value string) {
170173 }
171174 }
172175
173-func (h *handlerSet) OnConsoleMessage(_ purecef.Browser, _ purecef.LogSeverity, _ string, _ string, _ int32) int32 {
176+func (h *handlerSet) OnConsoleMessage(_ purecef.Browser, _ purecef.LogSeverity, _, _ string, _ int32) int32 {
174177 return 0
175178 }
176179
@@ -185,7 +188,7 @@ func (h *handlerSet) OnCursorChange(_ purecef.Browser, _ uintptr, _ purecef.Curs
185188 return 0
186189 }
187190
188-func (h *handlerSet) OnMediaAccessChange(_ purecef.Browser, _ int32, _ int32) {}
191+func (h *handlerSet) OnMediaAccessChange(_ purecef.Browser, _, _ int32) {}
189192
190193 func (h *handlerSet) OnContentsBoundsChange(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
191194
@@ -196,7 +199,7 @@ func (h *handlerSet) GetRootWindowScreenRect(_ purecef.Browser, _ *purecef.Rect)
196199 // ===========================================================================
197200
198201 // OnLoadingStateChange updates the loading/navigation state cache and fires callbacks.
199-func (h *handlerSet) OnLoadingStateChange(_ purecef.Browser, isloading int32, cangoback int32, cangoforward int32) {
202+func (h *handlerSet) OnLoadingStateChange(_ purecef.Browser, isloading, cangoback, cangoforward int32) {
200203 loading := isloading != 0
201204 h.wv.updateLoadState(loading, cangoback != 0, cangoforward != 0)
202205
@@ -244,7 +247,7 @@ func (h *handlerSet) OnLoadEnd(_ purecef.Browser, frame purecef.Frame, _ int32)
244247 }
245248
246249 // OnLoadError is a no-op in Phase 1.
247-func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.Errorcode, _ string, _ string) {
250+func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.Errorcode, _, _ string) {
248251 }
249252
250253 // ===========================================================================
@@ -252,13 +255,21 @@ func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.E
252255 // ===========================================================================
253256
254257 // OnBeforePopup blocks all popups in Phase 1.
255-func (h *handlerSet) OnBeforePopup(_ purecef.Browser, _ purecef.Frame, _ int32, _ string, _ string, _ purecef.WindowOpenDisposition, _ int32, _ *purecef.PopupFeatures, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) bool {
258+func (h *handlerSet) OnBeforePopup(
259+ _ purecef.Browser, _ purecef.Frame, _ int32, _, _ string,
260+ _ purecef.WindowOpenDisposition, _ int32, _ *purecef.PopupFeatures,
261+ _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings,
262+ _, _ unsafe.Pointer,
263+) bool {
256264 return true // block
257265 }
258266
259267 func (h *handlerSet) OnBeforePopupAborted(_ purecef.Browser, _ int32) {}
260268
261-func (h *handlerSet) OnBeforeDevToolsPopup(_ purecef.Browser, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) {
269+func (h *handlerSet) OnBeforeDevToolsPopup(
270+ _ purecef.Browser, _ *purecef.WindowInfo, _ unsafe.Pointer,
271+ _ *purecef.BrowserSettings, _, _ unsafe.Pointer,
272+) {
262273 }
263274
264275 // OnAfterCreated stores the browser and host references and enables input.
@@ -287,7 +298,7 @@ func (h *handlerSet) OnBeforeClose(_ purecef.Browser) {
287298 // RequestHandler (11 methods)
288299 // ===========================================================================
289300
290-func (h *handlerSet) OnBeforeBrowse(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ int32, _ int32) bool {
301+func (h *handlerSet) OnBeforeBrowse(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _, _ int32) bool {
291302 return false
292303 }
293304
@@ -295,11 +306,17 @@ func (h *handlerSet) OnOpenUrlfromTab(_ purecef.Browser, _ purecef.Frame, _ stri
295306 return 0
296307 }
297308
298-func (h *handlerSet) GetResourceRequestHandler(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ int32, _ int32, _ string, _ unsafe.Pointer) purecef.ResourceRequestHandler {
309+func (h *handlerSet) GetResourceRequestHandler(
310+ _ purecef.Browser, _ purecef.Frame, _ purecef.Request,
311+ _, _ int32, _ string, _ unsafe.Pointer,
312+) purecef.ResourceRequestHandler {
299313 return nil
300314 }
301315
302-func (h *handlerSet) GetAuthCredentials(_ purecef.Browser, _ string, _ int32, _ string, _ int32, _ string, _ string, _ purecef.AuthCallback) int32 {
316+func (h *handlerSet) GetAuthCredentials(
317+ _ purecef.Browser, _ string, _ int32, _ string, _ int32,
318+ _, _ string, _ purecef.AuthCallback,
319+) int32 {
303320 return 0
304321 }
305322
@@ -307,7 +324,10 @@ func (h *handlerSet) OnCertificateError(_ purecef.Browser, _ purecef.Errorcode,
307324 return 0
308325 }
309326
310-func (h *handlerSet) OnSelectClientCertificate(_ purecef.Browser, _ int32, _ string, _ int32, _ int, _ unsafe.Pointer, _ purecef.SelectClientCertificateCallback) int32 {
327+func (h *handlerSet) OnSelectClientCertificate(
328+ _ purecef.Browser, _ int32, _ string, _ int32, _ int,
329+ _ unsafe.Pointer, _ purecef.SelectClientCertificateCallback,
330+) int32 {
311331 return 0
312332 }
313333
@@ -78,7 +78,7 @@ func (h *handlerSet) GetViewRect(_ purecef.Browser, rect *purecef.Rect) {
78 rect.Height = ht78 rect.Height = ht
79 }79 }
80 80
81-func (h *handlerSet) GetScreenPoint(_ purecef.Browser, _ int32, _ int32, _ unsafe.Pointer, _ unsafe.Pointer) int32 {81+func (h *handlerSet) GetScreenPoint(_ purecef.Browser, _, _ int32, _, _ unsafe.Pointer) int32 {
82 return 082 return 0
83 }83 }
84 84
@@ -90,7 +90,10 @@ func (h *handlerSet) OnPopupSize(_ purecef.Browser, _ *purecef.Rect) {}
90 90
91 // OnPaint receives the BGRA pixel buffer from CEF and forwards dirty rects91 // OnPaint receives the BGRA pixel buffer from CEF and forwards dirty rects
92 // to the render pipeline for GPU upload.92 // to the render pipeline for GPU upload.
93-func (h *handlerSet) OnPaint(_ purecef.Browser, _ purecef.PaintElementType, dirtyRects []purecef.Rect, buffer unsafe.Pointer, width int32, height int32) {93+func (h *handlerSet) OnPaint(
94+ _ purecef.Browser, _ purecef.PaintElementType,
95+ dirtyRects []purecef.Rect, buffer unsafe.Pointer, width, height int32,
96+) {
94 rects := make([]rect, len(dirtyRects))97 rects := make([]rect, len(dirtyRects))
95 for i, dr := range dirtyRects {98 for i, dr := range dirtyRects {
96 rects[i] = rect{X: dr.X, Y: dr.Y, Width: dr.Width, Height: dr.Height}99 rects[i] = rect{X: dr.X, Y: dr.Y, Width: dr.Width, Height: dr.Height}
@@ -106,13 +109,13 @@ func (h *handlerSet) GetTouchHandleSize(_ purecef.Browser, _ purecef.HorizontalA
106 109
107 func (h *handlerSet) OnTouchHandleStateChanged(_ purecef.Browser, _ *purecef.TouchHandleState) {}110 func (h *handlerSet) OnTouchHandleStateChanged(_ purecef.Browser, _ *purecef.TouchHandleState) {}
108 111
109-func (h *handlerSet) StartDragging(_ purecef.Browser, _ purecef.DragData, _ purecef.DragOperationsMask, _ int32, _ int32) int32 {112+func (h *handlerSet) StartDragging(_ purecef.Browser, _ purecef.DragData, _ purecef.DragOperationsMask, _, _ int32) int32 {
110 return 0113 return 0
111 }114 }
112 115
113 func (h *handlerSet) UpdateDragCursor(_ purecef.Browser, _ purecef.DragOperationsMask) {}116 func (h *handlerSet) UpdateDragCursor(_ purecef.Browser, _ purecef.DragOperationsMask) {}
114 117
115-func (h *handlerSet) OnScrollOffsetChanged(_ purecef.Browser, _ float64, _ float64) {}118+func (h *handlerSet) OnScrollOffsetChanged(_ purecef.Browser, _, _ float64) {}
116 119
117 func (h *handlerSet) OnImeCompositionRangeChanged(_ purecef.Browser, _ *purecef.Range, _ []purecef.Rect) {120 func (h *handlerSet) OnImeCompositionRangeChanged(_ purecef.Browser, _ *purecef.Range, _ []purecef.Rect) {
118 }121 }
@@ -170,7 +173,7 @@ func (h *handlerSet) OnStatusMessage(_ purecef.Browser, value string) {
170 }173 }
171 }174 }
172 175
173-func (h *handlerSet) OnConsoleMessage(_ purecef.Browser, _ purecef.LogSeverity, _ string, _ string, _ int32) int32 {176+func (h *handlerSet) OnConsoleMessage(_ purecef.Browser, _ purecef.LogSeverity, _, _ string, _ int32) int32 {
174 return 0177 return 0
175 }178 }
176 179
@@ -185,7 +188,7 @@ func (h *handlerSet) OnCursorChange(_ purecef.Browser, _ uintptr, _ purecef.Curs
185 return 0188 return 0
186 }189 }
187 190
188-func (h *handlerSet) OnMediaAccessChange(_ purecef.Browser, _ int32, _ int32) {}191+func (h *handlerSet) OnMediaAccessChange(_ purecef.Browser, _, _ int32) {}
189 192
190 func (h *handlerSet) OnContentsBoundsChange(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }193 func (h *handlerSet) OnContentsBoundsChange(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
191 194
@@ -196,7 +199,7 @@ func (h *handlerSet) GetRootWindowScreenRect(_ purecef.Browser, _ *purecef.Rect)
196 // ===========================================================================199 // ===========================================================================
197 200
198 // OnLoadingStateChange updates the loading/navigation state cache and fires callbacks.201 // OnLoadingStateChange updates the loading/navigation state cache and fires callbacks.
199-func (h *handlerSet) OnLoadingStateChange(_ purecef.Browser, isloading int32, cangoback int32, cangoforward int32) {202+func (h *handlerSet) OnLoadingStateChange(_ purecef.Browser, isloading, cangoback, cangoforward int32) {
200 loading := isloading != 0203 loading := isloading != 0
201 h.wv.updateLoadState(loading, cangoback != 0, cangoforward != 0)204 h.wv.updateLoadState(loading, cangoback != 0, cangoforward != 0)
202 205
@@ -244,7 +247,7 @@ func (h *handlerSet) OnLoadEnd(_ purecef.Browser, frame purecef.Frame, _ int32)
244 }247 }
245 248
246 // OnLoadError is a no-op in Phase 1.249 // OnLoadError is a no-op in Phase 1.
247-func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.Errorcode, _ string, _ string) {250+func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.Errorcode, _, _ string) {
248 }251 }
249 252
250 // ===========================================================================253 // ===========================================================================
@@ -252,13 +255,21 @@ func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.E
252 // ===========================================================================255 // ===========================================================================
253 256
254 // OnBeforePopup blocks all popups in Phase 1.257 // OnBeforePopup blocks all popups in Phase 1.
255-func (h *handlerSet) OnBeforePopup(_ purecef.Browser, _ purecef.Frame, _ int32, _ string, _ string, _ purecef.WindowOpenDisposition, _ int32, _ *purecef.PopupFeatures, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) bool {258+func (h *handlerSet) OnBeforePopup(
259+ _ purecef.Browser, _ purecef.Frame, _ int32, _, _ string,
260+ _ purecef.WindowOpenDisposition, _ int32, _ *purecef.PopupFeatures,
261+ _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings,
262+ _, _ unsafe.Pointer,
263+) bool {
256 return true // block264 return true // block
257 }265 }
258 266
259 func (h *handlerSet) OnBeforePopupAborted(_ purecef.Browser, _ int32) {}267 func (h *handlerSet) OnBeforePopupAborted(_ purecef.Browser, _ int32) {}
260 268
261-func (h *handlerSet) OnBeforeDevToolsPopup(_ purecef.Browser, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) {269+func (h *handlerSet) OnBeforeDevToolsPopup(
270+ _ purecef.Browser, _ *purecef.WindowInfo, _ unsafe.Pointer,
271+ _ *purecef.BrowserSettings, _, _ unsafe.Pointer,
272+) {
262 }273 }
263 274
264 // OnAfterCreated stores the browser and host references and enables input.275 // OnAfterCreated stores the browser and host references and enables input.
@@ -287,7 +298,7 @@ func (h *handlerSet) OnBeforeClose(_ purecef.Browser) {
287 // RequestHandler (11 methods)298 // RequestHandler (11 methods)
288 // ===========================================================================299 // ===========================================================================
289 300
290-func (h *handlerSet) OnBeforeBrowse(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ int32, _ int32) bool {301+func (h *handlerSet) OnBeforeBrowse(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _, _ int32) bool {
291 return false302 return false
292 }303 }
293 304
@@ -295,11 +306,17 @@ func (h *handlerSet) OnOpenUrlfromTab(_ purecef.Browser, _ purecef.Frame, _ stri
295 return 0306 return 0
296 }307 }
297 308
298-func (h *handlerSet) GetResourceRequestHandler(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ int32, _ int32, _ string, _ unsafe.Pointer) purecef.ResourceRequestHandler {309+func (h *handlerSet) GetResourceRequestHandler(
310+ _ purecef.Browser, _ purecef.Frame, _ purecef.Request,
311+ _, _ int32, _ string, _ unsafe.Pointer,
312+) purecef.ResourceRequestHandler {
299 return nil313 return nil
300 }314 }
301 315
302-func (h *handlerSet) GetAuthCredentials(_ purecef.Browser, _ string, _ int32, _ string, _ int32, _ string, _ string, _ purecef.AuthCallback) int32 {316+func (h *handlerSet) GetAuthCredentials(
317+ _ purecef.Browser, _ string, _ int32, _ string, _ int32,
318+ _, _ string, _ purecef.AuthCallback,
319+) int32 {
303 return 0320 return 0
304 }321 }
305 322
@@ -307,7 +324,10 @@ func (h *handlerSet) OnCertificateError(_ purecef.Browser, _ purecef.Errorcode,
307 return 0324 return 0
308 }325 }
309 326
310-func (h *handlerSet) OnSelectClientCertificate(_ purecef.Browser, _ int32, _ string, _ int32, _ int, _ unsafe.Pointer, _ purecef.SelectClientCertificateCallback) int32 {327+func (h *handlerSet) OnSelectClientCertificate(
328+ _ purecef.Browser, _ int32, _ string, _ int32, _ int,
329+ _ unsafe.Pointer, _ purecef.SelectClientCertificateCallback,
330+) int32 {
311 return 0331 return 0
312 }332 }
313 333

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 8

Tags 42

↑↓ moveenter openesc close