From afd4e60c6a13a417964945396ebf252a4ba9b8ae Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Sat, 26 Mar 2022 18:11:49 +0200

Subject: [PATCH 1/1] iOS: Adjusted idle sleep; input fields; mobile UI layout


src/app.c | 26 +++++++++++-----

src/ios.m | 70 ++++++++++++++++++++++++++-----------------

src/ui/listwidget.c | 1 +

src/ui/mobile.c | 1 +

src/ui/uploadwidget.c | 13 ++++----

src/ui/widget.c | 38 ++++++++++++-----------

src/ui/widget.h | 1 +

7 files changed, 92 insertions(+), 58 deletions(-)

diff --git a/src/app.c b/src/app.c

index 50fd0db2..15c26736 100644

--- a/src/app.c

+++ b/src/app.c

@@ -140,6 +140,7 @@ struct Impl_App {

 iBool        isSuspended;

#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)

 iBool        isIdling;

 uint32_t     lastEventTime;

 int          sleepTimer;

#endif

@@ -1098,9 +1099,20 @@ static void init_App_(iApp *d, int argc, char **argv) {

 d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL);

 postCommand_Root(NULL, "document.autoreload");

#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)

#endif

 d->isFinishedLaunching = iTrue;

 /* Run any commands that were pending completion of launch. */ {

@@ -1686,10 +1698,10 @@ void processEvents_App(enum iAppEventMode eventMode) {

 deinit_PtrArray(&windows);

#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)

 if (d->isIdling && !gotEvents) {

 }

#endif

backToMainLoop:;

diff --git a/src/ios.m b/src/ios.m

index eff970ef..6c64a854 100644

--- a/src/ios.m

+++ b/src/ios.m

@@ -168,6 +168,7 @@ API_AVAILABLE(ios(13.0))

 iString *fileBeingSaved;

 iString *pickFileCommand;

 iSystemTextInput *sysCtrl;

}

@property (nonatomic, assign) BOOL isHapticsAvailable;

@property (nonatomic, strong) NSObject *haptic;

@@ -183,23 +184,10 @@ static UIScrollView statusBarTapper_; / dummy scroll view just for getting not

 fileBeingSaved = NULL;

 pickFileCommand = NULL;

 sysCtrl = NULL;

 return self;

}

--(void)setSystemTextInput:(iSystemTextInput *)sys {

-}

--(iSystemTextInput *)systemTextInput {

-}

-- (CGFloat)layoutManager:(NSLayoutManager *)layoutManager

-}

-(void)setPickFileCommand:(const char *)command {

 if (!pickFileCommand) {

     pickFileCommand = new_String();

@@ -262,6 +250,11 @@ didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {

 }

}

+- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView {

+}

-(void)keyboardOnScreen:(NSNotification *)notification {

 NSDictionary *info   = notification.userInfo;

 NSValue      *value  = info[UIKeyboardFrameEndUserInfoKey];

@@ -295,6 +288,24 @@ static void sendReturnKeyPress_(void) {

 return NO;

}

+-(void)setSystemTextInput:(iSystemTextInput *)sys {

+}

+-(void)setSystemTextLineSpacing:(float)height {

+}

+-(iSystemTextInput *)systemTextInput {

+}

+- (CGFloat)layoutManager:(NSLayoutManager *)layoutManager

+}

replacementString:(NSString *)string {

 iSystemTextInput *sysCtrl = [appState_ systemTextInput];

@@ -318,11 +329,6 @@ replacementString:(NSString *)string {

 notifyChange_SystemTextInput_(sysCtrl);

}

-- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView {

-}

@end

/----------------------------------------------------------------------------------------------/

@@ -751,17 +757,17 @@ static CGRect convertToCGRect_(const iRect *rect, iBool expanded) {

 CGRect frame;

 // TODO: Convert coordinates properly!

 frame.origin.x = rect->pos.x / win->pixelRatio;

 frame.size.width = rect->size.x / win->pixelRatio;

 frame.size.height = rect->size.y / win->pixelRatio;

 /* Some padding to account for insets. If we just zero out the insets, the insertion point

    may be clipped at the edges. */

 if (expanded) {

 }

 return frame;

}

@@ -812,14 +818,16 @@ void init_SystemTextInput(iSystemTextInput *d, iRect rect, int flags) {

         [REF_d_view setTextAlignment:NSTextAlignmentRight];

     }

 }

 UIColor *backgroundColor = makeUIColor_(uiInputBackgroundFocused_ColorId);

 [appState_ setSystemTextInput:d];

 if (d->field) {

     UITextField *field = REF_d_field;

     [field setTextColor:textColor];

     [field setTintColor:tintColor];

+// [field setBackgroundColor:[UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:0.5f]];

     [field setDelegate:appState_];

     [field becomeFirstResponder];

 }

@@ -827,10 +835,14 @@ void init_SystemTextInput(iSystemTextInput *d, iRect rect, int flags) {

     UITextView *view = REF_d_view;

     [[view layoutManager] setDelegate:appState_];

     [view setBackgroundColor:[UIColor colorWithWhite:1.0f alpha:0.0f]];

+// [view setBackgroundColor:[UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:0.5f]];

     [view setTextColor:textColor];

     [view setTintColor:tintColor];

     if (flags & extraPadding_SystemTextInputFlag) {

     }

     [view setEditable:YES];

     [view setDelegate:appState_];

@@ -912,9 +924,11 @@ void setFont_SystemTextInput(iSystemTextInput *d, int fontId) {

// printf("fontname: %s\n", [name cStringUsingEncoding:NSUTF8StringEncoding]);

// }

     font = [UIFont fontWithName:@"Iosevka-Term-Extended" size:height * 0.82f];

 }

 else {

     font = [UIFont fontWithName:@"Roboto-Regular" size:height * 0.66f];

 }

 if (d->field) {

     [REF_d_field setFont:font];

diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c

index e2dbd5b8..7a627188 100644

--- a/src/ui/listwidget.c

+++ b/src/ui/listwidget.c

@@ -664,6 +664,7 @@ static void draw_ListWidget_(const iListWidget *d) {

     SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE);

 }

 unsetClip_Paint(&p);

 drawChildren_Widget(w);

}

diff --git a/src/ui/mobile.c b/src/ui/mobile.c

index 1b5e6a63..dfa02422 100644

--- a/src/ui/mobile.c

+++ b/src/ui/mobile.c

@@ -749,6 +749,7 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) {

     iListWidget *list = (iListWidget *) certList;

     setBackgroundColor_Widget(as_Widget(list), uiBackgroundSidebar_ColorId);

     widget = as_Widget(certList);

     updateItems_CertListWidget(certList);

     invalidate_ListWidget(list);

 }

