summaryrefslogtreecommitdiff
path: root/src/ui/lookupwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/lookupwidget.c')
-rw-r--r--src/ui/lookupwidget.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c
index d8e594de..e0de97bf 100644
--- a/src/ui/lookupwidget.c
+++ b/src/ui/lookupwidget.c
@@ -654,11 +654,14 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
654 (equal_Command(cmd, "layout.changed") && 654 (equal_Command(cmd, "layout.changed") &&
655 equal_Rangecc(range_Command(cmd, "id"), "navbar"))) { 655 equal_Rangecc(range_Command(cmd, "id"), "navbar"))) {
656 /* Position the lookup popup under the URL bar. */ { 656 /* Position the lookup popup under the URL bar. */ {
657 const iInt2 rootSize = size_Root(w->root); 657 iRoot *root = w->root;
658 const iRect navBarBounds = bounds_Widget(findWidget_App("navbar")); 658 const iInt2 rootSize = size_Root(root);
659 setFixedSize_Widget(w, init_I2(width_Widget(findWidget_App("url")), 659 const iRect navBarBounds = bounds_Widget(findChild_Widget(root->widget, "navbar"));
660 printf("navbar x:%d w:%d\n", navBarBounds.pos.x, navBarBounds.size.x);
661 iWidget *url = findChild_Widget(root->widget, "url");
662 setFixedSize_Widget(w, init_I2(width_Widget(url),
660 (rootSize.y - bottom_Rect(navBarBounds)) / 2)); 663 (rootSize.y - bottom_Rect(navBarBounds)) / 2));
661 setPos_Widget(w, bottomLeft_Rect(bounds_Widget(findWidget_App("url")))); 664 setPos_Widget(w, windowToLocal_Widget(w, bottomLeft_Rect(bounds_Widget(url))));
662#if defined (iPlatformAppleMobile) 665#if defined (iPlatformAppleMobile)
663 /* Adjust height based on keyboard size. */ { 666 /* Adjust height based on keyboard size. */ {
664 w->rect.size.y = visibleRootSize_Window(window).y - top_Rect(bounds_Widget(w)); 667 w->rect.size.y = visibleRootSize_Window(window).y - top_Rect(bounds_Widget(w));
@@ -667,6 +670,7 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
667 safeAreaInsets_iOS(&l, NULL, &r, NULL); 670 safeAreaInsets_iOS(&l, NULL, &r, NULL);
668 w->rect.size.x = rootSize.x - l - r; 671 w->rect.size.x = rootSize.x - l - r;
669 w->rect.pos.x = l; 672 w->rect.pos.x = l;
673 /* TODO: Need to use windowToLocal_Widget? */
670 } 674 }
671 } 675 }
672#endif 676#endif
@@ -694,7 +698,7 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
694 setText_InputWidget(url, url_DocumentWidget(document_App())); 698 setText_InputWidget(url, url_DocumentWidget(document_App()));
695 showCollapsed_Widget(w, iFalse); 699 showCollapsed_Widget(w, iFalse);
696 setCursor_LookupWidget_(d, iInvalidPos); 700 setCursor_LookupWidget_(d, iInvalidPos);
697 postCommandString_App(&item->command); 701 postCommandString_Root(get_Root(), &item->command);
698 postCommand_App("focus.set id:"); /* unfocus */ 702 postCommand_App("focus.set id:"); /* unfocus */
699 } 703 }
700 return iTrue; 704 return iTrue;