]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/services/gfx/mw/v2_0/src/drivers/gsselect_rtems.c
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / services / gfx / mw / v2_0 / src / drivers / gsselect_rtems.c
1 /*
2 /////////////////////////////////////////////////////////////////////////////
3 // $Header$
4 //
5 // Copyright (c) 2000 - Rosimildo da Silva
6 //  
7 // MODULE DESCRIPTION: 
8 // This module implements the "GsSelect()" function for Nano-X.
9 //
10 // MODIFICATION/HISTORY:
11 //
12 // $Log$
13 // Revision 1.1.9.1  2009-06-15 14:11:00  lothar
14 // unified MX27, MX25, MX37 trees
15 //
16 // Revision 1.1.1.1  2001/06/21 06:32:41  greg
17 // Microwindows pre8 with patches
18 //
19 // Revision 1.1.1.1  2001/06/05 03:44:01  root
20 // First import of 5/5/2001 Microwindows to CVS
21 //
22 //
23 /////////////////////////////////////////////////////////////////////////////
24 */
25
26 #include <stdio.h>
27 #include <errno.h>
28
29 #include <rtems/mw_uid.h>
30 #include "device.h"
31
32 /* defined in input_rtems.c */
33 extern struct MW_UID_MESSAGE m_kbd;
34 extern struct MW_UID_MESSAGE m_mou;
35
36
37 void
38 GsSelect(void)
39 {
40   struct MW_UID_MESSAGE m;
41   int rc;
42   unsigned int timeout = 10;
43
44   /* perform pre-select duties, if any*/
45   if(scrdev.PreSelect)
46   {
47      scrdev.PreSelect(&scrdev);
48   }
49
50   /* let's make sure that the type is invalid */
51   m.type = MV_UID_INVALID;
52
53   /* wait up to 100 milisecons for events */
54   rc = uid_read_message( &m, timeout );
55
56   /* return if timed-out or something went wrong */
57   if( rc < 0 )
58   {
59      if( errno != ETIMEDOUT )
60         EPRINTF( " rc= %d, errno=%d\n", rc, errno );
61      else
62      {
63         /* timeout handling */
64
65      }
66      return;
67   }
68
69   /* let's pass the event up to microwindows */
70   switch( m.type )
71   {
72     /* Mouse or Touch Screen event */
73     case MV_UID_REL_POS:
74     case MV_UID_ABS_POS:
75         m_mou = m;
76         while(GsCheckMouseEvent())
77              continue;
78         break;
79
80     /* KBD event */
81     case MV_UID_KBD:
82         m_kbd = m;
83         GsCheckKeyboardEvent();
84         break;
85
86     /* micro-windows does nothing with those.. */
87     case MV_UID_TIMER:
88     case MV_UID_INVALID:
89     default:
90        ;
91   }
92 }