]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/filedlg.cpp
Applied patch [ 736321 ] Compile error for src/msw/textctrl.cpp
[wxWidgets.git] / src / motif / filedlg.cpp
index 27ad5f831f7c4bf980ca2f9df009f8ccb629bc12..ed2ca5e9c49a4018232b8f7e41b41231847aaf29 100644 (file)
@@ -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
@@ -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);