home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / windows / openloo / 4560 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.6 KB  |  93 lines

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!cronkite.Central.Sun.COM!texsun!exucom.exu.ericsson.se!s11a02!exukarl
  2. From: exukarl@exu.ericsson.se (Karl Henderson)
  3. Newsgroups: comp.windows.open-look
  4. Subject: Key events
  5. Keywords: key event vt100
  6. Message-ID: <1992Nov18.132806.21387@exu.ericsson.se>
  7. Date: 18 Nov 92 13:28:06 GMT
  8. Sender: news@exu.ericsson.se
  9. Reply-To: exukarl@exu.ericsson.se
  10. Organization: Ericsson Network Systems
  11. Lines: 76
  12. Nntp-Posting-Host: s11a02.exu.ericsson.se
  13. X-Disclaimer: This article was posted by a user at Ericsson.
  14.               Any opinions expressed are strictly those of the
  15.               user and not necessarily those of Ericsson.
  16.  
  17. I have modified a vt100 emulator called xvttool to handle certain 
  18. key events and send respective escape sequences to the vax.  The 
  19. problem is that when I am rlogged into the vax and I hit one of 
  20. the keys, my Notify routine is called a million times instead of 
  21. just once.  But when I am not rlogged on to the vax, my Notify 
  22. routine is only called once (as I expect).
  23.  
  24. The code worked under OW2 but doesnt under OW3.  Below is a code 
  25. snibit to better explain what I am doing.
  26.  
  27. The problem is driving me crazy!!!!!!!!!!!!!
  28.  
  29. main()
  30. {
  31.    .
  32.    .
  33.    .
  34.   term_view = (Xv_Window) xv_get (terminal_sw, OPENWIN_NTH_VIEW, 0); 
  35.  
  36. /* set up events I want to handle on the tty window */
  37.   if (xv_set(term_view,
  38.          WIN_CONSUME_EVENTS,
  39.            WIN_MOUSE_BUTTONS, 
  40.            WIN_ASCII_EVENTS,
  41.            WIN_LEFT_KEYS, 
  42.            WIN_TOP_KEYS, 
  43.            WIN_RIGHT_KEYS, 
  44.            NULL,
  45.          WIN_IGNORE_EVENTS,
  46.            WIN_UP_EVENTS,
  47.            NULL,
  48.            NULL) != XV_OK) Winerror("xv_set") ;
  49.           
  50.   notify_interpose_event_func(term_view, do_event, NOTIFY_SAFE); 
  51.    .
  52.    .
  53.    .
  54. }
  55.  
  56. Notify_value do_event(win, event, arg, type) /* handle events in tty window */
  57.      Xv_Window win;
  58.      Event *event;
  59.      caddr_t arg;
  60.      Notify_event_type type; 
  61. {
  62.   XKeyEvent *keyevent;
  63.   KeySym keysym;
  64.   char buff[20];
  65.   int bufsize = 20;
  66.   XComposeStatus compose;
  67.   int charcount;
  68.  
  69.   buffer[0] = '\0';
  70.   keyevent = event->ie_xevent;
  71.   if (keyevent != NULL)      
  72.     charcount = XLookupString(keyevent, buff, bufsize, &keysym, &compose);
  73.  
  74.   switch (keyevent->keycode)
  75.   {
  76.       case 53: /* / */
  77.         sprintf(buffer, "OQ"); /* Help */
  78.         break;
  79.       case 54: /* * */
  80.         sprintf(buffer, "OR"); /* Find Next */
  81.         break;
  82.        .
  83.        .
  84.        .
  85.   } /* end switch */
  86.   if (strlen(buffer)) 
  87.   { 
  88.     ttysw_input(terminal_sw, buffer, strlen(buffer));
  89.     return NOTIFY_IGNORED;
  90.   }
  91.   return (Notify_value) notify_next_event_func(win, event, arg, type);
  92. } /* end do_event */
  93.