mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 22:09:28 +02:00
Customdrawn: Implement EnumDisplayMonitors and GetMonitorInfo for CD_X11 and CD_win32. Issue #31738, patch from Anton Kavalenka.
git-svn-id: trunk@62841 -
This commit is contained in:
parent
b9799e15cb
commit
b2501a2b9a
lcl/interfaces/customdrawn
@ -674,6 +674,7 @@ begin
|
||||
end
|
||||
else begin
|
||||
lTimer := XTimerListHead;
|
||||
if not Assigned(lTimer) then exit;
|
||||
lTimeoutInterval:= trunc((lTimer.Expires-now)*KMsToDateTime);
|
||||
if lTimeoutInterval < 0 then lTimeoutInterval:= 0; // we missed a timer: a quick look to
|
||||
// pending messages then go process the timer
|
||||
|
@ -1243,11 +1243,12 @@ function TWin32WidgetSet.EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer
|
||||
begin
|
||||
Result := Integer(Windows.EndPaint(Handle, @PS));
|
||||
end;
|
||||
*)
|
||||
|
||||
function TWin32WidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
|
||||
function TCDWidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
|
||||
begin
|
||||
Result := MultiMon.EnumDisplayMonitors(hdc, lprcClip, lpfnEnum, dwData);
|
||||
end;*)
|
||||
end;
|
||||
|
||||
type
|
||||
TProcRedirRec = record
|
||||
@ -1921,7 +1922,7 @@ begin
|
||||
Result := Windows.GetMapMode(DC);
|
||||
end;
|
||||
|
||||
function TWin32WidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: LCLType.PMonitorInfo): Boolean;
|
||||
function TCDWidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: LCLType.PMonitorInfo): Boolean;
|
||||
{$IFDEF WindowsUnicodeSupport}
|
||||
var
|
||||
LocalInfo: TMonitorInfoExW;
|
||||
|
@ -1665,23 +1665,32 @@ begin
|
||||
ACritSec:=System.PRTLCriticalSection(CritSection);
|
||||
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;
|
||||
cnt,i:integer;
|
||||
pscr:PScreen;
|
||||
r:TRect;
|
||||
begin
|
||||
Desktop := QApplication_desktop();
|
||||
Result := True;
|
||||
for i := 0 to QDesktopWidget_numScreens(Desktop) - 1 do
|
||||
Result:=false;
|
||||
if not Assigned(lpfnEnum) then exit;
|
||||
cnt:=XScreenCount(fDisplay);
|
||||
for i:=0 to cnt-1 do
|
||||
begin
|
||||
Result := Result and lpfnEnum(i + 1, 0, nil, dwData);
|
||||
if not Result then break;
|
||||
pscr:=XScreenOfDIsplay(fDisplay,i);
|
||||
if not Assigned(pscr) then exit;
|
||||
r.Top:=0;
|
||||
r.Left:=0;
|
||||
r.Right:=pscr^.width;
|
||||
r.Bottom:=pscr^.height;
|
||||
lpfnEnum(hMonitor(pscr),0,@r,dwData);
|
||||
end;
|
||||
Result:=(cnt>0);
|
||||
end;
|
||||
|
||||
|
||||
(*
|
||||
function CharsetToQtCharSet(const ALCLCharset: Byte): QFontDatabaseWritingSystem;
|
||||
begin
|
||||
Result := QFontDatabaseAny;
|
||||
@ -2911,25 +2920,22 @@ begin
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
*)
|
||||
|
||||
function TQtWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||
function TCDWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||
var
|
||||
Desktop: QDesktopWidgetH;
|
||||
pscr:PScreen absolute Monitor;
|
||||
begin
|
||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor = 0);
|
||||
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;
|
||||
Result := false;
|
||||
if (lpmi = nil) or (lpmi^.cbSize < SizeOf(TMonitorInfo)) or (Monitor = 0) then exit;
|
||||
|
||||
lpmi^.rcMonitor:=REct(0,0,pscr^.width,pscr^.height);
|
||||
lpmi^.rcWork:=lpmi^.rcMonitor;
|
||||
lpmi^.dwFlags := MONITORINFOF_PRIMARY;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
(*
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TQtWidgetSet.GetDeviceSize
|
||||
Params: none
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user