home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / windows / openloo / 4459 < prev    next >
Encoding:
Text File  |  1992-11-11  |  2.6 KB  |  91 lines

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