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