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);
|
Result := CallWindowProc(GLazyOldBtnProc, AWnd, AMsg, AWp, ALp);
|
||||||
end;
|
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);
|
procedure TPMBridge.DrawLazyButton(ADraw: PDrawItemStruct);
|
||||||
var
|
var
|
||||||
LRect: TRect;
|
LRect: TRect;
|
||||||
@@ -1373,6 +1394,7 @@ end;
|
|||||||
procedure TPMBridge.LazyWindowHandler(var AMsg: TMessage);
|
procedure TPMBridge.LazyWindowHandler(var AMsg: TMessage);
|
||||||
var
|
var
|
||||||
LRect: TRect;
|
LRect: TRect;
|
||||||
|
LX, LY: Integer;
|
||||||
LBrush: HBRUSH;
|
LBrush: HBRUSH;
|
||||||
LPt: TPoint;
|
LPt: TPoint;
|
||||||
LIn: Boolean;
|
LIn: Boolean;
|
||||||
@@ -1403,7 +1425,13 @@ begin
|
|||||||
WM_EXITSIZEMOVE:
|
WM_EXITSIZEMOVE:
|
||||||
begin
|
begin
|
||||||
GetWindowRect(FLazyWnd, LRect);
|
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;
|
Exit;
|
||||||
end;
|
end;
|
||||||
// Deux portes pour un seul menu : le fond de la barrette est declare
|
// 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);
|
LRect := Rect(LPosX, LPosY, LPosX + FLazyW, LPosY + LAZY_H);
|
||||||
if MonitorFromRect(@LRect, MONITOR_DEFAULTTONULL) <> 0 then
|
if MonitorFromRect(@LRect, MONITOR_DEFAULTTONULL) <> 0 then
|
||||||
begin
|
begin
|
||||||
|
ClampToWorkArea(FLazyW, LAZY_H, LPosX, LPosY);
|
||||||
LX := LPosX;
|
LX := LPosX;
|
||||||
LY := LPosY;
|
LY := LPosY;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user