/*
|
/*
|
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
// $Header: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/mw/src/drivers/mwselect_rtems.c,v 1.1.1.1 2002-02-15 09:17:33 markom Exp $
|
// $Header: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/mw/src/drivers/mwselect_rtems.c,v 1.1.1.1 2002-02-15 09:17:33 markom Exp $
|
//
|
//
|
// Copyright (c) 2000 - Rosimildo da Silva
|
// Copyright (c) 2000 - Rosimildo da Silva
|
//
|
//
|
// MODULE DESCRIPTION:
|
// MODULE DESCRIPTION:
|
// This module implements the "GsSelect()" function for MicroWindows.
|
// This module implements the "GsSelect()" function for MicroWindows.
|
//
|
//
|
// MODIFICATION/HISTORY:
|
// MODIFICATION/HISTORY:
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
// Revision 1.1.1.1 2001/06/21 06:32:41 greg
|
// Revision 1.1.1.1 2001/06/21 06:32:41 greg
|
// Microwindows pre8 with patches
|
// Microwindows pre8 with patches
|
//
|
//
|
// Revision 1.1.1.1 2001/06/05 03:44:01 root
|
// Revision 1.1.1.1 2001/06/05 03:44:01 root
|
// First import of 5/5/2001 Microwindows to CVS
|
// First import of 5/5/2001 Microwindows to CVS
|
//
|
//
|
//
|
//
|
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
*/
|
*/
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <errno.h>
|
#include <errno.h>
|
|
|
#include <rtems/mw_uid.h>
|
#include <rtems/mw_uid.h>
|
#include "device.h"
|
#include "device.h"
|
#include "windef.h"
|
#include "windef.h"
|
|
|
extern MWBOOL MwCheckMouseEvent();
|
extern MWBOOL MwCheckMouseEvent();
|
extern MWBOOL MwCheckKeyboardEvent();
|
extern MWBOOL MwCheckKeyboardEvent();
|
|
|
#if ANIMATEPALETTE
|
#if ANIMATEPALETTE
|
static int fade = 0;
|
static int fade = 0;
|
#endif
|
#endif
|
|
|
extern struct MW_UID_MESSAGE m_kbd;
|
extern struct MW_UID_MESSAGE m_kbd;
|
extern struct MW_UID_MESSAGE m_mou;
|
extern struct MW_UID_MESSAGE m_mou;
|
|
|
extern HWND dragwp; /* window user is dragging*/
|
extern HWND dragwp; /* window user is dragging*/
|
/*
|
/*
|
* "Select() routine called by the Microwindows framework to receive events
|
* "Select() routine called by the Microwindows framework to receive events
|
* from the input devices.
|
* from the input devices.
|
*/
|
*/
|
void MwSelect(void)
|
void MwSelect(void)
|
{
|
{
|
struct MW_UID_MESSAGE m;
|
struct MW_UID_MESSAGE m;
|
int rc;
|
int rc;
|
unsigned int timeout = 0;
|
unsigned int timeout = 0;
|
|
|
/* perform pre-select duties, if any*/
|
/* perform pre-select duties, if any*/
|
if(scrdev.PreSelect)
|
if(scrdev.PreSelect)
|
{
|
{
|
scrdev.PreSelect(&scrdev);
|
scrdev.PreSelect(&scrdev);
|
}
|
}
|
/* Set up the timeout for the main select(). If
|
/* Set up the timeout for the main select(). If
|
* the mouse is captured we're probably moving a window,
|
* the mouse is captured we're probably moving a window,
|
* so poll quickly to allow other windows to repaint while
|
* so poll quickly to allow other windows to repaint while
|
* checking for more event input.
|
* checking for more event input.
|
*/
|
*/
|
if( !dragwp )
|
if( !dragwp )
|
{
|
{
|
timeout = MwGetNextTimeoutValue(); /* returns ms*/
|
timeout = MwGetNextTimeoutValue(); /* returns ms*/
|
#if ANIMATEPALETTE
|
#if ANIMATEPALETTE
|
if(fade < 100)
|
if(fade < 100)
|
timeout = 40;
|
timeout = 40;
|
else
|
else
|
#endif
|
#endif
|
if(timeout == 0)
|
if(timeout == 0)
|
timeout = 10; /* 10ms required for vt fb switch*/
|
timeout = 10; /* 10ms required for vt fb switch*/
|
}
|
}
|
|
|
/* let's make sure that the type is invalid */
|
/* let's make sure that the type is invalid */
|
m.type = MV_UID_INVALID;
|
m.type = MV_UID_INVALID;
|
|
|
/* wait up to 100 milisecons for events */
|
/* wait up to 100 milisecons for events */
|
rc = uid_read_message( &m, timeout );
|
rc = uid_read_message( &m, timeout );
|
|
|
/* return if timed-out or something went wrong */
|
/* return if timed-out or something went wrong */
|
if( rc < 0 )
|
if( rc < 0 )
|
{
|
{
|
if( errno != ETIMEDOUT )
|
if( errno != ETIMEDOUT )
|
EPRINTF( " rc= %d, errno=%d\n", rc, errno );
|
EPRINTF( " rc= %d, errno=%d\n", rc, errno );
|
else
|
else
|
{
|
{
|
#if ANIMATEPALETTE
|
#if ANIMATEPALETTE
|
if(fade <= 100) {
|
if(fade <= 100) {
|
setfadelevel( &scrdev, fade );
|
setfadelevel( &scrdev, fade );
|
fade += 5;
|
fade += 5;
|
}
|
}
|
#endif
|
#endif
|
MwHandleTimers();
|
MwHandleTimers();
|
}
|
}
|
return;
|
return;
|
}
|
}
|
|
|
/* let's pass the event up to microwindows */
|
/* let's pass the event up to microwindows */
|
switch( m.type )
|
switch( m.type )
|
{
|
{
|
/* Mouse or Touch Screen event */
|
/* Mouse or Touch Screen event */
|
case MV_UID_REL_POS:
|
case MV_UID_REL_POS:
|
case MV_UID_ABS_POS:
|
case MV_UID_ABS_POS:
|
m_mou = m;
|
m_mou = m;
|
while( MwCheckMouseEvent() )
|
while( MwCheckMouseEvent() )
|
continue;
|
continue;
|
break;
|
break;
|
|
|
/* KBD event */
|
/* KBD event */
|
case MV_UID_KBD:
|
case MV_UID_KBD:
|
m_kbd = m;
|
m_kbd = m;
|
MwCheckKeyboardEvent();
|
MwCheckKeyboardEvent();
|
break;
|
break;
|
|
|
/* micro-windows does nothing with those.. */
|
/* micro-windows does nothing with those.. */
|
case MV_UID_TIMER:
|
case MV_UID_TIMER:
|
case MV_UID_INVALID:
|
case MV_UID_INVALID:
|
default:
|
default:
|
;
|
;
|
}
|
}
|
}
|
}
|
|
|
|
|