chuck@Morgan.COM (Chuck Ocheret) (04/24/91)
Posting this for someone in another division where they keep screwing up their mail and news setup. I don't think he can read news rightnow so respond directly to him an leave me out of it. From jerryl@is2.is.morgan.com Wed Apr 24 12:13:48 1991 Return-Path: <jerryl@is2.is.morgan.com> From: jerryl@is2.is.morgan.com (Jerry Liebelson) Subject: Netnews article to post To: chuck@s5 Date: Mon, 22 Apr 91 15:48:45 EDT X-Mailer: ELM [version 2.3 PL8] Hi Chuck, Thanks again for helping me out. Could you post the following article to the the following newsgroups: comp.windows.x.motif comp.windows.open-look with Subject: Motif Keyboard Accelerator problems under MIT X & Sun OpenWindows -- Jerry ==================== THE ARTICLE STARTS HERE ======================= Reply-To: uunet!is.morgan.com!jerryl ***** PLEASE REPLY BY EMAIL TO uunet!is.morgan.com!jerryl ******* SITUATION: I have a simple motif program (listed below) that consists of BulletinBoard widget containing a single PushButton widget. The program also registeres a bunch of keyboard accelerators that each trigger the button's activation callback routine. ENVIRONMENT: SunOS 4.11, X11R4 patchlevel 18, Motif 1.1, Sun OpenWindows 2.0, Sun SparcStation 2,SLC,IPC PROBLEM 1: When this program runs under MIT X11R4 with mwm, SOME of the accelerator keys DON'T activate: F4, F10, and the arrow keys. I suspect there is interference with the builtin tab-group (arrow keys) and menu-bar (F10) translations. But calling XmRemoveTabGroup doesn't seem to make any difference. DOES ANYBODY KNOW WHY THESE KEYS DON'T WORK AS THE OTHERS DO AND IS THERE A WAY TO GET THESE KEYS TO WORK? PROBLEM 2: When this program runs under Sun's X11/NEWS (OpenWindows) with either mwm or olwm, NONE of the NUMPAD keys (PgDn, PgUp, Home, End, arrow keys) and F4 and F10 work. The additional key failures don't seem to be caused by the X11/NEWS server alone; all the keys will function correctly if one uses Athena widgets instead of Motif widgets. DOES ANYBODY KNOW HOW I CAN GET ALL THESE KEYS TO WORK IN A MOTIF APPLICATION RUNNING UNDER THE SUN X11/NEWS SERVER? COMMENTS: I suspect that there is probably a single solution or explanation for the 2 problems. The outputs of xev and xmodmap in both MIT and OpenWindows environments don't seem to show anything significant. Also, under OpenWindows, the Osf XKeySymDB file was made available. ***** PLEASE REPLY BY EMAIL TO uunet!is.morgan.com!jerryl ******* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Jerry Liebelson | EMAIL: jerryl@is.morgan.com | | Information Systems | uunet!is.morgan.com!jerryl | | Morgan Stanley, Inc. | VOICE: (212) 703-2409 | | 1633 Broadway 36th Floor | FAX: (212) 703-2371 | | New York, NY 10019 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ------------------------- cut here ------------------------------- #include <stdio.h> #include <Intrinsic.h> #include <StringDefs.h> #include <keysym.h> #include <Xm/BulletinB.h> #include <Xm/PushB.h> void ButtonCallback(); void Quit(); Widget AppShell; static String Accelerators= { "#override <KeyPress>F3: ArmAndActivate() \n\ <KeyPress>R15: ArmAndActivate() \n\ <KeyPress>R9: ArmAndActivate() \n\ <KeyPress>R7: ArmAndActivate() \n\ <KeyPress>R13: ArmAndActivate() \n\ <KeyPress>Left: ArmAndActivate() \n\ <KeyPress>Down: ArmAndActivate() \n\ <KeyPress>Right: ArmAndActivate() \n\ <KeyPress>Up: ArmAndActivate() \n\ Shift<KeyPress>F10: ArmAndActivate() \n\ <KeyPress>F10: ArmAndActivate() \n\ Shift<KeyPress>F4: ArmAndActivate() \n\ <KeyPress>F4: ArmAndActivate() \n\ <KeyPress>Tab: ArmAndActivate() \n\ Shift<KeyPress>F11: ArmAndActivate() \n\ <KeyPress>F11: ArmAndActivate() \n\ <KeyPress>F12: ArmAndActivate()" }; /***************************************************************************/ int main(argc, argv) int argc; char **argv; { Widget board, button; Arg argList[10]; int i; XtAppContext appContext; Display *displayPtr; char appClass[64]; strcpy(appClass,argv[0]); if (islower(appClass[0])) appClass[0] = toupper(appClass[0]); else if (islower(appClass[1])) appClass[1] = toupper(appClass[1]); AppShell = XtAppInitialize ( &appContext, appClass, NULL, 0, &argc, argv, NULL, NULL, 0 ); board = XtCreateManagedWidget(argv[0], xmBulletinBoardWidgetClass, AppShell, NULL, 0); i=0; XtSetArg (argList[i], XmNaccelerators, XtParseAcceleratorTable(Accelerators)); i++; button = XtCreateManagedWidget(argv[0], xmPushButtonWidgetClass, board, argList, i); XtAddCallback(button, XmNactivateCallback, ButtonCallback, NULL); XtRealizeWidget(AppShell); XtInstallAllAccelerators(button, board); XtAppMainLoop(appContext); exit(-1); } void ButtonCallback(widget, clientData, callData) Widget widget; caddr_t clientData; XmAnyCallbackStruct *callData; { char keyString[12]; KeySym keySym; XLookupString(&callData->event->xkey, keyString, sizeof(keyString), &keySym, NULL); if (callData->event->xkey.state & ShiftMask) fprintf(stderr, "Shift "); if (keySym == XK_F1 ) fprintf(stderr, "F1"); else if (keySym == XK_F2 ) fprintf(stderr, "F2"); else if (keySym == XK_F3 ) fprintf(stderr, "F3"); else if (keySym == XK_F4 ) fprintf(stderr, "F4"); else if (keySym == XK_F5 ) fprintf(stderr, "F5"); else if (keySym == XK_F6 ) fprintf(stderr, "F6"); else if (keySym == XK_F7 ) fprintf(stderr, "F7"); else if (keySym == XK_F8 ) fprintf(stderr, "F8"); else if (keySym == XK_F9 ) fprintf(stderr, "F9"); else if (keySym == XK_F10 ) fprintf(stderr, "F10"); else if (keySym == XK_F11 ) fprintf(stderr, "F11"); else if (keySym == XK_F12 ) fprintf(stderr, "F12"); else if (keySym == XK_F12 ) fprintf(stderr, "F12"); else if (keySym == XK_Right) fprintf(stderr, "Right"); else if (keySym == XK_Left) fprintf(stderr, "Left"); else if (keySym == XK_Up) fprintf(stderr, "Up"); else if (keySym == XK_Down) fprintf(stderr, "Down"); else if (keySym == XK_R7) fprintf(stderr, "Home"); else if (keySym == XK_R13) fprintf(stderr, "End"); else if (keySym == XK_R9) fprintf(stderr, "PgUp"); else if (keySym == XK_R15) fprintf(stderr, "PgDn"); else if (keySym == XK_Tab) fprintf(stderr, "TAB"); fprintf(stderr, " Pressed\n"); } ------------------------- cut here ------------------------------- -- +--------------------+ Chuck Ocheret +---------------+ |chuck@fid.Morgan.COM| Morgan Stanley & Co., Inc. |(212) 703-4474 | | Duty now ... |19th Floor, 1251 Avenue of the Americas|for the future.| +--------------------+ New York, N.Y. 10020 USA +---------------+