void wxTopLevelWindowGTK::AddGrab() { if (!m_grabbed) { m_grabbed = true; gtk_grab_add( m_widget ); wxEventLoop().Run(); gtk_grab_remove( m_widget ); } }
int wxDialog::ShowModal() { if (IsModal()) { wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") ); return GetReturnCode(); } // use the apps top level window as parent if none given unless explicitly // forbidden if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) { extern WXDLLIMPEXP_DATA_CORE(wxList) wxPendingDelete; wxWindow * const parent = wxTheApp->GetTopWindow(); if ( parent && parent != this && parent->IsShownOnScreen() && !parent->IsBeingDeleted()) { wxCriticalSectionLocker locker(wxPendingDeleteCS); if (!wxPendingDelete.Member(parent) && !(parent->GetExtraStyle() & wxWS_EX_TRANSIENT) ) { m_parent = parent; gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) ); } } } wxBusyCursorSuspender cs; // temporarily suppress the busy cursor Show( true ); m_modalShowing = true; g_openDialogs++; // NOTE: gtk_window_set_modal internally calls gtk_grab_add() ! gtk_window_set_modal(GTK_WINDOW(m_widget), TRUE); wxEventLoop().Run(); gtk_window_set_modal(GTK_WINDOW(m_widget), FALSE); g_openDialogs--; return GetReturnCode(); }
int wxDialog::ShowModal() { if (IsModal()) { wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") ); return GetReturnCode(); } // use the apps top level window as parent if none given unless explicitly // forbidden if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) ) { wxWindow *parent = wxTheApp->GetTopWindow(); if ( parent && parent != this && parent->IsBeingDeleted() && !(parent->GetExtraStyle() & wxWS_EX_TRANSIENT) ) { m_parent = parent; gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) ); } } wxBusyCursorSuspender cs; // temporarily suppress the busy cursor Show( true ); SetFocus(); m_modalShowing = true; g_openDialogs++; gtk_grab_add( m_widget ); wxEventLoop().Run(); gtk_grab_remove( m_widget ); g_openDialogs--; return GetReturnCode(); }