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.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c
index ab0a009a..7d6052e2 100644
--- a/src/ui/lookupwidget.c
+++ b/src/ui/lookupwidget.c
@@ -629,9 +629,6 @@ static iBool moveCursor_LookupWidget_(iLookupWidget *d, int delta) {
629static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { 629static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
630 iWidget *w = as_Widget(d); 630 iWidget *w = as_Widget(d);
631 const char *cmd = command_UserEvent(ev); 631 const char *cmd = command_UserEvent(ev);
632// if (ev->type == SDL_MOUSEMOTION && contains_Widget(w, init_I2(ev->motion.x, ev->motion.y))) {
633// setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_ARROW);
634// }
635 if (isCommand_Widget(w, ev, "lookup.ready")) { 632 if (isCommand_Widget(w, ev, "lookup.ready")) {
636 /* Take the results and present them in the list. */ 633 /* Take the results and present them in the list. */
637 presentResults_LookupWidget_(d); 634 presentResults_LookupWidget_(d);
@@ -640,17 +637,23 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
640 if (isResize_UserEvent(ev) || (equal_Command(cmd, "layout.changed") && 637 if (isResize_UserEvent(ev) || (equal_Command(cmd, "layout.changed") &&
641 equal_Rangecc(range_Command(cmd, "id"), "navbar"))) { 638 equal_Rangecc(range_Command(cmd, "id"), "navbar"))) {
642 /* Position the lookup popup under the URL bar. */ { 639 /* Position the lookup popup under the URL bar. */ {
640 const iWindow *window = get_Window();
641 const iInt2 rootSize = rootSize_Window(window);
642 const iRect navBarBounds = bounds_Widget(findWidget_App("navbar"));
643 setSize_Widget(w, init_I2(width_Widget(findWidget_App("url")), 643 setSize_Widget(w, init_I2(width_Widget(findWidget_App("url")),
644 get_Window()->root->rect.size.y / 2)); 644 (rootSize.y - bottom_Rect(navBarBounds)) / 2));
645 setPos_Widget(w, bottomLeft_Rect(bounds_Widget(findWidget_App("url"))));
645#if defined (iPlatformAppleMobile) 646#if defined (iPlatformAppleMobile)
646 /* TODO: Ask the system how tall the keyboard is. */ { 647 /* TODO: Ask the system how tall the keyboard is. */ {
647 const iInt2 rootSize = rootSize_Window(get_Window()); 648 if (isLandscape_App()) {
648 if (rootSize.x > rootSize.y) {
649 w->rect.size.y = rootSize.y * 4 / 10; 649 w->rect.size.y = rootSize.y * 4 / 10;
650 } 650 }
651 else if (deviceType_App() == phone_AppDeviceType) {
652 w->rect.size.x = rootSize.x;
653 w->rect.pos.x = 0;
654 }
651 } 655 }
652#endif 656#endif
653 setPos_Widget(w, bottomLeft_Rect(bounds_Widget(findWidget_App("url"))));
654 arrange_Widget(w); 657 arrange_Widget(w);
655 } 658 }
656 updateVisible_ListWidget(d->list); 659 updateVisible_ListWidget(d->list);