Levure - flicker prior to displaying UI stack on iOS

Trevor DeVore lists at mangomultimedia.com
Thu Jun 7 17:02:12 EDT 2018

On Tue, Jun 5, 2018 at 12:36 PM, Ralf Bitter via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Unfortunately I am observing an annoying screen flicker
> during the startup sequence while the UI stack is opened
> and the Levure standalone is closed.
> The iOS splash screen, as defined in settings, is shown,
> then for a fraction of a second the screen is black just before
> the UI stack becomes visible. This happens not only in the
> simulator but on a real device (iPad Pro) too.
> Did tests using a very simple UI stack, no code included, just
> one card showing an image which is the same as the splash
> screen so that the transition from the splash screen to the
> UI stack should not be noticeable.

I've tracked down what is causing the flicker.

1) When the `startup` message is received the
`levureInitializeAndRunApplication` is called. This handler loads your
configuration files.
2) Next, the `levureRunApplication` handler is called in time (`0
3) `levureRunApplication` processes command line arguments and dispatches
the `InitializeApplication` message to your app. It then calls
`levureFinishLoadingApplication` in time (`10 milliseconds`).
4) `levureFinishLoadingApplication ` dispatches `OpenApplication` to your
application. This is where you display the "testUI" stack of your app.

The flicker occurs due to the `send in time` that occurs in step 3,
`levureRunApplication`. I just did a test where I called
`levureFinishLoadingApplication` inline and the flicker goes away. So now
 the only issue is to find a fix and I think there is an easy one.

In the comments I made for myself in the source code it says that the
reason `levureFinishLoadingApplication` is called in time is so that
appleEvents can be sent before the application is loaded. This allows URLs
that launched application to be tucked away in "process url" levure
property and used in `OpenApplication`. Since appleEvents only exist on
macOS `in time` only needs to be used on macOS.

Try changing line 507 (or thereabouts) in `levure.livecodescript` to the

if the platform is "macos" then
  send "levureFinishLoadingApplication" to me in 10 milliseconds
end if

In my tests this removes the flicker without breaking the macOS behavior.
If it works for you then I will submit a fix to the master branch of Levure.

Trevor DeVore

More information about the Use-livecode mailing list