From 5f773ba80103c5423c14442ac40301ff016512bb Mon Sep 17 00:00:00 2001 From: pit-ray Date: Fri, 23 Feb 2024 21:51:21 +0900 Subject: [PATCH] update fluent-tray --- libs/fluent_tray/fluent_tray.hpp | 39 ++++++++++++++------------------ src/core/version.hpp | 2 +- src/main.cpp | 4 ++-- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/libs/fluent_tray/fluent_tray.hpp b/libs/fluent_tray/fluent_tray.hpp index 14b1e6a4..60f3b921 100644 --- a/libs/fluent_tray/fluent_tray.hpp +++ b/libs/fluent_tray/fluent_tray.hpp @@ -706,14 +706,22 @@ namespace fluent_tray public: /** * @brief Create tray object. - * @param [in] message_id_offset Unique message identifier. - * @param [in] autocolorpick_offset Pixel offset to determine the background color. + * @param [in] menu_x_margin Horizontal margins outside menus. + * @param [in] menu_y_margin Vertical margins outside menus. + * @param [in] menu_x_pad Horizontal paddings inside menus. + * @param [in] menu_y_pad Vertical paddings inside menus. * @param [in] autofadedborder_from_backcolor Decay value from the background color to determine the background color of the currently selected menu and the color of the separator line. + * @param [in] autocolorpick_offset Pixel offset to determine the background color. + * @param [in] message_id_offset Unique message identifier. */ explicit FluentTray( - int message_id_offset=25, + LONG menu_x_margin=5, + LONG menu_y_margin=5, + LONG menu_x_pad=10, + LONG menu_y_pad=5, + unsigned char autofadedborder_from_backcolor=10, int autocolorpick_offset=5, - unsigned char autofadedborder_from_backcolor=10) + int message_id_offset=25) : menus_(), mouse_is_over_(), app_name_(), @@ -723,10 +731,10 @@ namespace fluent_tray icon_data_(), status_(TrayStatus::STOPPED), next_menu_id_(1), - menu_x_margin_(5), - menu_y_margin_(5), - menu_x_pad_(5), - menu_y_pad_(5), + menu_x_margin_(menu_x_margin), + menu_y_margin_(menu_y_margin), + menu_x_pad_(menu_x_pad), + menu_y_pad_(menu_y_pad), text_color_(CLR_INVALID), back_color_(CLR_INVALID), border_color_(CLR_INVALID), @@ -760,10 +768,6 @@ namespace fluent_tray * @brief Initialize tray and create icon on tray. * @param [in] app_name The application name to be displayed as tooltip text. * @param [in] icon_path A UTF-8 encoded path to the icon to be displayed in the system tray. - * @param [in] menu_x_margin Horizontal margins outside menus. - * @param [in] menu_y_margin Vertical margins outside menus. - * @param [in] menu_x_pad Horizontal paddings inside menus. - * @param [in] menu_y_pad Vertical paddings inside menus. * @param [in] opacity Menu opacity from 0 to 255. * @param [in] round_corner Option to round the corners of the menu window (Windows 11 only) * @return Returns true on success, false on failure. @@ -771,21 +775,12 @@ namespace fluent_tray bool create_tray( const std::string& app_name, const std::string& icon_path="", - LONG menu_x_margin=5, - LONG menu_y_margin=5, - LONG menu_x_pad=10, - LONG menu_y_pad=5, - unsigned char opacity=255, + unsigned char opacity=255, bool round_corner=true) { if(!util::string2wstring(app_name, app_name_)) { return false ; } - menu_x_margin_ = menu_x_margin ; - menu_y_margin_ = menu_y_margin ; - menu_x_pad_ = menu_x_pad ; - menu_y_pad_ = menu_y_pad ; - WNDCLASSW winc ; winc.style = CS_HREDRAW | CS_VREDRAW ; winc.lpfnWndProc = &FluentTray::callback ; diff --git a/src/core/version.hpp b/src/core/version.hpp index 10fd4ad8..45521195 100644 --- a/src/core/version.hpp +++ b/src/core/version.hpp @@ -1,6 +1,6 @@ #ifndef _VERSION_HPP #define _VERSION_HPP -#define WIN_VIND_VERSION "5.11.2.0" +#define WIN_VIND_VERSION "5.11.3.0" #endif diff --git a/src/main.cpp b/src/main.cpp index 33d513e1..13938847 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -184,7 +184,7 @@ int WINAPI WinMain( entry.init() ; - fluent_tray::FluentTray tray{} ; + fluent_tray::FluentTray tray(5, 5, 10, 10) ; auto& settable = core::SetTable::get_instance() ; const auto& icon_path = settable.get("icon_style").get() ; @@ -192,7 +192,7 @@ int WINAPI WinMain( if(!tray.create_tray( "win-vind", (core::RESOURCE_ROOT_PATH() / "icons" / icon_path).u8string(), - 5, 5, 10, 10, 240, true)) { + 240, true)) { PRINT_ERROR("Failed tray initialization") ; return 1 ; }