From afce90c9f6b52db97de29824d1afd1a0742550df Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 15 May 2021 22:38:13 +0300 Subject: Mobile: Various improvements and fixes - fill the safe area with theme background - don't set button hover states if dragging/scrolling - edge-draggable widgets must be flagged as such - Preferences top panel offset matches sibling panels' offset - allow toolbar to unhide when document is not scrollable --- src/ui/documentwidget.c | 4 +-- src/ui/labelwidget.c | 14 +++++++-- src/ui/root.c | 1 + src/ui/sidebarwidget.c | 1 - src/ui/touch.c | 18 ++++++++++- src/ui/touch.h | 1 + src/ui/util.c | 83 +++++++++++++++++++++++++++++++++++++++---------- src/ui/util.h | 7 +++-- src/ui/widget.c | 64 +++++++++++++++++++++++++++++++------- src/ui/widget.h | 6 +++- src/ui/window.c | 7 ++++- 11 files changed, 168 insertions(+), 38 deletions(-) (limited to 'src/ui') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 23731105..ea86a810 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -1444,8 +1444,8 @@ static void scrollBegan_DocumentWidget_(iAnyObject *any, int offset, uint32_t du } /* Show and hide toolbar on scroll. */ if (deviceType_App() == phone_AppDeviceType) { - if (prefs_App()->hideToolbarOnScroll && iAbs(offset) > 5 && - normScrollPos_DocumentWidget_(d) > 0) { + const float normPos = normScrollPos_DocumentWidget_(d); + if (prefs_App()->hideToolbarOnScroll && iAbs(offset) > 5 && normPos >= 0) { showToolbars_Root(as_Widget(d)->root, offset < 0); } } diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 5d0f0041..44ed795b 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c @@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "app.h" #include "util.h" #include "keys.h" +#include "touch.h" struct Impl_LabelWidget { iWidget widget; @@ -46,6 +47,15 @@ struct Impl_LabelWidget { } flags; }; +static iBool isHover_LabelWidget_(const iLabelWidget *d) { +#if defined (iPlatformMobile) + if (!isHovering_Touch()) { + return iFalse; + } +#endif + return isHover_Widget(d); +} + static iInt2 padding_LabelWidget_(const iLabelWidget *d, int corner) { const iWidget *w = constAs_Widget(d); const int64_t flags = flags_Widget(w); @@ -199,7 +209,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int if (startsWith_String(&d->label, "\r")) { colorEscape = cstr_String(&d->label)[1] - asciiBase_ColorEscape; /* TODO: can be two bytes long */ } - if (isHover_Widget(w)) { + if (isHover_LabelWidget_(d)) { if (isFrameless) { *bg = uiBackgroundFramelessHover_ColorId; *fg = uiTextFramelessHover_ColorId; @@ -257,7 +267,7 @@ static void draw_LabelWidget_(const iLabelWidget *d) { const int64_t flags = flags_Widget(w); const iRect bounds = bounds_Widget(w); iRect rect = bounds; - const iBool isHover = isHover_Widget(w); + const iBool isHover = isHover_LabelWidget_(d); if (isButton) { shrink_Rect(&rect, divi_I2(gap2_UI, 4)); adjustEdges_Rect(&rect, gap_UI / 8, 0, -gap_UI / 8, 0); diff --git a/src/ui/root.c b/src/ui/root.c index 233de51c..913f82e9 100644 --- a/src/ui/root.c +++ b/src/ui/root.c @@ -350,6 +350,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { } else if (equal_Command(cmd, "input.resized")) { /* No parent handled this, so do a full rearrangement. */ + /* TODO: Defer this and do a single rearrangement later. */ arrange_Widget(root); postRefresh_App(); return iTrue; diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 2c7ee75f..5d51b144 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c @@ -555,7 +555,6 @@ static void updateMetrics_SidebarWidget_(iSidebarWidget *d) { .x); } } - printf("maxButtonLabelWidth: %d\n", d->maxButtonLabelWidth); updateItemHeight_SidebarWidget_(d); } diff --git a/src/ui/touch.c b/src/ui/touch.c index f1aa8f06..c373ebd3 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c @@ -340,7 +340,7 @@ static void update_TouchState_(void *ptr) { static iWidget *findSlidePanel_Widget_(iWidget *d) { for (iWidget *w = d; w; w = parent_Widget(w)) { - if (isVisible_Widget(w) && flags_Widget(w) & horizontalOffset_WidgetFlag) { + if (isVisible_Widget(w) && flags_Widget(w) & edgeDraggable_WidgetFlag) { return w; } } @@ -453,6 +453,8 @@ iBool processEvent_Touch(const SDL_Event *ev) { if (edge == left_TouchEdge) { dragging = findSlidePanel_Widget_(aff); if (dragging) { + printf("Selected for dragging: "); + identify_Widget(dragging); setFlags_Widget(dragging, dragged_WidgetFlag, iTrue); } } @@ -745,6 +747,20 @@ iInt2 latestPosition_Touch(void) { return touchState_()->currentTouchPos; } +iBool isHovering_Touch(void) { + iTouchState *d = touchState_(); + if (numFingers_Touch() == 1) { + const iTouch *touch = constFront_Array(d->touches); + if (touch->isTapBegun && isStationary_Touch_(touch)) { + return iTrue; + } + if (touch->isTapAndHold) { + return iTrue; + } + } + return iFalse; +} + size_t numFingers_Touch(void) { return size_Array(touchState_()->touches); } diff --git a/src/ui/touch.h b/src/ui/touch.h index 1a6fb350..e048224a 100644 --- a/src/ui/touch.h +++ b/src/ui/touch.h @@ -41,4 +41,5 @@ enum iWidgetTouchMode widgetMode_Touch (const iWidget *widget); void widgetDestroyed_Touch (iWidget *widget); iInt2 latestPosition_Touch (void); /* valid during processing of current event */ +iBool isHovering_Touch (void); /* stationary touch or a long-press drag ongoing */ size_t numFingers_Touch (void); diff --git a/src/ui/util.c b/src/ui/util.c index fe35031b..e653b58c 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -837,7 +837,7 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, iBool postCommands) { if (postCommands) { postCommand_Widget(d, "menu.opened"); } - if (isPortraitPhone) { + if (deviceType_App() == phone_AppDeviceType) { setVisualOffset_Widget(d, isSlidePanel ? width_Widget(d) : height_Widget(d), 0, 0); setVisualOffset_Widget(d, 0, 330, easeOut_AnimFlag | softer_AnimFlag); } @@ -851,7 +851,7 @@ void closeMenu_Widget(iWidget *d) { setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iTrue); postRefresh_App(); postCommand_Widget(d, "menu.closed"); - if (isPortrait_App() && deviceType_App() == phone_AppDeviceType) { + if (deviceType_App() == phone_AppDeviceType) { const iBool wasDragged = iAbs(value_Anim(&d->visualOffset) - 0) > 1; setVisualOffset_Widget(d, flags_Widget(d) & horizontalOffset_WidgetFlag ? @@ -1206,7 +1206,13 @@ static iBool slidePanelHandler_(iWidget *d, const char *cmd) { iWidget *panel = userData_Object(button); openMenu_Widget(panel, innerToWindow_Widget(panel, zero_I2())); setFlags_Widget(panel, disabled_WidgetFlag, iFalse); -// updateTextCStr_LabelWidget(findWidget_App("panel.back"), ); + /* + if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) { + setFlags_Widget(d, visualOffset_WidgetFlag | horizontalOffset_WidgetFlag, iTrue); + d->visualOffset = panel->visualOffset; + d->visualOffset.to = -d->visualOffset.from / 3; + d->visualOffset.from = 0; + }*/ return iTrue; } if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd) && @@ -1220,6 +1226,13 @@ static iBool slidePanelHandler_(iWidget *d, const char *cmd) { iWidget *child = i.object; if (!cmp_String(id_Widget(child), "panel") && isVisible_Widget(child)) { closeMenu_Widget(child); + /* + if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) { + setFlags_Widget(d, visualOffset_WidgetFlag | horizontalOffset_WidgetFlag, iTrue); + d->visualOffset = child->visualOffset; + d->visualOffset.from = -d->visualOffset.to / 3; + d->visualOffset.to = 0; + }*/ setFlags_Widget(child, disabled_WidgetFlag, iTrue); setFocus_Widget(NULL); updateTextCStr_LabelWidget(findWidget_App("panel.back"), "Back"); @@ -1373,6 +1386,15 @@ static iWidget *makeValuePaddingWithHeading_(iLabelWidget *heading, iWidget *val if (isInstance_Object(value, &Class_InputWidget)) { addChildFlags_Widget(div, iClob(value), expand_WidgetFlag); } + else if (isInstance_Object(value, &Class_LabelWidget) && + cmp_String(command_LabelWidget((iLabelWidget *) value), "toggle")) { + addChildFlags_Widget(div, iClob(value), expand_WidgetFlag); + /* TODO: This doesn't work? */ +// setCommand_LabelWidget(heading, +// collectNewFormat_String("!%s ptr:%p", +// cstr_String(command_LabelWidget((iLabelWidget *) value)), +// value)); + } else { addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); addChild_Widget(div, iClob(value)); @@ -1400,7 +1422,8 @@ static iWidget *addChildPanel_(iWidget *sheet, iLabelWidget *panelButton, focusRoot_WidgetFlag | hidden_WidgetFlag | disabled_WidgetFlag | arrangeVertical_WidgetFlag | resizeWidthOfChildren_WidgetFlag | arrangeHeight_WidgetFlag | overflowScrollable_WidgetFlag | - horizontalOffset_WidgetFlag | commandOnClick_WidgetFlag); + horizontalOffset_WidgetFlag | edgeDraggable_WidgetFlag | + commandOnClick_WidgetFlag); return owner; } @@ -1433,7 +1456,8 @@ void finalizeSheet_Widget(iWidget *sheet) { setFlags_Widget(sheet, commandOnClick_WidgetFlag | frameless_WidgetFlag | - resizeWidthOfChildren_WidgetFlag, + resizeWidthOfChildren_WidgetFlag | + edgeDraggable_WidgetFlag, iTrue); iPtrArray * contents = collect_PtrArray(new_PtrArray()); /* two-column pages */ iPtrArray * panelButtons = collect_PtrArray(new_PtrArray()); @@ -1443,6 +1467,7 @@ void finalizeSheet_Widget(iWidget *sheet) { const int64_t panelButtonFlags = borderBottom_WidgetFlag | alignLeft_WidgetFlag | frameless_WidgetFlag | extraPadding_WidgetFlag; iWidget *topPanel = new_Widget(); + setFlags_Widget(topPanel, topPanelOffset_WidgetFlag, iTrue); /* slide with children */ setId_Widget(topPanel, "panel.top"); addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); if (prefsTabs) { @@ -1493,7 +1518,8 @@ void finalizeSheet_Widget(iWidget *sheet) { const iBool useSlidePanels = (size_PtrArray(contents) == size_PtrArray(panelButtons)); addChildFlags_Widget(sheet, iClob(topPanel), arrangeVertical_WidgetFlag | - resizeWidthOfChildren_WidgetFlag | arrangeHeight_WidgetFlag | + resizeWidthOfChildren_WidgetFlag | + arrangeHeight_WidgetFlag | overflowScrollable_WidgetFlag | commandOnClick_WidgetFlag); setCommandHandler_Widget(topPanel, slidePanelHandler_); @@ -1636,7 +1662,8 @@ void finalizeSheet_Widget(iWidget *sheet) { #if defined (iPlatformAppleMobile) appendCStr_String(msg, " (" LAGRANGE_IOS_VERSION ")"); #endif - addChild_Widget(panel, iClob(new_LabelWidget(cstr_String(msg), NULL))); + addChildFlags_Widget(panel, iClob(new_LabelWidget(cstr_String(msg), NULL)), + frameless_WidgetFlag); addChildFlags_Widget(panel, iClob(makePanelButton_(globe_Icon " By @jk@skyjake.fi", "!open url:https://skyjake.fi/@jk")), @@ -2011,13 +2038,17 @@ iWidget *makeQuestion_Widget(const char *title, const char *msg, const iMenuItem *item = &items[i]; const char first = item->label[0]; if (first == '*' || first == '&') { - addChildFlags_Widget(dlg, + iLabelWidget *option = + addChildFlags_Widget(dlg, iClob(newKeyMods_LabelWidget(item->label + 1, item->key, item->kmods, item->command)), resizeToParentWidth_WidgetFlag | (first == '&' ? selected_WidgetFlag : 0)); + if (deviceType_App() != desktop_AppDeviceType) { + setFont_LabelWidget(option, defaultBig_FontId); + } } } addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); @@ -2225,6 +2256,23 @@ static void addPrefsInputWithHeading_(iWidget *headings, iWidget *values, addDialogInputWithHeading_(headings, values, format_CStr("${%s}", id), id, input); } +void setupSheetTransition_Widget(iWidget *sheet, iBool isIncoming) { + if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) { + identify_Widget(sheet); + /* View transition. */ + if (isIncoming) { + setFlags_Widget(sheet, horizontalOffset_WidgetFlag, iTrue); + setVisualOffset_Widget(sheet, size_Root(sheet->root).x, 0, 0); + setVisualOffset_Widget(sheet, 0, 200, easeOut_AnimFlag); + } + else { + const iBool wasDragged = iAbs(value_Anim(&sheet->visualOffset)) > 0; + setVisualOffset_Widget(sheet, size_Root(sheet->root).x, wasDragged ? 100 : 200, + wasDragged ? 0 : easeIn_AnimFlag); + } + } +} + iWidget *makePreferences_Widget(void) { iWidget *dlg = makeSheet_Widget("prefs"); addChildFlags_Widget(dlg, @@ -2257,14 +2305,16 @@ iWidget *makePreferences_Widget(void) { addChild_Widget(values, iClob(makeToggle_Widget("prefs.hoverlink"))); addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.archive.openindex}"))); addChild_Widget(values, iClob(makeToggle_Widget("prefs.archive.openindex"))); - addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.pinsplit}"))); - iWidget *pinSplit = new_Widget(); - /* Split mode document pinning. */ { - addRadioButton_(pinSplit, "prefs.pinsplit.0", "${prefs.pinsplit.none}", "pinsplit.set arg:0"); - addRadioButton_(pinSplit, "prefs.pinsplit.1", "${prefs.pinsplit.left}", "pinsplit.set arg:1"); - addRadioButton_(pinSplit, "prefs.pinsplit.2", "${prefs.pinsplit.right}", "pinsplit.set arg:2"); - } - addChildFlags_Widget(values, iClob(pinSplit), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); + if (deviceType_App() != phone_AppDeviceType) { + addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.pinsplit}"))); + iWidget *pinSplit = new_Widget(); + /* Split mode document pinning. */ { + addRadioButton_(pinSplit, "prefs.pinsplit.0", "${prefs.pinsplit.none}", "pinsplit.set arg:0"); + addRadioButton_(pinSplit, "prefs.pinsplit.1", "${prefs.pinsplit.left}", "pinsplit.set arg:1"); + addRadioButton_(pinSplit, "prefs.pinsplit.2", "${prefs.pinsplit.right}", "pinsplit.set arg:2"); + } + addChildFlags_Widget(values, iClob(pinSplit), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); + } addChild_Widget(headings, iClob(makePadding_Widget(bigGap))); addChild_Widget(values, iClob(makePadding_Widget(bigGap))); /* UI languages. */ { @@ -2486,6 +2536,7 @@ iWidget *makePreferences_Widget(void) { (iMenuItem[]){ { "${dismiss}", SDLK_ESCAPE, 0, "prefs.dismiss" } }, 1))); addChild_Widget(dlg->root->widget, iClob(dlg)); finalizeSheet_Widget(dlg); + setupSheetTransition_Widget(dlg, iTrue); // printTree_Widget(dlg); return dlg; } diff --git a/src/ui/util.h b/src/ui/util.h index 50845280..6185945f 100644 --- a/src/ui/util.h +++ b/src/ui/util.h @@ -255,9 +255,10 @@ size_t tabCount_Widget (const iWidget *tabs); /*-----------------------------------------------------------------------------------------------*/ -iWidget * makeSheet_Widget (const char *id); -void finalizeSheet_Widget (iWidget *sheet); -iWidget * makeDialogButtons_Widget(const iMenuItem *actions, size_t numActions); +iWidget * makeSheet_Widget (const char *id); +void finalizeSheet_Widget (iWidget *sheet); +void setupSheetTransition_Widget (iWidget *sheet, iBool isIncoming); +iWidget * makeDialogButtons_Widget (const iMenuItem *actions, size_t numActions); iInputWidget *addTwoColumnDialogInputField_Widget(iWidget *headings, iWidget *values, const char *labelText, const char *inputId, diff --git a/src/ui/widget.c b/src/ui/widget.c index dd0c1b05..3a67bf4e 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c @@ -40,6 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ # include "../ios.h" #endif +static void printInfo_Widget_(const iWidget *); + void releaseChildren_Widget(iWidget *d) { iForEach(ObjectList, i, d->children) { ((iWidget *) i.object)->parent = NULL; /* the actual reference being held */ @@ -59,12 +61,23 @@ void init_Widget(iWidget *d) { d->bgColor = none_ColorId; d->frameColor = none_ColorId; init_Anim(&d->visualOffset, 0.0f); +// init_Anim(&d->fadeOpacity, 0.0f); d->children = NULL; d->parent = NULL; d->commandHandler = NULL; iZap(d->padding); } +#if 0 +static void animateFadeOpacity_Widget_(void *ptr) { + iWidget *d = ptr; + postRefresh_App(); + if (!isFinished_Anim(&d->fadeOpacity)) { + addTicker_App(animateFadeOpacity_Widget_, ptr); + } +} +#endif + static void visualOffsetAnimation_Widget_(void *ptr) { iWidget *d = ptr; postRefresh_App(); @@ -89,10 +102,12 @@ void deinit_Widget(iWidget *d) { if (d->flags & visualOffset_WidgetFlag) { removeTicker_App(visualOffsetAnimation_Widget_, d); } +// removeTicker_App(animateFadeOpacity_Widget_, d); widgetDestroyed_Touch(d); } static void aboutToBeDestroyed_Widget_(iWidget *d) { + d->flags |= destroyPending_WidgetFlag; if (isFocused_Widget(d)) { setFocus_Widget(NULL); return; @@ -371,10 +386,13 @@ iRect innerBounds_Widget(const iWidget *d) { return ib; } -//iLocalDef iBool isArranged_Widget_(const iWidget *d) { -// return !isCollapsed_Widget_(d) && ~d->flags & fixedPosition_WidgetFlag; -//} - +iRect innerBoundsWithoutVisualOffset_Widget(const iWidget *d) { + iRect ib = adjusted_Rect(boundsWithoutVisualOffset_Widget(d), + init_I2(d->padding[0], d->padding[1]), + init_I2(-d->padding[2], -d->padding[3])); + ib.size = max_I2(zero_I2(), ib.size); + return ib; +} static size_t numArrangedChildren_Widget_(const iWidget *d) { size_t count = 0; @@ -743,6 +761,16 @@ static void applyVisualOffset_Widget_(const iWidget *d, iInt2 *pos) { pos->y += off; } } + if (d->flags & topPanelOffset_WidgetFlag) { + iConstForEach(ObjectList, i, children_Widget(parent_Widget(d))) { + const iWidget *child = i.object; + if (child == d) continue; + if (child->flags & (visualOffset_WidgetFlag | dragged_WidgetFlag)) { + const int invOff = size_Root(d->root).x - iRound(value_Anim(&child->visualOffset)); + pos->x -= invOff / 3; + } + } + } } iRect bounds_Widget(const iWidget *d) { @@ -942,7 +970,7 @@ iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) { } iBool scrollOverflow_Widget(iWidget *d, int delta) { - iRect bounds = bounds_Widget(d); + iRect bounds = boundsWithoutVisualOffset_Widget(d); const iInt2 rootSize = size_Root(d->root); const iRect winRect = safeRect_Root(d->root); const int yTop = top_Rect(winRect); @@ -1046,6 +1074,7 @@ void drawBackground_Widget(const iWidget *d) { if (d->flags & noBackground_WidgetFlag) { return; } +// iAnim *fadeOpacity = (iAnim *) &d->fadeOpacity; if (d->flags & hidden_WidgetFlag && ~d->flags & visualOffset_WidgetFlag) { return; } @@ -1063,10 +1092,24 @@ void drawBackground_Widget(const iWidget *d) { init_Paint(&p); drawSoftShadow_Paint(&p, bounds_Widget(d), 12 * gap_UI, black_ColorId, 30); } - - if (fadeBackground && ~d->flags & noFadeBackground_WidgetFlag) { + const iBool isFaded = fadeBackground && + ~d->flags & noFadeBackground_WidgetFlag && + ~d->flags & destroyPending_WidgetFlag; +#if 0 + if (isFaded && fadeOpacity->to != 1.0f) { + setValue_Anim(fadeOpacity, 1.0f, 150); + animateFadeOpacity_Widget_((void *) d); + } + else if (!isFaded && fadeOpacity->to != 0.0f) { + setValue_Anim(fadeOpacity, 0.0f, 150); + animateFadeOpacity_Widget_((void *) d); + } + if (value_Anim(fadeOpacity) > 0.0f) { +#endif + if (isFaded) { iPaint p; init_Paint(&p); +// p.alpha = (uint8_t) (2 * 0x50 * value_Anim(&d->fadeOpacity)); p.alpha = 0x50; SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND); int fadeColor; @@ -1081,9 +1124,7 @@ void drawBackground_Widget(const iWidget *d) { fadeColor = gray50_ColorId; break; } - fillRect_Paint(&p, - rect_Root(d->root), - fadeColor); + fillRect_Paint(&p, rect_Root(d->root), fadeColor); SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE); } if (d->bgColor >= 0 || d->frameColor >= 0) { @@ -1603,7 +1644,8 @@ static void printInfo_Widget_(const iWidget *d) { cstr_String(text_LabelWidget((const iLabelWidget *) d)), cstr_String(command_LabelWidget((const iLabelWidget *) d))); } - printf("size:%dx%d {min:%dx%d} [%d..%d %d:%d] flags:%08llx%s%s%s%s%s%s%s\n", + printf("pos:%d,%d size:%dx%d {min:%dx%d} [%d..%d %d:%d] flags:%08llx%s%s%s%s%s%s%s\n", + d->rect.pos.x, d->rect.pos.y, d->rect.size.x, d->rect.size.y, d->minSize.x, d->minSize.y, d->padding[0], d->padding[2], diff --git a/src/ui/widget.h b/src/ui/widget.h index 13f400d1..7e464077 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -117,6 +117,9 @@ enum iWidgetFlag { #define parentCannotResizeHeight_WidgetFlag iBit64(58) #define ignoreForParentWidth_WidgetFlag iBit64(59) #define noFadeBackground_WidgetFlag iBit64(60) +#define destroyPending_WidgetFlag iBit64(61) /* TODO: needed? */ +#define edgeDraggable_WidgetFlag iBit64(62) +#define topPanelOffset_WidgetFlag iBit64(63) /* visual offset determined by the offset of siblings */ enum iWidgetAddPos { back_WidgetAddPos, @@ -139,9 +142,10 @@ struct Impl_Widget { iAnim visualOffset; int bgColor; int frameColor; +// iAnim fadeOpacity; iObjectList *children; iWidget * parent; - iBool (*commandHandler)(iWidget *, const char *); + iBool (*commandHandler)(iWidget *, const char *); iRoot * root; }; diff --git a/src/ui/window.c b/src/ui/window.c index 5699da4c..ff565b84 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1008,7 +1008,12 @@ void draw_Window(iWindow *d) { /* Clear the window. The clear color is visible as a border around the window when the custom frame is being used. */ { #if defined (iPlatformAppleMobile) - const iColor back = get_Color(uiBackground_ColorId); + iColor back = get_Color(uiBackground_ColorId); + if (deviceType_App() == phone_AppDeviceType) { + /* Page background extends to safe area, so fill it completely. */ + setCurrent_Root(d->roots[0]); + back = get_Color(tmBackground_ColorId); + } #else const iColor back = get_Color(gotFocus && d->place.snap != maximized_WindowSnap && ~winFlags & SDL_WINDOW_FULLSCREEN_DESKTOP -- cgit v1.2.3