Skip to content

Commit

Permalink
Merge pull request #4103 from andydotxyz/fix/3981
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz authored Aug 1, 2023
2 parents ecb8c1a + e374b89 commit cfca1a7
Show file tree
Hide file tree
Showing 79 changed files with 696 additions and 644 deletions.
4 changes: 2 additions & 2 deletions cmd/fyne_settings/settings/appearance.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func newColorButton(n string, c color.Color, s *Settings) *colorButton {

func (c *colorButton) CreateRenderer() fyne.WidgetRenderer {
r := canvas.NewRectangle(c.color)
r.CornerRadius = theme.InputRadiusSize()
r.CornerRadius = theme.SelectionRadiusSize()
r.StrokeWidth = 5

if c.name == c.s.fyneSettings.PrimaryColor {
Expand Down Expand Up @@ -250,7 +250,7 @@ func (c *colorRenderer) Refresh() {
c.rect.StrokeColor = color.Transparent
}
c.rect.FillColor = c.c.color
c.rect.CornerRadius = theme.InputRadiusSize()
c.rect.CornerRadius = theme.SelectionRadiusSize()

c.rect.Refresh()
}
Expand Down
4 changes: 2 additions & 2 deletions dialog/fileitem.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (i *fileDialogItem) Tapped(_ *fyne.PointEvent) {

func (i *fileDialogItem) CreateRenderer() fyne.WidgetRenderer {
background := canvas.NewRectangle(nil)
background.CornerRadius = theme.InputRadiusSize()
background.CornerRadius = theme.SelectionRadiusSize()
text := widget.NewLabelWithStyle(i.name, fyne.TextAlignCenter, fyne.TextStyle{})
text.Wrapping = fyne.TextTruncate
icon := widget.NewFileIcon(i.location)
Expand Down Expand Up @@ -135,7 +135,7 @@ func (s fileItemRenderer) Refresh() {
s.background.FillColor = nil
}

s.background.CornerRadius = theme.InputRadiusSize()
s.background.CornerRadius = theme.SelectionRadiusSize()

s.background.Refresh()
canvas.Refresh(s.item)
Expand Down
2 changes: 2 additions & 0 deletions internal/driver/glfw/menu_bar_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (i *menuBarItem) Child() *publicWidget.Menu {
// Implements: fyne.Widget
func (i *menuBarItem) CreateRenderer() fyne.WidgetRenderer {
background := canvas.NewRectangle(theme.HoverColor())
background.CornerRadius = theme.SelectionRadiusSize()
background.Hide()
text := canvas.NewText(i.Menu.Label, theme.ForegroundColor())
objects := []fyne.CanvasObject{background, text}
Expand Down Expand Up @@ -160,6 +161,7 @@ func (r *menuBarItemRenderer) MinSize() fyne.Size {
}

func (r *menuBarItemRenderer) Refresh() {
r.background.CornerRadius = theme.SelectionRadiusSize()
if r.i.active && r.i.Parent.active {
r.background.FillColor = theme.FocusColor()
r.background.Show()
Expand Down
Binary file modified internal/driver/glfw/testdata/menu_bar_active_edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified internal/driver/glfw/testdata/menu_bar_active_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified internal/driver/glfw/testdata/menu_bar_active_help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified internal/driver/glfw/testdata/menu_bar_hovered_file_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified internal/driver/glfw/testdata/menu_bar_hovered_file_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified internal/driver/glfw/testdata/menu_bar_hovered_file_recent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified internal/driver/glfw/testdata/menu_bar_inactive_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down Expand Up @@ -52,7 +52,7 @@
<text pos="8,8" size="64x19">Open</text>
</widget>
<widget pos="0,78" size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="44x19">Recent</text>
<image pos="60,7" rsc="menuExpandIcon" size="iconInlineSize"/>
</widget>
Expand Down Expand Up @@ -81,7 +81,7 @@
<text pos="8,8" size="56x19">File 2</text>
</widget>
<widget pos="0,78" size="72x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="72x35"/>
<rectangle fillColor="focus" radius="4" size="72x35"/>
<text pos="8,8" size="36x19">Older</text>
<image pos="52,7" rsc="menuExpandIcon" size="iconInlineSize"/>
</widget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down Expand Up @@ -52,7 +52,7 @@
<text pos="8,8" size="64x19">Open</text>
</widget>
<widget pos="0,78" size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="44x19">Recent</text>
<image pos="60,7" rsc="menuExpandIcon" size="iconInlineSize"/>
</widget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down Expand Up @@ -52,7 +52,7 @@
<text pos="8,8" size="64x19">Open</text>
</widget>
<widget pos="0,78" size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="44x19">Recent</text>
<image pos="60,7" rsc="menuExpandIcon" size="iconInlineSize"/>
</widget>
Expand All @@ -75,7 +75,7 @@
<rectangle fillColor="menuBackground" size="72x113"/>
<container size="72x113">
<widget size="72x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="72x35"/>
<rectangle fillColor="focus" radius="4" size="72x35"/>
<text pos="8,8" size="56x19">File 1</text>
</widget>
<widget pos="0,39" size="72x35" type="*widget.menuItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down Expand Up @@ -52,7 +52,7 @@
<text pos="8,8" size="64x19">Open</text>
</widget>
<widget pos="0,78" size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="44x19">Recent</text>
<image pos="60,7" rsc="menuExpandIcon" size="iconInlineSize"/>
</widget>
Expand Down Expand Up @@ -81,7 +81,7 @@
<text pos="8,8" size="56x19">File 2</text>
</widget>
<widget pos="0,78" size="72x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="72x35"/>
<rectangle fillColor="focus" radius="4" size="72x35"/>
<text pos="8,8" size="36x19">Older</text>
<image pos="52,7" rsc="menuExpandIcon" size="iconInlineSize"/>
</widget>
Expand All @@ -104,7 +104,7 @@
<rectangle fillColor="menuBackground" size="50x74"/>
<container size="50x74">
<widget size="50x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="50x35"/>
<rectangle fillColor="focus" radius="4" size="50x35"/>
<text pos="8,8" size="34x19">Old 1</text>
</widget>
<widget pos="0,39" size="50x35" type="*widget.menuItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<text pos="8,4" size="25x19">Edit</text>
</widget>
<widget pos="87,0" size="46x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="46x27"/>
<rectangle fillColor="focus" radius="4" size="46x27"/>
<text pos="8,4" size="30x19">Help</text>
</widget>
</container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="41x27"/>
<rectangle fillColor="focus" radius="4" size="41x27"/>
<text pos="8,4" size="25x19">Edit</text>
</widget>
<widget pos="87,0" size="46x27" type="*glfw.menuBarItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="41x27"/>
<rectangle fillColor="focus" radius="4" size="41x27"/>
<text pos="8,4" size="25x19">Edit</text>
</widget>
<widget pos="87,0" size="46x27" type="*glfw.menuBarItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<text pos="8,4" size="25x19">Edit</text>
</widget>
<widget pos="87,0" size="46x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="46x27"/>
<rectangle fillColor="focus" radius="4" size="46x27"/>
<text pos="8,4" size="30x19">Help</text>
</widget>
</container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand All @@ -46,7 +46,7 @@
<rectangle fillColor="menuBackground" size="80x113"/>
<container size="80x113">
<widget size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="64x19">New</text>
</widget>
<widget pos="0,39" size="80x35" type="*widget.menuItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down Expand Up @@ -49,7 +49,7 @@
<text pos="8,8" size="64x19">New</text>
</widget>
<widget pos="0,39" size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="64x19">Open</text>
</widget>
<widget pos="0,78" size="80x35" type="*widget.menuItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down Expand Up @@ -52,7 +52,7 @@
<text pos="8,8" size="64x19">Open</text>
</widget>
<widget pos="0,78" size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="44x19">Recent</text>
<image pos="60,7" rsc="menuExpandIcon" size="iconInlineSize"/>
</widget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down Expand Up @@ -49,7 +49,7 @@
<text pos="8,8" size="64x19">New</text>
</widget>
<widget pos="0,39" size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="64x19">Open</text>
</widget>
<widget pos="0,78" size="80x35" type="*widget.menuItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand All @@ -46,7 +46,7 @@
<rectangle fillColor="menuBackground" size="80x113"/>
<container size="80x113">
<widget size="80x35" type="*widget.menuItem">
<rectangle fillColor="focus" size="80x35"/>
<rectangle fillColor="focus" radius="4" size="80x35"/>
<text pos="8,8" size="64x19">New</text>
</widget>
<widget pos="0,39" size="80x35" type="*widget.menuItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<rectangle fillColor="background" size="300x27"/>
<container pos="8,0" size="284x27">
<widget size="38x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="38x27"/>
<rectangle fillColor="focus" radius="4" size="38x27"/>
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<text pos="8,4" size="22x19">File</text>
</widget>
<widget pos="42,0" size="41x27" type="*glfw.menuBarItem">
<rectangle fillColor="focus" size="41x27"/>
<rectangle fillColor="focus" radius="4" size="41x27"/>
<text pos="8,4" size="25x19">Edit</text>
</widget>
</container>
Expand Down
2 changes: 1 addition & 1 deletion internal/driver/glfw/testdata/windows_hover_object.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</widget>
</widget>
<widget pos="0,39" size="192x35" type="*widget.listItem">
<rectangle fillColor="hover" size="192x35"/>
<rectangle fillColor="hover" radius="3" size="192x35"/>
<widget size="192x35" type="*widget.Entry">
<rectangle fillColor="inputBackground" pos="1,1" radius="5" size="190x33"/>
<rectangle radius="5" size="190x33" strokeColor="inputBorder" strokeWidth="1"/>
Expand Down
1 change: 1 addition & 0 deletions test/testtheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func NewTheme() fyne.Theme {
theme.SizeNameCaptionText: float32(15),
theme.SizeNameInputBorder: float32(5),
theme.SizeNameInputRadius: float32(2),
theme.SizeNameSelectionRadius: float32(6),
},
}
}
1 change: 1 addition & 0 deletions test/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func Theme() fyne.Theme {
theme.SizeNameCaptionText: float32(11),
theme.SizeNameInputBorder: float32(2),
theme.SizeNameInputRadius: float32(4),
theme.SizeNameSelectionRadius: float32(4),
},
}
}
Expand Down
Loading

0 comments on commit cfca1a7

Please sign in to comment.