home *** CD-ROM | disk | FTP | other *** search
- 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
- From: exukarl@exu.ericsson.se (Karl Henderson)
- Newsgroups: comp.windows.open-look
- Subject: Key events
- Keywords: key event vt100
- Message-ID: <1992Nov18.132806.21387@exu.ericsson.se>
- Date: 18 Nov 92 13:28:06 GMT
- Sender: news@exu.ericsson.se
- Reply-To: exukarl@exu.ericsson.se
- Organization: Ericsson Network Systems
- Lines: 76
- Nntp-Posting-Host: s11a02.exu.ericsson.se
- X-Disclaimer: This article was posted by a user at Ericsson.
- Any opinions expressed are strictly those of the
- user and not necessarily those of Ericsson.
-
- I have modified a vt100 emulator called xvttool to handle certain
- key events and send respective escape sequences to the vax. The
- problem is that when I am rlogged into the vax and I hit one of
- the keys, my Notify routine is called a million times instead of
- just once. But when I am not rlogged on to the vax, my Notify
- routine is only called once (as I expect).
-
- The code worked under OW2 but doesnt under OW3. Below is a code
- snibit to better explain what I am doing.
-
- The problem is driving me crazy!!!!!!!!!!!!!
-
- main()
- {
- .
- .
- .
- term_view = (Xv_Window) xv_get (terminal_sw, OPENWIN_NTH_VIEW, 0);
-
- /* set up events I want to handle on the tty window */
- if (xv_set(term_view,
- WIN_CONSUME_EVENTS,
- WIN_MOUSE_BUTTONS,
- WIN_ASCII_EVENTS,
- WIN_LEFT_KEYS,
- WIN_TOP_KEYS,
- WIN_RIGHT_KEYS,
- NULL,
- WIN_IGNORE_EVENTS,
- WIN_UP_EVENTS,
- NULL,
- NULL) != XV_OK) Winerror("xv_set") ;
-
- notify_interpose_event_func(term_view, do_event, NOTIFY_SAFE);
- .
- .
- .
- }
-
- Notify_value do_event(win, event, arg, type) /* handle events in tty window */
- Xv_Window win;
- Event *event;
- caddr_t arg;
- Notify_event_type type;
- {
- XKeyEvent *keyevent;
- KeySym keysym;
- char buff[20];
- int bufsize = 20;
- XComposeStatus compose;
- int charcount;
-
- buffer[0] = '\0';
- keyevent = event->ie_xevent;
- if (keyevent != NULL)
- charcount = XLookupString(keyevent, buff, bufsize, &keysym, &compose);
-
- switch (keyevent->keycode)
- {
- case 53: /* / */
- sprintf(buffer, "OQ"); /* Help */
- break;
- case 54: /* * */
- sprintf(buffer, "OR"); /* Find Next */
- break;
- .
- .
- .
- } /* end switch */
- if (strlen(buffer))
- {
- ttysw_input(terminal_sw, buffer, strlen(buffer));
- return NOTIFY_IGNORED;
- }
- return (Notify_value) notify_next_event_func(win, event, arg, type);
- } /* end do_event */
-