X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a8680e3e0e5066d35a8f4fd43294ba4bfcaf4ba7..a83ea9c15a7ac7bbdc6686164cfcbbc21ae5031a:/src/motif/dialog.cpp diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 533cad7db5..55d0b2fbef 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -9,10 +9,13 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "dialog.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #ifdef __VMS #define XtDisplay XTDISPLAY #define XtWindow XTWINDOW @@ -194,7 +197,10 @@ bool wxDialog::DoCreate( wxWindow* parent, wxWindowID id, void wxDialog::SetModal(bool flag) { - if ( flag ) +#ifdef __VMS +#pragma message disable codcauunr +#endif + if ( flag ) m_windowStyle |= wxDIALOG_MODAL ; else if ( m_windowStyle & wxDIALOG_MODAL ) @@ -203,6 +209,9 @@ void wxDialog::SetModal(bool flag) wxModelessWindows.DeleteObject(this); if (!flag) wxModelessWindows.Append(this); +#ifdef __VMS +#pragma message enable codcauunr +#endif } wxDialog::~wxDialog() @@ -282,8 +291,8 @@ void wxDialog::SetTitle(const wxString& title) bool wxDialog::Show( bool show ) { - if( !wxTopLevelWindowMotif::Show( show ) ) - return FALSE; + if( !wxWindowBase::Show( show ) ) + return false; m_isShown = show; @@ -305,8 +314,8 @@ bool wxDialog::Show( bool show ) else XtUnmanageChild((Widget)m_mainWidget) ; - XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget())); - XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE); + XFlush(XtDisplay((Widget)m_mainWidget)); + XSync(XtDisplay((Widget)m_mainWidget), FALSE); } return TRUE; @@ -319,6 +328,9 @@ int wxDialog::ShowModal() Show(TRUE); + // after the event loop ran, the widget might already have been destroyed + WXDisplay* display = (WXDisplay*)XtDisplay( (Widget)m_mainWidget ); + if (m_modalShowing) return 0; m_eventLoop = new wxEventLoop; @@ -329,12 +341,7 @@ int wxDialog::ShowModal() m_eventLoop->Run(); // Now process all events in case they get sent to a destroyed dialog - XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE); - while (m_eventLoop->Pending()) - { - XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget())); - m_eventLoop->Dispatch(); - } + wxFlushEvents( display ); delete m_eventLoop; m_eventLoop = NULL;