[Lazarus] AnchorDockingDsgn with multi-monitor setup

Rik van Kekem rik at graficalc.nl
Fri Nov 6 13:57:34 CET 2015


We've already discussed some of this on the forum. See topic for extra 
background:
http://forum.lazarus.freepascal.org/index.php/topic,30226.msg192660.html#msg192660

My left monitor is primary monitor but it's numbered 2 in Windows.
See image at 
http://forum.lazarus.freepascal.org/index.php/topic,30226.90.html
My monitor on the right is the extended one and is numbered 1.

Lazarus with AnchorDockingDsgn always opens up on monitor 1 (my monitor 
on the right).
I've already submitted a bug-track: 
http://mantis.freepascal.org/view.php?id=28803

My question is probably for Mattias (as assignee of the bug-report and 
author of anchordocking) or others who worked on this. In 
lazarus\components\anchordocking\anchordocking.pas there is some 
monitor-code in SetupSite() function and before that. There the WorkArea 
of Node.Monitor in Screen.Monitors is taken. But why is this WorkArea 
again calculated if it was already saved in environmentoptions.xml? The 
problem I'm having now is that Lazarus always restores to the monitor on 
the right (which is the extended monitor, not the primary one).

If I change the following it works for both monitors, regardless on 
which Lazarus was closed, it will open always at the same position. It 
just takes the WorkArea which is already saved and used for opening Lazarus.

--- 
C:/Users/Rik/AppData/Local/Temp/anchordocking.pas-revBASE.svn000.tmp.pas 
ma okt 26 22:34:11 2015
+++ C:/dev/lazarus/components/anchordocking/anchordocking.pas    vr nov  
6 13:50:20 2015
@@ -1749,7 +1749,8 @@ var
          aMonitor:=Screen.Monitors[Node.Monitor]
        else
          aMonitor:=Site.Monitor;
-      WorkArea:=aMonitor.WorkareaRect;
+      //WorkArea:=aMonitor.WorkareaRect;
+      WorkArea:=SrcWorkArea;
        {$IFDEF VerboseAnchorDockRestore}
        debugln(['TAnchorDockMaster.RestoreLayout.SetupSite 
WorkArea=',dbgs(WorkArea)]);
        {$ENDIF}

I think all the monitor-stuff could be deleted because the WorkArea is 
already saved.
(or am I seeing this wrong?)

Grtz,
Rik (rvk on forum)





More information about the Lazarus mailing list