Rick Scott <[EMAIL PROTECTED]> writes:
> It seems that XtGrabButton takes an int for the button arg, but
> XtUngrabButton wants a KeyCode for the button arg!!!!! How the hell
> do I map a button int to a button KeyCode!!!!!!
The KeyCode arg might a bug in the man page. From the Xt sources:
void XtUngrabButton (widget, button, modifiers)
Widget widget;
unsigned int button;
Modifiers modifiers;
{
WIDGET_TO_APPCON(widget);
LOCK_APP(app);
UngrabKeyOrButton(widget, (KeyCode)button, modifiers, POINTER);
UNLOCK_APP(app);
}
...and UngrabKeyOrButton calls XUngrabButton with the `button'
argument passed to it.
void UngrabKeyOrButton (widget, keyOrButton, modifiers, isKeyboard)
Widget widget;
int keyOrButton;
Modifiers modifiers;
Boolean isKeyboard;
{
XtServerGrabRec tempGrab;
XtPerWidgetInput pwi;
XtCheckSubclass(widget, coreWidgetClass,
"in XtUngrabKey or XtUngrabButton");
/* Build a temporary grab list entry */
tempGrab.widget = widget;
tempGrab.modifiers = modifiers;
tempGrab.keybut = keyOrButton;
tempGrab.hasExt = False;
LOCK_PROCESS;
pwi = _XtGetPerWidgetInput(widget, FALSE);
UNLOCK_PROCESS;
/*
* if there is no entry in the context manager then somethings wrong
*/
if (!pwi)
{
XtAppWarningMsg(XtWidgetToApplicationContext(widget),
"invalidGrab", "ungrabKeyOrButton", XtCXtToolkitError,
"Attempt to remove nonexistent passive grab",
(String *)NULL, (Cardinal *)NULL);
return;
}
if (XtIsRealized(widget))
{
if (isKeyboard)
XUngrabKey(widget->core.screen->display,
keyOrButton, (unsigned int)modifiers,
widget->core.window);
else
XUngrabButton(widget->core.screen->display,
keyOrButton, (unsigned int)modifiers,
widget->core.window);
}
/* Delete all entries which are encompassed by the specified grab. */
DeleteServerGrabFromList(isKeyboard ? &pwi->keyList : &pwi->ptrList,
&tempGrab);
}