diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-17 18:17:13 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-17 18:17:13 +0300 |
commit | ab10c23969bb7d7be73613d50ae2a3755da39fb0 (patch) | |
tree | a9c13a233d76d9ac19ce1e6a771e8e9c6e8466ec /src | |
parent | 42ac51ac631ce111324aaa8cba4659af0489da7b (diff) |
Mobile: Preferences on tablet devices
Use the mobile layout on tablets as well.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/color.c | 2 | ||||
-rw-r--r-- | src/ui/inputwidget.c | 2 | ||||
-rw-r--r-- | src/ui/listwidget.c | 2 | ||||
-rw-r--r-- | src/ui/mobile.c | 89 | ||||
-rw-r--r-- | src/ui/touch.c | 1 | ||||
-rw-r--r-- | src/ui/util.c | 2 |
6 files changed, 64 insertions, 34 deletions
diff --git a/src/ui/color.c b/src/ui/color.c index 6cbbdf28..a6ba18e4 100644 --- a/src/ui/color.c +++ b/src/ui/color.c | |||
@@ -305,7 +305,7 @@ void setThemePalette_Color(enum iColorTheme theme) { | |||
305 | 0.4f)); | 305 | 0.4f)); |
306 | uiPalette_[uiMarked_ColorId ].a = 128; | 306 | uiPalette_[uiMarked_ColorId ].a = 128; |
307 | uiPalette_[uiMatching_ColorId].a = 128; | 307 | uiPalette_[uiMatching_ColorId].a = 128; |
308 | if (deviceType_App() == phone_AppDeviceType) { | 308 | if (deviceType_App() != desktop_AppDeviceType) { |
309 | copy_(uiInputBackground_ColorId, uiBackgroundSidebar_ColorId); | 309 | copy_(uiInputBackground_ColorId, uiBackgroundSidebar_ColorId); |
310 | copy_(uiInputFrame_ColorId, uiBackgroundSidebar_ColorId); | 310 | copy_(uiInputFrame_ColorId, uiBackgroundSidebar_ColorId); |
311 | copy_(uiInputFrameFocused_ColorId, uiBackgroundSidebar_ColorId); | 311 | copy_(uiInputFrameFocused_ColorId, uiBackgroundSidebar_ColorId); |
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index fc843371..3b72cc60 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -306,7 +306,7 @@ static void updateMetrics_InputWidget_(iInputWidget *d) { | |||
306 | iWidget *w = as_Widget(d); | 306 | iWidget *w = as_Widget(d); |
307 | updateSizeForFixedLength_InputWidget_(d); | 307 | updateSizeForFixedLength_InputWidget_(d); |
308 | /* Caller must arrange the width, but the height is fixed. */ | 308 | /* Caller must arrange the width, but the height is fixed. */ |
309 | w->rect.size.y = contentHeight_InputWidget_(d, iTrue) + 3 * padding_().y; /* TODO: Why 3x? */ | 309 | w->rect.size.y = contentHeight_InputWidget_(d, iTrue) + 3.0f * padding_().y; /* TODO: Why 3x? */ |
310 | if (flags_Widget(w) & extraPadding_WidgetFlag) { | 310 | if (flags_Widget(w) & extraPadding_WidgetFlag) { |
311 | w->rect.size.y += 2 * gap_UI; | 311 | w->rect.size.y += 2 * gap_UI; |
312 | } | 312 | } |
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c index 95be44a0..a3406d48 100644 --- a/src/ui/listwidget.c +++ b/src/ui/listwidget.c | |||
@@ -414,7 +414,7 @@ static void draw_ListWidget_(const iListWidget *d) { | |||
414 | init_I2(blankWidth, d->itemHeight) }; | 414 | init_I2(blankWidth, d->itemHeight) }; |
415 | iConstForEach(IntSet, v, &d->invalidItems) { | 415 | iConstForEach(IntSet, v, &d->invalidItems) { |
416 | const size_t index = *v.value; | 416 | const size_t index = *v.value; |
417 | if (contains_Range(&drawItems, index)) { | 417 | if (contains_Range(&drawItems, index) && index < size_PtrArray(&d->items)) { |
418 | const iListItem *item = constAt_PtrArray(&d->items, index); | 418 | const iListItem *item = constAt_PtrArray(&d->items, index); |
419 | const iRect itemRect = { init_I2(0, index * d->itemHeight - buf->origin), | 419 | const iRect itemRect = { init_I2(0, index * d->itemHeight - buf->origin), |
420 | init_I2(d->visBuf->texSize.x, d->itemHeight) }; | 420 | init_I2(d->visBuf->texSize.x, d->itemHeight) }; |
diff --git a/src/ui/mobile.c b/src/ui/mobile.c index b1d4d71c..423e8cb5 100644 --- a/src/ui/mobile.c +++ b/src/ui/mobile.c | |||
@@ -35,10 +35,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
35 | # include "ios.h" | 35 | # include "ios.h" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | static iBool useMobileSheetLayout_(void) { | ||
39 | return deviceType_App() != desktop_AppDeviceType; | ||
40 | } | ||
41 | |||
42 | static enum iFontId labelFont_(void) { | ||
43 | return deviceType_App() == phone_AppDeviceType ? defaultBig_FontId : defaultMedium_FontId; | ||
44 | } | ||
45 | |||
46 | static enum iFontId labelBoldFont_(void) { | ||
47 | return deviceType_App() == phone_AppDeviceType ? defaultBigBold_FontId : defaultMediumBold_FontId; | ||
48 | } | ||
49 | |||
38 | static void updatePanelSheetMetrics_(iWidget *sheet) { | 50 | static void updatePanelSheetMetrics_(iWidget *sheet) { |
39 | iWidget *navi = findChild_Widget(sheet, "panel.navi"); | 51 | iWidget *navi = findChild_Widget(sheet, "panel.navi"); |
40 | iWidget *naviPad = child_Widget(navi, 0); | 52 | iWidget *naviPad = child_Widget(navi, 0); |
41 | int naviHeight = lineHeight_Text(defaultBig_FontId) + 4 * gap_UI; | 53 | int naviHeight = lineHeight_Text(labelFont_()) + 4 * gap_UI; |
42 | #if defined (iPlatformAppleMobile) | 54 | #if defined (iPlatformAppleMobile) |
43 | float left, right, top, bottom; | 55 | float left, right, top, bottom; |
44 | safeAreaInsets_iOS(&left, &top, &right, &bottom); | 56 | safeAreaInsets_iOS(&left, &top, &right, &bottom); |
@@ -70,16 +82,33 @@ static void unselectAllPanelButtons_(iWidget *topPanel) { | |||
70 | static iBool mainDetailSplitHandler_(iWidget *mainDetailSplit, const char *cmd) { | 82 | static iBool mainDetailSplitHandler_(iWidget *mainDetailSplit, const char *cmd) { |
71 | if (equal_Command(cmd, "window.resized")) { | 83 | if (equal_Command(cmd, "window.resized")) { |
72 | const iBool isPortrait = (deviceType_App() == phone_AppDeviceType && isPortrait_App()); | 84 | const iBool isPortrait = (deviceType_App() == phone_AppDeviceType && isPortrait_App()); |
73 | const iRect safeRoot = safeRect_Root(mainDetailSplit->root); | 85 | const iRect safeRoot = safeRect_Root(mainDetailSplit->root); |
74 | setPos_Widget(mainDetailSplit, topLeft_Rect(safeRoot)); | 86 | setPos_Widget(mainDetailSplit, topLeft_Rect(safeRoot)); |
75 | setFixedSize_Widget(mainDetailSplit, safeRoot.size); | 87 | setFixedSize_Widget(mainDetailSplit, safeRoot.size); |
76 | setFlags_Widget(mainDetailSplit, arrangeHorizontal_WidgetFlag, !isPortrait); | 88 | iWidget * sheet = parent_Widget(mainDetailSplit); |
77 | iWidget *detailStack = findChild_Widget(mainDetailSplit, "detailstack"); | 89 | iWidget * navi = findChild_Widget(sheet, "panel.navi"); |
78 | setFlags_Widget(detailStack, expand_WidgetFlag, !isPortrait); | 90 | iWidget * detailStack = findChild_Widget(mainDetailSplit, "detailstack"); |
79 | if (!isPortrait) { | 91 | const size_t numPanels = childCount_Widget(detailStack); |
80 | iWidget *topPanel = findChild_Widget(mainDetailSplit, "panel.top"); | 92 | const iBool isSideBySide = !isPortrait && numPanels > 0; |
93 | setFlags_Widget(mainDetailSplit, arrangeHorizontal_WidgetFlag, isSideBySide); | ||
94 | setFlags_Widget(detailStack, expand_WidgetFlag, isSideBySide); | ||
95 | setFlags_Widget(detailStack, hidden_WidgetFlag, numPanels == 0); | ||
96 | iWidget *topPanel = findChild_Widget(mainDetailSplit, "panel.top"); | ||
97 | const int pad = isPortrait ? 0 : 3 * gap_UI; | ||
98 | if (isSideBySide) { | ||
81 | iAssert(topPanel); | 99 | iAssert(topPanel); |
82 | topPanel->rect.size.x = safeRoot.size.x * 2 / 5; | 100 | topPanel->rect.size.x = (deviceType_App() == phone_AppDeviceType ? |
101 | safeRoot.size.x * 2 / 5 : (safeRoot.size.x / 3)); | ||
102 | } | ||
103 | if (deviceType_App() == tablet_AppDeviceType) { | ||
104 | setPadding_Widget(topPanel, pad, 0, pad, pad); | ||
105 | if (numPanels == 0) { | ||
106 | setFlags_Widget(sheet, centerHorizontal_WidgetFlag, iTrue); | ||
107 | const int sheetWidth = iMin(safeRoot.size.x, safeRoot.size.y); | ||
108 | mainDetailSplit->rect.size.x = sheetWidth; | ||
109 | setFixedSize_Widget(sheet, init_I2(sheetWidth, -1)); | ||
110 | setFixedSize_Widget(navi, init_I2(sheetWidth, -1)); | ||
111 | } | ||
83 | } | 112 | } |
84 | iForEach(ObjectList, i, children_Widget(detailStack)) { | 113 | iForEach(ObjectList, i, children_Widget(detailStack)) { |
85 | iWidget *panel = i.object; | 114 | iWidget *panel = i.object; |
@@ -87,7 +116,6 @@ static iBool mainDetailSplitHandler_(iWidget *mainDetailSplit, const char *cmd) | |||
87 | if (!isPortrait) { | 116 | if (!isPortrait) { |
88 | setVisualOffset_Widget(panel, 0, 0, 0); | 117 | setVisualOffset_Widget(panel, 0, 0, 0); |
89 | } | 118 | } |
90 | const int pad = isPortrait ? 0 : 3 * gap_UI; | ||
91 | setPadding_Widget(panel, pad, 0, pad, pad); | 119 | setPadding_Widget(panel, pad, 0, pad, pad); |
92 | } | 120 | } |
93 | arrange_Widget(mainDetailSplit); | 121 | arrange_Widget(mainDetailSplit); |
@@ -96,7 +124,7 @@ static iBool mainDetailSplitHandler_(iWidget *mainDetailSplit, const char *cmd) | |||
96 | } | 124 | } |
97 | 125 | ||
98 | static iBool topPanelHandler_(iWidget *topPanel, const char *cmd) { | 126 | static iBool topPanelHandler_(iWidget *topPanel, const char *cmd) { |
99 | const iBool isPortrait = deviceType_App() == phone_AppDeviceType && isPortrait_App(); | 127 | const iBool isPortrait = useMobileSheetLayout_() && isPortrait_App(); |
100 | if (equal_Command(cmd, "panel.open")) { | 128 | if (equal_Command(cmd, "panel.open")) { |
101 | iWidget *button = pointer_Command(cmd); | 129 | iWidget *button = pointer_Command(cmd); |
102 | iWidget *panel = userData_Object(button); | 130 | iWidget *panel = userData_Object(button); |
@@ -213,7 +241,7 @@ static iAnyObject *addPanelChild_(iWidget *panel, iAnyObject *child, int64_t fla | |||
213 | (elementType == textInput_PrefsElement && | 241 | (elementType == textInput_PrefsElement && |
214 | precedingElementType != textInput_PrefsElement && | 242 | precedingElementType != textInput_PrefsElement && |
215 | precedingElementType != heading_PrefsElement)) { | 243 | precedingElementType != heading_PrefsElement)) { |
216 | addChild_Widget(panel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); | 244 | addChild_Widget(panel, iClob(makePadding_Widget(lineHeight_Text(labelFont_())))); |
217 | } | 245 | } |
218 | } | 246 | } |
219 | if ((elementType == toggle_PrefsElement && precedingElementType != toggle_PrefsElement) || | 247 | if ((elementType == toggle_PrefsElement && precedingElementType != toggle_PrefsElement) || |
@@ -242,7 +270,7 @@ static iLabelWidget *makePanelButton_(const char *text, const char *command) { | |||
242 | frameless_WidgetFlag | extraPadding_WidgetFlag, | 270 | frameless_WidgetFlag | extraPadding_WidgetFlag, |
243 | iTrue); | 271 | iTrue); |
244 | checkIcon_LabelWidget(btn); | 272 | checkIcon_LabelWidget(btn); |
245 | setFont_LabelWidget(btn, defaultBig_FontId); | 273 | setFont_LabelWidget(btn, labelFont_()); |
246 | setTextColor_LabelWidget(btn, uiTextStrong_ColorId); | 274 | setTextColor_LabelWidget(btn, uiTextStrong_ColorId); |
247 | setBackgroundColor_Widget(as_Widget(btn), uiBackgroundSidebar_ColorId); | 275 | setBackgroundColor_Widget(as_Widget(btn), uiBackgroundSidebar_ColorId); |
248 | return btn; | 276 | return btn; |
@@ -251,7 +279,7 @@ static iLabelWidget *makePanelButton_(const char *text, const char *command) { | |||
251 | static iWidget *makeValuePadding_(iWidget *value) { | 279 | static iWidget *makeValuePadding_(iWidget *value) { |
252 | iInputWidget *input = isInstance_Object(value, &Class_InputWidget) ? (iInputWidget *) value : NULL; | 280 | iInputWidget *input = isInstance_Object(value, &Class_InputWidget) ? (iInputWidget *) value : NULL; |
253 | if (input) { | 281 | if (input) { |
254 | setFont_InputWidget(input, defaultBig_FontId); | 282 | setFont_InputWidget(input, labelFont_()); |
255 | setContentPadding_InputWidget(input, 3 * gap_UI, 3 * gap_UI); | 283 | setContentPadding_InputWidget(input, 3 * gap_UI, 3 * gap_UI); |
256 | } | 284 | } |
257 | iWidget *pad = new_Widget(); | 285 | iWidget *pad = new_Widget(); |
@@ -278,7 +306,7 @@ static iWidget *makeValuePaddingWithHeading_(iLabelWidget *heading, iWidget *val | |||
278 | setPadding_Widget(div, gap_UI, gap_UI, 4 * gap_UI, gap_UI); | 306 | setPadding_Widget(div, gap_UI, gap_UI, 4 * gap_UI, gap_UI); |
279 | addChildFlags_Widget(div, iClob(heading), 0); | 307 | addChildFlags_Widget(div, iClob(heading), 0); |
280 | //setFixedSize_Widget(as_Widget(heading), init_I2(-1, height_Widget(value))); | 308 | //setFixedSize_Widget(as_Widget(heading), init_I2(-1, height_Widget(value))); |
281 | setFont_LabelWidget(heading, defaultBig_FontId); | 309 | setFont_LabelWidget(heading, labelFont_()); |
282 | setTextColor_LabelWidget(heading, uiTextStrong_ColorId); | 310 | setTextColor_LabelWidget(heading, uiTextStrong_ColorId); |
283 | if (isInstance_Object(value, &Class_InputWidget)) { | 311 | if (isInstance_Object(value, &Class_InputWidget)) { |
284 | addChildFlags_Widget(div, iClob(value), expand_WidgetFlag); | 312 | addChildFlags_Widget(div, iClob(value), expand_WidgetFlag); |
@@ -331,7 +359,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
331 | easier to create phone versions of each dialog, but at least this works with any | 359 | easier to create phone versions of each dialog, but at least this works with any |
332 | future changes to the UI (..."works"). At least this way it is possible to enforce | 360 | future changes to the UI (..."works"). At least this way it is possible to enforce |
333 | a consistent styling. */ | 361 | a consistent styling. */ |
334 | if (deviceType_App() == phone_AppDeviceType && parent_Widget(sheet) == root_Widget(sheet)) { | 362 | if (useMobileSheetLayout_() && parent_Widget(sheet) == root_Widget(sheet)) { |
335 | if (~flags_Widget(sheet) & keepOnTop_WidgetFlag) { | 363 | if (~flags_Widget(sheet) & keepOnTop_WidgetFlag) { |
336 | /* Already finalized. */ | 364 | /* Already finalized. */ |
337 | arrange_Widget(sheet); | 365 | arrange_Widget(sheet); |
@@ -398,10 +426,10 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
398 | } | 426 | } |
399 | iWidget *detailStack = new_Widget(); { | 427 | iWidget *detailStack = new_Widget(); { |
400 | setId_Widget(detailStack, "detailstack"); | 428 | setId_Widget(detailStack, "detailstack"); |
401 | setFlags_Widget(detailStack, resizeWidthOfChildren_WidgetFlag, iTrue); | 429 | setFlags_Widget(detailStack, collapse_WidgetFlag | resizeWidthOfChildren_WidgetFlag, iTrue); |
402 | addChild_Widget(mainDetailSplit, iClob(detailStack)); | 430 | addChild_Widget(mainDetailSplit, iClob(detailStack)); |
403 | } | 431 | } |
404 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); | 432 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(labelFont_())))); |
405 | /* Slide top panel with detail panels. */ { | 433 | /* Slide top panel with detail panels. */ { |
406 | setFlags_Widget(topPanel, refChildrenOffset_WidgetFlag, iTrue); | 434 | setFlags_Widget(topPanel, refChildrenOffset_WidgetFlag, iTrue); |
407 | topPanel->offsetRef = detailStack; | 435 | topPanel->offsetRef = detailStack; |
@@ -433,7 +461,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
433 | 0x1f5a7, /* computer network */ | 461 | 0x1f5a7, /* computer network */ |
434 | }; | 462 | }; |
435 | setIcon_LabelWidget(panelButton, icons[i]); | 463 | setIcon_LabelWidget(panelButton, icons[i]); |
436 | // setFont_LabelWidget(panelButton, defaultBig_FontId); | 464 | // setFont_LabelWidget(panelButton, labelFont_()); |
437 | // setBackgroundColor_Widget(as_Widget(panelButton), uiBackgroundSidebar_ColorId); | 465 | // setBackgroundColor_Widget(as_Widget(panelButton), uiBackgroundSidebar_ColorId); |
438 | iRelease(page); | 466 | iRelease(page); |
439 | delete_String(text); | 467 | delete_String(text); |
@@ -490,7 +518,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
490 | } | 518 | } |
491 | if (isInstance_Object(value, &Class_LabelWidget)) { | 519 | if (isInstance_Object(value, &Class_LabelWidget)) { |
492 | valueLabel = (iLabelWidget *) value; | 520 | valueLabel = (iLabelWidget *) value; |
493 | setFont_LabelWidget(valueLabel, defaultBig_FontId); | 521 | setFont_LabelWidget(valueLabel, labelFont_()); |
494 | } | 522 | } |
495 | if (isInstance_Object(value, &Class_InputWidget)) { | 523 | if (isInstance_Object(value, &Class_InputWidget)) { |
496 | valueInput = (iInputWidget *) value; | 524 | valueInput = (iInputWidget *) value; |
@@ -505,7 +533,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
505 | } | 533 | } |
506 | } | 534 | } |
507 | if (valueInput) { | 535 | if (valueInput) { |
508 | setFont_InputWidget(valueInput, defaultBig_FontId); | 536 | setFont_InputWidget(valueInput, labelFont_()); |
509 | setContentPadding_InputWidget(valueInput, 3 * gap_UI, 0); | 537 | setContentPadding_InputWidget(valueInput, 3 * gap_UI, 0); |
510 | } | 538 | } |
511 | /* Toggles have the button on the right. */ | 539 | /* Toggles have the button on the right. */ |
@@ -541,7 +569,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
541 | if (childCount_Widget(value) >= 2) { | 569 | if (childCount_Widget(value) >= 2) { |
542 | element = radioButton_PrefsElement; | 570 | element = radioButton_PrefsElement; |
543 | /* Always padding before radio buttons. */ | 571 | /* Always padding before radio buttons. */ |
544 | addChild_Widget(owner, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); | 572 | addChild_Widget(owner, iClob(makePadding_Widget(lineHeight_Text(labelFont_())))); |
545 | } | 573 | } |
546 | addChildFlags_Widget(owner, iClob(heading), borderBottom_WidgetFlag); | 574 | addChildFlags_Widget(owner, iClob(heading), borderBottom_WidgetFlag); |
547 | if (headingLabel) { | 575 | if (headingLabel) { |
@@ -577,13 +605,13 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
577 | destroyPending_Root(sheet->root); | 605 | destroyPending_Root(sheet->root); |
578 | /* Additional elements for preferences. */ | 606 | /* Additional elements for preferences. */ |
579 | if (isPrefs) { | 607 | if (isPrefs) { |
580 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(defaultBig_FontId)))); | 608 | addChild_Widget(topPanel, iClob(makePadding_Widget(lineHeight_Text(labelFont_())))); |
581 | addChildFlags_Widget(topPanel, | ||
582 | iClob(makePanelButton_(info_Icon " ${menu.help}", "!open url:about:help")), | ||
583 | borderTop_WidgetFlag); | ||
584 | iLabelWidget *aboutButton = addChildFlags_Widget(topPanel, | 609 | iLabelWidget *aboutButton = addChildFlags_Widget(topPanel, |
585 | iClob(makePanelButton_(planet_Icon " ${menu.about}", "panel.open")), | 610 | iClob(makePanelButton_(planet_Icon " ${menu.about}", "panel.open")), |
586 | chevron_WidgetFlag); | 611 | chevron_WidgetFlag); |
612 | addChildFlags_Widget(topPanel, | ||
613 | iClob(makePanelButton_(info_Icon " ${menu.help}", "!open url:about:help")), | ||
614 | borderTop_WidgetFlag); | ||
587 | /* The About panel. */ { | 615 | /* The About panel. */ { |
588 | iWidget *panel = addChildPanel_(detailStack, aboutButton, NULL); | 616 | iWidget *panel = addChildPanel_(detailStack, aboutButton, NULL); |
589 | iString *msg = collectNew_String(); | 617 | iString *msg = collectNew_String(); |
@@ -640,7 +668,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
640 | alignLeft_WidgetFlag | extraPadding_WidgetFlag); | 668 | alignLeft_WidgetFlag | extraPadding_WidgetFlag); |
641 | checkIcon_LabelWidget(back); | 669 | checkIcon_LabelWidget(back); |
642 | setId_Widget(as_Widget(back), "panel.back"); | 670 | setId_Widget(as_Widget(back), "panel.back"); |
643 | setFont_LabelWidget(back, defaultBig_FontId); | 671 | setFont_LabelWidget(back, labelFont_()); |
644 | if (!isPrefs) { | 672 | if (!isPrefs) { |
645 | /* Pick up the dialog buttons for the navbar. */ | 673 | /* Pick up the dialog buttons for the navbar. */ |
646 | iWidget *buttons = findChild_Widget(sheet, "dialogbuttons"); | 674 | iWidget *buttons = findChild_Widget(sheet, "dialogbuttons"); |
@@ -659,11 +687,11 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
659 | setFlags_Widget(as_Widget(back), alignLeft_WidgetFlag, iFalse); | 687 | setFlags_Widget(as_Widget(back), alignLeft_WidgetFlag, iFalse); |
660 | setFlags_Widget(as_Widget(back), alignRight_WidgetFlag, iTrue); | 688 | setFlags_Widget(as_Widget(back), alignRight_WidgetFlag, iTrue); |
661 | setIcon_LabelWidget(back, 0); | 689 | setIcon_LabelWidget(back, 0); |
662 | setFont_LabelWidget(back, defaultBigBold_FontId); | 690 | setFont_LabelWidget(back, labelBoldFont_()); |
663 | } | 691 | } |
664 | else if (def != cancel) { | 692 | else if (def != cancel) { |
665 | removeChild_Widget(buttons, def); | 693 | removeChild_Widget(buttons, def); |
666 | setFont_LabelWidget(def, defaultBigBold_FontId); | 694 | setFont_LabelWidget(def, labelBoldFont_()); |
667 | setFlags_Widget(as_Widget(def), | 695 | setFlags_Widget(as_Widget(def), |
668 | frameless_WidgetFlag | extraPadding_WidgetFlag | | 696 | frameless_WidgetFlag | extraPadding_WidgetFlag | |
669 | noBackground_WidgetFlag, iTrue); | 697 | noBackground_WidgetFlag, iTrue); |
@@ -677,7 +705,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
677 | i.object != cancel && i.object != def) { | 705 | i.object != cancel && i.object != def) { |
678 | iLabelWidget *item = i.object; | 706 | iLabelWidget *item = i.object; |
679 | setBackgroundColor_Widget(i.object, uiBackgroundSidebar_ColorId); | 707 | setBackgroundColor_Widget(i.object, uiBackgroundSidebar_ColorId); |
680 | setFont_LabelWidget(item, defaultBig_FontId); | 708 | setFont_LabelWidget(item, labelFont_()); |
681 | removeChild_Widget(buttons, item); | 709 | removeChild_Widget(buttons, item); |
682 | addChildFlags_Widget(topPanel, iClob(item), panelButtonFlags | | 710 | addChildFlags_Widget(topPanel, iClob(item), panelButtonFlags | |
683 | (isFirstAction ? borderTop_WidgetFlag : 0)); | 711 | (isFirstAction ? borderTop_WidgetFlag : 0)); |
@@ -721,7 +749,7 @@ void finalizeSheet_Mobile(iWidget *sheet) { | |||
721 | } | 749 | } |
722 | 750 | ||
723 | void setupMenuTransition_Mobile(iWidget *sheet, iBool isIncoming) { | 751 | void setupMenuTransition_Mobile(iWidget *sheet, iBool isIncoming) { |
724 | if (deviceType_App() != phone_AppDeviceType) { | 752 | if (!useMobileSheetLayout_()) { |
725 | return; | 753 | return; |
726 | } | 754 | } |
727 | const iBool isSlidePanel = (flags_Widget(sheet) & horizontalOffset_WidgetFlag) != 0; | 755 | const iBool isSlidePanel = (flags_Widget(sheet) & horizontalOffset_WidgetFlag) != 0; |
@@ -751,6 +779,7 @@ void setupSheetTransition_Mobile(iWidget *sheet, iBool isIncoming) { | |||
751 | setVisualOffset_Widget(sheet, 0, 200, easeOut_AnimFlag); | 779 | setVisualOffset_Widget(sheet, 0, 200, easeOut_AnimFlag); |
752 | } | 780 | } |
753 | else { | 781 | else { |
782 | setFlags_Widget(sheet, horizontalOffset_WidgetFlag, iTrue); | ||
754 | const iBool wasDragged = iAbs(value_Anim(&sheet->visualOffset)) > 0; | 783 | const iBool wasDragged = iAbs(value_Anim(&sheet->visualOffset)) > 0; |
755 | setVisualOffset_Widget(sheet, size_Root(sheet->root).x, wasDragged ? 100 : 200, | 784 | setVisualOffset_Widget(sheet, size_Root(sheet->root).x, wasDragged ? 100 : 200, |
756 | wasDragged ? 0 : easeIn_AnimFlag); | 785 | wasDragged ? 0 : easeIn_AnimFlag); |
diff --git a/src/ui/touch.c b/src/ui/touch.c index e8f53bca..296e0e08 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c | |||
@@ -586,6 +586,7 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
586 | // pixels.y, y_F3(amount), y_F3(touch->accum)); | 586 | // pixels.y, y_F3(amount), y_F3(touch->accum)); |
587 | if (pixels.x || pixels.y) { | 587 | if (pixels.x || pixels.y) { |
588 | setFocus_Widget(NULL); | 588 | setFocus_Widget(NULL); |
589 | setCurrent_Root(touch->affinity->root); | ||
589 | dispatchMotion_Touch_(touch->pos[0], 0); | 590 | dispatchMotion_Touch_(touch->pos[0], 0); |
590 | dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ | 591 | dispatchEvent_Widget(touch->affinity, (SDL_Event *) &(SDL_MouseWheelEvent){ |
591 | .type = SDL_MOUSEWHEEL, | 592 | .type = SDL_MOUSEWHEEL, |
diff --git a/src/ui/util.c b/src/ui/util.c index b4c43951..4b35f8f7 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -1513,7 +1513,7 @@ static int cmp_MenuItem_(const void *e1, const void *e2) { | |||
1513 | #endif | 1513 | #endif |
1514 | 1514 | ||
1515 | void updatePreferencesLayout_Widget(iWidget *prefs) { | 1515 | void updatePreferencesLayout_Widget(iWidget *prefs) { |
1516 | if (!prefs || deviceType_App() == phone_AppDeviceType) { | 1516 | if (!prefs || deviceType_App() != desktop_AppDeviceType) { |
1517 | return; | 1517 | return; |
1518 | } | 1518 | } |
1519 | /* Doing manual layout here because the widget arranging logic isn't sophisticated enough. */ | 1519 | /* Doing manual layout here because the widget arranging logic isn't sophisticated enough. */ |