gtk/win32: use gdk_win32_surface_get_handle

As I propose to deprecate gdk_win32_surface_get_impl_hwnd() next,
replace it with the alternative.

The main difference between the two functions is that
gdk_win32_surface_get_impl_hwnd() fails gracefully by returning NULL if
the surface is not of the win32 implementation.

All the surfaces should be native surfaces here, and the existing code
doesn't seem to deal with NULL case anyway.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-08-23 16:31:07 +04:00
parent 3cbf6c9d6e
commit 04ebec0fa7

View File

@ -256,7 +256,7 @@ gtk_im_context_ime_set_client_widget (GtkIMContext *context,
if (surface != NULL) if (surface != NULL)
{ {
HWND hwnd = gdk_win32_surface_get_impl_hwnd (surface); HWND hwnd = gdk_win32_surface_get_handle (surface);
HIMC himc = ImmGetContext (hwnd); HIMC himc = ImmGetContext (hwnd);
if (himc) if (himc)
{ {
@ -418,7 +418,7 @@ gtk_im_context_ime_reset (GtkIMContext *context)
if (!context_ime->client_surface) if (!context_ime->client_surface)
return; return;
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); hwnd = gdk_win32_surface_get_handle (context_ime->client_surface);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return; return;
@ -453,7 +453,7 @@ get_utf8_preedit_string (GtkIMContextIME *context_ime,
if (!context_ime->client_surface) if (!context_ime->client_surface)
return g_strdup (""); return g_strdup ("");
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); hwnd = gdk_win32_surface_get_handle (context_ime->client_surface);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return g_strdup (""); return g_strdup ("");
@ -512,7 +512,7 @@ get_pango_attr_list (GtkIMContextIME *context_ime, const char *utf8str)
if (!context_ime->client_surface) if (!context_ime->client_surface)
return attrs; return attrs;
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); hwnd = gdk_win32_surface_get_handle (context_ime->client_surface);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return attrs; return attrs;
@ -655,7 +655,7 @@ gtk_im_context_ime_focus_in (GtkIMContext *context)
return; return;
} }
hwnd = gdk_win32_surface_get_impl_hwnd (toplevel); hwnd = gdk_win32_surface_get_handle (toplevel);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return; return;
@ -780,7 +780,7 @@ gtk_im_context_ime_set_cursor_location (GtkIMContext *context,
if (!context_ime->client_surface) if (!context_ime->client_surface)
return; return;
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); hwnd = gdk_win32_surface_get_handle (context_ime->client_surface);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return; return;
@ -811,7 +811,7 @@ gtk_im_context_ime_set_use_preedit (GtkIMContext *context,
HWND hwnd; HWND hwnd;
HIMC himc; HIMC himc;
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); hwnd = gdk_win32_surface_get_handle (context_ime->client_surface);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return; return;
@ -844,7 +844,7 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context)
if (!(context_ime->client_widget && context_ime->client_surface)) if (!(context_ime->client_widget && context_ime->client_surface))
return; return;
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); hwnd = gdk_win32_surface_get_handle (context_ime->client_surface);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return; return;
@ -955,10 +955,10 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display,
return retval; return retval;
toplevel = context_ime->client_surface; toplevel = context_ime->client_surface;
if (gdk_win32_surface_get_impl_hwnd (toplevel) != msg->hwnd) if (gdk_win32_surface_get_handle (toplevel) != msg->hwnd)
return retval; return retval;
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); hwnd = gdk_win32_surface_get_handle (context_ime->client_surface);
himc = ImmGetContext (hwnd); himc = ImmGetContext (hwnd);
if (!himc) if (!himc)
return retval; return retval;