Fix #398 keyboard layout change not working

This commit is contained in:
stax76
2022-04-08 19:16:18 +02:00
parent 1bc6fb9509
commit 309ddbf08e
4 changed files with 10 additions and 17 deletions

View File

@@ -413,23 +413,8 @@ KP1 script-binding delete_current_file/confirm
mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event));
if (WindowHandle == IntPtr.Zero)
{
WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
if (WindowHandle != IntPtr.Zero)
{
int GWL_STYLE = -16;
uint WS_CHILD = 0x40000000;
uint WS_CLIPSIBLINGS = 0x04000000;
uint WS_DISABLED = 0x08000000;
uint WS_VISIBLE = 0x10000000;
Native.SetWindowLong(WindowHandle, GWL_STYLE,
WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS);
}
}
try
{
switch (evt.event_id)

View File

@@ -815,6 +815,9 @@ namespace mpvnet
if (Core.WindowHandle != IntPtr.Zero)
m.Result = SendMessage(Core.WindowHandle, m.Msg, m.WParam, m.LParam);
break;
case 0x051: // WM_INPUTLANGCHANGE
ActivateKeyboardLayout(m.LParam, 0x00000100u /*KLF_SETFORPROCESS*/);
break;
case 0x319: // WM_APPCOMMAND
{
string value = Input.WM_APPCOMMAND_to_mpv_key((int)(m.LParam.ToInt64() >> 16 & ~0xf000));