summaryrefslogtreecommitdiff
path: root/src/ui/lookupwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-27 13:39:25 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-27 13:39:25 +0300
commitb924ad8d8180306f18434882ab922f8c54da4f98 (patch)
treee05d84c294e3f4cc7d9f66535e80ddcfcee92d9e /src/ui/lookupwidget.c
parentc75d710f1b81e273d2d4d385ef765702de533f1b (diff)
Fixed icon alignments
Some of the icons in the Bookmarks list and lookup results were misaligned.
Diffstat (limited to 'src/ui/lookupwidget.c')
-rw-r--r--src/ui/lookupwidget.c15
1 files changed, 11 insertions, 4 deletions
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
127 pos.y = bottom_Rect(rect) - lineHeight_Text(d->font); 127 pos.y = bottom_Rect(rect) - lineHeight_Text(d->font);
128 } 128 }
129 if (!isEmpty_String(&d->icon)) { 129 if (!isEmpty_String(&d->icon)) {
130 const iRect iconRect = { pos, init_I2(gap_UI * 5, height_Rect(rect)) }; 130 const iRect iconRect = { init_I2(pos.x, top_Rect(rect)),
131 const iInt2 iconSize = measureRange_Text(d->font, range_String(&d->icon)); 131 init_I2(gap_UI * 5, height_Rect(rect)) };
132 const iRect iconVis = visualBounds_Text(d->font, range_String(&d->icon));
132 drawRange_Text(d->font, 133 drawRange_Text(d->font,
133 addX_I2(pos, width_Rect(iconRect) / 2 - iconSize.x / 2), 134 sub_I2(mid_Rect(iconRect), mid_Rect(iconVis)),
134 fg, 135 fg,
135 range_String(&d->icon)); 136 range_String(&d->icon));
136 pos.x += width_Rect(iconRect) + gap_UI * 3 / 2; 137 pos.x += width_Rect(iconRect) + gap_UI * 3 / 2;
@@ -301,7 +302,7 @@ static void searchIdentities_LookupJob_(iLookupJob *d) {
301 iLookupResult *res = new_LookupResult(); 302 iLookupResult *res = new_LookupResult();
302 res->type = identity_LookupResultType; 303 res->type = identity_LookupResultType;
303 res->relevance = identityRelevance_LookupJob_(d, identity); 304 res->relevance = identityRelevance_LookupJob_(d, identity);
304 res->icon = identity->icon; 305 res->icon = 0x1f464; /* identity->icon; */
305 iString *cn = subject_TlsCertificate(identity->cert); 306 iString *cn = subject_TlsCertificate(identity->cert);
306 set_String(&res->label, cn); 307 set_String(&res->label, cn);
307 delete_String(cn); 308 delete_String(cn);
@@ -701,6 +702,12 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
701 } 702 }
702 return iTrue; 703 return iTrue;
703 } 704 }
705 if (ev->type == SDL_MOUSEMOTION) {
706 if (contains_Widget(w, init_I2(ev->motion.x, ev->motion.y))) {
707 setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_HAND);
708 }
709 return iFalse;
710 }
704 if (ev->type == SDL_KEYDOWN) { 711 if (ev->type == SDL_KEYDOWN) {
705 const int mods = keyMods_Sym(ev->key.keysym.mod); 712 const int mods = keyMods_Sym(ev->key.keysym.mod);
706 const int key = ev->key.keysym.sym; 713 const int key = ev->key.keysym.sym;