Cursors under SunView

Robert Lupton lupton at uhccux.uhcc.hawaii.edu
Fri Mar 17 14:12:58 AEST 1989


I have a piece of code that puts up a cursor in a SunView Canvas, 
and then loops looking for either a mouse button or a key being hit.
If I call it repeatedly, I see every mouse button (I've removed the code
to do that), but I only see every other keyboard key. 
Does anyone have any ideas? Notice that I am not using the notifier 
for this, I am asking for events explicitly.

sunv_cursor(x,y)
int *x,*y;
{
   Cursor cursor;
   Event event;

   cursor = window_get(canvas,WIN_CURSOR);
   cursor_set(cursor,CURSOR_CROSSHAIR_LENGTH,CURSOR_TO_EDGE,0);
   window_set(canvas,WIN_CURSOR,cursor,0);
   window_set(canvas,WIN_CONSUME_KBD_EVENTS,WIN_NO_EVENTS,WIN_ASCII_EVENTS,0,0);

   for(;;) {
      if(window_read_event(canvas,&event) < 0) {
         perror("read event");
      }
      (void)canvas_event(canvas,&event);
      if(isascii(event_action(&event))) {
	 cursor_set(cursor,CURSOR_CROSSHAIR_LENGTH,INACTIVE_CURSOR_LEN,0);
	 window_set(canvas,WIN_CURSOR,cursor,0);
	 window_set(canvas,WIN_IGNORE_KBD_EVENT,WIN_ASCII_EVENTS,0);
         return;
      }
   }
}


			Robert Lupton
			
			(lupton at uhccux.uhcc.hawaii.edu)



More information about the Comp.unix.questions mailing list