First attempt to fix wince regressions

git-svn-id: trunk@25185 -
This commit is contained in:
sekelsenmat 2010-05-04 14:21:22 +00:00
parent 51bab0e62e
commit 25189bb1cf
3 changed files with 55 additions and 3 deletions

View File

@ -50,6 +50,10 @@ type
);
end;
TWinCEVersion = (wince_1, wince_2, wince_3, wince_4,
wince_5, wince_6, wince_6_1, wince_6_5, wince_7,
wince_other);
function WM_To_String(WM_Message: Integer): string;
function WindowPosFlagsToString(Flags: UINT): string;
procedure EventTrace(Message: String; Data: TObject);
@ -101,6 +105,7 @@ function WideStrCmp(W1, W2: PWideChar): Integer;
{ Automatic detection of platform }
function GetWinCEPlatform: TApplicationType;
function GetWinCEVersion: TWinCEVersion;
var
DefaultWindowInfo: TWindowInfo;
@ -1359,6 +1364,38 @@ begin
end;
{$endif}
function GetWinCEVersion: TWinCEVersion;
{$ifdef Win32}
begin
Result := wince_other;
end;
{$else}
var
versionInfo: OSVERSIONINFO;
begin
Result := wince_other;
System.FillChar(versionInfo, sizeof(OSVERSIONINFO), #0);
versionInfo.dwOSVersionInfoSize := sizeof(OSVERSIONINFO);
if GetVersionEx(@versionInfo) then
begin
case versionInfo.dwMajorVersion of
1: Result := wince_1;
2: Result := Wince_2;
3: Result := Wince_3;
4: Result := Wince_4;
5:
begin
if versionInfo.dwMinorVersion = 2 then Result := Wince_6
else Result := Wince_5;
end;
6: Result := Wince_6;
end;
end;
end;
{$endif}
{-------------------------------------------------------------------------------
procedure AddToChangedMenus(Window: HWnd);

View File

@ -2918,9 +2918,17 @@ end;
function TWinCEWidgetSet.SetWindowOrgEx(DC: HDC; NewX, NewY: Integer;
OldPoint: PPoint): Boolean;
begin
{ roozbeh:does this always work?it is heavily used in labels and some other drawing controls}
Result := Boolean(Windows.SetViewPortOrgEx(DC, -NewX, -NewY, LPPoint(OldPoint)));
// Result:=inherited SetWindowOrgEx(dc, NewX, NewY, OldPoint);
// if GetWinCEVersion >= wince_5 then
// Result:= WinExt.SetWindowOrgEx(dc, NewX, NewY, OldPoint)
// Result := False
// else
// Using SetViewPortOrgEx causes the following bugs:
// http://bugs.freepascal.org/view.php?id=15654
// * Group Box caption doesn't show
// * Label x position inside group box is too small
// * Windows control y position inside group box is too highe
// See: http://wiki.lazarus.freepascal.org/Windows_CE_Development_Notes#Regressions
Result := Boolean(Windows.SetViewPortOrgEx(DC, -NewX, -NewY, LPPoint(OldPoint)));
end;
{------------------------------------------------------------------------------

View File

@ -243,6 +243,13 @@ type
TOPENFILENAME = OPENFILENAME;
POPENFILENAME = ^OPENFILENAME;
// See: http://msdn.microsoft.com/en-us/library/aa453954.aspx
// Available in Windows CE 5.0+
function SetWindowOrgEx(
_hdc:HDC;
_x:longint;
_y:longint;
_lpoint:LPPOINT):WINBOOL; external KernelDLL name 'SetWindowOrgEx';
Implementation