[1mdiff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c[m
[1mindex e57a5fdc..da0113ce 100644[m
[1m--- a/src/ui/lookupwidget.c[m
[1m+++ b/src/ui/lookupwidget.c[m
[36m@@ -665,8 +665,9 @@[m [mstatic iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {[m
(bottom_Rect(rect_Root(root)) - bottom_Rect(navBarBounds)) / 2));[m
setPos_Widget(w, windowToLocal_Widget(w, bottomLeft_Rect(bounds_Widget(url))));[m
#if defined (iPlatformAppleMobile)[m
[32m+[m[32m /* TODO: Check this again. */[m
/* Adjust height based on keyboard size. */ {[m
[31m- w->rect.size.y = visibleSize_Root(root).y - top_Rect(bounds_Widget(w));[m
[32m+[m[32m w->rect.size.y = bottom_Rect(visibleRect_Root(root)) - top_Rect(bounds_Widget(w));[m
if (deviceType_App() == phone_AppDeviceType) {[m
float l, r;[m
safeAreaInsets_iOS(&l, NULL, &r, NULL);[m
[1mdiff --git a/src/ui/root.c b/src/ui/root.c[m
[1mindex d847480f..95126654 100644[m
[1m--- a/src/ui/root.c[m
[1m+++ b/src/ui/root.c[m
[36m@@ -1529,6 +1529,35 @@[m [miRect safeRect_Root(const iRoot *d) {[m
return rect;[m
}[m
[m
[31m-iInt2 visibleSize_Root(const iRoot *d) {[m
[31m- return addY_I2(size_Root(d), -get_MainWindow()->keyboardHeight);[m
[32m+[m[32miRect visibleRect_Root(const iRoot *d) {[m
[32m+[m[32m iRect visRect = rect_Root(d);[m
[32m+[m[32m#if defined (iPlatformAppleMobile)[m
[32m+[m[32m /* TODO: Check this on device... Maybe DisplayUsableBounds would be good here, too? */[m
[32m+[m[32m float left, top, right, bottom;[m
[32m+[m[32m safeAreaInsets_iOS(&left, &top, &right, &bottom);[m
[32m+[m[32m visRect.pos.x = (int) left;[m
[32m+[m[32m visRect.size.x -= (int) (left + right);[m
[32m+[m[32m visRect.pos.y = (int) top;[m
[32m+[m[32m visRect.size.y -= (int) (top + bottom);[m
[32m+[m[32m#endif[m
[32m+[m[32m#if defined (iPlatformDesktop)[m
[32m+[m[32m /* Apply the usable bounds of the display. */[m
[32m+[m[32m SDL_Rect usable; {[m
[32m+[m[32m const float ratio = d->window->pixelRatio;[m
[32m+[m[32m SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(d->window->win), &usable);[m
[32m+[m[32m iInt2 winPos;[m
[32m+[m[32m SDL_GetWindowPosition(d->window->win, &winPos.x, &winPos.y);[m
[32m+[m[32m mulfv_I2(&winPos, ratio);[m
[32m+[m[32m usable.x *= ratio;[m
[32m+[m[32m usable.y *= ratio;[m
[32m+[m[32m usable.w *= ratio;[m
[32m+[m[32m usable.h *= ratio;[m
[32m+[m[32m /* Make it relative to the window. */[m
[32m+[m[32m usable.x -= winPos.x;[m
[32m+[m[32m usable.y -= winPos.y;[m
[32m+[m[32m visRect = intersect_Rect(visRect, init_Rect(usable.x, usable.y, usable.w, usable.h));[m[41m [m
[32m+[m[32m }[m
[32m+[m[32m#endif[m
[32m+[m[32m adjustEdges_Rect(&visRect, 0, 0, -get_MainWindow()->keyboardHeight, 0);[m
[32m+[m[32m return visRect;[m
}[m
[1mdiff --git a/src/ui/root.h b/src/ui/root.h[m
[1mindex 04dd5e16..851d927d 100644[m
[1m--- a/src/ui/root.h[m
[1m+++ b/src/ui/root.h[m
[36m@@ -40,6 +40,6 @@[m [mvoid updateToolbarColors_Root (iRoot *);[m
iInt2 size_Root (const iRoot *);[m
iRect rect_Root (const iRoot *);[m
iRect safeRect_Root (const iRoot *);[m
[31m-iInt2 visibleSize_Root (const iRoot ); / may be obstructed by software keyboard */[m
[32m+[m[32miRect visibleRect_Root (const iRoot ); / may be obstructed by software keyboard */[m
iBool isNarrow_Root (const iRoot *);[m
int appIconSize_Root (void);[m
[1mdiff --git a/src/ui/util.c b/src/ui/util.c[m
[1mindex 760bf48f..88348ff8 100644[m
[1m--- a/src/ui/util.c[m
[1m+++ b/src/ui/util.c[m
[36m@@ -1038,7 +1038,7 @@[m [mvoid openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {[m
iRect displayRect = zero_Rect(); [m
for (int i = 0; i < SDL_GetNumVideoDisplays(); i++) {[m
SDL_Rect dispBounds;[m
[31m- SDL_GetDisplayBounds(i, &dispBounds);[m
[32m+[m[32m SDL_GetDisplayUsableBounds(i, &dispBounds);[m
displayRect = union_Rect([m
displayRect, init_Rect(dispBounds.x, dispBounds.y, dispBounds.w, dispBounds.h));[m
}[m
[36m@@ -1070,7 +1070,7 @@[m [mvoid openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {[m
iInt2 menuPos = add_I2(winPos,[m
divf_I2(sub_I2(windowCoord, divi_I2(gap2_UI, 2)), pixelRatio));[m
/* Check display bounds. */ {[m
[31m- const iInt2 menuSize = divf_I2(d->rect.size, pixelRatio);[m
[32m+[m[32m iInt2 menuSize = divf_I2(d->rect.size, pixelRatio);[m
if (menuOpenFlags & center_MenuOpenFlags) {[m
iInt2 winSize;[m
SDL_GetWindowSize(sdlWin, &winSize.x, &winSize.y);[m
[1mdiff --git a/src/ui/widget.c b/src/ui/widget.c[m
[1mindex b509cbe2..6ce5e02a 100644[m
[1m--- a/src/ui/widget.c[m
[1m+++ b/src/ui/widget.c[m
[36m@@ -1142,11 +1142,9 @@[m [mstatic iBool isOverflowScrollPossible_Widget_(const iWidget *d, int delta) {[m
return iFalse;[m
}[m
iRect bounds = boundsWithoutVisualOffset_Widget(d);[m
[31m- const iRect winRect = adjusted_Rect(safeRect_Root(d->root),[m
[31m- zero_I2(),[m
[31m- init_I2(0, -get_MainWindow()->keyboardHeight));[m
[31m- const int yTop = top_Rect(winRect);[m
[31m- const int yBottom = bottom_Rect(winRect);[m
[32m+[m[32m const iRect winRect = visibleRect_Root(d->root);[m
[32m+[m[32m const int yTop = top_Rect(winRect);[m
[32m+[m[32m const int yBottom = bottom_Rect(winRect);[m
if (delta == 0) {[m
if (top_Rect(bounds) >= yTop && bottom_Rect(bounds) <= yBottom) {[m
return iFalse; /* fits inside just fine */[m
[36m@@ -1162,11 +1160,9 @@[m [miBool scrollOverflow_Widget(iWidget *d, int delta) {[m
if (!isOverflowScrollPossible_Widget_(d, delta)) {[m
return iFalse;[m
}[m
[31m- iRect bounds = boundsWithoutVisualOffset_Widget(d);[m
[31m- const iRect winRect = adjusted_Rect(safeRect_Root(d->root),[m
[31m- zero_I2(),[m
[31m- init_I2(0, -get_MainWindow()->keyboardHeight));[m
[31m- iRangei validPosRange = { bottom_Rect(winRect) - height_Rect(bounds), top_Rect(winRect) };[m
[32m+[m[32m iRect bounds = boundsWithoutVisualOffset_Widget(d);[m
[32m+[m[32m const iRect winRect = visibleRect_Root(d->root);[m
[32m+[m[32m iRangei validPosRange = { bottom_Rect(winRect) - height_Rect(bounds), top_Rect(winRect) };[m
if (validPosRange.start > validPosRange.end) {[m
validPosRange.start = validPosRange.end; /* no room to scroll */[m
}[m
[36m@@ -1244,18 +1240,28 @@[m [miBool processEvent_Widget(iWidget *d, const SDL_Event *ev) {[m
/* TODO: Motion events occur frequently. Maybe it would help if these were handled[m
via audiences that specifically register to listen for motion, to minimize the[m
number of widgets that need to process them. */[m
[31m- const int hoverScrollLimit = 2 * lineHeight_Text(default_FontId);[m
[32m+[m[32m const int hoverScrollLimit = 1.5f * lineHeight_Text(default_FontId);[m
float speed = 0.0f;[m
if (ev->motion.y < hoverScrollLimit) {[m
speed = (hoverScrollLimit - ev->motion.y) / (float) hoverScrollLimit;[m
}[m
else {[m
[31m- const int bottomLimit = bottom_Rect(rect_Root(d->root)) - hoverScrollLimit;[m
[31m- if (ev->motion.y > bottomLimit ) {[m
[32m+[m[32m const iWindow *win = window_Widget(d);[m
[32m+[m[32m SDL_Rect usable;[m
[32m+[m[32m SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(win->win),[m
[32m+[m[32m &usable);[m
[32m+[m[32m const int bottomLimit =[m
[32m+[m[32m iMin(bottom_Rect(rect_Root(d->root)), usable.h * win->pixelRatio) -[m
[32m+[m[32m hoverScrollLimit;[m
[32m+[m[32m if (ev->motion.y > bottomLimit) {[m
speed = -(ev->motion.y - bottomLimit) / (float) hoverScrollLimit;[m
}[m
[32m+[m[32m printf("my:%d bottomLimit:%d => %f (%d)\n", ev->motion.y, bottomLimit, speed[m
[32m+[m[32m ,isOverflowScrollPossible_Widget_(d, speed)); fflush(stdout);[m
}[m
[31m- if (speed != 0.0f && isOverflowScrollPossible_Widget_(d, speed > 0 ? 1 : -1)) {[m
[32m+[m[32m const int dir = speed > 0 ? 1 : -1;[m
[32m+[m[32m if (speed != 0.0f && isOverflowScrollPossible_Widget_(d, dir)) {[m
[32m+[m[32m// speed = dir * powf(speed, 1.5f);[m
const uint32_t nowTime = SDL_GetTicks();[m
uint32_t elapsed = nowTime - lastHoverOverflowMotionTime_;[m
if (elapsed > 100) {[m
[1mdiff --git a/src/ui/window.c b/src/ui/window.c[m
[1mindex c63ad76a..fa364cff 100644[m
[1m--- a/src/ui/window.c[m
[1m+++ b/src/ui/window.c[m
[36m@@ -1676,9 +1676,13 @@[m [miWindow *newPopup_Window(iInt2 screenPos, iWidget *rootWidget) {[m
#if !defined (iPlatformApple)[m
setForceSoftwareRender_App(iTrue);[m
#endif[m
[32m+[m[32m SDL_Rect usableRect;[m
[32m+[m[32m SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(get_MainWindow()->base.win),[m
[32m+[m[32m &usableRect);[m
iWindow *win =[m
new_Window(popup_WindowType,[m
[31m- (iRect){ screenPos, divf_I2(rootWidget->rect.size, get_Window()->pixelRatio) },[m
[32m+[m[32m (iRect){ screenPos, min_I2(divf_I2(rootWidget->rect.size, get_Window()->pixelRatio),[m
[32m+[m[32m init_I2(usableRect.w, usableRect.h)) },[m
SDL_WINDOW_ALWAYS_ON_TOP |[m
#if !defined (iPlatformAppleDesktop)[m
SDL_WINDOW_BORDERLESS |[m
text/plain
This content has been proxied by September (ba2dc).