CustomDrawn: Fixed crash on startup. Implement EnumDisplayMonitors() and GetMonitorInfo(). Issue , patch from Yuriy Sydorov.

git-svn-id: trunk@62599 -
This commit is contained in:
juha 2020-01-30 17:12:37 +00:00
parent cfcc3b5d82
commit beaf08063c
2 changed files with 13 additions and 31 deletions

View File

@ -1508,22 +1508,13 @@ begin
System.EnterCriticalsection(ACritSec^);
end;
(*function TQtWidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect;
function TCDWidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect;
lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
var
i: integer;
Desktop: QDesktopWidgetH;
begin
Desktop := QApplication_desktop();
Result := True;
for i := 0 to QDesktopWidget_numScreens(Desktop) - 1 do
begin
Result := Result and lpfnEnum(i + 1, 0, nil, dwData);
if not Result then break;
end;
Result := lpfnEnum(1, 0, nil, dwData);
end;
(*
function CharsetToQtCharSet(const ALCLCharset: Byte): QFontDatabaseWritingSystem;
begin
Result := QFontDatabaseAny;
@ -2909,25 +2900,16 @@ begin
else
Result := 0;
end;
function TQtWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
var
Desktop: QDesktopWidgetH;
*)
function TCDWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
begin
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor = 0);
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor <> 1);
if not Result then Exit;
Desktop := QApplication_desktop();
Dec(Monitor);
Result := (Monitor >= 0) and (Monitor < PtrUInt(QDesktopWidget_numScreens(Desktop)));
if not Result then Exit;
QDesktopWidget_screenGeometry(Desktop, @lpmi^.rcMonitor, Monitor);
QDesktopWidget_availableGeometry(Desktop, @lpmi^.rcWork, Monitor);
if PtrUInt(QDesktopWidget_primaryScreen(Desktop)) = Monitor then
lpmi^.dwFlags := MONITORINFOF_PRIMARY
else
lpmi^.dwFlags := 0;
lpmi^.rcMonitor:=Types.Rect(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
lpmi^.rcWork:=lpmi^.rcMonitor;
lpmi^.dwFlags := MONITORINFOF_PRIMARY
end;
(*
{------------------------------------------------------------------------------
Method: TQtWidgetSet.GetDeviceSize
Params: none

View File

@ -83,7 +83,7 @@ function Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean; override;
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override;
function EndPaint(Handle: hwnd; var PS: TPaintStruct): Integer; override;*)
procedure EnterCriticalSection(var CritSection: TCriticalSection); override;
//function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; override;
function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; override;
function EnumFontFamiliesEx(DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; Lparam: LParam; Flags: dword): longint; override;
//function ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; override;
function ExtCreatePen(dwPenStyle, dwWidth: DWord; const lplb: TLogBrush; dwStyleCount: DWord; lpStyle: PDWord): HPEN; override;
@ -118,9 +118,9 @@ function GetDoubleClickTime: UINT; override;*)
function GetFocus: HWND; override;
(*function GetForegroundWindow: HWND; override;*)
function GetKeyState(nVirtKey: Integer): Smallint; override;
(*function GetMapMode(DC: HDC): Integer; override;
//function GetMapMode(DC: HDC): Integer; override;
function GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean; override;
function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; override;*)
//function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; override;
function GetParent(Handle : HWND): HWND; override;
function GetProp(Handle : hwnd; Str : PChar): Pointer; override;
function GetRgnBox(RGN : HRGN; lpRect : PRect) : Longint; override;