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.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c
index 10039e10..eabfc7d2 100644
--- a/src/ui/lookupwidget.c
+++ b/src/ui/lookupwidget.c
@@ -36,6 +36,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36#include "util.h" 36#include "util.h"
37#include "visited.h" 37#include "visited.h"
38 38
39#if defined (iPlatformAppleMobile)
40# include "../ios.h"
41#endif
42
39#include <the_Foundation/mutex.h> 43#include <the_Foundation/mutex.h>
40#include <the_Foundation/thread.h> 44#include <the_Foundation/thread.h>
41#include <the_Foundation/regexp.h> 45#include <the_Foundation/regexp.h>
@@ -641,8 +645,9 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
641 if (isMetricsChange_UserEvent(ev)) { 645 if (isMetricsChange_UserEvent(ev)) {
642 updateMetrics_LookupWidget_(d); 646 updateMetrics_LookupWidget_(d);
643 } 647 }
644 else if (isResize_UserEvent(ev) || (equal_Command(cmd, "layout.changed") && 648 else if (isResize_UserEvent(ev) || equal_Command(cmd, "keyboard.changed") ||
645 equal_Rangecc(range_Command(cmd, "id"), "navbar"))) { 649 (equal_Command(cmd, "layout.changed") &&
650 equal_Rangecc(range_Command(cmd, "id"), "navbar"))) {
646 /* Position the lookup popup under the URL bar. */ { 651 /* Position the lookup popup under the URL bar. */ {
647 const iWindow *window = get_Window(); 652 const iWindow *window = get_Window();
648 const iInt2 rootSize = rootSize_Window(window); 653 const iInt2 rootSize = rootSize_Window(window);
@@ -651,13 +656,13 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
651 (rootSize.y - bottom_Rect(navBarBounds)) / 2)); 656 (rootSize.y - bottom_Rect(navBarBounds)) / 2));
652 setPos_Widget(w, bottomLeft_Rect(bounds_Widget(findWidget_App("url")))); 657 setPos_Widget(w, bottomLeft_Rect(bounds_Widget(findWidget_App("url"))));
653#if defined (iPlatformAppleMobile) 658#if defined (iPlatformAppleMobile)
654 /* TODO: Ask the system how tall the keyboard is. */ { 659 /* Adjust height based on keyboard size. */ {
655 if (isLandscape_App()) { 660 w->rect.size.y = visibleRootSize_Window(window).y - top_Rect(bounds_Widget(w));
656 w->rect.size.y = rootSize.y * 4 / 10; 661 if (deviceType_App() == phone_AppDeviceType) {
657 } 662 float l, r;
658 else if (deviceType_App() == phone_AppDeviceType) { 663 safeAreaInsets_iOS(&l, NULL, &r, NULL);
659 w->rect.size.x = rootSize.x; 664 w->rect.size.x = rootSize.x - l - r;
660 w->rect.pos.x = 0; 665 w->rect.pos.x = l;
661 } 666 }
662 } 667 }
663#endif 668#endif