I have simply test application with next fuctionality:
It can change keyboard layout from English to Russian by klicking on buttons "En" and "Ru" and by klicking on "En" and "Ru" textboxes.
I tried to run it on my Windows 10 and it works good. All functions work as designed.
But when I installed last version of Wine (wine-8-8) on my Astra linux 1.7_x86-64 OS and run this test application with wine (./wine ~/test_language.exe), it has not been working as it should.
It have opened without problems and UI has also been visible.
But when I clicked to buttons "En", "Ru" and text boxes, it was not changing the keyboard layout.
In terminal console I could see next messages:
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0024:fixme:thread:GetThreadUILanguage : stub, returning default language.
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 0072D9D0, 00000000 0072D9F8
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 0x419 0072D9D0 00000000 0072D9F8) returning a dummy value (current locale)
0024:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 0072D9D0, 022D19B0 0072D9F8
0024:fixme:nls:get_dummy_preferred_ui_language (0x38 0x419 0072D9D0 022D19B0 0072D9F8) returning a dummy value (current locale)
0024:fixme:wtsapi:WTSRegisterSessionNotification Stub 0001007E 0x00000000
0024:fixme:uxtheme:BufferedPaintInit Stub ()
006c:fixme:imm:ImeSetActiveContext himc 0000000000010026, flag 0 stub!
0024:fixme:imm:ImeSetActiveContext himc 00010076, flag 0x1 stub!
0024:fixmeLoadKeyboardLayoutW name L"00000419", flags 0, semi-stub!
0024:fixmeX11DRV_ActivateKeyboardLayout 0x4190419, 0000: semi-stub!
0024:fixmeLoadKeyboardLayoutW name L"00000409", flags 0, semi-stub!
0024:fixmeX11DRV_ActivateKeyboardLayout 0x4190419, 0000: semi-stub!
0024:fixmeLoadKeyboardLayoutW name L"00000419", flags 0, semi-stub!
0024:fixmeX11DRV_ActivateKeyboardLayout 0x4190419, 0000: semi-stub!
0024:fixmeLoadKeyboardLayoutW name L"00000409", flags 0, semi-stub!
0024:fixmeX11DRV_ActivateKeyboardLayout 0x4190419, 0000: semi-stub!
0024:fixme:wtsapi:WTSUnRegisterSessionNotification Stub 0001007E
I suppose that the problem is not working function "LoadKeyboardLayoutW". Because as you see it was trying to load Russian language (L"00000409").
But after English language was activated instead (X11DRV_ActivateKeyboardLayout 0x4190419).
I tried to find this function in wine build files. I only found X11DRV_ActivateKeyboardLayout it in wine-8.8/dlls/winex11.drv/keyboard.c. It is below:
/***********************************************************************
* ActivateKeyboardLayout (X11DRV.@)
*/
HKL CDECL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags)
{
HKL oldHkl = 0;
struct x11drv_thread_data *thread_data = x11drv_init_thread_data();
FIXME("%p, %04x: semi-stub!\n", hkl, flags);
if (flags & KLF_SETFORPROCESS)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
FIXME("KLF_SETFORPROCESS not supported\n");
return 0;
}
if (flags)
FIXME("flags %x not supported\n",flags);
if (hkl == (HKL)HKL_NEXT || hkl == (HKL)HKL_PREV)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
FIXME("HKL_NEXT and HKL_PREV not supported\n");
return 0;
}
if (!match_x11_keyboard_layout(hkl))
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
FIXME("setting keyboard of different locales not supported\n");
return 0;
}
oldHkl = thread_data->kbd_layout;
if (!oldHkl) oldHkl = get_locale_kbd_layout();
thread_data->kbd_layout = hkl;
return oldHkl;
}
Could someone please suggest some fixes for that please?
Thanks in advance!
Cannot change Keyboard Layout when running application In Wine on Astra Linux
-
- Newbie
- Posts: 2
- Joined: Fri May 26, 2023 9:12 am
Re: Cannot change Keyboard Layout when running application In Wine on Astra Linux
Wine-staging has a patch to change the keyboard layout.
Whether that is enough to make your program work, I don't know.
Isn't it easier to change the layout with a native program instead of Wine?
Whether that is enough to make your program work, I don't know.
Isn't it easier to change the layout with a native program instead of Wine?
-
- Newbie
- Posts: 2
- Joined: Fri May 26, 2023 9:12 am
Re: Cannot change Keyboard Layout when running application In Wine on Astra Linux
Thank you for your reply!
Just to avoid misunderstood. I have .exe application which I need to run with Wine on Astra Linux.
I know that it is easier to change layout using default linux tools. And I can do it. But for my task I need to do it using Wine.
I tried to install different patches for keyboard but it still do not work. So I suppose to make change in some Wine build files or functions in them.
I also tried to debug function LoadKeyboardLayoutW and found next errors during compilation:
input.c: In function ‘LoadKeyboardLayoutW’:
input.c:452:12: error: ‘keyboard’ undeclared (first use in this function); did you mean ‘keybound’?
FIXME_(keyboard)( "name %s, flags %x, semi-stub!\n", debugstr_w( name ), flags );
^~~~~~~~
keybound
input.c:452:58: error: implicit declaration of function ‘debugstr_w’ [-Werror=implicit-function-declaration]
FIXME_(keyboard)( "name %s, flags %x, semi-stub!\n", debugstr_w( name ), flags );
^~~~~~~~~~
input.c:454:11: error: implicit declaration of function ‘wcstoul’; did you mean ‘wcstombs’? [-Werror=implicit-function-declaration]
tmp = wcstoul( name, NULL, 16 );
^~~~~
wcstombs
input.c:461:5: error: implicit declaration of function ‘wcscpy’; did you mean ‘wscrl’? [-Werror=implicit-function-declaration]
wcscpy( layout_path, L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\" );
^~~~
wscrl
input.c:462:5: error: implicit declaration of function ‘wcscat’; did you mean ‘wchgat’? [-Werror=implicit-function-declaration]
wcscat( layout_path, name );
^~~~~~
wchgat
I tried to declare "keyboard" using different ways but it won`t help. Does someone have any thoughts about it?
Just to avoid misunderstood. I have .exe application which I need to run with Wine on Astra Linux.
I know that it is easier to change layout using default linux tools. And I can do it. But for my task I need to do it using Wine.
I tried to install different patches for keyboard but it still do not work. So I suppose to make change in some Wine build files or functions in them.
I also tried to debug function LoadKeyboardLayoutW and found next errors during compilation:
input.c: In function ‘LoadKeyboardLayoutW’:
input.c:452:12: error: ‘keyboard’ undeclared (first use in this function); did you mean ‘keybound’?
FIXME_(keyboard)( "name %s, flags %x, semi-stub!\n", debugstr_w( name ), flags );
^~~~~~~~
keybound
input.c:452:58: error: implicit declaration of function ‘debugstr_w’ [-Werror=implicit-function-declaration]
FIXME_(keyboard)( "name %s, flags %x, semi-stub!\n", debugstr_w( name ), flags );
^~~~~~~~~~
input.c:454:11: error: implicit declaration of function ‘wcstoul’; did you mean ‘wcstombs’? [-Werror=implicit-function-declaration]
tmp = wcstoul( name, NULL, 16 );
^~~~~
wcstombs
input.c:461:5: error: implicit declaration of function ‘wcscpy’; did you mean ‘wscrl’? [-Werror=implicit-function-declaration]
wcscpy( layout_path, L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\" );
^~~~
wscrl
input.c:462:5: error: implicit declaration of function ‘wcscat’; did you mean ‘wchgat’? [-Werror=implicit-function-declaration]
wcscat( layout_path, name );
^~~~~~
wchgat
I tried to declare "keyboard" using different ways but it won`t help. Does someone have any thoughts about it?