diff --git a/desktop/go.mod b/desktop/go.mod index 5c8c2a3a0..ed3ee783c 100644 --- a/desktop/go.mod +++ b/desktop/go.mod @@ -20,4 +20,4 @@ require ( github.com/godbus/dbus/v5 v5.2.2 // indirect ) -replace github.com/vivaui/viva => github.com/Lithe-IDEA/viva v0.6.7-0.20261121064427-ecc66fc55042 +replace github.com/vivaui/viva => github.com/Lithe-IDEA/viva v0.6.7-0.20261123062230-3c6c46081fe6 diff --git a/desktop/go.sum b/desktop/go.sum index 397647976..ab1b5e213 100644 --- a/desktop/go.sum +++ b/desktop/go.sum @@ -1,5 +1,5 @@ -github.com/Lithe-IDEA/viva v0.6.7-0.20261121064427-ecc66fc55042 h1:OCMipbo7UxizI9qLawOemmDPxO4e/LTO/Q+GyqzetUQ= -github.com/Lithe-IDEA/viva v0.6.7-0.20261121064427-ecc66fc55042/go.mod h1:e9In6+J77G7B9ow4enZ2FSOFh7U3q4cQ5iJr3Qn/Olk= +github.com/Lithe-IDEA/viva v0.6.7-0.20261123062230-3c6c46081fe6 h1:w1ZfpHUsHEdY/rlQspiZcAAHsNcIEDH0iQ/NvPzVTJ4= +github.com/Lithe-IDEA/viva v0.6.7-0.20261123062230-3c6c46081fe6/go.mod h1:e9In6+J77G7B9ow4enZ2FSOFh7U3q4cQ5iJr3Qn/Olk= github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ= diff --git a/desktop/internal/logwindow/toolbar.go b/desktop/internal/logwindow/toolbar.go index 3cdc716a9..933c673ab 100644 --- a/desktop/internal/logwindow/toolbar.go +++ b/desktop/internal/logwindow/toolbar.go @@ -448,7 +448,7 @@ func (w *window) rangeEditor(c ui.C, anchor ui.Box) { w.rangeEnd = end.Format(toolbarTimeFormat) } spec := ui.PopoverSpec{Width: toolbarRangeWidth, Align: ui.Start, Offset: toolbarMenuGap} - ui.PopoverWith(c, anchor, spec, &w.menus.timeRange, func() { + ui.PopoverWith(c, anchor, &w.menus.timeRange, spec, func() { start, startOK := parseRangeTime(w.rangeStart) end, endOK := parseRangeTime(w.rangeEnd) readable := startOK && endOK diff --git a/desktop/internal/logwindow/window.go b/desktop/internal/logwindow/window.go index cc16e69c7..3635e5502 100644 --- a/desktop/internal/logwindow/window.go +++ b/desktop/internal/logwindow/window.go @@ -371,7 +371,7 @@ func (w *window) title(c ui.C) { if w.model.directory != "" { title = abbreviateHome(filepath.Join(w.model.directory, w.model.currentSessionPath)) } - leading, trailing := app.TitlebarInsets() + leading, trailing := c.TitlebarInsets() ui.Stack(c).FillWidth().Height(titleHeight).Shrink(0).Background(w.pal.bg3).MovesWindow().Children(func() { // The system's window buttons sit at the leading end, so the title keeps clear of // them on that side and is centered in what is left. diff --git a/desktop/internal/settingswindow/plugin_region_view.go b/desktop/internal/settingswindow/plugin_region_view.go index d687c1226..017da3a41 100644 --- a/desktop/internal/settingswindow/plugin_region_view.go +++ b/desktop/internal/settingswindow/plugin_region_view.go @@ -306,7 +306,7 @@ func (s regionSettings) toolPicker(c ui.C, row ui.Box, language i18n.Language, s title = i18n.Shared(language, "desktop.buildSettings.optionsProject") } spec := ui.PopoverSpec{Align: ui.Start, Width: toolPickerWidth, ConsumeOutsidePress: true, Title: title} - ui.PopoverWith(c, row, spec, open, func() { + ui.PopoverWith(c, row, open, spec, func() { before := scope.wanted(tool.ID) current := toolchainCurrent(tool) ui.Scroll(c.Part("choices")).Scrollbars().FillWidth().MaxHeight(toolPickerMaxHeight).Children(func() { diff --git a/desktop/internal/settingswindow/window_view.go b/desktop/internal/settingswindow/window_view.go index 2986b0dfc..6a9099014 100644 --- a/desktop/internal/settingswindow/window_view.go +++ b/desktop/internal/settingswindow/window_view.go @@ -7,7 +7,6 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/fontprefs" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/icons" - "github.com/vivaui/viva/app" "github.com/vivaui/viva/gfx" "github.com/vivaui/viva/ui" ) @@ -77,7 +76,7 @@ func (w *window) keys(c ui.C) { // title keeps the native window title beside the system controls. func (w *window) title(c ui.C) { - leading, trailing := app.TitlebarInsets() + leading, trailing := c.TitlebarInsets() ui.Stack(c).FillWidth().Height(titleHeight).Shrink(0).Background(w.pal.titleBar).MovesWindow().Children(func() { ui.Row(c).Fill().PadSides(0, max(8, trailing), 0, max(80, leading+10)).Items(ui.Center).Children(func() { ui.Text(c, w.text.Settings.Title).FontSize(13).Weight(gfx.WeightSemibold).Color(w.pal.text).Ellipsis() diff --git a/desktop/internal/workbench/branch_view.go b/desktop/internal/workbench/branch_view.go index 6f361bb48..cc7093bf2 100644 --- a/desktop/internal/workbench/branch_view.go +++ b/desktop/internal/workbench/branch_view.go @@ -51,7 +51,7 @@ func branchInset(depth int) float32 { return chromeEdge + float32(depth)*branchI func (a *App) drawBranchPopup(c ui.C, p *project, anchor ui.Box) { b, t := &a.branch, a.text.Branch spec := ui.PopoverSpec{Align: ui.Start, Offset: chromeMenuOffset, Width: branchPopupWidth, ConsumeOutsidePress: true} - ui.PopoverWith(c, anchor, spec, &b.open, func() { + ui.PopoverWith(c, anchor, &b.open, spec, func() { ui.Column(c).FillWidth().MaxHeight(branchPopupMaxHeight).Gap(chromeMenuItems).Children(func() { a.drawBranchPanel(c, p, t) }) @@ -199,7 +199,7 @@ func (a *App) drawWorkspaceBranchRepo(c ui.C, p *project, t i18n.BranchMessages, // The press that closes the panel goes on to the popup, so a click on another repository opens // that one's panel at once. spec := ui.PopoverSpec{Side: components.PopoverRight, Align: ui.Start, Offset: chromeMenuOffset, Width: branchPopupWidth} - ui.PopoverWith(c, row, spec, &b.repoOpen, func() { + ui.PopoverWith(c, row, &b.repoOpen, spec, func() { ui.Column(c).FillWidth().MaxHeight(branchPopupMaxHeight).Gap(chromeMenuItems).Children(func() { if a.drawBranchActions(c, p, b.currentReference(), query, false) { ui.Divider(c) diff --git a/desktop/internal/workbench/chrome_view.go b/desktop/internal/workbench/chrome_view.go index e9bb84ee3..46de23070 100644 --- a/desktop/internal/workbench/chrome_view.go +++ b/desktop/internal/workbench/chrome_view.go @@ -4,11 +4,9 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/icons" - "github.com/vivaui/viva/app" "github.com/vivaui/viva/components" "github.com/vivaui/viva/gfx" "github.com/vivaui/viva/ui" - "runtime" "slices" ) @@ -130,12 +128,9 @@ func (a *App) chromeGlyph(c ui.C, i int, layout glyphLayout, rest, hover gfx.Col // controls in it take their own presses. func (a *App) titleBar(c ui.C) { // The system's window buttons sit at one end of the strip, so the content keeps clear of - // them. - leading, trailing := app.TitlebarInsets() - if a.fullscreen && runtime.GOOS == "darwin" { - // macOS hides the traffic lights in fullscreen; the strip starts at the edge. - leading = 0 - } + // them. The window answers for itself: zero in full screen, where macOS hides the + // traffic lights, and under a system titlebar. + leading, trailing := c.TitlebarInsets() clicked := -1 ui.Row(c).FillWidth().Height(titleBarHeight).Shrink(0).Background(a.chromeFill()). Items(ui.Center).Gap(chromeGap).PadSides(0, trailing+chromeEdge, 0, leading+chromeEdge). @@ -450,7 +445,7 @@ func (a *App) hiddenToolWindowList(c ui.C, anchor ui.Box, z zone) { if z != zoneLeftTop && z != zoneRightTop { spec.Align = ui.End } - ui.PopoverWith(c, anchor, spec, &open, func() { + ui.PopoverWith(c, anchor, &open, spec, func() { ui.Column(c).FillWidth().Gap(chromeMenuItems).Children(func() { for _, i := range a.chrome.hidden { row, clicked := a.hiddenToolWindowRow(c.KeyInt(i), i) @@ -634,7 +629,7 @@ func (a *App) projectMenu(c ui.C, anchor ui.Box) { picked, removed := -1, -1 spec := ui.PopoverSpec{Align: ui.Start, Offset: chromeMenuOffset, Width: chromeMenuWidth, ConsumeOutsidePress: true} open := true - ui.PopoverWith(c, anchor, spec, &open, func() { + ui.PopoverWith(c, anchor, &open, spec, func() { ui.Scroll(c).Scrollbars().FillWidth().MaxHeight(chromeMenuMaxHeight).Gap(chromeMenuItems).Children(func() { created = a.menuAction(c.Part("new"), icons.Plus, a.text.Title.NewProjectItem) chosen = a.menuAction(c.Part("open"), icons.FolderOpen, a.text.Title.OpenItem) diff --git a/desktop/internal/workbench/commit_view.go b/desktop/internal/workbench/commit_view.go index b868307c6..cfc5b889e 100644 --- a/desktop/internal/workbench/commit_view.go +++ b/desktop/internal/workbench/commit_view.go @@ -412,7 +412,7 @@ func (a *App) drawCommitOptions(c ui.C, cs *commitState, generates bool) { // they belong to; they line up with the gear at the bottom and grow upwards, and open on // the left when the panel is docked at the window's right edge. spec := ui.PopoverSpec{Side: components.PopoverRight, Align: ui.End, Width: 320} - ui.PopoverWith(c, button, spec, &cs.optionsOpen, func() { + ui.PopoverWith(c, button, &cs.optionsOpen, spec, func() { ui.Column(c).FillWidth().Gap(8).Children(func() { a.commitOptionHeading(c, i18n.Shared(lang, "desktop.commit.optionsGit")) ui.Row(c).FillWidth().Items(ui.Center).Gap(4).Children(func() { diff --git a/desktop/internal/workbench/gitlog_popover_view.go b/desktop/internal/workbench/gitlog_popover_view.go index e3cc096d8..b62a19422 100644 --- a/desktop/internal/workbench/gitlog_popover_view.go +++ b/desktop/internal/workbench/gitlog_popover_view.go @@ -43,7 +43,7 @@ func (a *App) drawLogPopover(c ui.C, p *project, which logPopover, anchor ui.Box } open := true spec := ui.PopoverSpec{Align: ui.Start, Offset: 4, Width: width, ConsumeOutsidePress: true} - ui.PopoverWith(c, anchor, spec, &open, func() { + ui.PopoverWith(c, anchor, &open, spec, func() { switch l.popover { case logPopoverBranch: a.drawLogBranchFilter(c, p) diff --git a/desktop/internal/workbench/markdown_preview.go b/desktop/internal/workbench/markdown_preview.go index b9edcdd75..3960c2a79 100644 --- a/desktop/internal/workbench/markdown_preview.go +++ b/desktop/internal/workbench/markdown_preview.go @@ -362,7 +362,7 @@ func (a *App) markdownContentsButton(c ui.C, p *project, d *document) { top = min(top, h.level) } spec := ui.PopoverSpec{Align: ui.End, Width: markdownContentsWidth, ConsumeOutsidePress: true, Title: title} - ui.PopoverWith(c, button, spec, &s.contentsOpen, func() { + ui.PopoverWith(c, button, &s.contentsOpen, spec, func() { height := min(float32(len(s.headings))*markdownContentsRow, markdownContentsMax) ui.List(c, &s.contents, len(s.headings), func(row ui.ListRow) { h := s.headings[row.Index] diff --git a/desktop/internal/workbench/memory_monitor.go b/desktop/internal/workbench/memory_monitor.go index a3a209f01..d9c05c702 100644 --- a/desktop/internal/workbench/memory_monitor.go +++ b/desktop/internal/workbench/memory_monitor.go @@ -433,7 +433,7 @@ func (a *App) memoryDetails(c ui.C, anchor ui.Box) { c.Canvas().RequestFrameIn(memoryDetailInterval) language := a.language() spec := ui.PopoverSpec{Side: components.PopoverTop, Align: ui.End, Offset: chromeMenuOffset, Width: memoryPanelWidth, ConsumeOutsidePress: true} - ui.PopoverWith(c.Key("memoryDetails"), anchor, spec, &m.open, func() { + ui.PopoverWith(c.Key("memoryDetails"), anchor, &m.open, spec, func() { ui.Column(c).FillWidth().Gap(memorySectionGap).Children(func() { a.memoryHeader(c, language) switch { diff --git a/desktop/internal/workbench/notifications.go b/desktop/internal/workbench/notifications.go index e29b964d3..246e5d5f4 100644 --- a/desktop/internal/workbench/notifications.go +++ b/desktop/internal/workbench/notifications.go @@ -313,7 +313,7 @@ func (a *App) notificationPanel(c ui.C, anchor ui.Box) { align = ui.Start } spec := ui.PopoverSpec{Side: components.PopoverTop, Align: align, Offset: chromeMenuOffset, Width: notificationPanelWidth, ConsumeOutsidePress: true} - ui.PopoverWith(c, anchor, spec, ¢er.open, func() { + ui.PopoverWith(c, anchor, ¢er.open, spec, func() { ui.Row(c).FillWidth().Height(28).Items(ui.Center).Gap(8).Children(func() { ui.Text(c, i18n.Shared(language, "desktop.notifications.title")).Weight(gfx.WeightSemibold).Grow(1).Ellipsis() a.notificationClearButton(c) diff --git a/desktop/internal/workbench/project_gradient.go b/desktop/internal/workbench/project_gradient.go index 3aab8487c..2eb3ce33b 100644 --- a/desktop/internal/workbench/project_gradient.go +++ b/desktop/internal/workbench/project_gradient.go @@ -1,9 +1,6 @@ package workbench import ( - "runtime" - - "github.com/vivaui/viva/app" "github.com/vivaui/viva/gfx" ) @@ -60,10 +57,9 @@ func (a *App) paintProjectGradient(canvas *gfx.Canvas, bounds gfx.Rect) { rgb = projectGradientDark[index] } peak := gfx.RGB24(rgb) - leading, _ := app.TitlebarInsets() - if a.fullscreen && runtime.GOOS == "darwin" { - leading = 0 - } + // The canvas answers for the window it paints: zero in full screen and under a + // system titlebar, where the buttons are not on the strip. + leading, _ := canvas.TitlebarInsets() anchor := leading + projectGradientAnchor width := min(anchor+projectGradientWidth, bounds.Width) if width <= 0 { diff --git a/desktop/internal/workbench/remote_host_files_view.go b/desktop/internal/workbench/remote_host_files_view.go index 20049b67c..c667d921a 100644 --- a/desktop/internal/workbench/remote_host_files_view.go +++ b/desktop/internal/workbench/remote_host_files_view.go @@ -32,9 +32,9 @@ func (a *App) remoteHostFilesPopup(c ui.C) { ui.Stack(c.Part("remote-host-files-anchor")).Fill().Children(func() { anchor = ui.Row(c).Absolute().Left((bounds.Width - width) / 2).Top(84).Width(width).Height(1) }) - closed := ui.PopoverWith(c.Part("remote-host-files"), anchor, ui.PopoverSpec{ + closed := ui.PopoverWith(c.Part("remote-host-files"), anchor, &f.open, ui.PopoverSpec{ Width: width, Offset: 1, Align: ui.Start, KeepOpenOnAnchor: true, - }, &f.open, func() { + }, func() { ui.Column(c).FillWidth().Height(height).Gap(8).Children(func() { ui.Row(c).FillWidth().Items(ui.Center).Gap(8).Children(func() { ui.Text(c, i18n.Shared(language, "desktop.remote.hostFile.title")).Bold().Shrink(0) diff --git a/desktop/internal/workbench/search_everywhere_view.go b/desktop/internal/workbench/search_everywhere_view.go index 51a785604..f4a9e4eaf 100644 --- a/desktop/internal/workbench/search_everywhere_view.go +++ b/desktop/internal/workbench/search_everywhere_view.go @@ -56,9 +56,9 @@ func (a *App) everywherePopup(c ui.C) { ui.Stack(c).Fill().Children(func() { anchor = ui.Row(c).Absolute().Left((bounds.Width - width) / 2).Top(84).Width(width).Height(1) }) - closed := ui.PopoverWith(c, anchor, ui.PopoverSpec{ + closed := ui.PopoverWith(c, anchor, &v.open, ui.PopoverSpec{ Width: width, Offset: 1, Align: ui.Start, KeepOpenOnAnchor: true, - }, &v.open, func() { + }, func() { ui.Column(c).FillWidth().Height(height).Gap(8).Children(func() { if p.everywhereActionsOnly() { ui.Text(c, i18n.Shared(language, "desktop.everywhere.actions")).Bold() @@ -229,7 +229,7 @@ func (a *App) everywhereFilter(c ui.C, p *project, language i18n.Language) { if button.Clicked() { v.filterOpen = !v.filterOpen } - ui.PopoverWith(c, button, ui.PopoverSpec{Align: ui.End, Width: 300}, &v.filterOpen, func() { + ui.PopoverWith(c, button, &v.filterOpen, ui.PopoverSpec{Align: ui.End, Width: 300}, func() { option := func(label, action string, value *bool) { before := *value ui.Checkbox(c, value, label) diff --git a/desktop/internal/workbench/search_view.go b/desktop/internal/workbench/search_view.go index b7f279a0d..8dbe1e9e3 100644 --- a/desktop/internal/workbench/search_view.go +++ b/desktop/internal/workbench/search_view.go @@ -95,7 +95,7 @@ func (a *App) searchOptions(c ui.C, language i18n.Language) { if button.Clicked() { v.optionsOpen = !v.optionsOpen } - ui.PopoverWith(c, button, ui.PopoverSpec{Align: ui.End, Width: 300}, &v.optionsOpen, func() { + ui.PopoverWith(c, button, &v.optionsOpen, ui.PopoverSpec{Align: ui.End, Width: 300}, func() { option := func(label, action string, value *bool) { before := *value ui.Checkbox(c, value, label) diff --git a/desktop/internal/workbench/standalone.go b/desktop/internal/workbench/standalone.go index 942338594..a78a5fc4e 100644 --- a/desktop/internal/workbench/standalone.go +++ b/desktop/internal/workbench/standalone.go @@ -39,7 +39,7 @@ func (a *App) standaloneWorkbench(c ui.C) { plan := a.layout.arrange(c.Bounds(), open) hidden := slotCount language := a.language() - leading, trailing := app.TitlebarInsets() + leading, trailing := c.TitlebarInsets() ui.Column(c).Fill().Children(func() { ui.Row(c).FillWidth().Height(titleBarHeight).Shrink(0).Items(ui.Center).Gap(8). PadSides(0, trailing+chromeEdge, 0, leading+chromeEdge).MovesWindow().Children(func() { diff --git a/desktop/internal/workbench/tabstrip.go b/desktop/internal/workbench/tabstrip.go index 5ad312a5a..ab0f5ffba 100644 --- a/desktop/internal/workbench/tabstrip.go +++ b/desktop/internal/workbench/tabstrip.go @@ -521,7 +521,7 @@ func (a *App) hiddenTabsButton(c ui.C, place *groupPlace, s *tabStrip, tabs []sh wasOpen := s.menu if s.menu { spec := ui.PopoverSpec{Align: ui.End, Offset: chromeMenuOffset, Width: tabMenuWidth, ConsumeOutsidePress: true} - ui.PopoverWith(c, button, spec, &s.menu, func() { + ui.PopoverWith(c, button, &s.menu, spec, func() { ui.Scroll(c.Part("hidden")).Scrollbars().FillWidth().MaxHeight(tabMenuMaxHeight).Gap(chromeMenuItems).Children(func() { for _, member := range s.hidden { i := slices.IndexFunc(tabs, func(t shownTab) bool { return t.member() == member }) diff --git a/desktop/internal/workbench/welcome_view.go b/desktop/internal/workbench/welcome_view.go index 849b3bfdc..86d51466e 100644 --- a/desktop/internal/workbench/welcome_view.go +++ b/desktop/internal/workbench/welcome_view.go @@ -40,7 +40,7 @@ func (a *App) welcomePanel(c ui.C) { // The macOS welcome title sits after the traffic lights; the workbench hides it. title := ui.Row(c).Absolute().Top(0).Right(0) if runtime.GOOS == "darwin" { - leading, _ := app.TitlebarInsets() + leading, _ := c.TitlebarInsets() title.Left(max(84, leading+10)).Height(32).Items(ui.Center) } else { title.Left(0).Height(titleBarHeight).Center() @@ -50,7 +50,7 @@ func (a *App) welcomePanel(c ui.C) { }) // The update arrow sits at the top right, as on the workbench's title bar, clear of the // system's window buttons where they are on that side. - _, trailing := app.TitlebarInsets() + _, trailing := c.TitlebarInsets() ui.Row(c).Absolute().Top(0).Right(trailing + chromeEdge).Height(titleBarHeight).Items(ui.Center).Children(func() { a.updateArrow(c) }) diff --git a/desktop/internal/workbench/workbench_background.go b/desktop/internal/workbench/workbench_background.go index 7e0c9dc22..9e18f2b96 100644 --- a/desktop/internal/workbench/workbench_background.go +++ b/desktop/internal/workbench/workbench_background.go @@ -589,7 +589,7 @@ func (a *App) backgroundPopover(c ui.C, anchor ui.Box) { picked := strength spec := ui.PopoverSpec{Side: components.PopoverLeft, Align: ui.End, Width: 320, ConsumeOutsidePress: true} open := true - ui.PopoverWith(c.Key("workbenchBackground"), anchor, spec, &open, func() { + ui.PopoverWith(c.Key("workbenchBackground"), anchor, &open, spec, func() { ui.Column(c).Gap(8).FillWidth().Children(func() { ui.Row(c).FillWidth().Items(ui.Center).Gap(6).Children(func() { ui.Icon(c, icons.Image).Size(14, 14).Color(a.colors.Subtle)