+ printf( "destroy from %s\n", win->GetName().c_str() );
+ break;
+ }
+ case CreateNotify:
+ {
+ printf( "create from %s\n", win->GetName().c_str() );
+ break;
+ }
+ case MapRequest:
+ {
+ printf( "map request from %s\n", win->GetName().c_str() );
+ break;
+ }
+ case ResizeRequest:
+ {
+ printf( "resize request from %s\n", win->GetName().c_str() );
+
+ Display *disp = (Display*) wxGetDisplay();
+ XEvent report;
+
+ // to avoid flicker
+ report = * event;
+ while( XCheckTypedWindowEvent (disp, actualWindow, ResizeRequest, &report));
+
+ wxSize sz = win->GetSize();
+ wxSizeEvent sizeEvent(sz, win->GetId());
+ sizeEvent.SetEventObject(win);
+
+ return win->GetEventHandler()->ProcessEvent( sizeEvent );
+ }
+#endif
+#endif
+#if wxUSE_NANOX
+ case GR_EVENT_TYPE_CLOSE_REQ:
+ {
+ if (win)
+ {
+ win->Close(FALSE);
+ return TRUE;
+ }
+ return FALSE;
+ break;
+ }
+#endif
+ case EnterNotify:
+ case LeaveNotify:
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ {
+ if (!win->IsEnabled())
+ return FALSE;
+
+ // Here we check if the top level window is
+ // disabled, which is one aspect of modality.
+ wxWindow *tlw = win;
+ while (tlw && !tlw->IsTopLevel())
+ tlw = tlw->GetParent();
+ if (tlw && !tlw->IsEnabled())
+ return FALSE;
+
+ if (event->type == ButtonPress)
+ {
+ if ((win != wxWindow::FindFocus()) && win->AcceptsFocus())
+ {
+ // This might actually be done in wxWindow::SetFocus()
+ // and not here. TODO.
+ g_prevFocus = wxWindow::FindFocus();
+ g_nextFocus = win;
+
+ win->SetFocus();
+ }
+ }
+
+#if !wxUSE_NANOX
+ if (event->type == LeaveNotify || event->type == EnterNotify)
+ {
+ // Throw out NotifyGrab and NotifyUngrab
+ if (event->xcrossing.mode != NotifyNormal)
+ return FALSE;
+ }
+#endif
+ wxMouseEvent wxevent;
+ wxTranslateMouseEvent(wxevent, win, window, event);
+ return win->GetEventHandler()->ProcessEvent( wxevent );
+ }
+ case FocusIn:
+ {
+#if !wxUSE_NANOX
+ if ((event->xfocus.detail != NotifyPointer) &&
+ (event->xfocus.mode == NotifyNormal))
+#endif
+ {
+ // wxLogDebug( "FocusIn from %s of type %s", win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+
+ wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
+ focusEvent.SetEventObject(win);
+ focusEvent.SetWindow( g_prevFocus );
+ g_prevFocus = NULL;
+
+ return win->GetEventHandler()->ProcessEvent(focusEvent);
+ }
+ return FALSE;
+ break;
+ }
+ case FocusOut:
+ {
+#if !wxUSE_NANOX
+ if ((event->xfocus.detail != NotifyPointer) &&
+ (event->xfocus.mode == NotifyNormal))
+#endif
+ {
+ // wxLogDebug( "FocusOut from %s of type %s", win->GetName().c_str(), win->GetClassInfo()->GetClassName() );
+
+ wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
+ focusEvent.SetEventObject(win);
+ focusEvent.SetWindow( g_nextFocus );
+ g_nextFocus = NULL;
+ return win->GetEventHandler()->ProcessEvent(focusEvent);
+ }
+ return FALSE;
+ break;
+ }
+ default:
+ {
+#ifdef __WXDEBUG__
+ //wxString eventName = wxGetXEventName(XEvent& event);
+ //wxLogDebug(wxT("Event %s not handled"), eventName.c_str());
+#endif
+ return FALSE;
+ break;