feat(port): add Texture interface for favicon abstraction
Introduce Texture interface in port layer for clean architecture abstraction over gdk.Texture, avoiding GTK imports in application layer. Add OnFaviconChanged callback to WebViewCallbacks for favicon change notifications.
- commit
- 88a2e8688a61581e441d62cb6eecdc30e9e67681
- author
- brice · · 2025-12-15 17:53 UTC
- committer
- brice · · 2025-12-15 17:56 UTC
- parent
- 4130d3e
- signature
- unsigned
1 file · +11 -0
M internal/application/port/webview.go +11 -0
| @@ -60,6 +60,14 @@ type PopupRequest struct { | |||
| 60 | 60 | ParentViewID WebViewID | |
| 61 | 61 | } | |
| 62 | 62 | ||
| 63 | + | // Texture represents a graphics texture (abstraction over gdk.Texture). | |
| 64 | + | // This interface allows the port layer to work with textures without | |
| 65 | + | // importing GTK/GDK packages directly. | |
| 66 | + | type Texture interface { | |
| 67 | + | // GoPointer returns the underlying C pointer for GTK interop. | |
| 68 | + | GoPointer() uintptr | |
| 69 | + | } | |
| 70 | + | ||
| 63 | 71 | // WebViewCallbacks defines callback handlers for WebView events. | |
| 64 | 72 | // Implementations should invoke these on the main thread/goroutine. | |
| 65 | 73 | type WebViewCallbacks struct { | |
| @@ -71,6 +79,9 @@ type WebViewCallbacks struct { | |||
| 71 | 79 | OnURIChanged func(uri string) | |
| 72 | 80 | // OnProgressChanged is called during page load with progress 0.0-1.0. | |
| 73 | 81 | OnProgressChanged func(progress float64) | |
| 82 | + | // OnFaviconChanged is called when the page favicon changes. | |
| 83 | + | // The parameter is a *gdk.Texture (passed as Texture interface to avoid GTK import in port layer). | |
| 84 | + | OnFaviconChanged func(favicon Texture) | |
| 74 | 85 | // OnClose is called when the WebView requests to close. | |
| 75 | 86 | OnClose func() | |
| 76 | 87 | // OnCreate is called when a popup window is requested. | |
| @@ -60,6 +60,14 @@ type PopupRequest struct { | |||||
| 60 | ParentViewID WebViewID | 60 | ParentViewID WebViewID | ||
| 61 | } | 61 | } | ||
| 62 | 62 | ||||
| 63 | + | // Texture represents a graphics texture (abstraction over gdk.Texture). | |||
| 64 | + | // This interface allows the port layer to work with textures without | |||
| 65 | + | // importing GTK/GDK packages directly. | |||
| 66 | + | type Texture interface { | |||
| 67 | + | // GoPointer returns the underlying C pointer for GTK interop. | |||
| 68 | + | GoPointer() uintptr | |||
| 69 | + | } | |||
| 70 | + | ||||
| 63 | // WebViewCallbacks defines callback handlers for WebView events. | 71 | // WebViewCallbacks defines callback handlers for WebView events. | ||
| 64 | // Implementations should invoke these on the main thread/goroutine. | 72 | // Implementations should invoke these on the main thread/goroutine. | ||
| 65 | type WebViewCallbacks struct { | 73 | type WebViewCallbacks struct { | ||
| @@ -71,6 +79,9 @@ type WebViewCallbacks struct { | |||||
| 71 | OnURIChanged func(uri string) | 79 | OnURIChanged func(uri string) | ||
| 72 | // OnProgressChanged is called during page load with progress 0.0-1.0. | 80 | // OnProgressChanged is called during page load with progress 0.0-1.0. | ||
| 73 | OnProgressChanged func(progress float64) | 81 | OnProgressChanged func(progress float64) | ||
| 82 | + | // OnFaviconChanged is called when the page favicon changes. | |||
| 83 | + | // The parameter is a *gdk.Texture (passed as Texture interface to avoid GTK import in port layer). | |||
| 84 | + | OnFaviconChanged func(favicon Texture) | |||
| 74 | // OnClose is called when the WebView requests to close. | 85 | // OnClose is called when the WebView requests to close. | ||
| 75 | OnClose func() | 86 | OnClose func() | ||
| 76 | // OnCreate is called when a popup window is requested. | 87 | // OnCreate is called when a popup window is requested. | ||