diff --git a/src/gui/TextEditor.cpp b/src/gui/TextEditor.cpp index e877e838..db4a7a9f 100644 --- a/src/gui/TextEditor.cpp +++ b/src/gui/TextEditor.cpp @@ -38,6 +38,7 @@ TextEditor::TextEditor(XojPageView* gui, GtkWidget* widget, Text* text, bool own g_object_get(settings, "gtk-cursor-blink-timeout", &this->cursorBlinkTimeout, nullptr); this->imContext = gtk_im_multicontext_new(); + gtk_im_context_set_client_window(this->imContext, gtk_widget_get_window(this->widget)); gtk_im_context_focus_in(this->imContext); g_signal_connect(this->imContext, "commit", G_CALLBACK(iMCommitCallback), this); @@ -1048,7 +1049,6 @@ void TextEditor::paint(cairo_t* cr, GdkRectangle* repaintRect, double zoom) { cairo_stroke(cr); // Notify the IM of the app's window and cursor position. - gtk_im_context_set_client_window(this->imContext, gtk_widget_get_window(this->widget)); GdkRectangle cursorRect; cursorRect.x = static_cast(zoom * x0 + x1 + zoom * cX); cursorRect.y = static_cast(zoom * y0 + y1 + zoom * cY);