From ede4a58e9d624d376f8a476bb534aceb4ad1d8f0 Mon Sep 17 00:00:00 2001 From: pit-ray Date: Thu, 15 Feb 2024 13:44:38 +0900 Subject: [PATCH] fix the background color of tray --- libs/fluent_tray/fluent_tray.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/fluent_tray/fluent_tray.hpp b/libs/fluent_tray/fluent_tray.hpp index 59326811..9595bc1a 100644 --- a/libs/fluent_tray/fluent_tray.hpp +++ b/libs/fluent_tray/fluent_tray.hpp @@ -82,6 +82,14 @@ typedef enum { #define FLUENT_TRAY_MESSAGE_ID_OFFSET (25) #endif +#ifndef FLUENT_TRAY_COLORPICK_OFFSET +/** + * @brief Pixel offset to determine the background color. + */ +#define FLUENT_TRAY_COLORPICK_OFFSET (5) +#endif + + /** * @namespace fluent_tray * @brief Base namespace @@ -1326,7 +1334,10 @@ namespace fluent_tray if(auto dc = GetDC(NULL)) { // Get Taskbar color - back_color_ = GetPixel(dc, abd.rc.left + 1, abd.rc.top + 1) ; + back_color_ = GetPixel( + dc, + abd.rc.left + FLUENT_TRAY_COLORPICK_OFFSET, + abd.rc.top + FLUENT_TRAY_COLORPICK_OFFSET) ; if(back_color_ == CLR_INVALID) { // if failed, use COLOR_WINDOW color. back_color_ = GetSysColor(COLOR_WINDOW) ;