diff options
Diffstat (limited to 'src/ui/lookupwidget.c')
-rw-r--r-- | src/ui/lookupwidget.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c index 7d6052e2..10039e10 100644 --- a/src/ui/lookupwidget.c +++ b/src/ui/lookupwidget.c | |||
@@ -372,6 +372,10 @@ static iThreadResult worker_LookupWidget_(iThread *thread) { | |||
372 | 372 | ||
373 | iDefineObjectConstruction(LookupWidget) | 373 | iDefineObjectConstruction(LookupWidget) |
374 | 374 | ||
375 | static void updateMetrics_LookupWidget_(iLookupWidget *d) { | ||
376 | setItemHeight_ListWidget(d->list, lineHeight_Text(uiContent_FontId) * 1.25f); | ||
377 | } | ||
378 | |||
375 | void init_LookupWidget(iLookupWidget *d) { | 379 | void init_LookupWidget(iLookupWidget *d) { |
376 | iWidget *w = as_Widget(d); | 380 | iWidget *w = as_Widget(d); |
377 | init_Widget(w); | 381 | init_Widget(w); |
@@ -381,7 +385,6 @@ void init_LookupWidget(iLookupWidget *d) { | |||
381 | setFlags_Widget(w, unhittable_WidgetFlag, iTrue); | 385 | setFlags_Widget(w, unhittable_WidgetFlag, iTrue); |
382 | #endif | 386 | #endif |
383 | d->list = addChild_Widget(w, iClob(new_ListWidget())); | 387 | d->list = addChild_Widget(w, iClob(new_ListWidget())); |
384 | setItemHeight_ListWidget(d->list, lineHeight_Text(uiContent_FontId) * 1.25f); | ||
385 | d->cursor = iInvalidPos; | 388 | d->cursor = iInvalidPos; |
386 | d->work = new_Thread(worker_LookupWidget_); | 389 | d->work = new_Thread(worker_LookupWidget_); |
387 | setUserData_Thread(d->work, d); | 390 | setUserData_Thread(d->work, d); |
@@ -390,6 +393,7 @@ void init_LookupWidget(iLookupWidget *d) { | |||
390 | init_String(&d->pendingTerm); | 393 | init_String(&d->pendingTerm); |
391 | d->pendingDocs = NULL; | 394 | d->pendingDocs = NULL; |
392 | d->finishedJob = NULL; | 395 | d->finishedJob = NULL; |
396 | updateMetrics_LookupWidget_(d); | ||
393 | start_Thread(d->work); | 397 | start_Thread(d->work); |
394 | } | 398 | } |
395 | 399 | ||
@@ -634,8 +638,11 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { | |||
634 | presentResults_LookupWidget_(d); | 638 | presentResults_LookupWidget_(d); |
635 | return iTrue; | 639 | return iTrue; |
636 | } | 640 | } |
637 | if (isResize_UserEvent(ev) || (equal_Command(cmd, "layout.changed") && | 641 | if (isMetricsChange_UserEvent(ev)) { |
638 | equal_Rangecc(range_Command(cmd, "id"), "navbar"))) { | 642 | updateMetrics_LookupWidget_(d); |
643 | } | ||
644 | else if (isResize_UserEvent(ev) || (equal_Command(cmd, "layout.changed") && | ||
645 | equal_Rangecc(range_Command(cmd, "id"), "navbar"))) { | ||
639 | /* Position the lookup popup under the URL bar. */ { | 646 | /* Position the lookup popup under the URL bar. */ { |
640 | const iWindow *window = get_Window(); | 647 | const iWindow *window = get_Window(); |
641 | const iInt2 rootSize = rootSize_Window(window); | 648 | const iInt2 rootSize = rootSize_Window(window); |