mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-09 12:10:09 +00:00
Merge branch 'ime-preedit-hidpi-3' into 'gtk-3-24'
gtkimcontextime.c: Fix preedit window placement on HiDPI See merge request GNOME/gtk!775
This commit is contained in:
commit
56cfc65909
@ -845,6 +845,7 @@ gtk_im_context_ime_set_cursor_location (GtkIMContext *context,
|
|||||||
COMPOSITIONFORM cf;
|
COMPOSITIONFORM cf;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
HIMC himc;
|
HIMC himc;
|
||||||
|
guint scale;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_IM_CONTEXT_IME (context));
|
g_return_if_fail (GTK_IS_IM_CONTEXT_IME (context));
|
||||||
|
|
||||||
@ -860,10 +861,11 @@ gtk_im_context_ime_set_cursor_location (GtkIMContext *context,
|
|||||||
if (!himc)
|
if (!himc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
scale = gdk_window_get_scale_factor (context_ime->client_window);
|
||||||
get_window_position (context_ime->client_window, &wx, &wy);
|
get_window_position (context_ime->client_window, &wx, &wy);
|
||||||
cf.dwStyle = CFS_POINT;
|
cf.dwStyle = CFS_POINT;
|
||||||
cf.ptCurrentPos.x = wx + context_ime->cursor_location.x;
|
cf.ptCurrentPos.x = (wx + context_ime->cursor_location.x) * scale;
|
||||||
cf.ptCurrentPos.y = wy + context_ime->cursor_location.y;
|
cf.ptCurrentPos.y = (wy + context_ime->cursor_location.y) * scale;
|
||||||
ImmSetCompositionWindow (himc, &cf);
|
ImmSetCompositionWindow (himc, &cf);
|
||||||
|
|
||||||
ImmReleaseContext (hwnd, himc);
|
ImmReleaseContext (hwnd, himc);
|
||||||
@ -1050,6 +1052,7 @@ gtk_im_context_ime_message_filter (GdkXEvent *xevent,
|
|||||||
{
|
{
|
||||||
gint wx = 0, wy = 0;
|
gint wx = 0, wy = 0;
|
||||||
CANDIDATEFORM cf;
|
CANDIDATEFORM cf;
|
||||||
|
guint scale = gdk_window_get_scale_factor (context_ime->client_window);
|
||||||
|
|
||||||
get_window_position (context_ime->client_window, &wx, &wy);
|
get_window_position (context_ime->client_window, &wx, &wy);
|
||||||
/* FIXME! */
|
/* FIXME! */
|
||||||
@ -1062,17 +1065,17 @@ gtk_im_context_ime_message_filter (GdkXEvent *xevent,
|
|||||||
gdk_win32_window_get_impl_hwnd (gdk_window_get_toplevel
|
gdk_win32_window_get_impl_hwnd (gdk_window_get_toplevel
|
||||||
(context_ime->client_window));
|
(context_ime->client_window));
|
||||||
GetWindowRect (hwnd_top, &rc);
|
GetWindowRect (hwnd_top, &rc);
|
||||||
pt.x = wx;
|
pt.x = wx * scale;
|
||||||
pt.y = wy;
|
pt.y = wy * scale;
|
||||||
ClientToScreen (hwnd_top, &pt);
|
ClientToScreen (hwnd_top, &pt);
|
||||||
wx = pt.x - rc.left;
|
wx = (pt.x - rc.left) / scale;
|
||||||
wy = pt.y - rc.top;
|
wy = (pt.y - rc.top) / scale;
|
||||||
}
|
}
|
||||||
cf.dwIndex = 0;
|
cf.dwIndex = 0;
|
||||||
cf.dwStyle = CFS_CANDIDATEPOS;
|
cf.dwStyle = CFS_CANDIDATEPOS;
|
||||||
cf.ptCurrentPos.x = wx + context_ime->cursor_location.x;
|
cf.ptCurrentPos.x = (wx + context_ime->cursor_location.x) * scale;
|
||||||
cf.ptCurrentPos.y = wy + context_ime->cursor_location.y
|
cf.ptCurrentPos.y = (wy + context_ime->cursor_location.y
|
||||||
+ context_ime->cursor_location.height;
|
+ context_ime->cursor_location.height) * scale;
|
||||||
ImmSetCandidateWindow (himc, &cf);
|
ImmSetCandidateWindow (himc, &cf);
|
||||||
|
|
||||||
if ((msg->lParam & GCS_COMPSTR))
|
if ((msg->lParam & GCS_COMPSTR))
|
||||||
|
Loading…
Reference in New Issue
Block a user