From b924ad8d8180306f18434882ab922f8c54da4f98 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 27 May 2021 13:39:25 +0300 Subject: Fixed icon alignments Some of the icons in the Bookmarks list and lookup results were misaligned. --- src/ui/lookupwidget.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/ui/lookupwidget.c') diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c index 3eafd4bd..254aad93 100644 --- a/src/ui/lookupwidget.c +++ b/src/ui/lookupwidget.c @@ -127,10 +127,11 @@ static void draw_LookupItem_(iLookupItem *d, iPaint *p, iRect rect, const iListW pos.y = bottom_Rect(rect) - lineHeight_Text(d->font); } if (!isEmpty_String(&d->icon)) { - const iRect iconRect = { pos, init_I2(gap_UI * 5, height_Rect(rect)) }; - const iInt2 iconSize = measureRange_Text(d->font, range_String(&d->icon)); + const iRect iconRect = { init_I2(pos.x, top_Rect(rect)), + init_I2(gap_UI * 5, height_Rect(rect)) }; + const iRect iconVis = visualBounds_Text(d->font, range_String(&d->icon)); drawRange_Text(d->font, - addX_I2(pos, width_Rect(iconRect) / 2 - iconSize.x / 2), + sub_I2(mid_Rect(iconRect), mid_Rect(iconVis)), fg, range_String(&d->icon)); pos.x += width_Rect(iconRect) + gap_UI * 3 / 2; @@ -301,7 +302,7 @@ static void searchIdentities_LookupJob_(iLookupJob *d) { iLookupResult *res = new_LookupResult(); res->type = identity_LookupResultType; res->relevance = identityRelevance_LookupJob_(d, identity); - res->icon = identity->icon; + res->icon = 0x1f464; /* identity->icon; */ iString *cn = subject_TlsCertificate(identity->cert); set_String(&res->label, cn); delete_String(cn); @@ -701,6 +702,12 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { } return iTrue; } + if (ev->type == SDL_MOUSEMOTION) { + if (contains_Widget(w, init_I2(ev->motion.x, ev->motion.y))) { + setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_HAND); + } + return iFalse; + } if (ev->type == SDL_KEYDOWN) { const int mods = keyMods_Sym(ev->key.keysym.mod); const int key = ev->key.keysym.sym; -- cgit v1.2.3