]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/filedlg.cpp
compilation fix for Mac and reformatted the code
[wxWidgets.git] / src / motif / filedlg.cpp
index c4ea2a4f4edcb7530b132cae6230eac8ca76308e..ed2ca5e9c49a4018232b8f7e41b41231847aaf29 100644 (file)
@@ -188,12 +188,12 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
 
 static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget)
 {
-    wxWindow::DoChangeBackgroundColour((WXWidget) widget, *wxWHITE);
+    wxDoChangeBackgroundColour((WXWidget) widget, *wxWHITE);
 
     // Change colour of the scrolled areas of the listboxes
     Widget listParent = XtParent (widget);
 #if 0
-    wxWindow::DoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
+    wxDoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
 #endif
 
     Widget hsb = (Widget) 0;
@@ -207,8 +207,8 @@ static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget)
     * function to change them (by default, taken from wxSystemSettings)
     */
     wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
-    wxWindow::DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
-    wxWindow::DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
+    wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
+    wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
 
     if (hsb)
       XtVaSetValues (hsb,
@@ -227,9 +227,7 @@ int wxFileDialog::ShowModal()
     //  static char fileBuf[512];
     Widget parentWidget = (Widget) 0;
     if (m_parent)
-    {
         parentWidget = (Widget) m_parent->GetTopWidget();
-    }
     else
         parentWidget = (Widget) wxTheApp->GetTopLevelWidget();
     // prepare the arg list
@@ -334,9 +332,9 @@ int wxFileDialog::ShowModal()
         XmNresizePolicy, XmRESIZE_NONE,
         NULL);
 #endif
-    //    DoChangeBackgroundColour((WXWidget) fileSel, m_backgroundColour);
-    DoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
-    DoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
+    //    wxDoChangeBackgroundColour((WXWidget) fileSel, m_backgroundColour);
+    wxDoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
+    wxDoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
 
     wxChangeListBoxColours(this, dirListWidget);
     wxChangeListBoxColours(this, fileListWidget);
@@ -349,28 +347,25 @@ int wxFileDialog::ShowModal()
     wxEndBusyCursor();
 
     XtAddGrab(XtParent(fileSel), TRUE, FALSE);
+    XtAppContext context = (XtAppContext) wxTheApp->GetAppContext();
     XEvent event;
     while (!m_fileSelectorReturned)
     {
-        XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
+        XtAppNextEvent(context, &event);
+        XtDispatchEvent(&event);
     }
     XtRemoveGrab(XtParent(fileSel));
 
-    XmUpdateDisplay((Widget) wxTheApp->GetTopLevelWidget()); // Experimental
+    // XmUpdateDisplay((Widget) wxTheApp->GetTopLevelWidget()); // Experimental
+
+    Display* display = XtDisplay(fileSel);
 
-    //  XtDestroyWidget(fileSel);
     XtUnmapWidget(XtParent(fileSel));
     XtDestroyWidget(XtParent(fileSel));
 
     // Now process all events, because otherwise
     // this might remain on the screen
-    XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
-    while (XtAppPending((XtAppContext) wxTheApp->GetAppContext()))
-    {
-        XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
-        XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
-        XtDispatchEvent(&event);
-    }
+    wxFlushEvents(display);
 
     m_path = m_fileSelectorAnswer;
     m_fileName = wxFileNameFromPath(m_fileSelectorAnswer);