nanogui: Re: Help --- assert( drivers/mempl4.c, line=237 ) --- follow up
Subject:
Re: Help --- assert( drivers/mempl4.c, line=237 ) --- follow up
From:
Rosimildo daSilva ####@####.####
Date:
23 Dec 1999 16:27:02 -0000
Message-Id: <199912231621.IAA18126@www1.xoommail.com>
"Greg Haerr" wrote:
> : Left button == 0x04
> : Right button == 0x01
> : Both buttons == 0x05
> :
> : So, it looks good when running the test driver.
> :
>
> Perhaps it's your GsSelect code that calls GsCheckMouse
> and GsCheckKbd even when timeout returned. And
> then the mouse driver is called twice, and returns
> data twice?
>
> If that's not it, go into the GsCheckMouse code and
> trace through the code leading up to the WM_LBUTTONDOWN
> that is being created. It's values should be the same as
> any previous or post WM_MOUSEMOVE messages,
> since they are generated in addition to the GdMoveCursor,
> which actually moves the cursor on the screen.
I have finally understood this a bit. The termios buffer
for the mouse driver, mou_ser.c is getting full, and some
bytes of the mouse stream are lost. It takes a little a while
to recover. During this period waird things happen.
This happens more often with the 3d demo because my test machine
does NOT perform well with floating point ( cyrix 586 ).
One solution that worked for me was to change the signatures
of GsCheckMouseEvent & GsCheckKeyboardEvent to return a
boolean indicating whether or not an event was posted. I use
this information to keep "pumping" mouse events as long as
there is one.
/* RTEMS select became ... */
void GsSelect(void)
{
static int mouse_had_data = FALSE;
static int kbd_had_data = FALSE;
rtems_event_set o;
rtems_status_code rc;
rtems_interval timeout;
rtems_option options;
/* perform pre-select duties, if any*/
if( scrdev.PreSelect )
{
scrdev.PreSelect( &scrdev );
}
/* As long as we have data in the Mouse or KBD buffers
* let's handle it.
*/
if( mouse_had_data )
{
mouse_had_data = GsCheckMouseEvent();
}
if( kbd_had_data )
{
kbd_had_data = GsCheckKeyboardEvent();
}
if( mouse_had_data || kbd_had_data )
return;
/* Let's wait until next eveen becomes available */
options = RTEMS_WAIT | RTEMS_EVENT_ANY;
timeout = 100; /* in ticks ~ 1 sec */
o = 0;
rc = rtems_event_receive( RTEMS_KBD_EVENT | RTEMS_MOUSE_EVENT,
options, timeout, &o );
if( ( rc == RTEMS_TIMEOUT ) || ( rc == RTEMS_UNSATISFIED ) )
{
return;
}
/* If mouse data present, service it*/
if( o & RTEMS_MOUSE_EVENT )
{
mouse_had_data = GsCheckMouseEvent();
}
/* If keyboard data present, service it*/
if( o & RTEMS_KBD_EVENT )
______________________________________________________
Get your free web-based email at http://www.xoom.com
Birthday? Anniversary? Send FREE animated greeting
cards for any occasion at http://greetings.xoom.com