From: deal@tempus.Kodak.Com (Stephen M. Deal)
Newsgroups: comp.windows.x.motif
Subject: Problem with Motif keysyms on a Sun
Keywords: keysym, XKeysymDB, XtParseTranslationTable
Date: 7 Nov 92 02:44:03 GMT
Article-I.D.: kodak.1992Nov7.024403.8023
Reply-To: deal@Kodak.COM
Distribution: na
Organization: Eastman Kodak Company

I think that I want to hardcode the keysym translations into an application
but I am not sure if I should or if I am approaching it correctly.

I wrote a Motif application that runs on both Sun and HP platforms. The Sun
that I built it on has the Motif libraries and it works just fine. However
when I move the application to a Sun machine without Motif I get keysym 
errors as follows:
    Warning: translation table syntax error: Unknown keysym name: osfActivate
    Warning: ... found while parsing '<Key>osfActivate: ManagerGadgetSelect() '
    Warning: translation table syntax error: Unknown keysym name: osfBackSpace
    Warning: ... found while parsing ' ~Meta ~Alt <Key>osfBackSpace: delete-previous-character()'

and many, many more. Other than that it works just fine.

When I look at the /usr/openwin/lib/XKeysymDB file that comes standard with 
a Sun (i.e. no support for Motif) it has entries like this:
    osfXK_Activate:                 1004FF44
    osfXK_BackSpace:                1004FF08

On the Sun with the Motif libraries it includes a second XKeysymDB file 
where the entries are as follows:
    osfActivate                     :1004FF44
    osfBackSpace                    :1004FF08

Notice the difference between them in the form of XK_
I can make the keysym errors go away on the machines without Motif by 
appending the second XKeysymDB file to the /usr/openwin/lib/XKeysymDB 
file but then the system managers complain that it is a nuisance to
maintain. They would prefer a single binary that they can export without
messing with the /usr/openwin/lib/XKeysymDB file on every machine.

So I ended up trying to hardcode the translations into the application. I
created a translation table that looks like this:
    static char sunTransTbl[]= "#augment\n\
    <Key>osfXK_Activate:    ManagerGadgetSelect()  \n\
    ~Meta ~Alt <Key>osfXK_BackSpace:        delete-previous-character()";
and many, many more. Then I defined the translations in my main as follows:
    #ifdef SUNOS
      suntranslations=XtParseTranslationTable(sunTransTbl);
    #endif

    XtSetArg(args[argcnt], XtNtranslations, suntranslations); argcnt++;
    XekdirMain = XtAppCreateShell( "Xekdir", "xekdir",
        applicationShellWidgetClass, display, args, argcnt);

and when I run it it does not recognize any key or button events :-(

Before I go any further I wanted to know if I am missing an easier way to
make this application portable. Does anyone know of a simpler manner in
which I can get the Motif app to quit complaining about the Sun definition
of the keysym translations? Can I do it in the app-defaults file for the
application?

Any and all help on this problem would be appreciated.

Thanks!

  ======================================================================
  | Steve Deal	 	| Internet: deal@Kodak.COM		       |
  | Eastman Kodak Co.	| UUCP:     ...rutgers!rit!kodak!tempus!deal   |
  | Engr. Systems Div.	| Voice:    (716) 726 - 5396		       |
  | mailcode: 35108	| FAX:	    (716) 726 - 7406	               |
  | 901 Elmgrove Road	| 					       |
  | Rochester, NY	| 					       |
  | 	   14653-5108   |					       |
  ====================================================================== 
    Disclaimer:	"Everyone is entitled to an opinion, 
		 the above is mine and not that of my employer."