fix(windows): add comments for new functions

This commit is contained in:
rc-swag 2026-09-07 13:03:29 +10:00
parent d67c4911af
commit 0409cda120
2 changed files with 34 additions and 5 deletions

View file

@ -7,7 +7,28 @@ uses
System.SysUtils,
keymanapi_TLB;
(**
Returns true if the keyboard files need to be compiled for the specified KLID.
@param BaseKeyboardID KLID of the base keyboard to compile.
@returns True If the keyboard files need to be compiled.
*)
function BaseKeyboardNeedsMCompile(BaseKeyboardID: Integer): Boolean;
(**
Sets the base keyboard KLID for the current user and compiles the keyboard
files if necessary. In the case the compiled keyboard files are not present,
it will require elevation.
@param WindowHandle Window handle to own the elevation prompt.
@param BaseKeyboardID KLID of the base keyboard KLID to set.
@returns True when the base keyboard setting has been applied.
*)
function SetBaseKeyboard(WindowHandle: THandle; BaseKeyboardID: Integer): Boolean;
(**
Compiles the base keyboard files for the specified KLID.
@param BaseKeyboardID KLID of the base keyboard to compile.
@returns True when the compilation is successful.
*)
function MCompileBaseKeyboard(BaseKeyboardID: Integer): Boolean;
implementation
@ -38,20 +59,20 @@ end;
function SetBaseKeyboard(WindowHandle: THandle; BaseKeyboardID: Integer): Boolean;
begin
Result := False;
Result := True;
if BaseKeyboardNeedsMCompile(BaseKeyboardID) then
begin
if not kmcom.SystemInfo.IsAdministrator then
begin
WaitForElevatedConfiguration(WindowHandle, '-mcompilekbds ' + IntToHex(BaseKeyboardID, 8));
Result := WaitForElevatedConfiguration(WindowHandle, '-mcompilekbds ' + IntToHex(BaseKeyboardID, 8)) = 0;
end
else
MCompileBaseKeyboard(BaseKeyboardID);
Result := MCompileBaseKeyboard(BaseKeyboardID);
end;
if not Result then
Exit;
kmcom.Options['koBaseLayout'].Value := BaseKeyboardID;
kmcom.Options.Apply;
Result := True;
end;
function MCompileBaseKeyboard(BaseKeyboardID: Integer): Boolean;

View file

@ -18,6 +18,14 @@ type
procedure FireCommand(const command: WideString; params: TStringList); override;
end;
(**
Form for the user to select a base keyboard. If the user selects a base
keyboard, the KLID of the selected base keyboard is returned in
BaseKeyboardID.
@param [out] BaseKeyboardID KLID of the base keyboard selected by the user.
@returns True if the user selected a base keyboard.
*)
function ConfigureBaseKeyboard(out BaseKeyboardID: Integer): Boolean;
implementation