From f357151cc60003000865252135905c6417504dd6 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 23 Nov 2012 15:39:29 +0100 Subject: [PATCH] Bug 668239 - texts disappear when notebook switch page at zh_CN locate In gtkimcontextime.c, use gdk_win32_window_get_impl_hwnd() to get to the impl's existing native window instead of GDK_WINDOW_HWND() which implicitly ensures a native window for the widget itself. This seems to work around whatever GDK problem with native subwindows and fixes the bug. --- modules/input/gtkimcontextime.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/input/gtkimcontextime.c b/modules/input/gtkimcontextime.c index 1ff6e36180..b15f0f2581 100644 --- a/modules/input/gtkimcontextime.c +++ b/modules/input/gtkimcontextime.c @@ -277,7 +277,7 @@ gtk_im_context_ime_set_client_window (GtkIMContext *context, HIMC himc; HWND hwnd; - hwnd = GDK_WINDOW_HWND (client_window); + hwnd = gdk_win32_window_get_impl_hwnd (client_window); himc = ImmGetContext (hwnd); if (himc) { @@ -347,7 +347,7 @@ gtk_im_context_ime_reset (GtkIMContext *context) if (!context_ime->client_window) return; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return; @@ -376,7 +376,7 @@ get_utf8_preedit_string (GtkIMContextIME *context_ime, gint *pos_ret) if (pos_ret) *pos_ret = 0; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return g_strdup (""); @@ -399,7 +399,7 @@ get_utf8_preedit_string (GtkIMContextIME *context_ime, gint *pos_ret) g_warning ("%s", error->message); g_error_free (error); } - + if (pos_ret) { pos = ImmGetCompositionStringW (himc, GCS_CURSORPOS, NULL, 0); @@ -435,7 +435,7 @@ get_pango_attr_list (GtkIMContextIME *context_ime, const gchar *utf8str) HWND hwnd; HIMC himc; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return attrs; @@ -573,7 +573,7 @@ gtk_im_context_ime_focus_in (GtkIMContext *context) /* swtich current context */ context_ime->focus = TRUE; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return; @@ -583,7 +583,7 @@ gtk_im_context_ime_focus_in (GtkIMContext *context) { gdk_window_add_filter (toplevel, gtk_im_context_ime_message_filter, context_ime); - top_hwnd = GDK_WINDOW_HWND (toplevel); + top_hwnd = gdk_win32_window_get_impl_hwnd (toplevel); context_ime->toplevel = toplevel; } @@ -646,7 +646,7 @@ gtk_im_context_ime_focus_out (GtkIMContext *context) /* swtich current context */ context_ime->focus = FALSE; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return; @@ -708,7 +708,7 @@ gtk_im_context_ime_focus_out (GtkIMContext *context) gdk_window_remove_filter (toplevel, gtk_im_context_ime_message_filter, context_ime); - top_hwnd = GDK_WINDOW_HWND (toplevel); + top_hwnd = gdk_win32_window_get_impl_hwnd (toplevel); context_ime->toplevel = NULL; } @@ -742,7 +742,7 @@ gtk_im_context_ime_set_cursor_location (GtkIMContext *context, if (!context_ime->client_window) return; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return; @@ -772,7 +772,7 @@ gtk_im_context_ime_set_use_preedit (GtkIMContext *context, HWND hwnd; HIMC himc; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return; @@ -808,7 +808,7 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context) if (!GTK_IS_WIDGET (widget)) return; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return; @@ -820,7 +820,7 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context) /* Try to make sure we use a font that actually can show the * language in question. - */ + */ switch (PRIMARYLANGID (LOWORD (ime))) { @@ -848,7 +848,7 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context) default: lang = ""; break; } - + if (lang[0]) { /* We know what language it is. Look for a character, any @@ -915,7 +915,7 @@ gtk_im_context_ime_message_filter (GdkXEvent *xevent, if (!context_ime->focus) return retval; - hwnd = GDK_WINDOW_HWND (context_ime->client_window); + hwnd = gdk_win32_window_get_impl_hwnd (context_ime->client_window); himc = ImmGetContext (hwnd); if (!himc) return retval; @@ -935,8 +935,8 @@ gtk_im_context_ime_message_filter (GdkXEvent *xevent, RECT rc; hwnd_top = - GDK_WINDOW_HWND (gdk_window_get_toplevel - (context_ime->client_window)); + gdk_win32_window_get_impl_hwnd (gdk_window_get_toplevel + (context_ime->client_window)); GetWindowRect (hwnd_top, &rc); pt.x = wx; pt.y = wy;