refactor(ui): trim browser window setup
- commit
- 9634a01bde3e011ad3c861fd2ced373f881d5a69
- author
- brice · · 2026-06-23 15:52 UTC
- committer
- brice · · 2026-06-23 20:01 UTC
- parent
- 3ada45b
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +25 -21
M internal/ui/app.go +25 -21
| @@ -511,6 +511,31 @@ func (a *App) createBrowserWindow(ctx context.Context, initialURL string) (*brow | |||
| 511 | 511 | } | |
| 512 | 512 | mainWindow.Window().ConnectCloseRequest(&closeRequestCb) | |
| 513 | 513 | ||
| 514 | + | a.initBrowserWindowOverlays(mainWindow, browserWindow, runtimeCfg) | |
| 515 | + | a.wireBrowserWindowPermissionIndicator(browserWindow) | |
| 516 | + | if a.kbDispatcher != nil { | |
| 517 | + | a.initBrowserWindowInput(ctx, browserWindow) | |
| 518 | + | } | |
| 519 | + | if a.tabCoord != nil { | |
| 520 | + | a.wireBrowserWindowTabBar(ctx, browserWindow) | |
| 521 | + | } | |
| 522 | + | browserWindow.initChrome(ctx, a) | |
| 523 | + | ||
| 524 | + | // Apply GTK CSS styling from theme manager. | |
| 525 | + | if a.deps == nil || a.deps.Theme == nil { | |
| 526 | + | return browserWindow, nil | |
| 527 | + | } | |
| 528 | + | if display := mainWindow.Window().GetDisplay(); display != nil { | |
| 529 | + | a.deps.Theme.ApplyToDisplay(ctx, display) | |
| 530 | + | } | |
| 531 | + | log.Debug(). | |
| 532 | + | Str("window_id", browserWindow.id). | |
| 533 | + | Str("url_host", logging.SafeURLHost(initialURL)). | |
| 534 | + | Msg("ui: create browser window completed") | |
| 535 | + | return browserWindow, nil | |
| 536 | + | } | |
| 537 | + | ||
| 538 | + | func (a *App) initBrowserWindowOverlays(mainWindow *window.MainWindow, browserWindow *browserWindow, runtimeCfg port.RuntimeUIConfig) { | |
| 514 | 539 | // Create permission popup and dialog presenter | |
| 515 | 540 | if a.deps != nil && a.deps.PermissionUC != nil { | |
| 516 | 541 | uiScale := runtimeCfg.DefaultUIScale | |
| @@ -535,27 +560,6 @@ func (a *App) createBrowserWindow(ctx context.Context, initialURL string) (*brow | |||
| 535 | 560 | } | |
| 536 | 561 | browserWindow.webrtcIndicator = indicator | |
| 537 | 562 | } | |
| 538 | - | a.wireBrowserWindowPermissionIndicator(browserWindow) | |
| 539 | - | if a.kbDispatcher != nil { | |
| 540 | - | a.initBrowserWindowInput(ctx, browserWindow) | |
| 541 | - | } | |
| 542 | - | if a.tabCoord != nil { | |
| 543 | - | a.wireBrowserWindowTabBar(ctx, browserWindow) | |
| 544 | - | } | |
| 545 | - | browserWindow.initChrome(ctx, a) | |
| 546 | - | ||
| 547 | - | // Apply GTK CSS styling from theme manager. | |
| 548 | - | if a.deps == nil || a.deps.Theme == nil { | |
| 549 | - | return browserWindow, nil | |
| 550 | - | } | |
| 551 | - | if display := mainWindow.Window().GetDisplay(); display != nil { | |
| 552 | - | a.deps.Theme.ApplyToDisplay(ctx, display) | |
| 553 | - | } | |
| 554 | - | log.Debug(). | |
| 555 | - | Str("window_id", browserWindow.id). | |
| 556 | - | Str("url_host", logging.SafeURLHost(initialURL)). | |
| 557 | - | Msg("ui: create browser window completed") | |
| 558 | - | return browserWindow, nil | |
| 559 | 563 | } | |
| 560 | 564 | ||
| 561 | 565 | func (a *App) ensureWindowForTabMap() { | |
| @@ -511,6 +511,31 @@ func (a *App) createBrowserWindow(ctx context.Context, initialURL string) (*brow | |||||
| 511 | } | 511 | } | ||
| 512 | mainWindow.Window().ConnectCloseRequest(&closeRequestCb) | 512 | mainWindow.Window().ConnectCloseRequest(&closeRequestCb) | ||
| 513 | 513 | ||||
| 514 | + | a.initBrowserWindowOverlays(mainWindow, browserWindow, runtimeCfg) | |||
| 515 | + | a.wireBrowserWindowPermissionIndicator(browserWindow) | |||
| 516 | + | if a.kbDispatcher != nil { | |||
| 517 | + | a.initBrowserWindowInput(ctx, browserWindow) | |||
| 518 | + | } | |||
| 519 | + | if a.tabCoord != nil { | |||
| 520 | + | a.wireBrowserWindowTabBar(ctx, browserWindow) | |||
| 521 | + | } | |||
| 522 | + | browserWindow.initChrome(ctx, a) | |||
| 523 | + | ||||
| 524 | + | // Apply GTK CSS styling from theme manager. | |||
| 525 | + | if a.deps == nil || a.deps.Theme == nil { | |||
| 526 | + | return browserWindow, nil | |||
| 527 | + | } | |||
| 528 | + | if display := mainWindow.Window().GetDisplay(); display != nil { | |||
| 529 | + | a.deps.Theme.ApplyToDisplay(ctx, display) | |||
| 530 | + | } | |||
| 531 | + | log.Debug(). | |||
| 532 | + | Str("window_id", browserWindow.id). | |||
| 533 | + | Str("url_host", logging.SafeURLHost(initialURL)). | |||
| 534 | + | Msg("ui: create browser window completed") | |||
| 535 | + | return browserWindow, nil | |||
| 536 | + | } | |||
| 537 | + | ||||
| 538 | + | func (a *App) initBrowserWindowOverlays(mainWindow *window.MainWindow, browserWindow *browserWindow, runtimeCfg port.RuntimeUIConfig) { | |||
| 514 | // Create permission popup and dialog presenter | 539 | // Create permission popup and dialog presenter | ||
| 515 | if a.deps != nil && a.deps.PermissionUC != nil { | 540 | if a.deps != nil && a.deps.PermissionUC != nil { | ||
| 516 | uiScale := runtimeCfg.DefaultUIScale | 541 | uiScale := runtimeCfg.DefaultUIScale | ||
| @@ -535,27 +560,6 @@ func (a *App) createBrowserWindow(ctx context.Context, initialURL string) (*brow | |||||
| 535 | } | 560 | } | ||
| 536 | browserWindow.webrtcIndicator = indicator | 561 | browserWindow.webrtcIndicator = indicator | ||
| 537 | } | 562 | } | ||
| 538 | - | a.wireBrowserWindowPermissionIndicator(browserWindow) | |||
| 539 | - | if a.kbDispatcher != nil { | |||
| 540 | - | a.initBrowserWindowInput(ctx, browserWindow) | |||
| 541 | - | } | |||
| 542 | - | if a.tabCoord != nil { | |||
| 543 | - | a.wireBrowserWindowTabBar(ctx, browserWindow) | |||
| 544 | - | } | |||
| 545 | - | browserWindow.initChrome(ctx, a) | |||
| 546 | - | ||||
| 547 | - | // Apply GTK CSS styling from theme manager. | |||
| 548 | - | if a.deps == nil || a.deps.Theme == nil { | |||
| 549 | - | return browserWindow, nil | |||
| 550 | - | } | |||
| 551 | - | if display := mainWindow.Window().GetDisplay(); display != nil { | |||
| 552 | - | a.deps.Theme.ApplyToDisplay(ctx, display) | |||
| 553 | - | } | |||
| 554 | - | log.Debug(). | |||
| 555 | - | Str("window_id", browserWindow.id). | |||
| 556 | - | Str("url_host", logging.SafeURLHost(initialURL)). | |||
| 557 | - | Msg("ui: create browser window completed") | |||
| 558 | - | return browserWindow, nil | |||
| 559 | } | 563 | } | ||
| 560 | 564 | ||||
| 561 | func (a *App) ensureWindowForTabMap() { | 565 | func (a *App) ensureWindowForTabMap() { | ||