refactor(browser): migrate workspace_popup.go to gotk4 API
- commit
- 143d1f0be16b8b7370a4e9b433846cd0a6f27800
- author
- bamen · · 2025-10-09 05:23 UTC
- parent
- a6a793c
- signature
- unsigned
1 file · +9 -8
M internal/app/browser/workspace_popup.go +9 -8
| @@ -9,6 +9,7 @@ import ( | |||
| 9 | 9 | ||
| 10 | 10 | "github.com/bnema/dumber/internal/app/messaging" | |
| 11 | 11 | "github.com/bnema/dumber/pkg/webkit" | |
| 12 | + | "github.com/diamondburned/gotk4/pkg/gtk/v4" | |
| 12 | 13 | ) | |
| 13 | 14 | ||
| 14 | 15 | const ( | |
| @@ -715,17 +716,17 @@ func (wm *WorkspaceManager) applyPopupSizeConstraints(view *webkit.WebView, widt | |||
| 715 | 716 | } | |
| 716 | 717 | ||
| 717 | 718 | // Apply to container | |
| 718 | - | if container := view.RootWidget(); container != 0 && webkit.WidgetIsValid(container) { | |
| 719 | - | webkit.WidgetSetSizeRequest(container, minWidth, minHeight) | |
| 720 | - | webkit.WidgetQueueResize(container) | |
| 721 | - | log.Printf("[workspace] Applied minimum size %dx%d to popup container=%#x", minWidth, minHeight, container) | |
| 719 | + | if container := view.RootWidget(); container != nil { | |
| 720 | + | container.SetSizeRequest(minWidth, minHeight) | |
| 721 | + | container.QueueResize() | |
| 722 | + | log.Printf("[workspace] Applied minimum size %dx%d to popup container=%p", minWidth, minHeight, container) | |
| 722 | 723 | } | |
| 723 | 724 | ||
| 724 | 725 | // Apply to WebView widget | |
| 725 | - | if webViewWidget := view.Widget(); webViewWidget != 0 && webkit.WidgetIsValid(webViewWidget) { | |
| 726 | - | webkit.WidgetSetSizeRequest(webViewWidget, minWidth, minHeight) | |
| 727 | - | webkit.WidgetQueueResize(webViewWidget) | |
| 728 | - | log.Printf("[workspace] Applied minimum size %dx%d to popup webview=%#x", minWidth, minHeight, webViewWidget) | |
| 726 | + | if webViewWidget := view.Widget(); webViewWidget != nil { | |
| 727 | + | webViewWidget.SetSizeRequest(minWidth, minHeight) | |
| 728 | + | webViewWidget.QueueResize() | |
| 729 | + | log.Printf("[workspace] Applied minimum size %dx%d to popup webview=%p", minWidth, minHeight, webViewWidget) | |
| 729 | 730 | } | |
| 730 | 731 | } | |
| 731 | 732 | ||
| @@ -9,6 +9,7 @@ import ( | |||||
| 9 | 9 | ||||
| 10 | "github.com/bnema/dumber/internal/app/messaging" | 10 | "github.com/bnema/dumber/internal/app/messaging" | ||
| 11 | "github.com/bnema/dumber/pkg/webkit" | 11 | "github.com/bnema/dumber/pkg/webkit" | ||
| 12 | + | "github.com/diamondburned/gotk4/pkg/gtk/v4" | |||
| 12 | ) | 13 | ) | ||
| 13 | 14 | ||||
| 14 | const ( | 15 | const ( | ||
| @@ -715,17 +716,17 @@ func (wm *WorkspaceManager) applyPopupSizeConstraints(view *webkit.WebView, widt | |||||
| 715 | } | 716 | } | ||
| 716 | 717 | ||||
| 717 | // Apply to container | 718 | // Apply to container | ||
| 718 | - | if container := view.RootWidget(); container != 0 && webkit.WidgetIsValid(container) { | 719 | + | if container := view.RootWidget(); container != nil { |
| 719 | - | webkit.WidgetSetSizeRequest(container, minWidth, minHeight) | 720 | + | container.SetSizeRequest(minWidth, minHeight) |
| 720 | - | webkit.WidgetQueueResize(container) | 721 | + | container.QueueResize() |
| 721 | - | log.Printf("[workspace] Applied minimum size %dx%d to popup container=%#x", minWidth, minHeight, container) | 722 | + | log.Printf("[workspace] Applied minimum size %dx%d to popup container=%p", minWidth, minHeight, container) |
| 722 | } | 723 | } | ||
| 723 | 724 | ||||
| 724 | // Apply to WebView widget | 725 | // Apply to WebView widget | ||
| 725 | - | if webViewWidget := view.Widget(); webViewWidget != 0 && webkit.WidgetIsValid(webViewWidget) { | 726 | + | if webViewWidget := view.Widget(); webViewWidget != nil { |
| 726 | - | webkit.WidgetSetSizeRequest(webViewWidget, minWidth, minHeight) | 727 | + | webViewWidget.SetSizeRequest(minWidth, minHeight) |
| 727 | - | webkit.WidgetQueueResize(webViewWidget) | 728 | + | webViewWidget.QueueResize() |
| 728 | - | log.Printf("[workspace] Applied minimum size %dx%d to popup webview=%#x", minWidth, minHeight, webViewWidget) | 729 | + | log.Printf("[workspace] Applied minimum size %dx%d to popup webview=%p", minWidth, minHeight, webViewWidget) |
| 729 | } | 730 | } | ||
| 730 | } | 731 | } | ||
| 731 | 732 | ||||