diff --git a/src/ui/uploadwidget.c b/src/ui/uploadwidget.c

index cb1c7c83..3286ad71 100644

--- a/src/ui/uploadwidget.c

+++ b/src/ui/uploadwidget.c

@@ -184,6 +184,7 @@ void init_UploadWidget(iUploadWidget *d) {

     const iMenuItem fileItems[] = {

         { "navi.action text:${dlg.upload.send}", 0, 0, "upload.accept" },

         { "title id:heading.upload.file" },

         { "button text:" uiTextAction_ColorEscape "${dlg.upload.pickfile}", 0, 0, "upload.pickfile" },            

         { "heading id:upload.file.name" },

         { "label id:upload.filepathlabel text:\u2014" },

@@ -196,16 +197,16 @@ void init_UploadWidget(iUploadWidget *d) {

     };

     initPanels_Mobile(w, NULL, (iMenuItem[]){                                                  

         { "title id:heading.upload" },

         { "heading id:upload.url" },

         { format_CStr("label id:upload.info font:%d",

                       deviceType_App() == phone_AppDeviceType ? uiLabelBig_FontId : uiLabelMedium_FontId) },

         { "input id:upload.path hint:hint.upload.path noheading:1 url:1 text:" },

         { NULL }

     }, actions, iElemCount(actions) - 1 /* no Accept button on main panel */);

     d->info          = findChild_Widget(w, "upload.info");

diff --git a/src/ui/widget.c b/src/ui/widget.c

index 6ad6f8de..dbf992aa 100644

--- a/src/ui/widget.c

+++ b/src/ui/widget.c

@@ -1536,6 +1536,26 @@ void drawLayerEffects_Widget(const iWidget *d) {

#endif

}

+void drawBorders_Widget(const iWidget *d) {

+}

void drawBackground_Widget(const iWidget *d) {

 if (d->flags & noBackground_WidgetFlag) {

     return;

@@ -1559,23 +1579,7 @@ void drawBackground_Widget(const iWidget *d) {

                                 gap_UI / 4, d->frameColor);

     }

 }

}

int drawCount_;

diff --git a/src/ui/widget.h b/src/ui/widget.h

index 9d05d8db..1ea198ad 100644

--- a/src/ui/widget.h

+++ b/src/ui/widget.h

@@ -218,6 +218,7 @@ size_t childCount_Widget (const iWidget *);

void draw_Widget (const iWidget *);

void drawLayerEffects_Widget (const iWidget *);

void drawBackground_Widget (const iWidget *);

+void drawBorders_Widget (const iWidget ); / called by drawBackground */

void drawChildren_Widget (const iWidget *);

void drawRoot_Widget (const iWidget ); / root only */

void setDrawBufferEnabled_Widget (iWidget *, iBool enable);

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.12/patch/afd4e60c6a13a417964945396ebf252a4ba9b8ae.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
81.168768 milliseconds
Gemini-to-HTML Time
3.267198 milliseconds

This content has been proxied by September (3851b).