~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/tv/tv_mouse.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <string.h>
  4 #include <tina/tv.h>
  5 #include <tina/tvfuncs.h>
  6 #include <tina/sysfuncs.h>
  7 
  8 Tv_mouse null_mouse(void);
  9 
 10 void    tv_set_mouse(Tv * tv, Tv_mouse mouse)
 11 {
 12     if (tv == NULL)
 13         return;
 14 
 15     tv->mouse = mouse;
 16     if (tv->tv_screen != NULL && tv->activity == MOUSE)
 17         (void) tv_set_activity_message(tv);
 18 }
 19 
 20 void    tv_set_mouse_reset(Tv * tv, void (*reset) ( /* ??? */ ))
 21 {
 22     if (tv->mouse_reset != reset)
 23     {
 24         (*tv->mouse_reset) ();
 25         tv->mouse_reset = reset;
 26     }
 27 }
 28 
 29 Tv_mouse null_mouse(void)
 30 {
 31     Tv_mouse mouse = {Tv_mouse_id};
 32 
 33     (void) strcpy(mouse.name, "null");
 34 
 35     (void) strcpy(mouse.left_name, "null");
 36     mouse.left_down = null_function;
 37     mouse.left_drag = null_function;
 38     mouse.left_up = null_function;
 39 
 40     (void) strcpy(mouse.middle_name, "null");
 41     mouse.middle_down = null_function;
 42     mouse.middle_drag = null_function;
 43     mouse.middle_up = null_function;
 44 
 45     (void) strcpy(mouse.right_name, "null");
 46     mouse.right_down = null_function;
 47     mouse.right_drag = null_function;
 48     mouse.right_up = null_function;
 49 
 50     return (mouse);
 51 }
 52 
 53 #ifndef ANSIFYING
 54 #ifdef __STRICT_ANSI__
 55 
 56 /* VARARGS quieten lint */
 57 Tv_mouse mouse_define(int case_flag,...)
 58 {
 59     Tv_mouse mouse = null_mouse();
 60     va_list ap;
 61 
 62     va_start(ap, case_flag);
 63 
 64     while (case_flag)
 65     {
 66         switch (case_flag)
 67         {
 68         case MOUSE_NAME:
 69             (void) strcpy(mouse.name, (char *) va_arg(ap, char *));
 70             break;
 71         case LEFT_NAME:
 72             (void) strcpy(mouse.left_name, (char *) va_arg(ap, char *));
 73             break;
 74         case LEFT_DOWN:
 75             mouse.left_down = (void (*) ()) va_arg(ap, void *);
 76             break;
 77         case LEFT_DRAG:
 78             mouse.left_drag = (void (*) ()) va_arg(ap, void *);
 79             break;
 80         case LEFT_UP:
 81             mouse.left_up = (void (*) ()) va_arg(ap, void *);
 82             break;
 83         case MIDDLE_NAME:
 84             (void) strcpy(mouse.middle_name, (char *) va_arg(ap, char *));
 85             break;
 86         case MIDDLE_DOWN:
 87             mouse.middle_down = (void (*) ()) va_arg(ap, void *);
 88             break;
 89         case MIDDLE_DRAG:
 90             mouse.middle_drag = (void (*) ()) va_arg(ap, void *);
 91             break;
 92         case MIDDLE_UP:
 93             mouse.middle_up = (void (*) ()) va_arg(ap, void *);
 94             break;
 95         case RIGHT_NAME:
 96             (void) strcpy(mouse.right_name, (char *) va_arg(ap, char *));
 97             break;
 98         case RIGHT_DOWN:
 99             mouse.right_down = (void (*) ()) va_arg(ap, void *);
100             break;
101         case RIGHT_DRAG:
102             mouse.right_drag = (void (*) ()) va_arg(ap, void *);
103             break;
104         case RIGHT_UP:
105             mouse.right_up = (void (*) ()) va_arg(ap, void *);
106             break;
107         }
108         case_flag = (int) va_arg(ap, int);
109     }
110     va_end(ap);
111     return (mouse);
112 }
113 
114 #else
115 
116 /* VARARGS quieten lint */
117 Tv_mouse mouse_define(first_arg, va_alist)
118 int     first_arg;              /* for ansi c compatibility */
119 
120 va_dcl
121 {
122     Tv_mouse mouse = {Tv_mouse_id};
123     int     case_flag;
124     va_list ap;
125 
126     va_start(ap);
127 
128     mouse = null_mouse();
129     /* while ((case_flag = (int) va_arg(ap, int)) != NULL) */
130     case_flag = first_arg;
131     while (case_flag != NULL)
132     {
133         switch (case_flag)
134         {
135         case MOUSE_NAME:
136             (void) strcpy(mouse.name, (char *) va_arg(ap, char *));
137             break;
138         case LEFT_NAME:
139             (void) strcpy(mouse.left_name, (char *) va_arg(ap, char *));
140             break;
141         case LEFT_DOWN:
142             mouse.left_down = (void (*) ()) va_arg(ap, void *);
143             break;
144         case LEFT_DRAG:
145             mouse.left_drag = (void (*) ()) va_arg(ap, void *);
146             break;
147         case LEFT_UP:
148             mouse.left_up = (void (*) ()) va_arg(ap, void *);
149             break;
150         case MIDDLE_NAME:
151             (void) strcpy(mouse.middle_name, (char *) va_arg(ap, char *));
152             break;
153         case MIDDLE_DOWN:
154             mouse.middle_down = (void (*) ()) va_arg(ap, void *);
155             break;
156         case MIDDLE_DRAG:
157             mouse.middle_drag = (void (*) ()) va_arg(ap, void *);
158             break;
159         case MIDDLE_UP:
160             mouse.middle_up = (void (*) ()) va_arg(ap, void *);
161             break;
162         case RIGHT_NAME:
163             (void) strcpy(mouse.right_name, (char *) va_arg(ap, char *));
164             break;
165         case RIGHT_DOWN:
166             mouse.right_down = (void (*) ()) va_arg(ap, void *);
167             break;
168         case RIGHT_DRAG:
169             mouse.right_drag = (void (*) ()) va_arg(ap, void *);
170             break;
171         case RIGHT_UP:
172             mouse.right_up = (void (*) ()) va_arg(ap, void *);
173             break;
174         }
175         case_flag = (int) va_arg(ap, int);
176     }
177     va_end(ap);
178     return (mouse);
179 }
180 
181 #endif                          /* __STRICT_ANSI__ */
182 #endif                          /* ANSIFYING */
183 
184 void    tv_mouse_proc(Tv * tv, int state, Ipos pos)
185 {
186     Tv_mouse *mouse = &tv->mouse;
187 
188     switch (state)
189     {
190     case LEFT_DOWN:
191         (*mouse->left_down) (tv, pos);
192         break;
193     case LEFT_DRAG:
194         (*mouse->left_drag) (tv, pos);
195         break;
196     case LEFT_UP:
197         (*mouse->left_up) (tv, pos);
198         break;
199     case MIDDLE_DOWN:
200         (*mouse->middle_down) (tv, pos);
201         break;
202     case MIDDLE_DRAG:
203         (*mouse->middle_drag) (tv, pos);
204         break;
205     case MIDDLE_UP:
206         (*mouse->middle_up) (tv, pos);
207         break;
208     case RIGHT_DOWN:
209         (*mouse->right_down) (tv, pos);
210         break;
211     case RIGHT_DRAG:
212         (*mouse->right_drag) (tv, pos);
213         break;
214     case RIGHT_UP:
215         (*mouse->right_up) (tv, pos);
216         break;
217     }
218 }
219 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.