Hi,
It's been a long time :)

In the current win32 implementation of nglApplication::SysLoop the OnIdle() event will never be called if not explicitely telling 'Call me even if nothing happened' (SetIdle(true)). Witch defeats the main purpose of the event if we consider that OnIdle() is a way for an application loop to ask for some more work, sort of 'well, I'm done now. what's next ?'. That is : prevents OnIdle() to be used as the main application heartbeat (witch would make sense...). By now, one would need to run a fool loop at every callback instead of just waiting for the message train to pass before processing consequences and repainting if necessary.

Here is a simpler win32 implementation of nglApplication::SysLoop proposal that solves the issues. (as usual : unix & mac versions are left as an exercise to the reader ;° )

int nglApplication::SysLoop()
{
  MSG msg;

  do
  {
    if (!GetIdle())
    {
      // Breathe (only returns at next message)
      GetMessage( &msg, NULL, 0, 0);

      TranslateMessage( &msg );
      DispatchMessage( &msg );
    }

    // Process (rest of) msg queue
    while (
      PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) &&
      msg.message != WM_QUIT
    ){
      TranslateMessage( &msg );
      DispatchMessage( &msg );
    }

    if(msg.message != WM_QUIT)
    {
      // We're done : enter idle state
      CallOnIdle();
    }
  }
  while (msg.message != WM_QUIT);

  CallOnExit(msg.wParam);

  return msg.wParam; // Return the exit code to the system
}

Some comments ?

Lo.

_______________________________________________
https://mail.gna.org/listinfo/ngl-devel

Reply via email to