fix releasing mouse capture before showing modal dialog, see #16647
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -136,9 +136,7 @@ int wxDialog::ShowModal()
|
|||||||
// release the mouse if it's currently captured as the window having it
|
// release the mouse if it's currently captured as the window having it
|
||||||
// will be disabled when this dialog is shown -- but will still keep the
|
// will be disabled when this dialog is shown -- but will still keep the
|
||||||
// capture making it impossible to do anything in the modal dialog itself
|
// capture making it impossible to do anything in the modal dialog itself
|
||||||
wxWindow * const win = wxWindow::GetCapture();
|
GTKReleaseMouseAndNotify();
|
||||||
if ( win )
|
|
||||||
win->GTKReleaseMouseAndNotify();
|
|
||||||
|
|
||||||
wxWindow * const parent = GetParentForModalDialog();
|
wxWindow * const parent = GetParentForModalDialog();
|
||||||
if ( parent )
|
if ( parent )
|
||||||
|
@@ -277,12 +277,6 @@ int wxMessageDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
WX_HOOK_MODAL_DIALOG();
|
WX_HOOK_MODAL_DIALOG();
|
||||||
|
|
||||||
// break the mouse capture as it would interfere with modal dialog (see
|
|
||||||
// wxDialog::ShowModal)
|
|
||||||
wxWindow * const win = wxWindow::GetCapture();
|
|
||||||
if ( win )
|
|
||||||
win->GTKReleaseMouseAndNotify();
|
|
||||||
|
|
||||||
if ( !m_widget )
|
if ( !m_widget )
|
||||||
{
|
{
|
||||||
GTKCreateMsgDialog();
|
GTKCreateMsgDialog();
|
||||||
@@ -290,6 +284,10 @@ int wxMessageDialog::ShowModal()
|
|||||||
wxT("failed to create GtkMessageDialog") );
|
wxT("failed to create GtkMessageDialog") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// break the mouse capture as it would interfere with modal dialog (see
|
||||||
|
// wxDialog::ShowModal)
|
||||||
|
GTKReleaseMouseAndNotify();
|
||||||
|
|
||||||
// This should be necessary, but otherwise the
|
// This should be necessary, but otherwise the
|
||||||
// parent TLW will disappear..
|
// parent TLW will disappear..
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
|
@@ -295,6 +295,15 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg)
|
|||||||
GtkWidget *dialog = gtk_assert_dialog_new();
|
GtkWidget *dialog = gtk_assert_dialog_new();
|
||||||
gtk_assert_dialog_set_message(GTK_ASSERT_DIALOG(dialog), msg.mb_str());
|
gtk_assert_dialog_set_message(GTK_ASSERT_DIALOG(dialog), msg.mb_str());
|
||||||
|
|
||||||
|
GdkDisplay* display = gtk_widget_get_display(dialog);
|
||||||
|
#ifdef __WXGTK3__
|
||||||
|
GdkDeviceManager* manager = gdk_display_get_device_manager(display);
|
||||||
|
GdkDevice* device = gdk_device_manager_get_client_pointer(manager);
|
||||||
|
gdk_device_ungrab(device, unsigned(GDK_CURRENT_TIME));
|
||||||
|
#else
|
||||||
|
gdk_display_pointer_ungrab(display, unsigned(GDK_CURRENT_TIME));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if wxUSE_STACKWALKER
|
#if wxUSE_STACKWALKER
|
||||||
// save the current stack ow...
|
// save the current stack ow...
|
||||||
StackDump dump(GTK_ASSERT_DIALOG(dialog));
|
StackDump dump(GTK_ASSERT_DIALOG(dialog));
|
||||||
|
@@ -4840,10 +4840,16 @@ void wxWindowGTK::DoReleaseMouse()
|
|||||||
|
|
||||||
void wxWindowGTK::GTKReleaseMouseAndNotify()
|
void wxWindowGTK::GTKReleaseMouseAndNotify()
|
||||||
{
|
{
|
||||||
ReleaseMouse();
|
GdkDisplay* display = gtk_widget_get_display(m_widget);
|
||||||
wxMouseCaptureLostEvent evt(GetId());
|
#ifdef __WXGTK3__
|
||||||
evt.SetEventObject( this );
|
GdkDeviceManager* manager = gdk_display_get_device_manager(display);
|
||||||
HandleWindowEvent( evt );
|
GdkDevice* device = gdk_device_manager_get_client_pointer(manager);
|
||||||
|
gdk_device_ungrab(device, unsigned(GDK_CURRENT_TIME));
|
||||||
|
#else
|
||||||
|
gdk_display_pointer_ungrab(display, unsigned(GDK_CURRENT_TIME));
|
||||||
|
#endif
|
||||||
|
g_captureWindow = NULL;
|
||||||
|
NotifyCaptureLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
Reference in New Issue
Block a user