From 97043cef22a97b8c24111ab27df609d7ad1558e4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 26 Apr 2014 17:11:31 +0000 Subject: [PATCH] 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/branches/WX_3_0_BRANCH@76398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 64008e5e19..ff9cf46aad 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2063,14 +2063,20 @@ void wxWindowGTK::GTKHandleRealized() GdkWindow* const window = GTKGetDrawingWindow(); - if (m_imContext) + if (m_wxwindow) { - gtk_im_context_set_client_window - ( - m_imContext, - window ? window - : gtk_widget_get_window(m_widget) - ); + if (m_imContext == NULL) + { + // 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); + } + gtk_im_context_set_client_window(m_imContext, window); } // Use composited window if background is transparent, if supported. @@ -2587,15 +2593,6 @@ void wxWindowGTK::PostCreation() if (GetLayoutDirection() == wxLayout_LeftToRight) 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