X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e35f56f6d323a15d4e70d4ac0adf9a0a42cce15..9d2f3c71d83c52fc4db6c8041de533562816b1d6:/src/motif/window.cpp diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 5af4953242..2642297fd9 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -86,6 +86,7 @@ END_EVENT_TABLE() wxWindow::wxWindow() { // Generic + m_isWindow = TRUE; // An optimization m_windowId = 0; m_windowStyle = 0; m_windowParent = NULL; @@ -265,6 +266,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, const wxString& name) { // Generic + m_isWindow = TRUE; // An optimization m_windowId = 0; m_windowStyle = 0; m_windowParent = NULL; @@ -747,7 +749,7 @@ void wxWindow::GetClientSize(int *x, int *y) const *x = xx; *y = yy; } -void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) { // A bit of optimization to help sort out the flickers. int oldX, oldY, oldW, oldH; @@ -819,7 +821,7 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags) */ } -void wxWindow::SetClientSize(int width, int height) +void wxWindow::DoSetClientSize(int width, int height) { if (m_drawingArea) { @@ -1582,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) @@ -2307,12 +2331,18 @@ void wxDeleteWindowFromTable(Widget w) // Get the underlying X window and display WXWindow wxWindow::GetXWindow() const { - return (WXWindow) XtWindow((Widget) GetMainWidget()); + if (GetMainWidget()) + return (WXWindow) XtWindow((Widget) GetMainWidget()); + else + return (WXWindow) 0; } WXDisplay *wxWindow::GetXDisplay() const { - return (WXDisplay*) XtDisplay((Widget) GetMainWidget()); + if (GetMainWidget()) + return (WXDisplay*) XtDisplay((Widget) GetMainWidget()); + else + return (WXDisplay*) NULL; } WXWidget wxWindow::GetMainWidget() const