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

@@ -1,9 +1,11 @@
- Fix keyboard layout change not working.
5.8.0.0 Beta (2022-04-02)
- Fix crash on Windows 7 systems without PowerShell.
- Fix showing incorrect timestamps in About dialog of Store version.
- Fix Store page showing non existant ARM and x86 support.
- Fix Store page showing non-existent ARM and x86 support.
- Fix opening zip files.
- The list of available input commands is like before shown
by the text editor, so it's like everything else searchable.
@@ -18,7 +20,7 @@
- Workaround not reproducible logo drawing crash.
- Info command shows the length.
- New mpv.net specific option `show-logo` that allows to disable
the drawing of the blue mpv.net logo ontop of the native OSC logo.
the drawing of the blue mpv.net logo on top of the native OSC logo.
- MediaInfo 22.03

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));

View File

@@ -18,6 +18,9 @@ namespace mpvnet
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string path);
[DllImport("user32.dll")]
public static extern uint ActivateKeyboardLayout(IntPtr hkl, uint flags);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindowEx(
IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);