summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt44
-rw-r--r--src/app.c8
-rw-r--r--src/ui/labelwidget.c2
-rw-r--r--src/ui/lookupwidget.c2
-rw-r--r--src/ui/metrics.c2
-rw-r--r--src/ui/mobile.c6
-rw-r--r--src/ui/root.c29
-rw-r--r--src/ui/sidebarwidget.c2
-rw-r--r--src/ui/text.c2
-rw-r--r--src/ui/window.c28
10 files changed, 72 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 262bbcb9..ee9c14d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,8 @@ option (ENABLE_HARFBUZZ_MINIMAL "Build the HarfBuzz library with minimal depende
44option (ENABLE_IDLE_SLEEP "While idle, sleep in the main thread instead of waiting for events" ON) 44option (ENABLE_IDLE_SLEEP "While idle, sleep in the main thread instead of waiting for events" ON)
45option (ENABLE_IPC "Use IPC to communicate between running instances" ON) 45option (ENABLE_IPC "Use IPC to communicate between running instances" ON)
46option (ENABLE_KERNING "Enable kerning in font renderer (slower)" ON) 46option (ENABLE_KERNING "Enable kerning in font renderer (slower)" ON)
47option (ENABLE_MOBILE_PHONE "Use the phone mobile UI design instead of desktop UI" OFF)
48option (ENABLE_MOBILE_TABLET "Use the tablet mobile UI design instead of desktop UI" OFF)
47option (ENABLE_MPG123 "Use mpg123 for decoding MPEG audio" ON) 49option (ENABLE_MPG123 "Use mpg123 for decoding MPEG audio" ON)
48option (ENABLE_RELATIVE_EMBED "Resources should always be found via relative path" OFF) 50option (ENABLE_RELATIVE_EMBED "Resources should always be found via relative path" OFF)
49option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW}) 51option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW})
@@ -279,6 +281,16 @@ if (MOBILE)
279 add_definitions (-DiPlatformMobile=1) 281 add_definitions (-DiPlatformMobile=1)
280else () 282else ()
281 add_definitions (-DiPlatformDesktop=1) 283 add_definitions (-DiPlatformDesktop=1)
284 # Forced UI design.
285 if (ENABLE_MOBILE_PHONE OR ENABLE_MOBILE_TABLET)
286 add_definitions (-DiPlatformMobile=1)
287 endif ()
288 if (ENABLE_MOBILE_PHONE)
289 add_definitions (-DiPlatformMobilePhone=1)
290 endif ()
291 if (ENABLE_MOBILE_TABLET)
292 add_definitions (-DiPlatformMobileTablet=1)
293 endif ()
282endif () 294endif ()
283 295
284# Target. 296# Target.
@@ -300,37 +312,37 @@ target_compile_options (app PUBLIC
300 -DSTB_VORBIS_NO_INTEGER_CONVERSION=1 312 -DSTB_VORBIS_NO_INTEGER_CONVERSION=1
301) 313)
302target_compile_definitions (app PUBLIC LAGRANGE_APP_VERSION="${PROJECT_VERSION}") 314target_compile_definitions (app PUBLIC LAGRANGE_APP_VERSION="${PROJECT_VERSION}")
315if (ENABLE_CUSTOM_FRAME AND MSYS)
316 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_CUSTOM_FRAME=1)
317endif ()
318if (ENABLE_DOWNLOAD_EDIT)
319 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_DOWNLOAD_EDIT=1)
320endif ()
321if (ENABLE_IDLE_SLEEP)
322 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_IDLE_SLEEP=1)
323endif ()
303if (ENABLE_IPC) 324if (ENABLE_IPC)
304 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_IPC=1) 325 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_IPC=1)
305endif () 326endif ()
306if (ENABLE_X11_SWRENDER)
307 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_X11_SWRENDER=1)
308endif ()
309if (ENABLE_KERNING) 327if (ENABLE_KERNING)
310 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_KERNING=1) 328 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_KERNING=1)
311endif () 329endif ()
312if (ENABLE_WINDOWPOS_FIX)
313 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_WINDOWPOS_FIX=1)
314endif ()
315if (ENABLE_MPG123 AND MPG123_FOUND) 330if (ENABLE_MPG123 AND MPG123_FOUND)
316 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_MPG123=1) 331 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_MPG123=1)
317 target_link_libraries (app PUBLIC PkgConfig::MPG123) 332 target_link_libraries (app PUBLIC PkgConfig::MPG123)
318endif () 333endif ()
334if (ENABLE_RESIZE_DRAW)
335 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_RESIZE_DRAW=1)
336endif ()
319if (ENABLE_WEBP AND WEBP_FOUND) 337if (ENABLE_WEBP AND WEBP_FOUND)
320 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_WEBP=1) 338 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_WEBP=1)
321 target_link_libraries (app PUBLIC PkgConfig::WEBP) 339 target_link_libraries (app PUBLIC PkgConfig::WEBP)
322endif () 340endif ()
323if (ENABLE_IDLE_SLEEP) 341if (ENABLE_WINDOWPOS_FIX)
324 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_IDLE_SLEEP=1) 342 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_WINDOWPOS_FIX=1)
325endif ()
326if (ENABLE_DOWNLOAD_EDIT)
327 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_DOWNLOAD_EDIT=1)
328endif ()
329if (ENABLE_CUSTOM_FRAME AND MSYS)
330 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_CUSTOM_FRAME=1)
331endif () 343endif ()
332if (ENABLE_RESIZE_DRAW) 344if (ENABLE_X11_SWRENDER)
333 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_RESIZE_DRAW=1) 345 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_X11_SWRENDER=1)
334endif () 346endif ()
335target_link_libraries (app PUBLIC the_Foundation::the_Foundation) 347target_link_libraries (app PUBLIC the_Foundation::the_Foundation)
336target_link_libraries (app PUBLIC ${SDL2_LDFLAGS}) 348target_link_libraries (app PUBLIC ${SDL2_LDFLAGS})
diff --git a/src/app.c b/src/app.c
index bf781c03..91472075 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1575,7 +1575,11 @@ iBool isLandscape_App(void) {
1575} 1575}
1576 1576
1577enum iAppDeviceType deviceType_App(void) { 1577enum iAppDeviceType deviceType_App(void) {
1578#if defined (iPlatformAppleMobile) 1578#if defined (iPlatformMobilePhone)
1579 return phone_AppDeviceType;
1580#elif defined (iPlatformMobileTablet)
1581 return tablet_AppDeviceType;
1582#elif defined (iPlatformAppleMobile)
1579 return isPhone_iOS() ? phone_AppDeviceType : tablet_AppDeviceType; 1583 return isPhone_iOS() ? phone_AppDeviceType : tablet_AppDeviceType;
1580#else 1584#else
1581 return desktop_AppDeviceType; 1585 return desktop_AppDeviceType;
@@ -2472,7 +2476,7 @@ iBool handleCommand_App(const char *cmd) {
2472 } 2476 }
2473 else if (equal_Command(cmd, "tabs.close")) { 2477 else if (equal_Command(cmd, "tabs.close")) {
2474 iWidget *tabs = findWidget_App("doctabs"); 2478 iWidget *tabs = findWidget_App("doctabs");
2475#if defined (iPlatformAppleMobile) 2479#if defined (iPlatformMobile)
2476 /* Can't close the last on mobile. */ 2480 /* Can't close the last on mobile. */
2477 if (tabCount_Widget(tabs) == 1 && numRoots_Window(get_Window()) == 1) { 2481 if (tabCount_Widget(tabs) == 1 && numRoots_Window(get_Window()) == 1) {
2478 postCommand_App("navigate.home"); 2482 postCommand_App("navigate.home");
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index edc36a49..58294c6a 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -68,7 +68,7 @@ static iInt2 padding_LabelWidget_(const iLabelWidget *d, int corner) {
68 : corner == 1 ? init_I2(w->padding[2], w->padding[1]) 68 : corner == 1 ? init_I2(w->padding[2], w->padding[1])
69 : corner == 2 ? init_I2(w->padding[2], w->padding[3]) 69 : corner == 2 ? init_I2(w->padding[2], w->padding[3])
70 : init_I2(w->padding[0], w->padding[3])); 70 : init_I2(w->padding[0], w->padding[3]));
71#if defined (iPlatformAppleMobile) 71#if defined (iPlatformMobile)
72 return add_I2(widgetPad, 72 return add_I2(widgetPad,
73 init_I2(flags & tight_WidgetFlag ? 2 * gap_UI : (4 * gap_UI), 73 init_I2(flags & tight_WidgetFlag ? 2 * gap_UI : (4 * gap_UI),
74 (flags & extraPadding_WidgetFlag ? 1.5f : 1.0f) * 3 * gap_UI / 2)); 74 (flags & extraPadding_WidgetFlag ? 1.5f : 1.0f) * 3 * gap_UI / 2));
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c
index a0a507ca..bf190d58 100644
--- a/src/ui/lookupwidget.c
+++ b/src/ui/lookupwidget.c
@@ -388,7 +388,7 @@ void init_LookupWidget(iLookupWidget *d) {
388 init_Widget(w); 388 init_Widget(w);
389 setId_Widget(w, "lookup"); 389 setId_Widget(w, "lookup");
390 setFlags_Widget(w, focusable_WidgetFlag, iTrue); 390 setFlags_Widget(w, focusable_WidgetFlag, iTrue);
391#if defined (iPlatformAppleMobile) 391#if defined (iPlatformMobile)
392 setFlags_Widget(w, unhittable_WidgetFlag, iTrue); 392 setFlags_Widget(w, unhittable_WidgetFlag, iTrue);
393#endif 393#endif
394 d->list = addChildFlags_Widget(w, iClob(new_ListWidget()), 394 d->list = addChildFlags_Widget(w, iClob(new_ListWidget()),
diff --git a/src/ui/metrics.c b/src/ui/metrics.c
index 32561ed7..53a52afb 100644
--- a/src/ui/metrics.c
+++ b/src/ui/metrics.c
@@ -33,7 +33,7 @@ iInt2 gap2_UI = { defaultGap_Metrics, defaultGap_Metrics };
33int fontSize_UI = defaultFontSize_Metrics; 33int fontSize_UI = defaultFontSize_Metrics;
34 34
35void setScale_Metrics(float scale) { 35void setScale_Metrics(float scale) {
36#if defined (iPlatformAppleMobile) 36#if defined (iPlatformMobile)
37 /* iPad needs a bit larger UI elements as the viewing distance is generally longer.*/ 37 /* iPad needs a bit larger UI elements as the viewing distance is generally longer.*/
38 if (deviceType_App() == tablet_AppDeviceType) { 38 if (deviceType_App() == tablet_AppDeviceType) {
39 scale *= 1.1f; 39 scale *= 1.1f;
diff --git a/src/ui/mobile.c b/src/ui/mobile.c
index 0ff3fe85..168a92b8 100644
--- a/src/ui/mobile.c
+++ b/src/ui/mobile.c
@@ -57,11 +57,13 @@ static enum iFontId labelBoldFont_(void) {
57 57
58static void updatePanelSheetMetrics_(iWidget *sheet) { 58static void updatePanelSheetMetrics_(iWidget *sheet) {
59 iWidget *navi = findChild_Widget(sheet, "panel.navi"); 59 iWidget *navi = findChild_Widget(sheet, "panel.navi");
60 iWidget *naviPad = child_Widget(navi, 0); 60// iWidget *naviPad = child_Widget(navi, 0);
61 int naviHeight = lineHeight_Text(labelFont_()) + 4 * gap_UI; 61 int naviHeight = lineHeight_Text(labelFont_()) + 4 * gap_UI;
62#if defined (iPlatformMobile)
63 float left = 0.0f, right = 0.0f, top = 0.0f, bottom = 0.0f;
62#if defined (iPlatformAppleMobile) 64#if defined (iPlatformAppleMobile)
63 float left, right, top, bottom;
64 safeAreaInsets_iOS(&left, &top, &right, &bottom); 65 safeAreaInsets_iOS(&left, &top, &right, &bottom);
66#endif
65 setPadding_Widget(sheet, left, 0, right, 0); 67 setPadding_Widget(sheet, left, 0, right, 0);
66 navi->rect.pos = init_I2(left, top); 68 navi->rect.pos = init_I2(left, top);
67 iConstForEach(PtrArray, i, findChildren_Widget(sheet, "panel.toppad")) { 69 iConstForEach(PtrArray, i, findChildren_Widget(sheet, "panel.toppad")) {
diff --git a/src/ui/root.c b/src/ui/root.c
index a8b9f998..a72f002c 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -83,7 +83,7 @@ static const iMenuItem navMenuItems_[] = {
83}; 83};
84#endif 84#endif
85 85
86#if defined (iPlatformAppleMobile) 86#if defined (iPlatformMobile)
87/* Tablet menu. */ 87/* Tablet menu. */
88static const iMenuItem tabletNavMenuItems_[] = { 88static const iMenuItem tabletNavMenuItems_[] = {
89 { folder_Icon " ${menu.openfile}", SDLK_o, KMOD_PRIMARY, "file.open" }, 89 { folder_Icon " ${menu.openfile}", SDLK_o, KMOD_PRIMARY, "file.open" },
@@ -120,9 +120,9 @@ static const iMenuItem phoneNavMenuItems_[] = {
120 { "---", 0, 0, NULL }, 120 { "---", 0, 0, NULL },
121 { gear_Icon " Settings...", SDLK_COMMA, KMOD_PRIMARY, "preferences" }, 121 { gear_Icon " Settings...", SDLK_COMMA, KMOD_PRIMARY, "preferences" },
122}; 122};
123#endif /* AppleMobile */ 123#endif /* Mobile */
124 124
125#if defined (iPlatformAppleMobile) 125#if defined (iPlatformMobile)
126static const iMenuItem identityButtonMenuItems_[] = { 126static const iMenuItem identityButtonMenuItems_[] = {
127 { "${menu.identity.notactive}", 0, 0, "ident.showactive" }, 127 { "${menu.identity.notactive}", 0, 0, "ident.showactive" },
128 { "---", 0, 0, NULL }, 128 { "---", 0, 0, NULL },
@@ -498,9 +498,10 @@ static void checkLoadAnimation_Root_(iRoot *d) {
498 498
499void updatePadding_Root(iRoot *d) { 499void updatePadding_Root(iRoot *d) {
500 if (d == NULL) return; 500 if (d == NULL) return;
501#if defined (iPlatformAppleMobile)
502 iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); 501 iWidget *toolBar = findChild_Widget(d->widget, "toolbar");
503 float left, top, right, bottom; 502 float bottom = 0.0f;
503#if defined (iPlatformAppleMobile)
504 float left, top, right;
504 safeAreaInsets_iOS(&left, &top, &right, &bottom); 505 safeAreaInsets_iOS(&left, &top, &right, &bottom);
505 /* Respect the safe area insets. */ { 506 /* Respect the safe area insets. */ {
506 setPadding_Widget(findChild_Widget(d->widget, "navdiv"), left, top, right, 0); 507 setPadding_Widget(findChild_Widget(d->widget, "navdiv"), left, top, right, 0);
@@ -508,6 +509,7 @@ void updatePadding_Root(iRoot *d) {
508 setPadding_Widget(toolBar, left, 0, right, bottom); 509 setPadding_Widget(toolBar, left, 0, right, bottom);
509 } 510 }
510 } 511 }
512#endif
511 if (toolBar) { 513 if (toolBar) {
512 /* TODO: get this from toolBar height, but it's buggy for some reason */ 514 /* TODO: get this from toolBar height, but it's buggy for some reason */
513 const int sidebarBottomPad = isPortrait_App() ? 11 * gap_UI + bottom : 0; 515 const int sidebarBottomPad = isPortrait_App() ? 11 * gap_UI + bottom : 0;
@@ -517,7 +519,6 @@ void updatePadding_Root(iRoot *d) {
517 are not arranged correctly until it's hidden and reshown. */ 519 are not arranged correctly until it's hidden and reshown. */
518 } 520 }
519 /* Note that `handleNavBarCommands_` also adjusts padding and spacing. */ 521 /* Note that `handleNavBarCommands_` also adjusts padding and spacing. */
520#endif
521} 522}
522 523
523void updateToolbarColors_Root(iRoot *d) { 524void updateToolbarColors_Root(iRoot *d) {
@@ -829,13 +830,13 @@ static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) {
829 return iFalse; 830 return iFalse;
830} 831}
831 832
832#if defined (iPlatformAppleMobile) 833#if defined (iPlatformMobile)
833static void dismissSidebar_(iWidget *sidebar, const char *toolButtonId) { 834static void dismissSidebar_(iWidget *sidebar, const char *toolButtonId) {
834 if (isVisible_Widget(sidebar)) { 835 if (isVisible_Widget(sidebar)) {
835 postCommandf_App("%s.toggle", cstr_String(id_Widget(sidebar))); 836 postCommandf_App("%s.toggle", cstr_String(id_Widget(sidebar)));
836 if (toolButtonId) { 837// if (toolButtonId) {
837 // setFlags_Widget(findWidget_App(toolButtonId), noBackground_WidgetFlag, iTrue); 838 // setFlags_Widget(findWidget_App(toolButtonId), noBackground_WidgetFlag, iTrue);
838 } 839// }
839 setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); 840 setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag);
840 } 841 }
841} 842}
@@ -909,7 +910,7 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) {
909 } 910 }
910 return iFalse; 911 return iFalse;
911} 912}
912#endif /* defined (iPlatformAppleMobile) */ 913#endif /* defined (iPlatformMobile) */
913 914
914static iLabelWidget *newLargeIcon_LabelWidget(const char *text, const char *cmd) { 915static iLabelWidget *newLargeIcon_LabelWidget(const char *text, const char *cmd) {
915 iLabelWidget *lab = newIcon_LabelWidget(text, 0, 0, cmd); 916 iLabelWidget *lab = newIcon_LabelWidget(text, 0, 0, cmd);
@@ -1198,8 +1199,8 @@ void createUserInterface_Root(iRoot *d) {
1198#if defined (iPlatformMobile) 1199#if defined (iPlatformMobile)
1199 const iBool isPhone = (deviceType_App() == phone_AppDeviceType); 1200 const iBool isPhone = (deviceType_App() == phone_AppDeviceType);
1200#endif 1201#endif
1201#if !defined (iHaveNativeMenus) 1202#if !defined (iHaveNativeMenus) || defined (iPlatformMobile)
1202# if defined (iPlatformAppleMobile) 1203# if defined (iPlatformMobile)
1203 iLabelWidget *navMenu = 1204 iLabelWidget *navMenu =
1204 makeMenuButton_LabelWidget(menu_Icon, isPhone ? phoneNavMenuItems_ : tabletNavMenuItems_, 1205 makeMenuButton_LabelWidget(menu_Icon, isPhone ? phoneNavMenuItems_ : tabletNavMenuItems_,
1205 isPhone ? iElemCount(phoneNavMenuItems_) : iElemCount(tabletNavMenuItems_)); 1206 isPhone ? iElemCount(phoneNavMenuItems_) : iElemCount(tabletNavMenuItems_));
@@ -1280,9 +1281,9 @@ void createUserInterface_Root(iRoot *d) {
1280 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev"))); 1281 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev")));
1281 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(close_Icon, SDLK_ESCAPE, 0, "find.close"))); 1282 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(close_Icon, SDLK_ESCAPE, 0, "find.close")));
1282 } 1283 }
1283#if defined (iPlatformAppleMobile) 1284#if defined (iPlatformMobile)
1284 /* Bottom toolbar. */ 1285 /* Bottom toolbar. */
1285 if (isPhone_iOS()) { 1286 if (deviceType_App() == phone_AppDeviceType) {
1286 iWidget *toolBar = new_Widget(); 1287 iWidget *toolBar = new_Widget();
1287 addChild_Widget(root, iClob(toolBar)); 1288 addChild_Widget(root, iClob(toolBar));
1288 setId_Widget(toolBar, "toolbar"); 1289 setId_Widget(toolBar, "toolbar");
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 767847ac..ea76a835 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -644,7 +644,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) {
644 d->buttonFont = uiLabel_FontId; 644 d->buttonFont = uiLabel_FontId;
645 d->itemFonts[0] = uiContent_FontId; 645 d->itemFonts[0] = uiContent_FontId;
646 d->itemFonts[1] = uiContentBold_FontId; 646 d->itemFonts[1] = uiContentBold_FontId;
647#if defined (iPlatformAppleMobile) 647#if defined (iPlatformMobile)
648 if (deviceType_App() == phone_AppDeviceType) { 648 if (deviceType_App() == phone_AppDeviceType) {
649 d->itemFonts[0] = defaultBig_FontId; 649 d->itemFonts[0] = defaultBig_FontId;
650 d->itemFonts[1] = defaultBigBold_FontId; 650 d->itemFonts[1] = defaultBigBold_FontId;
diff --git a/src/ui/text.c b/src/ui/text.c
index 06043c7b..c4596d1c 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -361,7 +361,7 @@ static void initFonts_Text_(iText *d) {
361 h12Font = &fontIosevkaTermExtended_Embedded; 361 h12Font = &fontIosevkaTermExtended_Embedded;
362 h3Font = &fontIosevkaTermExtended_Embedded; 362 h3Font = &fontIosevkaTermExtended_Embedded;
363 } 363 }
364#if defined (iPlatformAppleMobile) 364#if defined (iPlatformMobile)
365 const float uiSize = fontSize_UI * 1.1f; 365 const float uiSize = fontSize_UI * 1.1f;
366#else 366#else
367 const float uiSize = fontSize_UI; 367 const float uiSize = fontSize_UI;
diff --git a/src/ui/window.c b/src/ui/window.c
index febf5fe8..3bafd9a4 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -440,7 +440,11 @@ void init_Window(iWindow *d, iRect rect) {
440 if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { 440 if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) {
441 SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); 441 SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect));
442 } 442 }
443#if defined (iPlatformMobile)
444 const iInt2 minSize = zero_I2(); /* windows aren't independently resizable */
445#else
443 const iInt2 minSize = init_I2(425, 325); 446 const iInt2 minSize = init_I2(425, 325);
447#endif
444 SDL_SetWindowMinimumSize(d->win, minSize.x, minSize.y); 448 SDL_SetWindowMinimumSize(d->win, minSize.x, minSize.y);
445 SDL_SetWindowTitle(d->win, "Lagrange"); 449 SDL_SetWindowTitle(d->win, "Lagrange");
446 /* Some info. */ { 450 /* Some info. */ {
@@ -709,7 +713,6 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
709 } 713 }
710 } 714 }
711#endif /* defined LAGRANGE_ENABLE_CUSTOM_FRAME */ 715#endif /* defined LAGRANGE_ENABLE_CUSTOM_FRAME */
712 //printf("MOVED: %d, %d\n", ev->data1, ev->data2); fflush(stdout);
713 if (unsnap_Window_(d, &newPos)) { 716 if (unsnap_Window_(d, &newPos)) {
714 return iTrue; 717 return iTrue;
715 } 718 }
@@ -750,7 +753,13 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
750 case SDL_WINDOWEVENT_MINIMIZED: 753 case SDL_WINDOWEVENT_MINIMIZED:
751 d->isMinimized = iTrue; 754 d->isMinimized = iTrue;
752 return iTrue; 755 return iTrue;
753#endif /* defined (iPlatformDesktop) */ 756#else /* if defined (!iPlatformDesktop) */
757 case SDL_WINDOWEVENT_RESIZED:
758 /* On mobile, this occurs when the display is rotated. */
759 invalidate_Window(d);
760 postRefresh_App();
761 return iTrue;
762#endif
754 case SDL_WINDOWEVENT_LEAVE: 763 case SDL_WINDOWEVENT_LEAVE:
755 unhover_Widget(); 764 unhover_Widget();
756 d->isMouseInside = iFalse; 765 d->isMouseInside = iFalse;
@@ -760,19 +769,12 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
760 d->isMouseInside = iTrue; 769 d->isMouseInside = iTrue;
761 postCommand_App("window.mouse.entered"); 770 postCommand_App("window.mouse.entered");
762 return iTrue; 771 return iTrue;
763#if defined (iPlatformMobile)
764 case SDL_WINDOWEVENT_RESIZED:
765 /* On mobile, this occurs when the display is rotated. */
766 invalidate_Window(d);
767 postRefresh_App();
768 return iTrue;
769#endif
770 case SDL_WINDOWEVENT_FOCUS_GAINED: 772 case SDL_WINDOWEVENT_FOCUS_GAINED:
771 d->focusGainedAt = SDL_GetTicks(); 773 d->focusGainedAt = SDL_GetTicks();
772 setCapsLockDown_Keys(iFalse); 774 setCapsLockDown_Keys(iFalse);
773 postCommand_App("window.focus.gained"); 775 postCommand_App("window.focus.gained");
774 d->isExposed = iTrue; 776 d->isExposed = iTrue;
775#if defined (iPlatformMobile) 777#if !defined (iPlatformDesktop)
776 /* Returned to foreground, may have lost buffered content. */ 778 /* Returned to foreground, may have lost buffered content. */
777 invalidate_Window_(d, iTrue); 779 invalidate_Window_(d, iTrue);
778 postCommand_App("window.unfreeze"); 780 postCommand_App("window.unfreeze");
@@ -780,7 +782,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
780 return iFalse; 782 return iFalse;
781 case SDL_WINDOWEVENT_FOCUS_LOST: 783 case SDL_WINDOWEVENT_FOCUS_LOST:
782 postCommand_App("window.focus.lost"); 784 postCommand_App("window.focus.lost");
783#if defined (iPlatformMobile) 785#if !defined (iPlatformDesktop)
784 setFreezeDraw_Window(d, iTrue); 786 setFreezeDraw_Window(d, iTrue);
785#endif 787#endif
786 return iFalse; 788 return iFalse;
@@ -1020,7 +1022,6 @@ void draw_Window(iWindow *d) {
1020 if (d->isDrawFrozen) { 1022 if (d->isDrawFrozen) {
1021 return; 1023 return;
1022 } 1024 }
1023//#if defined (iPlatformMobile)
1024 /* Check if root needs resizing. */ { 1025 /* Check if root needs resizing. */ {
1025 iInt2 renderSize; 1026 iInt2 renderSize;
1026 SDL_GetRendererOutputSize(d->render, &renderSize.x, &renderSize.y); 1027 SDL_GetRendererOutputSize(d->render, &renderSize.x, &renderSize.y);
@@ -1029,7 +1030,6 @@ void draw_Window(iWindow *d) {
1029 processEvents_App(postedEventsOnly_AppEventMode); 1030 processEvents_App(postedEventsOnly_AppEventMode);
1030 } 1031 }
1031 } 1032 }
1032//#endif
1033 const int winFlags = SDL_GetWindowFlags(d->win); 1033 const int winFlags = SDL_GetWindowFlags(d->win);
1034 const iBool gotFocus = (winFlags & SDL_WINDOW_INPUT_FOCUS) != 0; 1034 const iBool gotFocus = (winFlags & SDL_WINDOW_INPUT_FOCUS) != 0;
1035 iPaint p; 1035 iPaint p;
@@ -1037,7 +1037,7 @@ void draw_Window(iWindow *d) {
1037 /* Clear the window. The clear color is visible as a border around the window 1037 /* Clear the window. The clear color is visible as a border around the window
1038 when the custom frame is being used. */ { 1038 when the custom frame is being used. */ {
1039 setCurrent_Root(d->roots[0]); 1039 setCurrent_Root(d->roots[0]);
1040#if defined (iPlatformAppleMobile) 1040#if defined (iPlatformMobile)
1041 iColor back = get_Color(uiBackground_ColorId); 1041 iColor back = get_Color(uiBackground_ColorId);
1042 if (deviceType_App() == phone_AppDeviceType) { 1042 if (deviceType_App() == phone_AppDeviceType) {
1043 /* Page background extends to safe area, so fill it completely. */ 1043 /* Page background extends to safe area, so fill it completely. */