Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xgb backend problem #12

Open
Commod0re opened this issue Oct 22, 2012 · 0 comments
Open

xgb backend problem #12

Commod0re opened this issue Oct 22, 2012 · 0 comments

Comments

@Commod0re
Copy link

I'm currently migrating an application I'm working on from go-ui to go.uik

I discovered an issue while building on Linux, and the fixes are simple (incorrect and missing casts)

I got the following errors when trying to build:

../../github.com/skelterjohn/go.wde/xgb/icon.go:57: cannot use width (type int) as type uint in field value
../../github.com/skelterjohn/go.wde/xgb/icon.go:58: cannot use height (type int) as type uint in field value
../../github.com/skelterjohn/go.wde/xgb/icon.go:59: cannot use data (type []int) as type []uint in field value

so I changed the function SetIcon like so:

func (w *Window) SetIcon(icon image.Image) {
    width := icon.Bounds().Max.X - icon.Bounds().Min.X
    height := icon.Bounds().Max.Y - icon.Bounds().Min.Y
    data := make([]uint, width*height)
    for x := 0; x < width; x++ {
        for y := 0; y < height; y++ {
            i := x + y*width
            c := icon.At(x, y)
            r, g, b, a := c.RGBA()
            data[i] = uint(a + r<<8 + g<<16 + b<<24)
        }
    }
    wmicon := ewmh.WmIcon{
        Width:  uint(width),
        Height: uint(height),
        Data:   data,
    }
    ewmh.WmIconSet(w.xu, w.win.Id, []ewmh.WmIcon{wmicon})
}

and it now builds and runs properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant