mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 20:28:19 +02:00
gtk, gtk2: return workarea for monitor under X
git-svn-id: trunk@19266 -
This commit is contained in:
parent
99241ad28e
commit
263fa6c078
@ -5368,10 +5368,19 @@ begin
|
||||
end;
|
||||
|
||||
function TGTKWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||
{$IFDEF HasX}
|
||||
var
|
||||
x, y, w, h: gint;
|
||||
{$ENDIF}
|
||||
begin
|
||||
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);
|
||||
{$IFDEF HasX}
|
||||
if XGetWorkarea(x, y, w, h) <> -1 then
|
||||
lpmi^.rcWork := Bounds(x, y, w, h)
|
||||
else
|
||||
{$ENDIF}
|
||||
lpmi^.rcWork := lpmi^.rcMonitor;
|
||||
lpmi^.dwFlags := MONITORINFOF_PRIMARY
|
||||
end;
|
||||
|
@ -506,6 +506,9 @@ end;
|
||||
function TGtk2WidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||
var
|
||||
MonitorRect: TGdkRectangle;
|
||||
{$IFDEF HasX}
|
||||
x, y, w, h: gint;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor = 0);
|
||||
if not Result then Exit;
|
||||
@ -514,6 +517,12 @@ begin
|
||||
with MonitorRect do
|
||||
lpmi^.rcMonitor := Bounds(x, y, width, height);
|
||||
// there is no way to determine workarea in gtk
|
||||
{$IFDEF HasX}
|
||||
if XGetWorkarea(x, y, w, h) <> -1 then
|
||||
lpmi^.rcWork := Bounds(Max(MonitorRect.x, x), Max(MonitorRect.y, y),
|
||||
Min(MonitorRect.Width, w), Min(MonitorRect.Height, h))
|
||||
else
|
||||
{$ENDIF}
|
||||
lpmi^.rcWork := lpmi^.rcMonitor;
|
||||
// gtk uses zero position for primary monitor
|
||||
if Monitor = 0 then
|
||||
|
Loading…
Reference in New Issue
Block a user