mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:39:20 +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;
|
end;
|
||||||
|
|
||||||
function TGTKWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
function TGTKWidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||||
|
{$IFDEF HasX}
|
||||||
|
var
|
||||||
|
x, y, w, h: gint;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) and (Monitor = 1);
|
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);
|
||||||
|
{$IFDEF HasX}
|
||||||
|
if XGetWorkarea(x, y, w, h) <> -1 then
|
||||||
|
lpmi^.rcWork := Bounds(x, y, w, h)
|
||||||
|
else
|
||||||
|
{$ENDIF}
|
||||||
lpmi^.rcWork := lpmi^.rcMonitor;
|
lpmi^.rcWork := lpmi^.rcMonitor;
|
||||||
lpmi^.dwFlags := MONITORINFOF_PRIMARY
|
lpmi^.dwFlags := MONITORINFOF_PRIMARY
|
||||||
end;
|
end;
|
||||||
|
@ -506,6 +506,9 @@ end;
|
|||||||
function TGtk2WidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
function TGtk2WidgetSet.GetMonitorInfo(Monitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||||
var
|
var
|
||||||
MonitorRect: TGdkRectangle;
|
MonitorRect: TGdkRectangle;
|
||||||
|
{$IFDEF HasX}
|
||||||
|
x, y, w, h: gint;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor = 0);
|
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo)) or (Monitor = 0);
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
@ -514,6 +517,12 @@ begin
|
|||||||
with MonitorRect do
|
with MonitorRect do
|
||||||
lpmi^.rcMonitor := Bounds(x, y, width, height);
|
lpmi^.rcMonitor := Bounds(x, y, width, height);
|
||||||
// there is no way to determine workarea in gtk
|
// 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;
|
lpmi^.rcWork := lpmi^.rcMonitor;
|
||||||
// gtk uses zero position for primary monitor
|
// gtk uses zero position for primary monitor
|
||||||
if Monitor = 0 then
|
if Monitor = 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user