lcl: make sure HMONITOR <> 0 for valid monitors

git-svn-id: trunk@19263 -
This commit is contained in:
paul 2009-04-07 04:58:55 +00:00
parent 5600446d97
commit a75bb49700
3 changed files with 8 additions and 6 deletions

View File

@ -3407,7 +3407,7 @@ end;
function TGTKWidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect;
lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
begin
Result := lpfnEnum(0, 0, nil, dwData);
Result := lpfnEnum(1, 0, nil, dwData);
end;
{.$define VerboseEnumFonts}
@ -5369,7 +5369,7 @@ end;
function TGTKWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
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;
lpmi^.rcMonitor := Bounds(0, 0, gdk_screen_width, gdk_screen_height);
lpmi^.rcWork := lpmi^.rcMonitor;

View File

@ -360,7 +360,7 @@ begin
Result := True;
for i := 0 to gdk_screen_get_n_monitors(gdk_screen_get_default) - 1 do
begin
Result := Result and lpfnEnum(i, 0, nil, dwData);
Result := Result and lpfnEnum(i + 1, 0, nil, dwData);
if not Result then break;
end;
end;
@ -507,8 +507,9 @@ function TGtk2WidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): B
var
MonitorRect: TGdkRectangle;
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;
Dec(Monitor);
gdk_screen_get_monitor_geometry(gdk_screen_get_default, Monitor, @MonitorRect);
with MonitorRect do
lpmi^.rcMonitor := Bounds(x, y, width, height);

View File

@ -1334,7 +1334,7 @@ begin
Result := True;
for i := 0 to QDesktopWidget_numScreens(Desktop) - 1 do
begin
Result := Result and lpfnEnum(i, 0, nil, dwData);
Result := Result and lpfnEnum(i + 1, 0, nil, dwData);
if not Result then break;
end;
end;
@ -2246,9 +2246,10 @@ function TQtWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boo
var
Desktop: QDesktopWidgetH;
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;
Desktop := QApplication_desktop();
Dec(Monitor);
Result := (Monitor >= 0) and (Monitor < QDesktopWidget_numScreens(Desktop));
if not Result then Exit;
QDesktopWidget_screenGeometry(Desktop, @lpmi^.rcMonitor, Monitor);