When TMonitor.WorkareaRect is not implemented, use TMonitor.BoundsRect

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2697 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
zoran-vucenovic
2013-03-10 16:02:31 +00:00
parent 5fc553bb5b
commit f08de69e4e

View File

@ -550,6 +550,7 @@ end;
procedure TDTCalendarForm.AdjustCalendarFormScreenPosition; procedure TDTCalendarForm.AdjustCalendarFormScreenPosition;
var var
M: TMonitor;
R: TRect; R: TRect;
P: TPoint; P: TPoint;
H, W: Integer; H, W: Integer;
@ -558,8 +559,14 @@ begin
W := Width; W := Width;
P := DTPicker.ControlToScreen(Point(0, DTPicker.Height)); P := DTPicker.ControlToScreen(Point(0, DTPicker.Height));
M := Screen.MonitorFromWindow(DTPicker.Handle);
R := Screen.MonitorFromWindow(DTPicker.Handle).WorkareaRect; R := M.WorkareaRect;
// WorkareaRect sometimes is not implemented (gtk2?). Depends on widgetset
// and window manager or something like that. Then it returns (0,0,0,0) and
// the best we can do is use BoundsRect instead:
if (R.Right <= R.Left) or (R.Bottom <= R.Top) then
R := M.BoundsRect;
if P.y > R.Bottom - H then if P.y > R.Bottom - H then
P.y := P.y - H - DTPicker.Height; P.y := P.y - H - DTPicker.Height;