cocoa: move ScreenContext to CocoaGDIObjects, always create it since it is used by any LCL application

git-svn-id: trunk@38880 -
This commit is contained in:
paul 2012-09-28 08:32:38 +00:00
parent 89930bd828
commit ad804864bd
5 changed files with 8 additions and 9 deletions

View File

@ -435,6 +435,7 @@ var
DefaultPen: TCocoaPen;
DefaultFont: TCocoaFont;
DefaultBitmap: TCocoaBitmap;
ScreenContext: TCocoaContext;
function CheckDC(dc: HDC): TCocoaContext;
function CheckDC(dc: HDC; Str: string): Boolean;
@ -1330,6 +1331,7 @@ begin
FRegion := TCocoaRegion.CreateDefault;
FRegion.AddRef;
FClipRegion := FRegion;
FSavedDCList := nil;
FText := TCocoaTextLayout.Create;
FClipped := False;
end;
@ -2591,10 +2593,13 @@ initialization
DefaultPen := TCocoaPen.CreateDefault;
DefaultFont := TCocoaFont.CreateDefault;
DefaultBitmap := TCocoaBitmap.CreateDefault;
ScreenContext := TCocoaContext.Create;
finalization
ScreenContext.Free;
DefaultBrush.Free;
DefaultPen.Free;
DefaultFont.Free;
DefaultBitmap.Free;
end.

View File

@ -141,9 +141,6 @@ implementation
uses
CocoaCaret;
var
ScreenContext : TCocoaContext = nil;
// the implementation of the utility methods
{$I cocoaobject.inc}
// the implementation of the winapi compatibility methods

View File

@ -448,7 +448,6 @@ end;
procedure InternalFinal;
begin
if Assigned(ScreenContext) then ScreenContext.Free;
end;

View File

@ -1303,11 +1303,8 @@ function TCocoaWidgetSet.GetDC(hWnd: HWND): HDC;
var
ctx: TCocoaContext;
begin
if hWnd=0 then
begin
if not Assigned(ScreenContext) then ScreenContext:=TCocoaContext.Create;
Result:=HDC(ScreenContext);
end
if hWnd = 0 then
Result := HDC(ScreenContext)
else
begin
// ToDo: Not finished yet

View File

@ -786,6 +786,7 @@ end;
function TLCLCommonCallback.DeliverMessage(var Msg): LRESULT;
begin
// WriteLn('Delivering message to target: ', PtrInt(Target), ' ', Target.ClassName);
Result := LCLMessageGlue.DeliverMessage(Target, Msg);
end;