X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b23386b266189c7e8561cdf3f6e25642b23c5ab8..fa16690b7d8d04c339373b42dda545cabf31045f:/src/motif/window.cpp?ds=inline diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 59022eb1cc..620a925f4e 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -1584,8 +1584,30 @@ bool wxWindow::Validate() // Get the window with the focus wxWindow *wxWindow::FindFocus() { - // TODO - return NULL; + // TODO Problems: + // (1) Can there be multiple focussed widgets in an application? + // In which case we need to find the top-level window that's + // currently active. + // (2) The widget with the focus may not be in the widget table + // depending on which widgets I put in the table + + wxNode *node = wxTopLevelWindows.First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + + Widget w = XmGetFocusWidget ((Widget) win->GetTopWidget()) ; + + if (w != (Widget) NULL) + { + wxWindow* focusWin = wxGetWindowFromTable(w); + if (focusWin) + return focusWin; + } + + node = node->Next(); + } + return (wxWindow*) NULL; } void wxWindow::AddChild(wxWindow *child) @@ -2139,7 +2161,7 @@ void wxWindow::SetValidator(const wxValidator& validator) { if ( m_windowValidator ) delete m_windowValidator; - m_windowValidator = validator.Clone(); + m_windowValidator = (wxValidator*) validator.Clone(); if ( m_windowValidator ) m_windowValidator->SetWindow(this) ;