mark@sunquest.UUCP (Mark Langley) (11/21/88)
I've found that if you add a display_acclerator method to a widget, it will not get passed the "String representation of the accelerators", as advertised. Instead it will pass a representation of the first event in the TRANSLATION TABLE... I traced what I think is the offending code to $X11R3/lib/Xt/TMstate.c. When a display accelerator is invoked from XtInstallAccelerators it is called with a string. Instead of deriving the string from the accelerators, it derives it from the translation table. Thus, after looking at the code for about 10 seconds, the following bug and its fix became clear. Namely, replace core.tm.translations with core.accelerators. (They are both of type XtTranslations...) Before... /* TMstate.c */ void XtInstallAccelerators(destination,source) Widget destination,source; { . . if (XtClass(source)->core_class.display_accelerator != NULL){ str[0] = '\0'; (void) PrintEvent(&str[0], &source->core.tm.translations->eventObjTbl[0].event); /* ^^^^^^^^^^^^^^^^^^^^ */ (*(XtClass(source)->core_class.display_accelerator))(source,str); } . . } After... void XtInstallAccelerators(destination,source) Widget destination,source; { . . if (XtClass(source)->core_class.display_accelerator != NULL){ str[0] = '\0'; (void) PrintEvent(&str[0], &source->core.accelerators->eventObjTbl[0].event); /* ^^^^^^^^^^^^^^^^^ */ (*(XtClass(source)->core_class.display_accelerator))(source,str); } . . } No? I tested it out and it seems to tell me about translations qua accelerators, as it should. I can post a widget w/acclerator if you want to see it. This looks like a trivial fix. Mark Langley mark@sunquest.com That's not writing... it's typing. --G.B. Shaw on James Joyce Ulysses.