Skip to content

Commit

Permalink
Fixing warnings from latest update
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jun 24, 2023
1 parent a12a4f5 commit 1122306
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 20 deletions.
7 changes: 4 additions & 3 deletions cmd/fynedesk/main.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package main

import (
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/theme"
wmtheme "fyshos.com/fynedesk/theme"

_ "fyshos.com/fynedesk/modules/composit"
_ "fyshos.com/fynedesk/modules/desktops"
_ "fyshos.com/fynedesk/modules/launcher"
_ "fyshos.com/fynedesk/modules/status"
_ "fyshos.com/fynedesk/modules/systray"

"fyne.io/fyne/v2/app"
)

func main() {
a := app.NewWithID("com.fyshos.fynedesk")
a.SetIcon(theme.FyneLogo())
a.SetIcon(wmtheme.AppIcon)
desk := setupDesktop(a)

desk.Run()
Expand Down
2 changes: 1 addition & 1 deletion internal/ui/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (w *widgetPanel) showAbout() {
bg := canvas.NewImageFromResource(wmTheme.FyneAboutBackground)
bg.FillMode = canvas.ImageFillContain
bg.Translucency = 0.67
win.SetContent(container.NewMax(bg, container.NewBorder(title, buttons, nil, nil, authors)))
win.SetContent(container.NewStack(bg, container.NewBorder(title, buttons, nil, nil, authors)))
win.SetCloseIntercept(func() {
win.Hide()
})
Expand Down
2 changes: 1 addition & 1 deletion internal/ui/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type background struct {
}

func (b *background) CreateRenderer() fyne.WidgetRenderer {
c := container.NewMax(b.loadModules()...)
c := container.NewStack(b.loadModules()...)
return &backgroundRenderer{b: b, c: c}
}

Expand Down
11 changes: 5 additions & 6 deletions internal/ui/desk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@ import (

"github.com/stretchr/testify/assert"

"fyshos.com/fynedesk"
wmTest "fyshos.com/fynedesk/test"
wmTheme "fyshos.com/fynedesk/theme"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/test"
"fyne.io/fyne/v2/theme"

"fyshos.com/fynedesk"
wmTest "fyshos.com/fynedesk/test"
wmTheme "fyshos.com/fynedesk/theme"
)

func TestDeskLayout_Layout(t *testing.T) {
l := &desktop{screens: wmTest.NewScreensProvider(&fynedesk.Screen{Name: "Screen0", X: 0, Y: 0,
Width: 2000, Height: 1000, Scale: 1.0}), settings: wmTest.NewSettings()}
l.bar = testBar([]string{})
l.widgets = newWidgetPanel(l)
bg := &background{wallpaper: container.NewStack(canvas.NewImageFromResource(theme.FyneLogo()))}
bg := &background{wallpaper: container.NewStack(canvas.NewImageFromResource(wmTheme.AppIcon))}
deskSize := fyne.NewSize(2000, 1000)

l.Layout([]fyne.CanvasObject{bg, l.bar, l.widgets}, deskSize)
Expand Down
7 changes: 4 additions & 3 deletions internal/ui/switcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (s *switchIcon) CreateRenderer() fyne.WidgetRenderer {
}

bg := canvas.NewRectangle(color.Transparent)
bg.CornerRadius = theme.InputRadiusSize()
img := canvas.NewImageFromResource(res)
text := widget.NewLabelWithStyle(title, fyne.TextAlignCenter, fyne.TextStyle{})
text.Wrapping = fyne.TextTruncate
Expand Down Expand Up @@ -90,11 +91,11 @@ type switchIconRenderer struct {
}

func (s switchIconRenderer) Layout(size fyne.Size) {
s.bg.Move(fyne.NewPos(-theme.Padding(), -theme.Padding()))
s.bg.Resize(size.Add(fyne.NewSize(theme.Padding()*2, theme.Padding()*2)))
s.bg.Move(fyne.NewPos(-theme.Padding()/2, -theme.Padding()/2))
s.bg.Resize(size.Add(fyne.NewSize(theme.Padding(), theme.Padding())))
s.img.Resize(fyne.NewSize(switcherIconSize, switcherIconSize))
s.text.Resize(fyne.NewSize(switcherIconSize+theme.Padding()*2, switcherTextSize))
s.text.Move(fyne.NewPos(-theme.Padding()*1, switcherIconSize))
s.text.Move(fyne.NewPos(-theme.Padding(), switcherIconSize-theme.Padding()/2))
}

func (s switchIconRenderer) MinSize() fyne.Size {
Expand Down
4 changes: 2 additions & 2 deletions internal/ui/widgetpanel.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (w *widgetPanel) CreateRenderer() fyne.WidgetRenderer {
})

w.rotated = &canvas.Image{}
w.clocks = container.NewMax(w.clock, container.New(&vClockPad{}, w.rotated))
w.clocks = container.NewStack(w.clock, container.New(&vClockPad{}, w.rotated))
if narrow {
w.clock.Hide()
} else {
Expand Down Expand Up @@ -237,7 +237,7 @@ func newWidgetPanel(rootDesk fynedesk.Desktop) *widgetPanel {
type vClockPad struct {
}

func (u *vClockPad) Layout(objects []fyne.CanvasObject, size fyne.Size) {
func (u *vClockPad) Layout(objects []fyne.CanvasObject, _ fyne.Size) {
objects[0].Resize(objects[0].MinSize())
objects[0].Move(fyne.NewPos(5, 0))
}
Expand Down
2 changes: 1 addition & 1 deletion modules/status/battery.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (b *battery) StatusAreaWidget() fyne.CanvasObject {
b.fill = canvas.NewRectangle(theme.ForegroundColor())
prop := canvas.NewRectangle(color.Transparent)
prop.SetMinSize(b.icon.MinSize().Add(fyne.NewSize(theme.Padding()*4, 0)))
icon := container.NewMax(container.NewCenter(prop, b.icon), container.NewWithoutLayout(b.fill))
icon := container.NewStack(container.NewCenter(prop, b.icon), container.NewWithoutLayout(b.fill))

// Set first value then tick
val, _ := b.value()
Expand Down
Binary file added theme/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion theme/bundled.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions theme/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ var (

// FyneAboutBackground is the image used as a background to the about screen
FyneAboutBackground = resourceFyneaboutbgPng
// AppIcon is the image for this application icon
AppIcon = resourceIconPng

// BatteryIcon is the material design icon for battery in light and dark theme
BatteryIcon = theme.NewThemedResource(resourceBatterySvg)
Expand Down
5 changes: 3 additions & 2 deletions wm/button.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package wm
import (
"image/color"

"fyshos.com/fynedesk"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"fyshos.com/fynedesk"
)

const (
Expand Down Expand Up @@ -52,5 +53,5 @@ func newCloseButton(win fynedesk.Window) fyne.CanvasObject {
}

b.Icon = theme.CancelIcon()
return container.NewMax(b.bg, b)
return container.NewStack(b.bg, b)
}

0 comments on commit 1122306

Please sign in to comment.