Delay GtkIMContext calls until widget is realized.

This may avoid a locking bug seen on Ubuntu which causes a deadlock.
See #16202


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2014-04-26 17:11:31 +00:00
parent 37ba576b4a
commit 6c6362401c

View File

@@ -2056,14 +2056,20 @@ void wxWindowGTK::GTKHandleRealized()
GdkWindow* const window = GTKGetDrawingWindow(); GdkWindow* const window = GTKGetDrawingWindow();
if (m_imContext) if (m_wxwindow)
{ {
gtk_im_context_set_client_window if (m_imContext == NULL)
( {
m_imContext, // Create input method handler
window ? window m_imContext = gtk_im_multicontext_new();
: gtk_widget_get_window(m_widget)
); // Cannot handle drawing preedited text yet
gtk_im_context_set_use_preedit(m_imContext, false);
g_signal_connect(m_imContext,
"commit", G_CALLBACK(gtk_wxwindow_commit_cb), this);
}
gtk_im_context_set_client_window(m_imContext, window);
} }
// Use composited window if background is transparent, if supported. // Use composited window if background is transparent, if supported.
@@ -2578,15 +2584,6 @@ void wxWindowGTK::PostCreation()
if (GetLayoutDirection() == wxLayout_LeftToRight) if (GetLayoutDirection() == wxLayout_LeftToRight)
gtk_widget_set_redraw_on_allocate(m_wxwindow, HasFlag(wxFULL_REPAINT_ON_RESIZE)); gtk_widget_set_redraw_on_allocate(m_wxwindow, HasFlag(wxFULL_REPAINT_ON_RESIZE));
} }
// Create input method handler
m_imContext = gtk_im_multicontext_new();
// Cannot handle drawing preedited text yet
gtk_im_context_set_use_preedit( m_imContext, FALSE );
g_signal_connect (m_imContext, "commit",
G_CALLBACK (gtk_wxwindow_commit_cb), this);
} }
// focus handling // focus handling