mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 03:56:12 +02:00
lcl: make sure HMONITOR <> 0 for valid monitors
git-svn-id: trunk@19263 -
This commit is contained in:
parent
5600446d97
commit
a75bb49700
@ -3407,7 +3407,7 @@ end;
|
|||||||
function TGTKWidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect;
|
function TGTKWidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect;
|
||||||
lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
|
lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
|
||||||
begin
|
begin
|
||||||
Result := lpfnEnum(0, 0, nil, dwData);
|
Result := lpfnEnum(1, 0, nil, dwData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{.$define VerboseEnumFonts}
|
{.$define VerboseEnumFonts}
|
||||||
@ -5369,7 +5369,7 @@ end;
|
|||||||
|
|
||||||
function TGTKWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
function TGTKWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) and (Monitor = 0);
|
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) and (Monitor = 1);
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
lpmi^.rcMonitor := Bounds(0, 0, gdk_screen_width, gdk_screen_height);
|
lpmi^.rcMonitor := Bounds(0, 0, gdk_screen_width, gdk_screen_height);
|
||||||
lpmi^.rcWork := lpmi^.rcMonitor;
|
lpmi^.rcWork := lpmi^.rcMonitor;
|
||||||
|
@ -360,7 +360,7 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
for i := 0 to gdk_screen_get_n_monitors(gdk_screen_get_default) - 1 do
|
for i := 0 to gdk_screen_get_n_monitors(gdk_screen_get_default) - 1 do
|
||||||
begin
|
begin
|
||||||
Result := Result and lpfnEnum(i, 0, nil, dwData);
|
Result := Result and lpfnEnum(i + 1, 0, nil, dwData);
|
||||||
if not Result then break;
|
if not Result then break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -507,8 +507,9 @@ function TGtk2WidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): B
|
|||||||
var
|
var
|
||||||
MonitorRect: TGdkRectangle;
|
MonitorRect: TGdkRectangle;
|
||||||
begin
|
begin
|
||||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo));
|
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor = 0);
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
|
Dec(Monitor);
|
||||||
gdk_screen_get_monitor_geometry(gdk_screen_get_default, Monitor, @MonitorRect);
|
gdk_screen_get_monitor_geometry(gdk_screen_get_default, Monitor, @MonitorRect);
|
||||||
with MonitorRect do
|
with MonitorRect do
|
||||||
lpmi^.rcMonitor := Bounds(x, y, width, height);
|
lpmi^.rcMonitor := Bounds(x, y, width, height);
|
||||||
|
@ -1334,7 +1334,7 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
for i := 0 to QDesktopWidget_numScreens(Desktop) - 1 do
|
for i := 0 to QDesktopWidget_numScreens(Desktop) - 1 do
|
||||||
begin
|
begin
|
||||||
Result := Result and lpfnEnum(i, 0, nil, dwData);
|
Result := Result and lpfnEnum(i + 1, 0, nil, dwData);
|
||||||
if not Result then break;
|
if not Result then break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2246,9 +2246,10 @@ function TQtWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boo
|
|||||||
var
|
var
|
||||||
Desktop: QDesktopWidgetH;
|
Desktop: QDesktopWidgetH;
|
||||||
begin
|
begin
|
||||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo));
|
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor = 0);
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
Desktop := QApplication_desktop();
|
Desktop := QApplication_desktop();
|
||||||
|
Dec(Monitor);
|
||||||
Result := (Monitor >= 0) and (Monitor < QDesktopWidget_numScreens(Desktop));
|
Result := (Monitor >= 0) and (Monitor < QDesktopWidget_numScreens(Desktop));
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
QDesktopWidget_screenGeometry(Desktop, @lpmi^.rcMonitor, Monitor);
|
QDesktopWidget_screenGeometry(Desktop, @lpmi^.rcMonitor, Monitor);
|
||||||
|
Loading…
Reference in New Issue
Block a user