From 1caa476a842608c637d53dd47183122b4bb53bbc Mon Sep 17 00:00:00 2001 From: "diamondburned (Forefront)" Date: Wed, 1 Jul 2020 11:49:20 -0700 Subject: [PATCH] Added compat for v0.0.39 --- go.mod | 4 ++-- go.sum | 4 ++++ internal/ui/imgview/imgview.go | 3 +-- .../ui/messages/input/completion/completion.go | 15 ++++++++++++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 0e7137f..0076715 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ replace github.com/gotk3/gotk3 => github.com/diamondburned/gotk3 v0.0.0-20200630 require ( github.com/Xuanwo/go-locale v0.2.0 github.com/alecthomas/chroma v0.7.3 - github.com/diamondburned/cchat v0.0.37 - github.com/diamondburned/cchat-discord v0.0.0-20200630031444-53111f3186b3 + github.com/diamondburned/cchat v0.0.39 + github.com/diamondburned/cchat-discord v0.0.0-20200701182710-73a7393e7846 github.com/diamondburned/cchat-mock v0.0.0-20200630025821-605d61d89288 github.com/diamondburned/imgutil v0.0.0-20200611215339-650ac7cfaf64 github.com/goodsign/monday v1.0.0 diff --git a/go.sum b/go.sum index 328323c..39b0196 100644 --- a/go.sum +++ b/go.sum @@ -53,12 +53,16 @@ github.com/diamondburned/cchat v0.0.35 h1:WiMGl8BQJgbP9E4xRxgLGlqUsHpTcJgDKDt8/6 github.com/diamondburned/cchat v0.0.35/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU= github.com/diamondburned/cchat v0.0.37 h1:yGz9yls5Lb/vLkU/DU53GjC80WOqoRe229DXsu5mtaY= github.com/diamondburned/cchat v0.0.37/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU= +github.com/diamondburned/cchat v0.0.39 h1:Hxd7swmAIECm0MBd5wb1IFvreChwDFwnAshqgAstWGA= +github.com/diamondburned/cchat v0.0.39/go.mod h1:+zXktogE45A0om4fT6B/z6Ii7FXNafjxsNspI0rlhbU= github.com/diamondburned/cchat-discord v0.0.0-20200619222738-e5babcbb42e3 h1:8RCcaY3gtA+8NG2mwkcC/PIFK+eS8XnGyeVaUbCXbF0= github.com/diamondburned/cchat-discord v0.0.0-20200619222738-e5babcbb42e3/go.mod h1:4q0jHEl1gJEzkS92oacwcSf9+3fFcNPukOpURDJpV/A= github.com/diamondburned/cchat-discord v0.0.0-20200629023132-0a66a65fcf27 h1:MAWs83jAZKxkU04RAoaewc1xUrLKlB6F5X1ViFRkWdw= github.com/diamondburned/cchat-discord v0.0.0-20200629023132-0a66a65fcf27/go.mod h1:af673uNyL2NSjYqJ54DotPV/iNY+OvBcQfDqHefbap4= github.com/diamondburned/cchat-discord v0.0.0-20200630031444-53111f3186b3 h1:NDh2osOfPBtiNzz8ro8P7vN4f91uuVMMBJ8+Q2s/EQo= github.com/diamondburned/cchat-discord v0.0.0-20200630031444-53111f3186b3/go.mod h1:hj6qS/5TOiIxwWyFMts51ILzY9M3GKbXT31hjVbr9gM= +github.com/diamondburned/cchat-discord v0.0.0-20200701182710-73a7393e7846 h1:LLgI89H9A4ZVf8U7bHmOSkG12b8B6a9dwo32Bq7+0AI= +github.com/diamondburned/cchat-discord v0.0.0-20200701182710-73a7393e7846/go.mod h1:lLWRY7l6cC3bI2ge+Vc7pEhgbIL8XYCeXt+h1PWA/1k= github.com/diamondburned/cchat-mock v0.0.0-20200615015702-8cac8b16378d h1:LkzARyvdGRvAsaKEPTV3XcqMHENH6J+KRAI+3sq41Qs= github.com/diamondburned/cchat-mock v0.0.0-20200615015702-8cac8b16378d/go.mod h1:SVTt5je4G+re8aSVJAFk/x8vvbRzXdpKgSKmVGoM1tg= github.com/diamondburned/cchat-mock v0.0.0-20200620231423-b286a0301190 h1:mHbA/xhL584IToD38m3QkeU1cRWIPzBZCDFi1Wv0Bz4= diff --git a/internal/ui/imgview/imgview.go b/internal/ui/imgview/imgview.go index cc18d40..3ca37fd 100644 --- a/internal/ui/imgview/imgview.go +++ b/internal/ui/imgview/imgview.go @@ -33,8 +33,7 @@ func BindTooltip(connector WidgetConnector) { var x, y float64 connector.Connect("motion-notify-event", func(w gtk.IWidget, ev *gdk.Event) { - mev := gdk.EventMotionNewFromEvent(ev) - x, y = mev.MotionVal() + x, y = gdk.EventMotionNewFromEvent(ev).MotionVal() }) connector.Connect("activate-link", func(c WidgetConnector, uri string) bool { diff --git a/internal/ui/messages/input/completion/completion.go b/internal/ui/messages/input/completion/completion.go index 522cc37..e9da1eb 100644 --- a/internal/ui/messages/input/completion/completion.go +++ b/internal/ui/messages/input/completion/completion.go @@ -14,6 +14,8 @@ const ( ImagePadding = 6 ) +var ppIcon = []imgutil.Processor{imgutil.Round(true)} + type View struct { *completion.Completer entries []cchat.CompletionEntry @@ -56,14 +58,21 @@ func (v *View) Update(words []string, i int) []gtk.IWidget { // Do we have an icon? if entry.IconURL != "" { + img.SetMarginStart(ImagePadding) img.SetSizeRequest(ImageSize, ImageSize) img.Show() - httputil.AsyncImageSized(img, entry.IconURL, ImageSize, ImageSize, imgutil.Round(true)) + + var pps []imgutil.Processor + if !entry.Image { + pps = ppIcon + } + + httputil.AsyncImageSized(img, entry.IconURL, ImageSize, ImageSize, pps...) } b, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) - b.PackStart(img, false, false, ImagePadding) - b.PackStart(l, true, true, 0) + b.PackStart(img, false, false, 0) // image has pad left + b.PackStart(l, true, true, ImagePadding) b.Show() widgets[i] = b