Skip to content

Commit f990805

Browse files
authored
Merge pull request #15269 from keymanapp/fix/windows/14261/splash-screen-unresponsive
fix(windows): unresponsive splash screen
2 parents 8b8ba76 + 492ce31 commit f990805

4 files changed

Lines changed: 29 additions & 8 deletions

File tree

windows/src/desktop/kmshell/main/Keyman.System.UpdateStateMachine.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,8 @@ procedure UpdateAvailableState.HandleAbort;
774774
procedure UpdateAvailableState.HandleInstallNow;
775775
begin
776776
bucStateContext.SetApplyNow(True);
777-
ChangeState(DownloadingState);
777+
// A new kmshell process will be used to download
778+
StartDownloadProcess;
778779
end;
779780

780781
{ DownloadingState }

windows/src/desktop/kmshell/main/UfrmMain.pas

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,12 @@ procedure TfrmMain.Update_ApplyNow;
839839
FResult := TUtilExecute.Shell(0, ShellPath, '', '-an');
840840
if not FResult then
841841
TKeymanSentryClient.Client.MessageEvent(Sentry.Client.SENTRY_LEVEL_ERROR,
842-
'TrmfMain: Shell Execute Update_ApplyNow Failed');
842+
'TrmfMain: Shell Execute Update_ApplyNow Failed')
843+
else
844+
ModalResult := mrAbort;
845+
// If a splash screen is currently open when "Install Now" is executed,
846+
// setting mrAbort ensures the splash screen is closed on the
847+
// return of "Keyman Configuration".
843848
end;
844849
end;
845850

windows/src/desktop/kmshell/main/initprog.pas

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ interface
7070
Windows, Controls, SysUtils, Classes, ErrorControlledRegistry, Forms, MessageIdentifiers, MessageIdentifierConsts, keymanapi_TLB;
7171

7272
procedure Run;
73-
procedure Main(Owner: TComponent = nil);
73+
function Main(Owner: TComponent = nil): TModalResult;
7474

7575

7676
type
@@ -164,10 +164,11 @@ procedure ShowKeyboardWelcome(PackageName: WideString); forward; // I2569
164164
procedure PrintKeyboard(KeyboardName: WideString); forward; // I2329
165165
function ProcessBackgroundUpdate(FMode: TKMShellMode; FSilent: Boolean): Boolean; forward;
166166

167-
procedure Main(Owner: TComponent = nil);
167+
function Main(Owner: TComponent = nil): TModalResult;
168168
var
169169
frmMain: TfrmMain;
170170
begin
171+
Result := mrNone;
171172
if not Assigned(Owner) then
172173
begin
173174
UfrmWebContainer.CreateForm(TfrmMain, frmMain);
@@ -180,7 +181,7 @@ procedure Main(Owner: TComponent = nil);
180181
begin
181182
with TfrmMain.Create(Owner) do
182183
try
183-
ShowModal;
184+
Result := ShowModal;
184185
finally
185186
Free;
186187
end;

windows/src/desktop/kmshell/startup/UfrmSplash.pas

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ TfrmSplash = class(TfrmWebContainer)
6363
FShowConfigurationOnLoad: Boolean;
6464
procedure WMUser_FormShown(var Message: TMessage); message WM_USER_FormShown;
6565
procedure WMUser(var Message: TMessage); message WM_USER;
66+
procedure ShowConfiguration;
6667
protected
6768
procedure FireCommand(const command: WideString; params: TStringList);
6869
override;
@@ -112,6 +113,17 @@ procedure ShowSplash;
112113
end;
113114
end;
114115

116+
procedure TfrmSplash.ShowConfiguration;
117+
var
118+
configFrmResult: Integer;
119+
begin
120+
configFrmResult := Main(Self);
121+
if configFrmResult = mrAbort then
122+
Command_Exit
123+
else
124+
Do_Content_Render;
125+
end;
126+
115127
procedure TfrmSplash.TntFormActivate(Sender: TObject);
116128
begin
117129
inherited;
@@ -152,15 +164,17 @@ procedure TfrmSplash.WMUser_FormShown(var Message: TMessage);
152164

153165
if FShowConfigurationOnLoad then
154166
begin
155-
Main(Self);
156-
Do_Content_Render;
167+
ShowConfiguration;
157168
end;
158169
end;
159170

160171
procedure TfrmSplash.FireCommand(const command: WideString; params: TStringList);
161172
begin
162173
if command = 'start' then Command_Start
163-
else if command = 'config' then begin Main(Self); Do_Content_Render; end // I4393 // I4396
174+
else if command = 'config' then
175+
begin
176+
ShowConfiguration;
177+
end // I4393 // I4396
164178
else if command = 'hidesplash' then FShouldDisplay := False
165179
else if command = 'showsplash' then FShouldDisplay := True
166180
else if command = 'exit' then Command_Exit

0 commit comments

Comments
 (0)