+ // FIXME_MGL -- root window should be a regular window so that
+ // enter/leave and activate/deactivate events work correctly
+}
+
+static ibool wxWindowMouseHandler(window_t *wnd, event_t *e)
+{
+ wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd);
+ wxPoint where = win->ScreenToClient(wxPoint(e->where_x, e->where_y));
+
+ wxEventType type = wxEVT_NULL;
+ wxMouseEvent event;
+ event.SetEventObject(win);
+ event.SetTimestamp(e->when);
+ event.m_x = where.x;
+ event.m_y = where.y;
+ event.m_shiftDown = e->modifiers & EVT_SHIFTKEY;
+ event.m_controlDown = e->modifiers & EVT_CTRLSTATE;
+ event.m_altDown = e->modifiers & EVT_LEFTALT;
+ event.m_metaDown = e->modifiers & EVT_RIGHTALT;
+ event.m_leftDown = e->modifiers & EVT_LEFTBUT;
+ event.m_middleDown = e->modifiers & EVT_MIDDLEBUT;
+ event.m_rightDown = e->modifiers & EVT_RIGHTBUT;
+
+ switch (e->what)
+ {
+ case EVT_MOUSEDOWN:
+ if ( e->message & EVT_LEFTBMASK )
+ type = (e->message & EVT_DBLCLICK) ?
+ wxEVT_LEFT_DCLICK : wxEVT_LEFT_DOWN;
+ else if ( e->message & EVT_MIDDLEBMASK )
+ type = (e->message & EVT_DBLCLICK) ?
+ wxEVT_MIDDLE_DCLICK : wxEVT_MIDDLE_DOWN;
+ else if ( e->message & EVT_RIGHTBMASK )
+ type = (e->message & EVT_DBLCLICK) ?
+ wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN;
+ break;
+
+ case EVT_MOUSEUP:
+ if ( e->message & EVT_LEFTBMASK )
+ type = wxEVT_LEFT_UP;
+ else if ( e->message & EVT_MIDDLEBMASK )
+ type = wxEVT_MIDDLE_UP;
+ else if ( e->message & EVT_RIGHTBMASK )
+ type = wxEVT_RIGHT_UP;
+ break;
+
+ case EVT_MOUSEMOVE:
+ if ( win != g_windowUnderMouse )
+ {
+ if ( g_windowUnderMouse )
+ {
+ wxMouseEvent event2(event);
+ wxPoint where2 = g_windowUnderMouse->ScreenToClient(
+ wxPoint(e->where_x, e->where_y));
+ event2.m_x = where2.x;
+ event2.m_y = where2.y;
+ event2.SetEventObject(g_windowUnderMouse);
+ event2.SetEventType(wxEVT_LEAVE_WINDOW);
+ g_windowUnderMouse->GetEventHandler()->ProcessEvent(event2);
+ }
+
+ wxMouseEvent event3(event);
+ event3.SetEventType(wxEVT_ENTER_WINDOW);
+ win->GetEventHandler()->ProcessEvent(event3);
+
+ g_windowUnderMouse = win;
+ }
+
+ type = wxEVT_MOTION;
+ break;
+
+ default:
+ break;
+ }
+
+ if ( type == wxEVT_NULL )
+ {
+ return FALSE;
+ }
+ else
+ {
+ event.SetEventType(type);
+ return win->GetEventHandler()->ProcessEvent(event);
+ }
+}
+
+static ibool wxWindowKeybHandler(window_t *wnd, event_t *e)
+{
+ // FIXME_MGL
+ return FALSE;
+}
+
+static ibool wxWindowJoyHandler(window_t *wnd, event_t *e)
+{
+ // FIXME_MGL
+ return FALSE;