Skip to content

Commit

Permalink
update fluent-tray
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Feb 23, 2024
1 parent 3142a06 commit 5f773ba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
39 changes: 17 additions & 22 deletions libs/fluent_tray/fluent_tray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_(),
Expand All @@ -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),
Expand Down Expand Up @@ -760,32 +768,19 @@ 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.
*/
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 ;
Expand Down
2 changes: 1 addition & 1 deletion src/core/version.hpp
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ 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<std::string>() ;

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 ;
}
Expand Down

0 comments on commit 5f773ba

Please sign in to comment.