fix(fillbar): remonte la barrette quand elle est recouverte, au lieu de la deplacer

Elle a le droit de se poser sur la barre des taches. Redemander HWND_TOPMOST
quand on l'est deja ne change rien : le shell restait devant au demarrage de
session et au menu Demarrer. Le passage NOTOPMOST -> TOPMOST force la remontee,
fait seulement quand le centre de la barrette appartient a une autre fenetre.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-09-22 15:38:05 +01:00
parent c1c7d9cd59
commit 1ae1d482f0
+30 -32
View File
@@ -1202,25 +1202,34 @@ 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 // LA BARRE DES TACHES EST TOPMOST ELLE AUSSI, et la barrette a le droit de se
// derriere elle des que le shell se remet en tete (demarrage de Windows, menu // poser dessus. Redemander HWND_TOPMOST ne suffit pas quand on l'est deja :
// Demarrer) et parait disparue. Elle est donc ramenee dans la zone de travail // Windows n'y voit rien a changer et la barrette reste dessous - invisible au
// de l'ecran ou elle se trouve - au chargement comme a la fin d'un deplacement. // demarrage de session, puis des qu'on ouvre le menu Demarrer. Le passage par
procedure ClampToWorkArea(AWidth, AHeight: Integer; var AX, AY: Integer); // NOTOPMOST force la remontee en tete de la bande. Fait seulement quand elle
// est vraiment recouverte (un point de sa surface ne lui appartient plus),
// pour ne pas remuer l'ordre des fenetres cinq fois par seconde.
function LazyIsCovered(AWnd: HWND): Boolean;
var var
LRect: TRect; LRect: TRect;
LMon: HMONITOR; LPt: TPoint;
LInfo: TMonitorInfo; LHit: HWND;
begin begin
LRect := Rect(AX, AY, AX + AWidth, AY + AHeight); Result := False;
LMon := MonitorFromRect(@LRect, MONITOR_DEFAULTTONEAREST); if not GetWindowRect(AWnd, LRect) then Exit;
if LMon = 0 then Exit; LPt.X := (LRect.Left + LRect.Right) div 2;
LInfo.cbSize := SizeOf(LInfo); LPt.Y := (LRect.Top + LRect.Bottom) div 2;
if not GetMonitorInfo(LMon, @LInfo) then Exit; LHit := WindowFromPoint(LPt);
if AX + AWidth > LInfo.rcWork.Right then AX := LInfo.rcWork.Right - AWidth; if LHit = 0 then Exit;
if AY + AHeight > LInfo.rcWork.Bottom then AY := LInfo.rcWork.Bottom - AHeight; Result := (LHit <> AWnd) and (GetAncestor(LHit, GA_ROOT) <> AWnd);
if AX < LInfo.rcWork.Left then AX := LInfo.rcWork.Left; end;
if AY < LInfo.rcWork.Top then AY := LInfo.rcWork.Top;
procedure LazyForceToTop(AWnd: HWND);
begin
SetWindowPos(AWnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
SetWindowPos(AWnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
end; end;
procedure TPMBridge.DrawLazyButton(ADraw: PDrawItemStruct); procedure TPMBridge.DrawLazyButton(ADraw: PDrawItemStruct);
@@ -1394,7 +1403,6 @@ 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;
@@ -1411,13 +1419,10 @@ begin
ApplyLazyAlpha(LIn); ApplyLazyAlpha(LIn);
end; end;
// TOPMOST N'EST PAS UN RANG, C'EST UNE BANDE. La barre des taches y est // TOPMOST N'EST PAS UN RANG, C'EST UNE BANDE. La barre des taches y est
// elle aussi, et cliquer son fond vide la remonte en tete de cette // elle aussi, et se remet en tete de cette bande au demarrage de la
// bande : une barrette posee dessus passe DERRIERE et semble avoir // session comme a l'ouverture du menu Demarrer : une barrette posee
// disparu, alors qu'elle est seulement recouverte. La reposer a chaque // dessus passe DERRIERE et semble avoir disparu.
// battement est ce que font tous les outils flottants ; sans mouvement if LazyIsCovered(FLazyWnd) then LazyForceToTop(FLazyWnd);
// ni taille a changer, l'appel ne repeint rien.
SetWindowPos(FLazyWnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
Exit; Exit;
end; end;
// Fin du glissement (la boucle modale ouverte par HTCAPTION), donc une // Fin du glissement (la boucle modale ouverte par HTCAPTION), donc une
@@ -1425,13 +1430,7 @@ begin
WM_EXITSIZEMOVE: WM_EXITSIZEMOVE:
begin begin
GetWindowRect(FLazyWnd, LRect); GetWindowRect(FLazyWnd, LRect);
LX := LRect.Left; SetPref(LAZY_POS_KEY, Format('%d,%d', [LRect.Left, LRect.Top]));
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
@@ -1686,7 +1685,6 @@ 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;