Create a small helper class for Unity global menu bug workaround.

Encapsulate the code temporarily incrementing wxOpenModalDialogsCount in a
small helper class to make it easier to reuse it elsewhere.

See #14823.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-03-21 22:36:42 +00:00
parent 49b18c6cd9
commit d3bd8b1a48
2 changed files with 51 additions and 6 deletions

View File

@@ -23,9 +23,7 @@
#include <gtk/gtk.h>
#include "wx/gtk/private/gtk2-compat.h"
// this is defined in src/gtk/toplevel.cpp
extern int wxOpenModalDialogsCount;
#include "wx/gtk/private/dialogcount.h"
wxDEFINE_TIED_SCOPED_PTR_TYPE(wxGUIEventLoop)
@@ -172,7 +170,7 @@ int wxDialog::ShowModal()
m_modalShowing = true;
wxOpenModalDialogsCount++;
wxOpenModalDialogLocker modalLock;
// NOTE: gtk_window_set_modal internally calls gtk_grab_add() !
gtk_window_set_modal(GTK_WINDOW(m_widget), TRUE);
@@ -190,8 +188,6 @@ int wxDialog::ShowModal()
gtk_window_set_modal(GTK_WINDOW(m_widget), FALSE);
wxOpenModalDialogsCount--;
return GetReturnCode();
}