Skip to content

Commit

Permalink
define DWMWA when win10 system
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Feb 11, 2024
1 parent f161cb5 commit 12beb6c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions include/fluent_tray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@

#include <dwmapi.h>

#if defined(DWMWA_COLOR_DEFAULT)
#define FLUENT_TRAY_DWMWA_AVAIABLE 1
#ifndef DWMWA_COLOR_DEFAULT
#define DWMWA_WINDOW_CORNER_PREFERENCE static_cast<DWMWINDOWATTRIBUTE>(33)
typedef enum {
DWMWCP_DEFAULT = 0,
DWMWCP_DONOTROUND = 1,
DWMWCP_ROUND = 2,
DWMWCP_ROUNDSMALL = 3
} DWM_WINDOW_CORNER_PREFERENCE;
#endif

#if defined(FLUENT_TRAY_DWMWA_AVAIABLE)
#pragma comment(lib, "Dwmapi")
#endif


namespace fluent_tray
Expand Down Expand Up @@ -589,15 +593,13 @@ namespace fluent_tray

// Set rounded window for Windows 11 only.
if(round_corner) {
#if defined(FLUENT_TRAY_DWMWA_AVAIABLE)
auto pref = DWMWCP_ROUND ;
if(DwmSetWindowAttribute(
hwnd_,
DWMWA_WINDOW_CORNER_PREFERENCE,
&pref, sizeof(pref)) != S_OK) {
return false ;
}
#endif
}

if(!change_icon(icon_path)) {
Expand Down

0 comments on commit 12beb6c

Please sign in to comment.