forked from IndySockets/Indy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IdAntiFreeze.pas
194 lines (165 loc) · 5.66 KB
/
IdAntiFreeze.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{
$Project$
$Workfile$
$Revision$
$DateUTC$
$Id$
This file is part of the Indy (Internet Direct) project, and is offered
under the dual-licensing agreement described on the Indy website.
(http://www.indyproject.org/)
Copyright:
(c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}
{
$Log$
}
{
Rev 1.6 2004.02.03 4:16:42 PM czhower
For unit name changes.
Rev 1.5 2004.01.01 3:13:32 PM czhower
Updated comment.
Rev 1.4 2003.12.31 10:30:24 PM czhower
Comment update.
Rev 1.3 2003.12.31 7:25:14 PM czhower
Now works in .net
Rev 1.2 10/4/2003 9:52:08 AM GGrieve
add IdCoreGlobal to uses list
Rev 1.1 2003.10.01 1:12:30 AM czhower
.Net
Rev 1.0 11/13/2002 08:37:36 AM JPMugaas
}
unit IdAntiFreeze;
{
NOTE - This unit must NOT appear in any Indy uses clauses. This is a ONE way
relationship and is linked in IF the user uses this component. This is done to
preserve the isolation from the massive FORMS unit.
Because it links to Forms:
- The Application.ProcessMessages cannot be done in IdCoreGlobal as an OS
independent function, and thus this unit is allowed to violate the IFDEF
restriction.
}
interface
{$I IdCompilerDefines.inc}
uses
Classes,
IdAntiFreezeBase,
IdBaseComponent;
{ Directive needed for generating a legacy non-UnitScoped C++Builder HPP }
{$IFDEF HAS_DIRECTIVE_HPPEMIT_LEGACYHPP}
{$HPPEMIT LEGACYHPP}
{$ENDIF}
{ Directive needed for C++Builder HPP to force static linking to this unit }
{$IFDEF HAS_DIRECTIVE_HPPEMIT_LINKUNIT}
{$HPPEMIT LINKUNIT}
{$ELSE}
{$IFDEF WINDOWS}
{$HPPEMIT '#pragma link "IdAntiFreeze"'} {Do not Localize}
{$ENDIF}
{$IFDEF UNIX}
{$HPPEMIT '#pragma link "IdAntiFreeze.o"'} {Do not Localize}
{$ENDIF}
{$ENDIF}
{$IFDEF VCL_10_3_OR_ABOVE}
// until Delphi 10.3.2 can be detected in IdCompilerDefines.inc,
// use {$IF DECLARED(...) here to enable the new platform values...)
{$IFNDEF VCL_10_3_UPDATE2_OR_ABOVE}
{$IF DECLARED(pidAllPlatforms)}
{$DEFINE HAS_ComponentPlatformsAttribute_AllPlatforms}
{$DEFINE HAS_ComponentPlatformsAttribute_OSX64}
{$IFEND}
{$ENDIF}
{$ENDIF}
type
{$IFDEF HAS_ComponentPlatformsAttribute}
[ComponentPlatformsAttribute(
{$IFDEF HAS_ComponentPlatformsAttribute_AllPlatforms}pidAllPlatforms
{$ELSE}
pidWin32
{$IFDEF HAS_ComponentPlatformsAttribute_Win64} or pidWin64{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_OSX32} or pidOSX32{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_iOS_Simulator32}or pidiOSSimulator32{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_iOS_Simulator} or pidiOSSimulator{$ENDIF}{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_AndroidArm32} or pidAndroidArm32{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_Android32Arm} or pidAndroid32Arm{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_Android} or pidAndroid{$ENDIF}{$ENDIF}{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_Linux32} or pidLinux32{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_iOS_Device32} or pidiOSDevice32{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_iOS_Device} or pidiOSDevice{$ENDIF}{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_Linux64} or pidLinux64{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_WinNX32} or pidWinNX32{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_WinIoT32} or pidWinIoT32{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_iOS_Device64} or pidiOSDevice64{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_WinARM32} or pidWinARM32{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_WinARM} or pidWinARM{$ENDIF}{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_OSXNX64} or pidOSXNX64{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_OSX64} or pidOSX64{$ENDIF}{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_Linux32Arm} or pidLinux32Arm{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_Linux64Arm} or pidLinux64Arm{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_AndroidArm64} or pidAndroidArm64{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_Android64Arm} or pidAndroid64Arm{$ELSE}
{$IFDEF HAS_ComponentPlatformsAttribute_Android64} or pidAndroid64{$ENDIF}{$ENDIF}{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_iOS_Simulator64} or pidiOSSimulator64{$ENDIF}
{$IFDEF HAS_ComponentPlatformsAttribute_OSXArm64} or pidOSXArm64{$ENDIF}
{$ENDIF}
)]
{$ENDIF}
TIdAntiFreeze = class(TIdAntiFreezeBase)
public
procedure Process; override;
end;
implementation
uses
{$IFDEF WIDGET_KYLIX}
QForms,
{$ENDIF}
{$IFDEF WIDGET_VCL_LIKE}
Forms,
{$ENDIF}
{$IFDEF WINDOWS}
{$IFNDEF FMX}
Messages,
Windows,
{$ENDIF}
{$ENDIF}
{$IFDEF WIDGET_WINFORMS}
System.Windows.Forms,
{$ENDIF}
IdGlobal;
{$IFDEF UNIX}
procedure TIdAntiFreeze.Process;
begin
//TODO: Handle ApplicationHasPriority
Application.ProcessMessages;
end;
{$ENDIF}
{$IFDEF WINDOWS}
{$IFNDEF FMX}
procedure TIdAntiFreeze.Process;
var
LMsg: TMsg;
begin
if ApplicationHasPriority then begin
Application.ProcessMessages;
end else begin
// This guarantees it will not ever call Application.Idle
if PeekMessage(LMsg, 0, 0, 0, PM_NOREMOVE) then begin
Application.HandleMessage;
end;
end;
end;
{$ELSE}
procedure TIdAntiFreeze.Process;
begin
//TODO: Handle ApplicationHasPriority
Application.ProcessMessages;
end;
{$ENDIF}
{$ENDIF}
{$IFDEF WIDGET_WINFORMS}
procedure TIdAntiFreeze.Process;
begin
//TODO: Handle ApplicationHasPriority
Application.DoEvents;
end;
{$ENDIF}
end.