LCL: move crScreenCursor to a private const of TScreen so that it isn't used elsewhere

This commit is contained in:
Ondrej Pokorny 2021-11-26 13:33:48 +01:00
parent d13c67e680
commit 89162e9c1c
4 changed files with 19 additions and 6 deletions

View File

@ -235,7 +235,6 @@ const
crSizeAll = TCursor(-22);
crLow = TCursor(-30);
crScreenCursor= Low(TCursor); // use only with Screen.BeginTempCursor/EndTempCursor to force Screen.Cursor
type
TCaptureMouseButtons = set of TMouseButton;

View File

@ -1055,6 +1055,8 @@ type
{ TScreen }
TScreen = class(TLCLComponent)
private const
crScreen = Low(TCursor); // use with Screen.BeginTempCursor/EndTempCursor to add Screen.Cursor into the temp list
private
FActiveControl: TWinControl;
FActiveCustomForm: TCustomForm;
@ -1186,6 +1188,8 @@ type
procedure EndTempCursor(const aCursor: TCursor);
procedure BeginWaitCursor;
procedure EndWaitCursor;
procedure BeginScreenCursor;
procedure EndScreenCursor;
public
property ActiveControl: TWinControl read FActiveControl;
property ActiveCustomForm: TCustomForm read FActiveCustomForm;

View File

@ -2948,7 +2948,7 @@ begin
Screen.FSaveFocusedList.Insert(0, Screen.FFocusedForm);
Screen.FFocusedForm := Self;
Screen.MoveFormToFocusFront(Self);
Screen.BeginTempCursor(crScreenCursor);
Screen.BeginScreenCursor;
ModalResult := 0;
try
@ -3006,7 +3006,7 @@ begin
end;
finally
RestoreFocusState(SavedFocusState);
Screen.EndTempCursor(crScreenCursor);
Screen.EndScreenCursor;
if LCLIntf.IsWindow(ActiveWindow) then
SetActiveWindow(ActiveWindow);
Exclude(FFormState, fsModal);

View File

@ -295,6 +295,11 @@ begin
AddHandler(snRemoveForm,TMethod(OnRemoveForm),AsFirst);
end;
procedure TScreen.BeginScreenCursor;
begin
BeginTempCursor(crScreen);
end;
procedure TScreen.BeginTempCursor(const aCursor: TCursor);
var
OldCursor: TCursor;
@ -425,6 +430,11 @@ begin
FreeAndNil(AFormList);
end;
procedure TScreen.EndScreenCursor;
begin
EndTempCursor(crScreen);
end;
procedure TScreen.EndTempCursor(const aCursor: TCursor);
procedure _Delete(const _Index: Integer); // FPC 3.0.x doesn't support Delete() for arrays #36728
var
@ -857,12 +867,12 @@ end;
function TScreen.GetRealCursor: TCursor;
begin
if (Length(FTempCursors)>0) and (FTempCursors[High(FTempCursors)]<>crScreenCursor) then
if (Length(FTempCursors)>0) and (FTempCursors[High(FTempCursors)]<>crScreen) then
Result := FTempCursors[High(FTempCursors)]
else
if Cursor<>crScreenCursor then
if Cursor<>crScreen then
Result := Cursor
else // Screen.Cursor=crScreenCursor - we have to use crDefault because crScreenCursor is otherwise invalid
else // Screen.Cursor=crScreen - we have to use crDefault because crScreen is otherwise invalid
Result := crDefault;
end;