Skip to content

Commit

Permalink
TaskbarItem API Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Jan 30, 2024
1 parent 821c450 commit 7fac12f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion docs/taskbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Path: `Nickvision::Taskbar::TaskbarItem`
long Count: get, set
```
- The count shown on the taskbar item.
- Note: Setting the count will set the count visible to true if count > 0, else will set count visible to false.

### Methods
- ```cpp
Expand Down
2 changes: 1 addition & 1 deletion include/taskbar/taskbaritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace Nickvision::Taskbar
*/
long getCount() const;
/**
* @brief Sets the count shown on the taskbar item. Setting the count will set the count visible to true if count > 0, else will set count visible to false.
* @brief Sets the count shown on the taskbar item.
* @param count The new count value
*/
void setCount(long count);
Expand Down
8 changes: 5 additions & 3 deletions src/taskbar/taskbaritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace Nickvision::Taskbar

void TaskbarItem::setProgress(double progress)
{
setProgressState(progress == 0 ? ProgressState::NoProgress : ProgressState::Normal);
setProgressState(progress > 0 ? ProgressState::Normal : ProgressState::NoProgress);
std::lock_guard<std::mutex> lock{ m_mutex };
m_progress = progress;
#ifdef _WIN32
Expand Down Expand Up @@ -141,11 +141,13 @@ namespace Nickvision::Taskbar

void TaskbarItem::setCount(long count)
{
setCountVisible(count > 0);
std::lock_guard<std::mutex> lock{ m_mutex };
m_count = count;
#ifdef _WIN32
drawCountIcon();
if(m_countVisible)
{
drawCountIcon();
}
#elif defined(__linux__)
sendDBusUpdate();
#endif
Expand Down

0 comments on commit 7fac12f

Please sign in to comment.