-// Returns TRUE if an accelerator has been processed
-bool wxApp::CheckForAccelerator(WXEvent* event)
-{
- XEvent* xEvent = (XEvent*) event;
- if (xEvent->xany.type == KeyPress)
- {
- // Find a wxWindow for this window
- // TODO: should get display for the window, not the current display
- Widget widget = XtWindowToWidget((Display*) wxGetDisplay(), xEvent->xany.window);
- wxWindow* win = NULL;
-
- // Find the first wxWindow that corresponds to this event window
- while (widget && !(win = wxGetWindowFromTable(widget)))
- widget = XtParent(widget);
-
- if (!widget || !win)
- return FALSE;
-
- wxKeyEvent keyEvent(wxEVT_CHAR);
- wxTranslateKeyEvent(keyEvent, win, (Widget) 0, xEvent);
-
- // Now we have a wxKeyEvent and we have a wxWindow.
- // Go up the hierarchy until we find a matching accelerator,
- // or we get to the top.
- while (win)
- {
- if (win->ProcessAccelerator(keyEvent))
- return TRUE;
- win = win->GetParent();
- }
- return FALSE;
- }
- return FALSE;
-}
-
-bool wxApp::CheckForKeyDown(WXEvent* event)
-{
- XEvent* xEvent = (XEvent*) event;
- if (xEvent->xany.type == KeyPress)
- {
- Widget widget = XtWindowToWidget((Display*) wxGetDisplay(),
- xEvent->xany.window);
- wxWindow* win = NULL;
-
- // Find the first wxWindow that corresponds to this event window
- while (widget && !(win = wxGetWindowFromTable(widget)))
- widget = XtParent(widget);
-
- if (!widget || !win)
- return FALSE;
-
- wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
- wxTranslateKeyEvent(keyEvent, win, (Widget) 0, xEvent);
-
- return win->ProcessEvent( keyEvent );
- }
-
- return FALSE;
-}
-
-bool wxApp::CheckForKeyUp(WXEvent* event)
-{
- XEvent* xEvent = (XEvent*) event;
- if (xEvent->xany.type == KeyRelease)
- {
- Widget widget = XtWindowToWidget((Display*) wxGetDisplay(),
- xEvent->xany.window);
- wxWindow* win = NULL;
-
- // Find the first wxWindow that corresponds to this event window
- while (widget && !(win = wxGetWindowFromTable(widget)))
- widget = XtParent(widget);
-
- if (!widget || !win)
- return FALSE;
-
- wxKeyEvent keyEvent(wxEVT_KEY_UP);
- wxTranslateKeyEvent(keyEvent, win, (Widget) 0, xEvent);
-
- return win->ProcessEvent( keyEvent );
- }
-
- return FALSE;
-}
-