win32: move IME candidate window to video window

By default the IME candidate window appears on the top left corner
of the monitor. Move it to the video window for sane behavior.
This commit is contained in:
nanahi 2023-12-15 11:29:56 -05:00 committed by Dudemanguy
parent 2b1024fa50
commit 7ffd947830
3 changed files with 11 additions and 0 deletions

View File

@ -489,6 +489,7 @@ if features['win32-desktop']
win32_desktop_libs = [cc.find_library('avrt'),
cc.find_library('dwmapi'),
cc.find_library('gdi32'),
cc.find_library('imm32'),
cc.find_library('ole32'),
cc.find_library('uuid'),
cc.find_library('uxtheme'),

View File

@ -50,6 +50,7 @@ if not features['win32-threads']
endif
if features['win32-desktop']
test_utils_deps += cc.find_library('imm32')
test_utils_deps += cc.find_library('winmm')
endif
test_utils_objects = libmpv.extract_objects(test_utils_files)

View File

@ -1551,6 +1551,15 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
((LPNCCALCSIZE_PARAMS) lParam)->rgrc[0].top -= get_title_bar_height(w32);
}
break;
case WM_IME_STARTCOMPOSITION: {
HIMC imc = ImmGetContext(w32->window);
if (imc) {
COMPOSITIONFORM cf = {.dwStyle = CFS_POINT, .ptCurrentPos = {0, 0}};
ImmSetCompositionWindow(imc, &cf);
ImmReleaseContext(w32->window, imc);
}
break;
}
}
if (message == w32->tbtn_created_msg) {