Sometimes a delay is observed or the update is missing on key events.

Description

Sometimes the UI reaction on cursor or key events is missing or delayed on the target.

 

Solution

The reason is usually a wrong or disadvantageous update loop in the C-source code. In older documentations and examples the update loop was not implemented correct to react on cursor or key events. Therefore you should at first check your update loop. The screen update and garbage collection should be processed only if one of the following conditions is true:

-      An incoming user interaction (key or cursor event) was processed.

-      An expired timer was processed.

-      Pending signals have been processed.

So the update loop should look like this:

 

int command = 0;
int events = 0;
int timers = 0;
int signals = 0;
int run = 1;
 
while ( run )
{
  command = MSG_QueueGetCommand();
  if ( command == MSG_POWER_DOWN )
    run = 0;
 
  events  = ProcessEvents( command );
  timers  = EwProcessTimers();
  signals = EwProcessSignals();
 
  if ( timers || signals || events )
  {
    UpdateRoot((CoreRoot)rootObject, &Display);
    EwReclaimMemory();
  }
}

 

If in the above example, the check for incoming events is missing in the if-statement, an update happens only if a timer is expired or a pending signal was processed. In such a case the screen update could be delayed or missing at all.

 

See also

HowTo document [HT-005-PlatformIntegration.pdf]

 

Keywords

Screen, update, delay, missing, target, platform, integration, update loop, timers, signals, events, user input

 

Last update on 2010-08-19 by Mario Stefanutti.

Go back