diff --git a/delphi-backend/Source/PM.Bridge.pas b/delphi-backend/Source/PM.Bridge.pas index 5159227..b787f0a 100644 --- a/delphi-backend/Source/PM.Bridge.pas +++ b/delphi-backend/Source/PM.Bridge.pas @@ -174,6 +174,8 @@ type // Barrette en icones (police Segoe MDL2 Assets) plutot qu'en mots, et sa // largeur reelle - elle depend des boutons choisis dans les reglages. FLazyIcons: Boolean; + // Fond de la barrette retire (cle de couleur) : seuls les boutons restent. + FLazyClear: Boolean; FLazyW: Integer; procedure LazyWindowHandler(var AMsg: TMessage); // Corps extraits des raccourcis Ctrl+Shift+A et Ctrl+Shift+Q : la barrette @@ -446,6 +448,7 @@ const LAZY_ID_SETTINGS = 108; // reglages, onglet Fill bar LAZY_MENU_ICONS = 1; // hors des valeurs d'opacite (25..100) du meme menu LAZY_MENU_SETTINGS = 2; + LAZY_MENU_CLEAR = 3; // LE SONDAGE PLUTOT QUE TrackMouseEvent. La barrette a quatre fenetres // enfants : passer d'elle a un bouton envoie deja un WM_MOUSELEAVE au parent, // et il faudrait donc suivre la souris sur les cinq fenetres pour recoller @@ -469,6 +472,12 @@ const LAZY_BTNS_KEY = 'lazyButtons'; LAZY_BTNS_DEFAULT = 'full,pwd,totp,add,search,open,settings'; LAZY_ICONS_KEY = 'lazyIcons'; + // FOND TRANSPARENT : peint dans une couleur qu'aucun theme n'emploie, puis + // declaree cle (LWA_COLORKEY) - ces pixels ne sont plus dessines du tout, et + // les clics y TRAVERSENT. On traine donc la barrette par ses boutons + // (DragDetect), le fond n'etant plus la pour etre saisi. + LAZY_CLEAR_KEY = 'lazyClear'; + LAZY_KEY_COLOR = $00FF00FF; LAZY_H = 40; // Palette de la barrette, en COLORREF ($00BBGGRR - les octets sont INVERSES @@ -1267,15 +1276,22 @@ begin end; procedure TPMBridge.ApplyLazyAlpha(AHover: Boolean); +var + LAlpha: Byte; begin if FLazyWnd = 0 then Exit; // TRANSPARENTE N'EST PAS TRAVERSANTE : la barrette continue d'avaler les // clics sur toute sa surface. C'est un allegement du regard, pas un passage. + // Le pourcentage s'applique toujours aux boutons, fond retire ou non. if AHover or (FLazyAlphaPct >= 100) then - SetLayeredWindowAttributes(FLazyWnd, 0, 255, LWA_ALPHA) + LAlpha := 255 else - SetLayeredWindowAttributes(FLazyWnd, 0, - MulDiv(255, FLazyAlphaPct, 100), LWA_ALPHA); + LAlpha := MulDiv(255, FLazyAlphaPct, 100); + if FLazyClear then + SetLayeredWindowAttributes(FLazyWnd, LAZY_KEY_COLOR, LAlpha, + LWA_ALPHA or LWA_COLORKEY) + else + SetLayeredWindowAttributes(FLazyWnd, 0, LAlpha, LWA_ALPHA); end; procedure TPMBridge.ShowLazyMenu; @@ -1298,6 +1314,8 @@ begin if FLazyIcons then LIconsLabel := 'Show text' else LIconsLabel := 'Show icons'; AppendMenu(LMenu, MF_SEPARATOR, 0, nil); AppendMenu(LMenu, MF_STRING, LAZY_MENU_ICONS, PChar(LIconsLabel)); + AppendMenu(LMenu, MF_STRING or IfThen(FLazyClear, MF_CHECKED, MF_UNCHECKED), + LAZY_MENU_CLEAR, 'Transparent background'); AppendMenu(LMenu, MF_STRING, LAZY_MENU_SETTINGS, 'Fill bar settings...'); // LE BATTEMENT DOIT S'ARRETER PENDANT LE MENU. Il repose la barrette en @@ -1321,6 +1339,11 @@ begin if Assigned(FOnTrayRestore) then FOnTrayRestore(); if Assigned(FOnFillBarSettings) then FOnFillBarSettings(); end + else if LCmd = LAZY_MENU_CLEAR then + begin + if FLazyClear then SetPref(LAZY_CLEAR_KEY, '0') else SetPref(LAZY_CLEAR_KEY, '1'); + ReloadLazyBar; + end else if LCmd = LAZY_MENU_ICONS then begin if FLazyIcons then SetPref(LAZY_ICONS_KEY, '0') else SetPref(LAZY_ICONS_KEY, '1'); @@ -1403,6 +1426,14 @@ begin WM_ERASEBKGND: begin GetClientRect(FLazyWnd, LRect); + if FLazyClear then + begin + LBrush := CreateSolidBrush(LAZY_KEY_COLOR); + FillRect(HDC(AMsg.WParam), LRect, LBrush); + DeleteObject(LBrush); + AMsg.Result := 1; + Exit; + end; LBrush := CreateSolidBrush(IfThen(FDarkTheme, LAZY_DARK_BG, LAZY_LITE_BG)); FillRect(HDC(AMsg.WParam), LRect, LBrush); DeleteObject(LBrush); @@ -1580,6 +1611,7 @@ begin FLazyAlphaPct := LAZY_ALPHA_DEFAULT; FLazyIcons := GetPref(LAZY_ICONS_KEY) = '1'; + FLazyClear := GetPref(LAZY_CLEAR_KEY) = '1'; LList := GetPref(LAZY_BTNS_KEY); if LList = '' then LList := LAZY_BTNS_DEFAULT; InitCommonControls; diff --git a/delphi-backend/UMainForm.pas b/delphi-backend/UMainForm.pas index 2da4864..c7a1d2a 100644 --- a/delphi-backend/UMainForm.pas +++ b/delphi-backend/UMainForm.pas @@ -1347,6 +1347,7 @@ begin LFb.AddPair('buttons', PM.UserPrefs.GetPref('lazyButtons')); LFb.AddPair('icons', TJSONBool.Create(PM.UserPrefs.GetPref('lazyIcons') = '1')); LFb.AddPair('alpha', PM.UserPrefs.GetPref('lazyAlphaPct')); + LFb.AddPair('clear', TJSONBool.Create(PM.UserPrefs.GetPref('lazyClear') = '1')); WebBrowser.ExecuteJavaScript( 'if(window.Bridge&&Bridge.onFillBar)Bridge.onFillBar(' + LFb.ToJSON + ')'); finally @@ -1359,6 +1360,8 @@ begin PM.UserPrefs.SetPref('lazyButtons', GetParam('buttons')); if GetParam('icons') = '1' then PM.UserPrefs.SetPref('lazyIcons', '1') else PM.UserPrefs.SetPref('lazyIcons', '0'); + if GetParam('clear') = '1' then PM.UserPrefs.SetPref('lazyClear', '1') + else PM.UserPrefs.SetPref('lazyClear', '0'); var LAlpha := StrToIntDef(GetParam('alpha'), 60); if (LAlpha >= 25) and (LAlpha <= 100) then PM.UserPrefs.SetPref('lazyAlphaPct', IntToStr(LAlpha)); diff --git a/index.html b/index.html index 08566e9..3ea50da 100644 --- a/index.html +++ b/index.html @@ -785,6 +785,16 @@ +