summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/app.c13
-rw-r--r--src/ui/documentwidget.c5
-rw-r--r--src/ui/inputwidget.c6
-rw-r--r--src/ui/lookupwidget.c6
-rw-r--r--src/ui/root.c5
-rw-r--r--src/ui/window.c7
7 files changed, 32 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32f8afb2..94b70ea0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,7 @@ endif ()
31 31
32# Defaults that depend on environment. 32# Defaults that depend on environment.
33set (DEFAULT_RESIZE_DRAW ON) 33set (DEFAULT_RESIZE_DRAW ON)
34if (HAIKU) 34if (HAIKU OR ANDROID)
35 set (DEFAULT_RESIZE_DRAW OFF) 35 set (DEFAULT_RESIZE_DRAW OFF)
36endif () 36endif ()
37set (DEFAULT_IDLE_SLEEP OFF) 37set (DEFAULT_IDLE_SLEEP OFF)
diff --git a/src/app.c b/src/app.c
index f5f7ae2b..27c8bef7 100644
--- a/src/app.c
+++ b/src/app.c
@@ -3432,8 +3432,21 @@ void closePopups_App(void) {
3432} 3432}
3433 3433
3434#if defined (iPlatformAndroidMobile) 3434#if defined (iPlatformAndroidMobile)
3435
3435float displayDensity_Android(void) { 3436float displayDensity_Android(void) {
3436 iApp *d = &app_; 3437 iApp *d = &app_;
3437 return toFloat_String(at_CommandLine(&d->args, 1)); 3438 return toFloat_String(at_CommandLine(&d->args, 1));
3438} 3439}
3440
3441#include <jni.h>
3442
3443JNIEXPORT void JNICALL Java_fi_skyjake_lagrange_SDLActivity_postAppCommand(
3444 JNIEnv* env, jclass jcls,
3445 jstring command)
3446{
3447 const char *cmd = (*env)->GetStringUTFChars(env, command, NULL);
3448 postCommand_Root(NULL, cmd);
3449 (*env)->ReleaseStringUTFChars(env, command, cmd);
3450}
3451
3439#endif 3452#endif
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 0977da4a..04257a1c 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -3100,11 +3100,6 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
3100 NULL); 3100 NULL);
3101 insertChildAfter_Widget(buttons, iClob(lineBreak), 0); 3101 insertChildAfter_Widget(buttons, iClob(lineBreak), 0);
3102 } 3102 }
3103 else {
3104#if !defined (iPlatformAppleMobile)
3105 lineBreak = new_LabelWidget("${dlg.input.linebreak}", "text.insert arg:10");
3106#endif
3107 }
3108 if (lineBreak) { 3103 if (lineBreak) {
3109 setFlags_Widget(as_Widget(lineBreak), frameless_WidgetFlag, iTrue); 3104 setFlags_Widget(as_Widget(lineBreak), frameless_WidgetFlag, iTrue);
3110 setTextColor_LabelWidget(lineBreak, uiTextDim_ColorId); 3105 setTextColor_LabelWidget(lineBreak, uiTextDim_ColorId);
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 24983d69..2de16e6e 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -1269,8 +1269,8 @@ void end_InputWidget(iInputWidget *d, iBool accept) {
1269 if (!accept) { 1269 if (!accept) {
1270 /* Overwrite the edited lines. */ 1270 /* Overwrite the edited lines. */
1271 splitToLines_(&d->oldText, &d->lines); 1271 splitToLines_(&d->oldText, &d->lines);
1272 SDL_StopTextInput();
1273 } 1272 }
1273 SDL_StopTextInput();
1274 enableEditorKeysInMenus_(iTrue); 1274 enableEditorKeysInMenus_(iTrue);
1275 d->inFlags &= ~isMarking_InputWidgetFlag; 1275 d->inFlags &= ~isMarking_InputWidgetFlag;
1276 startOrStopCursorTimer_InputWidget_(d, iFalse); 1276 startOrStopCursorTimer_InputWidget_(d, iFalse);
@@ -2153,11 +2153,11 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) {
2153 updateAfterVisualOffsetChange_InputWidget_(d, w->root); 2153 updateAfterVisualOffsetChange_InputWidget_(d, w->root);
2154 } 2154 }
2155 } 2155 }
2156 else if (d->sysCtrl && isCommand_UserEvent(ev, "menu.opened")) { 2156#endif
2157 if (deviceType_App() != desktop_AppDeviceType && isCommand_UserEvent(ev, "menu.opened")) {
2157 setFocus_Widget(NULL); 2158 setFocus_Widget(NULL);
2158 return iFalse; 2159 return iFalse;
2159 } 2160 }
2160#endif
2161 if (isCommand_Widget(w, ev, "focus.gained")) { 2161 if (isCommand_Widget(w, ev, "focus.gained")) {
2162 if (contentBounds_InputWidget_(d).size.x < minWidth_InputWidget_) { 2162 if (contentBounds_InputWidget_(d).size.x < minWidth_InputWidget_) {
2163 setFocus_Widget(NULL); 2163 setFocus_Widget(NULL);
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c
index c654e3cf..f14170ad 100644
--- a/src/ui/lookupwidget.c
+++ b/src/ui/lookupwidget.c
@@ -676,17 +676,19 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
676 max_I2(zero_I2(), 676 max_I2(zero_I2(),
677 addX_I2(bottomLeft_Rect(bounds_Widget(url)), 677 addX_I2(bottomLeft_Rect(bounds_Widget(url)),
678 -extraWidth / 2)))); 678 -extraWidth / 2))));
679#if defined(iPlatformAppleMobile) 679#if defined(iPlatformMobile)
680 /* TODO: Check this again. */ 680 /* TODO: Check this again. */
681 /* Adjust height based on keyboard size. */ { 681 /* Adjust height based on keyboard size. */ {
682 w->rect.size.y = bottom_Rect(visibleRect_Root(root)) - top_Rect(bounds_Widget(w)); 682 w->rect.size.y = bottom_Rect(visibleRect_Root(root)) - top_Rect(bounds_Widget(w));
683# if defined (iPlatformAppleMobile)
683 if (deviceType_App() == phone_AppDeviceType) { 684 if (deviceType_App() == phone_AppDeviceType) {
684 float l, r; 685 float l = 0.0f, r = 0.0f;
685 safeAreaInsets_iOS(&l, NULL, &r, NULL); 686 safeAreaInsets_iOS(&l, NULL, &r, NULL);
686 w->rect.size.x = size_Root(root).x - l - r; 687 w->rect.size.x = size_Root(root).x - l - r;
687 w->rect.pos.x = l; 688 w->rect.pos.x = l;
688 /* TODO: Need to use windowToLocal_Widget? */ 689 /* TODO: Need to use windowToLocal_Widget? */
689 } 690 }
691# endif
690 } 692 }
691#endif 693#endif
692 arrange_Widget(w); 694 arrange_Widget(w);
diff --git a/src/ui/root.c b/src/ui/root.c
index 9e264993..36ac948e 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -512,7 +512,10 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {
512 else { 512 else {
513 addChild_Widget(root, iClob(sidebar)); 513 addChild_Widget(root, iClob(sidebar));
514 setWidth_SidebarWidget(sidebar, (float) width_Widget(root) / (float) gap_UI); 514 setWidth_SidebarWidget(sidebar, (float) width_Widget(root) / (float) gap_UI);
515 const int midHeight = height_Widget(root) / 2;// + lineHeight_Text(uiLabelLarge_FontId); 515 int midHeight = height_Widget(root) / 2;// + lineHeight_Text(uiLabelLarge_FontId);
516#if defined (iPlatformAndroidMobile)
517 midHeight += 2 * lineHeight_Text(uiLabelLarge_FontId);
518#endif
516 setMidHeight_SidebarWidget(sidebar, midHeight); 519 setMidHeight_SidebarWidget(sidebar, midHeight);
517 setFixedSize_Widget(as_Widget(sidebar), init_I2(-1, midHeight)); 520 setFixedSize_Widget(as_Widget(sidebar), init_I2(-1, midHeight));
518 setPos_Widget(as_Widget(sidebar), init_I2(0, height_Widget(root) - midHeight)); 521 setPos_Widget(as_Widget(sidebar), init_I2(0, height_Widget(root) - midHeight));
diff --git a/src/ui/window.c b/src/ui/window.c
index d694146a..953d5ea4 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1008,6 +1008,13 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
1008 postCommand_App("media.player.update"); /* in case a player needs updating */ 1008 postCommand_App("media.player.update"); /* in case a player needs updating */
1009 return iTrue; 1009 return iTrue;
1010 } 1010 }
1011 if (event.type == SDL_USEREVENT && isCommand_UserEvent(ev, "window.sysframe") && mw) {
1012 /* This command is sent on Android to update the keyboard height. */
1013 const char *cmd = command_UserEvent(ev);
1014 setKeyboardHeight_MainWindow(mw, argLabel_Command(cmd, "fullheight") -
1015 argLabel_Command(cmd, "bottom"));
1016 return iTrue;
1017 }
1011 if (processEvent_Touch(&event)) { 1018 if (processEvent_Touch(&event)) {
1012 return iTrue; 1019 return iTrue;
1013 } 1020 }