fix(fillbar): la position retenue est ramenee dans la zone de travail
Posee sur la barre des taches (TOPMOST elle aussi), la barrette passait derriere elle au demarrage de Windows et a l'ouverture du menu Demarrer. Mesure avant/apres sur ce poste : y=1037 (barre = 1032..1080) -> y=992. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1202,6 +1202,27 @@ begin
|
||||
Result := CallWindowProc(GLazyOldBtnProc, AWnd, AMsg, AWp, ALp);
|
||||
end;
|
||||
|
||||
// LA BARRE DES TACHES EST TOPMOST ELLE AUSSI : une barrette posee dessus passe
|
||||
// derriere elle des que le shell se remet en tete (demarrage de Windows, menu
|
||||
// Demarrer) et parait disparue. Elle est donc ramenee dans la zone de travail
|
||||
// de l'ecran ou elle se trouve - au chargement comme a la fin d'un deplacement.
|
||||
procedure ClampToWorkArea(AWidth, AHeight: Integer; var AX, AY: Integer);
|
||||
var
|
||||
LRect: TRect;
|
||||
LMon: HMONITOR;
|
||||
LInfo: TMonitorInfo;
|
||||
begin
|
||||
LRect := Rect(AX, AY, AX + AWidth, AY + AHeight);
|
||||
LMon := MonitorFromRect(@LRect, MONITOR_DEFAULTTONEAREST);
|
||||
if LMon = 0 then Exit;
|
||||
LInfo.cbSize := SizeOf(LInfo);
|
||||
if not GetMonitorInfo(LMon, @LInfo) then Exit;
|
||||
if AX + AWidth > LInfo.rcWork.Right then AX := LInfo.rcWork.Right - AWidth;
|
||||
if AY + AHeight > LInfo.rcWork.Bottom then AY := LInfo.rcWork.Bottom - AHeight;
|
||||
if AX < LInfo.rcWork.Left then AX := LInfo.rcWork.Left;
|
||||
if AY < LInfo.rcWork.Top then AY := LInfo.rcWork.Top;
|
||||
end;
|
||||
|
||||
procedure TPMBridge.DrawLazyButton(ADraw: PDrawItemStruct);
|
||||
var
|
||||
LRect: TRect;
|
||||
@@ -1373,6 +1394,7 @@ end;
|
||||
procedure TPMBridge.LazyWindowHandler(var AMsg: TMessage);
|
||||
var
|
||||
LRect: TRect;
|
||||
LX, LY: Integer;
|
||||
LBrush: HBRUSH;
|
||||
LPt: TPoint;
|
||||
LIn: Boolean;
|
||||
@@ -1403,7 +1425,13 @@ begin
|
||||
WM_EXITSIZEMOVE:
|
||||
begin
|
||||
GetWindowRect(FLazyWnd, LRect);
|
||||
SetPref(LAZY_POS_KEY, Format('%d,%d', [LRect.Left, LRect.Top]));
|
||||
LX := LRect.Left;
|
||||
LY := LRect.Top;
|
||||
ClampToWorkArea(FLazyW, LAZY_H, LX, LY);
|
||||
if (LX <> LRect.Left) or (LY <> LRect.Top) then
|
||||
SetWindowPos(FLazyWnd, HWND_TOPMOST, LX, LY, 0, 0,
|
||||
SWP_NOSIZE or SWP_NOACTIVATE);
|
||||
SetPref(LAZY_POS_KEY, Format('%d,%d', [LX, LY]));
|
||||
Exit;
|
||||
end;
|
||||
// Deux portes pour un seul menu : le fond de la barrette est declare
|
||||
@@ -1658,6 +1686,7 @@ begin
|
||||
LRect := Rect(LPosX, LPosY, LPosX + FLazyW, LPosY + LAZY_H);
|
||||
if MonitorFromRect(@LRect, MONITOR_DEFAULTTONULL) <> 0 then
|
||||
begin
|
||||
ClampToWorkArea(FLazyW, LAZY_H, LPosX, LPosY);
|
||||
LX := LPosX;
|
||||
LY := LPosY;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user