+static void wxFrameEventHandler(Widget wid,
+ XtPointer WXUNUSED(client_data),
+ XEvent* event,
+ Boolean* continueToDispatch)
+{
+ wxFrame *frame = (wxFrame *)wxGetWindowFromTable(wid);
+ if (frame)
+ {
+ wxMouseEvent wxevent(wxEVT_NULL);
+ if (wxTranslateMouseEvent(wxevent, frame, wid, event))
+ {
+ wxevent.SetEventObject(frame);
+ wxevent.SetId(frame->GetId());
+ frame->GetEventHandler()->ProcessEvent(wxevent);
+ }
+ else
+ {
+ // An attempt to implement OnCharHook by calling OnCharHook first;
+ // if this returns TRUE, set continueToDispatch to False
+ // (don't continue processing).
+ // Otherwise set it to True and call OnChar.
+ wxKeyEvent keyEvent(wxEVT_CHAR);
+ if (wxTranslateKeyEvent(keyEvent, frame, wid, event))
+ {
+ keyEvent.SetEventObject(frame);
+ keyEvent.SetId(frame->GetId());
+ keyEvent.SetEventType(wxEVT_CHAR_HOOK);
+ if (frame->GetEventHandler()->ProcessEvent(keyEvent))
+ {
+ *continueToDispatch = False;
+ return;
+ }
+ else
+ {
+ // For simplicity, OnKeyDown is the same as OnChar
+ // TODO: filter modifier key presses from OnChar
+ keyEvent.SetEventType(wxEVT_KEY_DOWN);
+
+ // Only process OnChar if OnKeyDown didn't swallow it
+ if (!frame->GetEventHandler()->ProcessEvent (keyEvent))
+ {
+ keyEvent.SetEventType(wxEVT_CHAR);
+ frame->GetEventHandler()->ProcessEvent(keyEvent);
+ }
+ }
+ }
+ }
+ }
+ *continueToDispatch = True;
+}