diff --git a/CONFIG.md b/CONFIG.md deleted file mode 100644 index 4daad8e..0000000 --- a/CONFIG.md +++ /dev/null @@ -1,209 +0,0 @@ -### Other Languages -[简体中文](./Config/zh-cn.md) -## Storage Location -TranslucentFlyouts stores the majority of its information in the Windows registry, which can be accessed at ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\```. Configuration information is categorized based on functionality and is expanded into relevant subkeys under this path. - -Since the current UI has not been developed yet, you need to manually make modifications, and each change will take effect immediately. -If the subkeys are not exist, then you have to manually create them by yourself. - -## Appearance Settings -
General - -### -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts``` -> Note: **If there are values with the same name under ```Menu``` or ```DropDown```, the values in the subkeys will be prioritized, and this part will be ignored.** - -The following are the accepted values: - -```EffectType``` -```ini -# DWORD (32-bit) value that controls the type of effect, ranging from 0 to 7 -# 0: Disable all effects -# 1: Transparent - no background blur or other effects -# 2: Solid color - opacity will be ignored -# 3: Blur - also known as Aero -# 4: Classic acrylic blur -# 5: Modern acrylic blur - same as Windows 10, available only in Windows 11 -# ======= The following values are available only in Windows 11 ======== -# 6: Acrylic - overlay color and opacity are ignored, determined automatically by the system -# 7: Mica - overlay color and opacity are ignored, determined automatically by the system, not recommended as it looks ugly -# 8: MicaAlt - overlay color and opacity are ignored, determined automatically by the system, higher opacity compared to Mica, not recommended as it looks ugly -``` -```EnableDropShadow``` -```ini -# DWORD (32-bit) value that controls whether the drop shadow is enabled, set to 1 to enable, 0 to disable (recommended to enable) -``` -```DarkMode_GradientColor``` -```ini -# DWORD (32-bit) value that controls the overlay color in dark mode (RGB) -``` -```LightMode_GradientColor``` -```ini -# DWORD (32-bit) value that controls the overlay color in light mode (RGB) -``` -```DarkMode_Opacity``` -```ini -# DWORD (32-bit) value that controls the opacity in dark mode (RGB) -``` -```LightMode_Opacity``` -```ini -# DWORD (32-bit) value that controls the opacity in light mode (RGB) -``` -```Disabled``` -```ini -# DWORD (32-bit) value that controls whether the feature is disabled -``` -
- -Modify your general appearance settings. -
Dropdown Control - -### -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\DropDown``` -The following are the accepted values: - -Refer to the ```General``` section for details. -
- -Modify the appearance of the dropdown control. - -
Menu - -### -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu``` -The following are the accepted values: - -```NoSystemOutline``` -```ini -# DWORD (32-bit) value that controls whether to remove the system-drawn bounding rectangle, set to 1 to remove, 0 to keep -# After setting to 1, you can customize the corner type (Windows 11), change or remove the border color (Windows 11), -# and change the color of the bounding rectangle (Windows 10/11) -``` -```EnableImmersiveStyle``` -```ini -# DWORD (32-bit) value that controls whether to use a modern menu style, set to 1 to enable, 0 to disable (enabled by default) -# On Windows 10, the appearance will be as consistent as possible with the context menu of the desktop right-click -# On Windows 11, users should not change this value -``` -```EnableCustomRendering``` -```ini -# DWORD (32-bit) value that controls whether to use custom rendering, set to 1 to enable, 0 to disable (disabled by default) -# By default, TranslucentFlyouts uses theme bitmaps and the Theme API for rendering, but sometimes you may find the default system themes too ugly -# When enabled, TranslucentFlyouts will use Direct2D for rendering, allowing you to not only customize the color and opacity but also achieve significant performance improvements -# On Windows 11, users can change this value to ensure compatibility with StartAllBack -``` - -For other details, refer to the ```General``` section. -
- -Modify the overall appearance of the popup menu. - -
Menu Items - -### -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\*``` -> ```*``` can be ```Hot```, ```DisabledHot```, ```Focusing``` (Windows 11 only), ```Border```, or ```Separator``` - -The following are the accepted values: - -```DarkMode_GradientColor``` -```ini -# DWORD (32-bit) value that controls the overlay color in dark mode (RGB) -# For the Border subkey, this value represents the border color; for other subkeys, it is only used when EnableCustomRendering is enabled -``` -```LightMode_GradientColor``` -```ini -# DWORD (32-bit) value that controls the overlay color in light mode (RGB) -# For the Border subkey, this value represents the border color; for other subkeys, it is only used when EnableCustomRendering is enabled -``` -```DarkMode_Opacity``` -```ini -# DWORD (32-bit) value that controls the opacity in dark mode (RGB) -# In Windows 11, this value is not available for the Border subkey; for other subkeys, it is only used when EnableCustomRendering is enabled -``` -```LightMode_Opacity``` -```ini -# DWORD (32-bit) value that controls the opacity in light mode (RGB) -# In Windows 11, this value is not available for the Border subkey; for other subkeys, it is only used when EnableCustomRendering is enabled -``` -```Disabled``` -```ini -# DWORD (32-bit) value that controls whether the custom rendering is disabled for this part -# For example, if you don't want the separator to be handled by custom rendering, you can set this value to 1 under the Separator subkey -# The Border subkey ignores this value -``` -```CornerRadius``` -```ini -# DWORD (32-bit) value that controls the corner radius, recommended value is 8 -# Only used when EnableCustomRendering is enabled -``` -```EnableThemeColorization``` -```ini -# DWORD (32-bit) value that controls whether to use the current theme color to fill the overlay color and opacity -# Only used when EnableCustomRendering is enabled -``` -
- -Define the appearance of highlighted items, disabled highlighted items, borders, separators, etc., in the popup menu. - -
Special Menu Items - -### Separator -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Separator``` - -The following are the accepted values: - -```ini -# DWORD (32-bit) value that controls the thickness of the separator line -# The usage and name of this value may change or be removed in the future, so it is recommended not to use it -``` - -### Border -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Border``` -In Windows 11, there are two types of borders due to historical reasons. Usually, you will only see the second type of border, and it cannot have opacity settings. To ensure consistency in settings, TranslucentFlyouts will change the appearance of both types of borders. - -The following are the accepted values: - -```NoBorderColor``` -```ini -# DWORD (32-bit) value that controls whether to disable the border color, set to 1 to disable, 0 for the default option -# When enabled, the color and opacity will be ignored -# Only applicable to Windows 11 -``` -```CornerType``` -```ini -# DWORD (32-bit) value that controls the corner type -# 0: Keep the default, use small corners -# 1: Square corners -# 2: Large corners -# 3: Small corners -# Only applicable to Windows 11 -``` - -### Focusing Item -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Focusing``` -Triggered by the ↓↑ keys on the keyboard in Windows 11, not available in Windows 10. - -The following are the accepted values: - -```FocusingWidth``` -```ini -# DWORD (32-bit) value that controls the line width of the focusing rectangle -# The usage and name of this value may change or be removed in the future, so it is recommended not to use it -``` - -
- -Define the size of the separator, focusing rectangle, and more details of the border. - -
Toolbar (Tooltip) - -### -Path: ```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Tooltip``` -The following are the accepted values: - -**Coming soon!** - -
- -Modify the overall appearance of the toolbar (tooltip). \ No newline at end of file diff --git a/Config/zh-cn.md b/Config/zh-cn.md deleted file mode 100644 index 9f2631b..0000000 --- a/Config/zh-cn.md +++ /dev/null @@ -1,211 +0,0 @@ -### Other Languages -[English](../CONFIG.md) -## 存储位置 -TranslucentFlyouts将绝大部分信息储存在Windows注册表中,你可以通过访问```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\```找到它们。配置信息会根据功能进行分类,在这个路径下依次展开成相关的子分支 - -由于当前UI还没有开发出来,所以需要你手动进行修改,每一次更改都会立即生效 -如果指定的键值不存在,你需要手动创建它们 - -## 外观设置 -
通用 - -### -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts``` -> 注意:**如果```Menu```或```DropDown```下存在同名值,则会优先读取子分支的值,忽略该部分** - -以下为可被接受的值 - -```EffectType``` -```ini -# DWORD(32)值,控制效果类型,范围为0~7 -# 0,禁用任何效果 -# 1,透明,背景没有模糊等效果 -# 2,纯色,不透明度将会被忽略 -# 3,模糊,又称Aero -# 4,经典亚克力模糊 -# 5,现代亚克力模糊,Windows 10表现同上,仅Windows 11可用 -# ======= 以下的值仅Windows 11可用 ======== -# 6,Acrylic,叠加色和不透明度会被忽略,由系统自动决定 -# 7,Mica,叠加色和不透明度会被忽略,由系统自动决定,不推荐,看起来很丑 -# 8,MicaAlt,叠加色和不透明度会被忽略,由系统自动决定,相比于Mica透明度更高,不推荐,也是看起来很丑 -``` -```EnableDropShadow``` -```ini -# DWORD(32)值,控制是否启用阴影,设为1启用,0则禁用,推荐启用 -``` -```DarkMode_GradientColor``` -```ini -# DWORD(32)值,控制暗模式下的叠加色(RGB) -``` -```LightMode_GradientColor``` -```ini -# DWORD(32)值,控制亮模式下的叠加色(RGB) -``` -```DarkMode_Opacity``` -```ini -# DWORD(32)值,控制暗模式下的不透明度(RGB) -``` -```LightMode_Opacity``` -```ini -# DWORD(32)值,控制亮模式下的不透明度(RGB) -``` -```Disabled``` -```ini -# DWORD(32)值,控制是否禁用 -``` -
- -更改你的通用外观 -
下拉控件 - -### -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\DropDown``` -以下为可被接受的值 - -详见于```通用``` -
- -更改下拉控件的外观 - -
菜单 - -### -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu``` -以下为可被接受的值 - -```NoSystemOutline``` -```ini -# DWORD(32)值,控制是否去除系统绘制的边界矩形,设为1移除,0则不去除 -# 设为1后,你可以自定义圆角类型(Windows 11),改变甚至移除边框颜色(Windows 11), -# 以及边界矩形的颜色(Windows 10/11) -``` -```EnableImmersiveStyle``` -```ini -# DWORD(32)值,控制是否使用现代化的菜单外观,设为1启用,0则禁用(默认情况下启用) -# 在Windows 10上,外观将尽可能与桌面右键的上下文菜单一致 -# 在Windows 11上,用户不应该更改此值 -``` -```EnableCustomRendering``` -```ini -# DWORD(32)值,控制是否使用自定义渲染,设为1启用,0则禁用(默认情况下禁用) -# 默认情况下使用主题位图和Theme API进行渲染,但有时候你可能觉得系统默认的主题太丑了 -# 启用该项后,TranslucentFlyouts将采用Direct2D进行渲染, -# 这时候,你不仅可以自定义颜色和不透明度,还可以获得性能上的大大提升 -# 在Windows 11上,用户可以更改此值以兼容StartAllBack -``` - -其余内容详见于```通用``` -
- -更改弹出菜单的大体外观 - -
菜单详细项 - -### -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\*``` -> ```*```有```Hot、DisabledHot、Focusing(仅Windows 11)、Border、Separator``` - -以下为可被接受的值 - -```DarkMode_GradientColor``` -```ini -# DWORD(32)值,控制暗模式下的叠加色(RGB) -# Border分支下该值是边框颜色,其余分支仅在启用EnableCustomRendering后使用 -``` -```LightMode_GradientColor``` -```ini -# DWORD(32)值,控制亮模式下的叠加色(RGB) -# Border分支下该值是边框颜色,其余分支仅在启用EnableCustomRendering后使用 -``` -```DarkMode_Opacity``` -```ini -# DWORD(32)值,控制暗模式下的不透明度(RGB) -# Windows 11中,Border分支下该值不可用,其余分支仅在启用EnableCustomRendering后使用 -``` -```LightMode_Opacity``` -```ini -# DWORD(32)值,控制亮模式下的不透明度(RGB) -# Windows 11中,Border分支下该值不可用,其余分支仅在启用EnableCustomRendering后使用 -``` -```Disabled``` -```ini -# DWORD(32)值,控制是否禁用该部分的自定义渲染 -# 例如你不希望分割线被自定义渲染接管,你可以将Separator下的此值设为1 -# Border分支无视该值 -``` -```CornerRadius``` -```ini -# DWORD(32)值,控制圆角半径大小,推荐为8 -# 仅在启用EnableCustomRendering后使用 -``` -```EnableThemeColorization``` -```ini -# DWORD(32)值,控制是否用当前主题色填充叠加色和不透明度 -# 仅在启用EnableCustomRendering后使用 -``` -
- -定义弹出菜单高亮项、禁用的高亮项,边框,聚焦等的外观 - -
较为特殊的菜单详细项 - -### 分割线 -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Separator``` - -以下为可被接受的值 - -```SeparatorWidth``` -```ini -# DWORD(32)值,控制分割线的粗细 -# 该值的用法和名称可能会在未来被改变、删除,请尽量不要使用它 -``` - -### 边框 -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Border``` -由于历史遗留原因,Windows 11有两种边框,第一种边框Windows 10也有,通常来讲你只会看到第二种边框,并且它无法设置不透明度,为了设置的通用性,TranslucentFlyouts会同时更改两种边框的外观 - -以下为可被接受的值 - -```NoBorderColor``` -```ini -# DWORD(32)值,控制是否禁用边框颜色,设为1禁用,0为默认选项 -# 启用后颜色和不透明度将会被忽略 -# 仅适用于Windows 11 -``` -```CornerType``` -```ini -# DWORD(32)值,控制边角类型 -# 0,保持默认,使用小圆角 -# 1,直角 -# 2,大圆角 -# 3,小圆角 -# 仅适用于Windows 11 -``` - -### 聚焦项 -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Focusing``` -在Windows 11上通过按下键盘的↓↑触发,Windows 10不可用 - -以下为可被接受的值 - -```FocusingWidth``` -```ini -# DWORD(32)值,控制聚焦矩形的线宽 -# 该值的用法和名称可能会在未来被改变、删除,请尽量不要使用它 -``` - -
- -定义分割线,聚焦矩形的大小,以及边框的更多信息 - -
工具条(工具提示) - -### -路径:```HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Tooltip``` -以下为可被接受的值 - -**即将到来!** -**COMING SOON!** -
- -更改工具条的大体外观 diff --git a/Config/zh-cn/CONFIG.md b/Config/zh-cn/CONFIG.md new file mode 100644 index 0000000..62b7388 --- /dev/null +++ b/Config/zh-cn/CONFIG.md @@ -0,0 +1,238 @@ +# TranslucentFlyouts +> 由于可配置的功能较多,所以该页面可能无法及时得到更新。 +因此我们呼吁大家一起完善这份文档,任何PR都是受欢迎的! +## 其它语言 +[English](../en-us/CONFIG.md) +## 描述 +目标版本: +- V2.0.0-alpha.4 +> 注意: +> 不支持更早的版本,对于更新的版本而言,该页面及子页面所显示的内容可能已经过时。 + +当前版本TranslucentFlyouts使用注册表储存配置信息。 +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\` +这里的值用于定义弹出菜单和下拉控件的通用外观,子项中与之相同的值将被优先读取。 +有关的子项,见: +- [Menu](./Menu/CONFIG.md) +- [DropDown](./DropDown/CONFIG.md) +## 值 +类型: DWORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称可被接受的值描述
+
+
EffectType
+
默认值: 5
+
+
+
+
无: 0
+
完全透明: 1
+
纯色: 2
+
模糊: 3
+
亚克力: 4
+
现代化亚克力: 5
+
亚克力背景层: 6
+
云母背景层: 7
+
云母变体背景层: 8
+
+
+
弹出控件使用的效果和背景类型。
+
+
Windows 10:  不支持6、7、8,使用5等同于使用4
+
Windows 11 22H2+:  不支持2、3
+Windows 11 (Build 22000 之前):  不支持6、8 +
注意: 使用6、7、8时,流利菜单动画将无法正确渲染
+
+
+
CornerType
+
默认值: 3
+
+
+
+
不更改: 0
+
直角: 1
+
大圆角: 2
+
小圆角: 3
+
+
+
弹出控件使用的边角类型。
+
+
Windows 10:  不支持
+
+
+
EnableDropShadow
+
默认值: 0
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
开启额外带有阴影的边框。
+注意:当且仅当EffectType为4或5,且CornerType为1时才可见 +
+
+
NoBorderColor
+
默认值: 0
+
+
+
+
使用边框颜色: 0
+
不使用边框颜色: 1
+
+
+
不渲染系统边框。
+
+Windows 10:  仅支持移除弹出菜单的系统边框 +
+
+
EnableThemeColorization
+
默认值: 0
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
使用你当前的主题色作为系统边框颜色
+
DarkMode_BorderColor/LightMode_BorderColor值存在时,该选项将被忽略
+
+
+
DarkMode_BorderColor
+
默认值: 主题定义的值
+
+
+
+
+
+
深色模式下边框颜色 (AARRGGBB)。
+
+
Windows 10:  仅支持覆盖弹出菜单的系统边框颜色
+
Windows 11:  CornerType不为1时,Alpha通道将总是被忽略
+
+
+
LightMode_BorderColor
+
默认值: 主题定义的值
+
+
+
+
+
+
浅色模式下边框颜色 (AARRGGBB)。
+
+
Windows 10:  仅支持覆盖弹出菜单的系统边框颜色
+
Windows 11:  使用圆角时,Alpha通道将总是被忽略
+
+
+
DarkMode_GradientColor
+
默认值: 0x412B2B2B
+
+
+
+
+
+
深色模式下叠加色的颜色 (AARRGGBB),被EffectType使用。
+
+注意:当EffectType为6、7、8时,该值将会被忽略 +
+
+
LightMode_GradientColor
+
默认值: 0x9EDDDDDD
+
+
+
+
+
+
浅色模式下叠加色的颜色 (AARRGGBB),被EffectType使用。
+
+注意:当EffectType为6、7、8时,该值将会被忽略 +
+
+
Disabled
+
默认值: 0
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
禁用TranslucentFlyouts。
+弹出菜单和下拉控件的半透明和动画效果将消失。 +
+ +## 读取顺序 +有时候部分的值可能未被创建,即尚不存在,此时TranslucentFlyouts将使用特定的读取顺序作为回退,尽可能读取到创建的值。 +你可以使用此特性创建适用于多个用户的统一配置 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\` +3. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/DropDown/CONFIG.md b/Config/zh-cn/DropDown/CONFIG.md new file mode 100644 index 0000000..e6add9a --- /dev/null +++ b/Config/zh-cn/DropDown/CONFIG.md @@ -0,0 +1,22 @@ +# DropDown +[返回上一级](../CONFIG.md) +## 描述 +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\DropDown` +## 值 +类型: DWORD +> 继承于[TranslucentFlyouts](..\CONFIG.md),同样使用其中的值 + + + + + + + +
名称可被接受的值描述
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\DropDown` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\DropDown` +3. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\` +4. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\` +5. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/Menu/Animation/CONFIG.md b/Config/zh-cn/Menu/Animation/CONFIG.md new file mode 100644 index 0000000..56e601a --- /dev/null +++ b/Config/zh-cn/Menu/Animation/CONFIG.md @@ -0,0 +1,129 @@ +# Animation +[返回上一级](../CONFIG.md) +## 描述 +> 注意: +> 设置本页面中的大部分值都需要[Menu](../CONFIG.md)中的`EnableFluentAnimation`为1,否则这些值将会被忽略。 + +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Animation` +## 值 +类型: DWORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称可被接受的值描述
+
+
FadeOutTime
+
默认值: 350
+
+
+
+
+
+
菜单项交互后的淡出动画持续时间 (ms)。
+
+
EnableFluentAnimation可以不为1
+
+
+
PopInTime
+
默认值: 250
+
+
+
+
+
+
弹出动画的弹出持续时间 (ms)。
+
+
+
FadeInTime
+
默认值: 87
+
+
+
+
+
+
弹出动画的淡入持续时间 (ms)。
+
+
+
PopInStyle
+
默认值: 0
+
+
+
+
0: 下滑 (WinUI/UWP)
+
1: 水波扩散
+
2: 平滑滚动
+
3: 平滑缩放
+
+
+
弹出动画的样式。
+
+
+
StartRatio
+
默认值: 50
+
+
+
+
0-100
+
+
+
弹出动画的百分比 (%)。
+
提高该值可以减少动画滞后的视觉错觉,但过高会削弱动画的视觉效果;减少该值可以更好的享受动画的视觉体验,但过低可能会影响操作体验。
+
+
+
EnableImmediateInterupting
+
默认值: 0
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
允许用户立即打断动画。
+
启用该项后,当鼠标选中/悬浮在一个菜单项时会立刻中止并直接结束流利动画。
+
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Animation` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\Menu\Animation` +3. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/Menu/CONFIG.md b/Config/zh-cn/Menu/CONFIG.md new file mode 100644 index 0000000..2d44853 --- /dev/null +++ b/Config/zh-cn/Menu/CONFIG.md @@ -0,0 +1,103 @@ +# Menu +[返回上一级](../CONFIG.md) +## 描述 +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu` +有关的子项,见: +- [Animation](./Animation/CONFIG.md) +- [DisabledHot](./DisabledHot/CONFIG.md) +- [Focusing](./Focusing/CONFIG.md) +- [Hot](./Hot/CONFIG.md) +- [Separator](./Separator/CONFIG.md) +## 值 +类型: DWORD +> 继承于[TranslucentFlyouts](..\CONFIG.md),同样使用其中的值 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称可被接受的值描述
+
+
NoSystemDropShadow
+
默认值: 0
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
移除老式的系统阴影(SysShadow)。
+
通常来说Windows 11没有老式的系统阴影,除非你使用直角样式的菜单
+
+
+
EnableImmersiveStyle
+
默认值: 1
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
统一弹出菜单的外观为现代化菜单。
+
+Windows 11:强烈建议不要禁用该项 +
+
+
EnableCustomRendering
+
默认值: 0
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
开启自定义渲染模式。
+
+
+
EnableFluentAnimation
+
默认值: 0
+
+
+
+
禁用: 0
+
启用: 1
+
+
+
为弹出菜单开启现代化的流利弹出动画。
+
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\Menu` +3. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\` +4. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\` +5. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/Menu/CustomRendering/CONFIG.md b/Config/zh-cn/Menu/CustomRendering/CONFIG.md new file mode 100644 index 0000000..ee9602e --- /dev/null +++ b/Config/zh-cn/Menu/CustomRendering/CONFIG.md @@ -0,0 +1,117 @@ +# CustomRendering +[返回上一级](../CONFIG.md) +## 描述 +> 注意: +> [Menu](../CONFIG.md)中的`EnableCustomRendering`必须为1,否则本页面的值将会被忽略。 + +有关的存储位置: +- `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\DisabledHot` +- `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Focusing` +- `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Hot` +- `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Separator` +## 值 +类型: DWORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
名称可被接受的值描述
+
+
CornerRadius
+
默认值: 8
+
+
+
+
+
+
菜单项的圆角半径
+
+
+
DarkMode_Color
+
DisabledHot 默认值: 0
+
Hot 默认值: 0x41808080
+
Separator 默认值: 0x30D9D9D9
+
Focusing 默认值: 0xFFFFFFFF
+
+
+
+
+
+
深色模式下的颜色 (AARRGGBB),被用于渲染边框或填充矩形。
+
+
+
LightMode_Color
+
DisabledHot 默认值: 0
+
Hot 默认值: 0x30000000
+
Separator 默认值: 0x30262626
+
Focusing 默认值: 0xFF000000
+
+
+
+
+
+
浅色模式下的颜色 (AARRGGBB),被用于渲染边框或填充矩形。
+
+
+
+
EnableThemeColorization
+
默认值: 0
+
+
+
+
0: 禁用
+
1: 启用
+
+
+
使用你当前的主题色覆盖LightMode_Color/DarkMode_Color中的值
+
+
+
Disabled
+
默认值: 0
+
+
+
+
0: 启用
+
1: 禁用
+
+
+
禁用后该部分不采用自定义渲染
+
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\*` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\Menu\*` +3. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/Menu/DisabledHot/CONFIG.md b/Config/zh-cn/Menu/DisabledHot/CONFIG.md new file mode 100644 index 0000000..05cfead --- /dev/null +++ b/Config/zh-cn/Menu/DisabledHot/CONFIG.md @@ -0,0 +1,23 @@ +# DisabledHot +[返回上一级](../CONFIG.md) +## 描述 +> 注意: +> [Menu](../CONFIG.md)中的`EnableCustomRendering`必须为1,否则本页面的值将会被忽略。 + +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\DisabledHot` +## 值 +类型: DWORD +> 继承于[CustomRendering](..\CustomRendering\CONFIG.md),同样使用其中的值 + + + + + + + +
名称可被接受的值描述
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\DisabledHot` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\Menu\DisabledHot` +3. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/Menu/Focusing/CONFIG.md b/Config/zh-cn/Menu/Focusing/CONFIG.md new file mode 100644 index 0000000..5df006c --- /dev/null +++ b/Config/zh-cn/Menu/Focusing/CONFIG.md @@ -0,0 +1,42 @@ +# Focusing +[返回上一级](../CONFIG.md) +## 描述 +> 注意: +> [Menu](../CONFIG.md)中的`EnableCustomRendering`必须为1,否则本页面的值将会被忽略。 + +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Focusing` +## 值 +类型: DWORD +> 继承于[CustomRendering](..\CustomRendering\CONFIG.md),同样使用其中的值 + + + + + + + + + + + + + +
名称可被接受的值描述
+
+
Width
+
默认值: 1000
+
+
+
+
+
+
控制弹出菜单聚焦矩形的边框粗细。
+
TranslucentFlyouts会将该值除以1000转换为设备无关像素(DIP)。
+
+Windows 10:不支持该值 +
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Focusing` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\Menu\Focusing` +3. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/Menu/Hot/CONFIG.md b/Config/zh-cn/Menu/Hot/CONFIG.md new file mode 100644 index 0000000..1a1de3a --- /dev/null +++ b/Config/zh-cn/Menu/Hot/CONFIG.md @@ -0,0 +1,23 @@ +# Hot +[返回上一级](../CONFIG.md) +## 描述 +> 注意: +> [Menu](../CONFIG.md)中的`EnableCustomRendering`必须为1,否则本页面的值将会被忽略。 + +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Hot` +## 值 +类型: DWORD +> 继承于[CustomRendering](..\CustomRendering\CONFIG.md),同样使用其中的值 + + + + + + + +
名称可被接受的值描述
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Hot` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\Menu\Hot` +3. 使用默认值 \ No newline at end of file diff --git a/Config/zh-cn/Menu/Separator/CONFIG.md b/Config/zh-cn/Menu/Separator/CONFIG.md new file mode 100644 index 0000000..d460819 --- /dev/null +++ b/Config/zh-cn/Menu/Separator/CONFIG.md @@ -0,0 +1,40 @@ +# Separator +[返回上一级](../CONFIG.md) +## 描述 +> 注意: +> [Menu](../CONFIG.md)中的`EnableCustomRendering`必须为1,否则本页面的值将会被忽略。 + +存储位置:`HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Separator` +## 值 +类型: DWORD +> 继承于[CustomRendering](..\CustomRendering\CONFIG.md),同样使用其中的值 + + + + + + + + + + + + + +
名称可被接受的值描述
+
+
Width
+
默认值: 1000
+
+
+
+
+
+
控制弹出菜单分割线的粗细。
+
TranslucentFlyouts会将该值除以1000转换为设备无关像素(DIP)。
+
+ +## 读取顺序 +1. `HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\Separator` +2. `HKEY_LOCAL_MACHINE\SOFTWARE\TranslucentFlyouts\Menu\Separator` +3. 使用默认值 \ No newline at end of file diff --git a/Images/FluentAnimations/Sample1.gif b/Images/FluentAnimations/Sample1.gif new file mode 100644 index 0000000..7589190 Binary files /dev/null and b/Images/FluentAnimations/Sample1.gif differ diff --git a/Images/FluentAnimations/Sample2.gif b/Images/FluentAnimations/Sample2.gif new file mode 100644 index 0000000..41ef043 Binary files /dev/null and b/Images/FluentAnimations/Sample2.gif differ diff --git a/Images/StartAllBack/DropDownComparison.png b/Images/StartAllBack/DropDownComparison.png deleted file mode 100644 index 4bff780..0000000 Binary files a/Images/StartAllBack/DropDownComparison.png and /dev/null differ diff --git a/Images/Unsupported/Windows2000.png b/Images/Unsupported/Windows2000.png index d3618eb..0d9ad80 100644 Binary files a/Images/Unsupported/Windows2000.png and b/Images/Unsupported/Windows2000.png differ diff --git a/Preset/Sample1.reg b/Preset/Sample1.reg new file mode 100644 index 0000000..7c578ae Binary files /dev/null and b/Preset/Sample1.reg differ diff --git a/Preset/Sample2.reg b/Preset/Sample2.reg new file mode 100644 index 0000000..f2a90c9 Binary files /dev/null and b/Preset/Sample2.reg differ diff --git a/README.md b/README.md index 29c70c1..7919f30 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ -## TranslucentFlyouts V2 +# TranslucentFlyouts V2 An application that makes most of the win32 popup menus translucent/transparent on Windows 10/11, providing more options to tweak it to meet your need. Compared to V1, TranslucentFlyouts V2 has better compatibility and the ability to customize. TranslucentFlyouts V1 has been moved to [TranslucentFlyoutsV1](https://github.com/ALTaleX531/TranslucentFlyoutsV1). **TranslucentFlyouts uses [LGNU V3 license](./COPYING.LESSER) started from V2.** +[![license](https://img.shields.io/github/license/ALTaleX531/TranslucentFlyouts.svg)](https://www.gnu.org/licenses/lgpl-3.0.en.html) +[![Github All Releases](https://img.shields.io/github/downloads/ALTaleX531/TranslucentFlyouts/total.svg)](https://github.com/QL-Win/QuickLook/releases) +[![GitHub release](https://img.shields.io/github/release/ALTaleX531/TranslucentFlyouts.svg)](https://github.com/QL-Win/QuickLook/releases/latest) - ### Other Languages @@ -14,34 +16,43 @@ TranslucentFlyouts V1 has been moved to [TranslucentFlyoutsV1](https://github.co ## Catalog - [Gallery](#gallery) - [How to use](#how-to-use) -- [Config](./CONFIG.md) +- [Config](./Config/zh-cn/CONFIG.md) - [Limitations & Compatibility](#limitations-and-compatibility) - [Dependencies & References](#dependencies-and-references) ## Gallery
Acrylic -Windows 10 -> ![Windows10 Light Mode](./Images/Acrylic/LightMode_Windows10.png) +Windows 10 +![Windows10 Light Mode](./Images/Acrylic/LightMode_Windows10.png) ![Windows10 Dark Mode](./Images/Acrylic/DarkMode_Windows10.png) Windows 11 -> ![Windows11 Light Mode](./Images/Acrylic/LightMode_Windows11.png) +![Windows11 Light Mode](./Images/Acrylic/LightMode_Windows11.png) ![Windows11 Dark Mode](./Images/Acrylic/DarkMode_Windows11.png)
Mica/MicaAlt (Windows 11 Only) -> ![Mica](./Images/Mica/DarkMode_Windows11.png) -![MicaAlt](./Images/Mica/DarkMode_Windows11(MicaAlt).png) +> ![MicaAlt](./Images/Mica/DarkMode_Windows11(MicaAlt).png)
Custom Rendering Sample -> ![Sample 1](./Images/CustomRendering/LightMode_Sample1.png) +![Sample 1](./Images/CustomRendering/LightMode_Sample1.png) ![Sample 2](./Images/CustomRendering/LightMode_Sample2.png)
+
Fluent Animations + +![Sample 1](./Images/FluentAnimations/Sample1.gif) +[Download Preset](./Preset/Sample1.reg) + +![Sample 2](./Images/FluentAnimations/Sample2.gif) +[Download Preset](./Preset/Sample2.reg) + +
+ ## How to use ### Install @@ -50,43 +61,41 @@ Windows 11 3. Run "`install.cmd`" as administrator. 4. Logoff to take effect. -**Downloading symbol files from Microsoft server is required at the first time or after a windows update, otherwise some functionalities will be unavailable!** -cmd: `Rundll32 "your path/TFMain64.dll",Main /install"` +> [Note!]: +> **Downloading symbol files from Microsoft server is required at the first time or after a windows update, otherwise some functionalities will be unavailable!** ### Uninstall 1. Run "`uninstall.cmd`" as administrator. -2. Delete the remaining files. +2. Logoff to take effect. +3. Delete the remaining files. -cmd: `Rundll32 "your path/TFMain64.dll",Main /uninstall"` ## Limitations and Compatibility ### Here are some situations that TranslucentFlyouts will always be automatically disabled. ### 1. Windows 2000 Style popup menu -> ![Windows2000](./Images/Unsupported/Windows2000.png) +![Windows2000](./Images/Unsupported/Windows2000.png) -Outdated. +Outdated. +Some third-party applications like `HoneyView` may cause this issue. ### 2. Ownerdrawn popup menu -> ![Ownerdrawn](./Images/Unsupported/Ownerdrawn.png) +![Ownerdrawn](./Images/Unsupported/Ownerdrawn.png) As you can see, it is a QT popup menu. It really looks like the default menu, isn't it? But it's rendering procedure is completely different from the defualt one, making TranslucentFlyout hard to modify its visual content. ### **3. StartAllBack** -**You can use TranslucentFlyouts with StartAllback but you really need to pay attention to the followings...** -StartAllBack has built-in support for translucent popup menu, its rendering procedure priority is higher than TranslucentFlyouts, so TranslucentFlyouts will actually do nothing for Windows Explorer. (maybe it's time to let StartAllBack know they should add an option to disable it entirely! ) - -**It wil also cause following possible issues when using together with TranslucentFlyouts** -### 1. Hovered menu item with flaws -> ![StartAllBack_MenuItemWithFlaws](./Images/StartAllBack/MenuItemWithFlaws.png) - ![StartAllBack_MenuItemColoredWithFlaws](./Images/StartAllBack/MenuItemColoredWithFlaws.png) +`StartAllBack` has built-in support for translucent popup menu, and its rendering procedure priority is higher than TranslucentFlyouts. +> [Note!]: +> For this reason, `v2.0.0-alpha.4` and higher versions of TranslucentFlyouts will automatically disable itself when `StartAllBack` was detected, unless there is a way to fully disable `StartAllBack`' s handling procedure. +> However, TranslucentFlyouts is still available for other applications except `Explorer`. + +**It may possibly also cause this issue when StartAllBack is installed** +![StartAllBack_MenuItemWithFlaws](./Images/StartAllBack/MenuItemWithFlaws.png) +![StartAllBack_MenuItemColoredWithFlaws](./Images/StartAllBack/MenuItemColoredWithFlaws.png) As you can see there is a white border around the menu item, it will always exist until you disable or uninstall StartAllBack... -**To solve this, you should set the dword value "EnableCustomRendering" to non-zero for TranslucentFlyouts.** +For now, there are two ways to solve this. +1. Set the dword value `EnableCustomRendering` to non-zero for TranslucentFlyouts. Registry path: HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\EnableCustomRendering - -### 2. Abnormal DropDown flyout -> ![DropDownComparison](./Images/StartAllBack/DropDownComparison.png) -It become opaque... -**To solve this, you should set the dword value "Disabled" to non-zero for TranslucentFlyouts.** -Registry path: HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\DropDown\Disabled +2. Install a custom theme. ## Dependencies and References ### [Microsoft Research Detours Package](https://github.com/microsoft/Detours) diff --git a/ReadMe/zh-cn.md b/ReadMe/zh-cn.md index 57a8ddb..c8aa8c3 100644 --- a/ReadMe/zh-cn.md +++ b/ReadMe/zh-cn.md @@ -1,4 +1,4 @@ -## TranslucentFlyouts V2 +# TranslucentFlyouts V2 一个在Windows10/11让大部分Win32弹出菜单半透明/全透明的应用,致力于提供更多可自定义选项以满足你的需要。 @@ -6,9 +6,11 @@ TranslucentFlyouts V1 已经被移动到 [TranslucentFlyoutsV1](https://github.com/ALTaleX531/TranslucentFlyoutsV1). **从TranslucentFlyouts V2开始,该项目使用[LGNU V3 license](/COPYING.LESSER)作为开源许可。** +[![license](https://img.shields.io/github/license/ALTaleX531/TranslucentFlyouts.svg)](https://www.gnu.org/licenses/lgpl-3.0.en.html) +[![Github All Releases](https://img.shields.io/github/downloads/ALTaleX531/TranslucentFlyouts/total.svg)](https://github.com/QL-Win/QuickLook/releases) +[![GitHub release](https://img.shields.io/github/release/ALTaleX531/TranslucentFlyouts.svg)](https://github.com/QL-Win/QuickLook/releases/latest) - - + ### 其它语言 @@ -18,7 +20,7 @@ TranslucentFlyouts V1 已经被移动到 [TranslucentFlyoutsV1](https://github.c - [图库](#gallery) - [如何使用](#how-to-use) -- [配置文件](../Config/zh-cn.md) +- [配置文件](../Config/zh-cn/CONFIG.md) - [一些限制和兼容性相关的问题](#limitations-and-compatibility) - [依靠和引用](#dependencies-and-references) @@ -28,27 +30,37 @@ TranslucentFlyouts V1 已经被移动到 [TranslucentFlyoutsV1](https://github.c
Acrylic 亚克力模糊 -Windows 10 -> ![Windows10 亮模式](../Images/Acrylic/LightMode_Windows10.png) +Windows 10 +![Windows10 亮模式](../Images/Acrylic/LightMode_Windows10.png) ![Windows10 暗模式](../Images/Acrylic/DarkMode_Windows10.png) Windows 11 -> ![Windows11 亮模式](../Images/Acrylic/LightMode_Windows11.png) +![Windows11 亮模式](../Images/Acrylic/LightMode_Windows11.png) ![Windows11 暗模式](../Images/Acrylic/DarkMode_Windows11.png)
Mica/MicaAlt 云母 (仅Windows 11) -> ![Mica](../Images/Mica/DarkMode_Windows11.png) +![Mica](../Images/Mica/DarkMode_Windows11.png) ![MicaAlt](../Images/Mica/DarkMode_Windows11(MicaAlt).png)
自定义渲染的例子 -> ![Sample 1](../Images/CustomRendering/LightMode_Sample1.png) +![Sample 1](../Images/CustomRendering/LightMode_Sample1.png) ![Sample 2](../Images/CustomRendering/LightMode_Sample2.png)
+
流利的动画 + +![Sample 1](../Images/FluentAnimations/Sample1.gif) +[下载预设](../Preset/Sample1.reg) + +![Sample 2](../Images/FluentAnimations/Sample2.gif) +[下载预设](../Preset/Sample2.reg) + +
+ ## How to use 如何使用 @@ -60,8 +72,8 @@ Windows 11 3. 以管理员身份运行"`install.cmd`" 4. 注销以应用更改 -**第一次使用时或系统大版本更新后,TranslucentFlyouts需要从微软服务器下载符号文件,否则一些功能将不可用!** -cmd: `Rundll32 "你放置的目录/TFMain64.dll",Main /install"` +> 注意: +> **第一次使用时或系统大版本更新后,TranslucentFlyouts需要从微软服务器下载符号文件,否则一些功能将不可用!** ### 卸载 @@ -69,8 +81,6 @@ cmd: `Rundll32 "你放置的目录/TFMain64.dll",Main /install"` 2. 注销以应用更改 3. 手动删除剩下的文件 -cmd: `Rundll32 "你放置的目录/TFMain64.dll",Main /uninstall"` - ## Limitations and Compatibility 一些限制和兼容性相关的问题 @@ -78,10 +88,10 @@ cmd: `Rundll32 "你放置的目录/TFMain64.dll",Main /uninstall"` ### 在以下的情况下,TranslucentFlyouts不可用 ### 1. Windows 2000 风格的弹出菜单 -> -> ![Windows2000](../Images/Unsupported/Windows2000.png) +![Windows2000](../Images/Unsupported/Windows2000.png) -老古董 +老古董。 +有些第三方程序比如`HoneyView`可能会造成这样的菜单。 ### 2. Ownerdrawn popup menu > @@ -90,28 +100,21 @@ cmd: `Rundll32 "你放置的目录/TFMain64.dll",Main /uninstall"` 如你所见,这是一个QT弹出菜单 是不是看着挺像系统的那种默认菜单? 但是它的渲染流程与默认菜单截然不同,使得TranslucentFlyouts很难正确修改它的视觉内容 - ### **3. StartAllBack** +`StartAllBack`具有对半透明弹出菜单的内置支持,并且它的渲染流程的优先级高于TranslucentFlyouts。 +> 注意: +> 出于这个原因的考量,`v2.0.0-alpha.4`和更高版本的TranslucentFlyouts检测到`StartAllBack`会自动禁用自身,且该现状将继续保持直到有办法能完全禁用`StartAllBack`对弹出菜单的处理。 +> 然而,TranslucentFlyouts仍然能对其它应用程序生效除了`资源管理器`. + +**它还可能导致以下的问题** +![StartAllBack_MenuItemWithFlaws](../Images/StartAllBack/MenuItemWithFlaws.png) +![StartAllBack_MenuItemColoredWithFlaws](../Images/StartAllBack/MenuItemColoredWithFlaws.png) +如你所见有个白白的边框环绕着高亮的菜单项,它会一直存在直到你禁用或卸载StartAllBack... +对于现在而言,有两种办法可以解决 +1. 将dword值`EnableCustomRendering`设置为非0值。 +注册表路径: HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\EnableCustomRendering +2. 安装个自定义美化主题 -**你可以将TranslucentFlyouts与StartAllBack一起使用,但你真的需要注意以下情况内容** -StartAllBack具有对半透明弹出菜单的内置支持,并且它的渲染流程的优先级高过TranslucentFlyouts,所以TranslucentFlyouts会实际上对文件管理器什么都不做。(也许是时候反馈给StartAllBack让它们提供一个彻底关闭这种内置支持的选项!) - -**它还可能会造成以下问题当与TranslucentFlyouts一起使用** - -### 1. 菜单高亮项有缺陷 -> -> ![StartAllBack_MenuItemWithFlaws](../Images/StartAllBack/MenuItemWithFlaws.png) - ![StartAllBack_MenuItemColoredWithFlaws](../Images/StartAllBack/MenuItemColoredWithFlaws.png) -如你所见有个白白的边框环绕着高亮的菜单项,它会一直存在直到你禁用或卸载StartAllBack... -**要想解决这个问题,你需要修改TranslucentFlyouts的注册表信息,将dword值“EnableCustomRendering”设置为非零值** -注册表路径: HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\Menu\EnableCustomRendering - -### 2. 不正常的下拉控件 -> -> ![DropDownComparison](../Images/StartAllBack/DropDownComparison.png) -变得不透明了 -**要想解决这个问题,你需要修改TranslucentFlyouts的注册表信息,将dword值“Disabled”设置为非零值** -注册表路径: HKEY_CURRENT_USER\SOFTWARE\TranslucentFlyouts\DropDown\Disabled ## Dependencies and References diff --git a/TFMain/MenuAnimation.cpp b/TFMain/MenuAnimation.cpp index 2330c89..6d3ca28 100644 --- a/TFMain/MenuAnimation.cpp +++ b/TFMain/MenuAnimation.cpp @@ -104,10 +104,6 @@ namespace TranslucentFlyouts::MenuAnimation nullptr ); THROW_LAST_ERROR_IF_NULL(window); - if (GetClassLongPtr(window, GCL_STYLE) & (CS_DROPSHADOW | CS_SAVEBITS)) - { - SetClassLongPtr(window, GCL_STYLE, GetClassLongPtr(window, GCL_STYLE) &~(CS_DROPSHADOW | CS_SAVEBITS)); - } auto menuDC{wil::GetWindowDC(hWnd)}; THROW_LAST_ERROR_IF_NULL(menuDC); @@ -188,7 +184,10 @@ namespace TranslucentFlyouts::MenuAnimation private: bool m_reverse{false}; bool m_started{false}; + bool m_useSysDropShadow{false}; + float m_cornerRadius{0.f};// 0.f, 4.f, 8.f float m_ratio{0.f}; + DWORD m_animationStyle{0}; POINT m_cursorPos{}; HWND m_backdropWindow{nullptr}; @@ -212,6 +211,7 @@ namespace TranslucentFlyouts::MenuAnimation Attach(); Utils::CloakWindow(m_menuWindow, TRUE); + SetCapture(m_menuWindow); window = CreateWindowExW( WS_EX_NOREDIRECTIONBITMAP | WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_PALETTEWINDOW, @@ -249,18 +249,23 @@ namespace TranslucentFlyouts::MenuAnimation auto info{menuHandler.GetMenuRenderingInfo(m_menuWindow)}; if (info.useUxTheme) { - // We are on Windows 10 or the corner is not round - if ( - FAILED(menuHandler.HandleRoundCorners(L"Menu"sv, window)) || + DWORD cornerType + { RegHelper::GetDword( L"Menu", L"CornerType", 3 - ) == 1 + ) + }; + + // We are on Windows 10 or the corner is not round + if ( + FAILED(menuHandler.HandleRoundCorners(L"Menu"sv, window)) || + cornerType == 1 ) { - SetClassLongPtr(window, GCL_STYLE, GetClassLongPtr(window, GCL_STYLE) | (CS_DROPSHADOW | CS_SAVEBITS)); - + m_cornerRadius = 0.f; + DWORD effectType { RegHelper::GetDword( @@ -281,6 +286,30 @@ namespace TranslucentFlyouts::MenuAnimation EffectHelper::SetWindowBackdrop(window, TRUE, 0, 4); } } + else + { + switch (cornerType) + { + case 1: + { + m_cornerRadius = 0.f; + break; + } + case 2: + { + m_cornerRadius = 8.f; + break; + } + case 0: + case 3: + { + m_cornerRadius = 4.f; + break; + } + default: + break; + } + } menuHandler.HandleSysBorderColors(L"Menu"sv, window, info.useDarkMode, info.borderColor); EffectHelper::EnableWindowDarkMode(window, info.useDarkMode); @@ -290,15 +319,11 @@ namespace TranslucentFlyouts::MenuAnimation } else { - // Windows 2000 style - SetClassLongPtr(window, GCL_STYLE, GetClassLongPtr(window, GCL_STYLE) | (CS_DROPSHADOW | CS_SAVEBITS)); + m_cornerRadius = 0.f; } THROW_IF_WIN32_BOOL_FALSE(SetLayeredWindowAttributes(window, 0, 255, LWA_ALPHA)); THROW_IF_WIN32_BOOL_FALSE(SetLayeredWindowAttributes(m_backdropWindow, 0, 0, LWA_ALPHA)); - THROW_IF_WIN32_BOOL_FALSE( - SetWindowPos(window, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW) - ); Utils::CloakWindow(window, TRUE); THROW_IF_WIN32_BOOL_FALSE( SetWindowPos(m_backdropWindow, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW) @@ -373,14 +398,11 @@ namespace TranslucentFlyouts::MenuAnimation { if (m_menuWindow) { - SendMessageW(m_menuWindow, WM_MAFINISHED, 0, 0); + // DO NOT USE SendMessage HERE OTHERWISE IT WILL CAUSE DEAD LOCK + SendNotifyMessageW(m_menuWindow, WM_MAFINISHED, 0, 0); } if (window) { - if (GetClassLongPtr(window, GCL_STYLE) & (CS_DROPSHADOW | CS_SAVEBITS)) - { - SetClassLongPtr(window, GCL_STYLE, GetClassLongPtr(window, GCL_STYLE) & ~(CS_DROPSHADOW | CS_SAVEBITS)); - } SendNotifyMessageW(window, WM_CLOSE, 0, 0); window = nullptr; } @@ -497,18 +519,6 @@ namespace TranslucentFlyouts::MenuAnimation wil::CoCreateInstance(CLSID_UIAnimationTransitionLibrary2) }; - constexpr float endValue{0.f}; - float beginValue{0.f}; - - if (reverse) - { - beginValue = float(size.cy) - float(size.cy) * m_ratio; - } - else - { - beginValue = -float(size.cy) + float(size.cy) * m_ratio; - } - // Synchronizing WAM and DirectComposition time such that when WAM Update is called, // the value reflects the DirectComposition value at the given time. DCOMPOSITION_FRAME_STATISTICS frameStatistics{}; @@ -517,75 +527,412 @@ namespace TranslucentFlyouts::MenuAnimation ); UI_ANIMATION_SECONDS timeNow{static_cast(frameStatistics.nextEstimatedFrameTime.QuadPart) / static_cast(frameStatistics.timeFrequency.QuadPart)}; + auto MakeAnimation = [&](std::function(com_ptr variable)> callback) + { + if (callback) + { + com_ptr variable{nullptr}; + com_ptr storyboard{nullptr}; + THROW_IF_FAILED( + manager->CreateAnimationVariable(0., &variable) + ); + THROW_IF_FAILED( + manager->CreateStoryboard(&storyboard) + ); + com_ptr transition{callback(variable)}; + THROW_IF_FAILED( + storyboard->AddTransition(variable.get(), transition.get()) + ); + THROW_IF_FAILED( + manager->Update(timeNow) + ); + THROW_IF_FAILED( + storyboard->Schedule(timeNow) + ); + + com_ptr dcompAnimation{nullptr}; + THROW_IF_FAILED( + dcompDevice->CreateAnimation(&dcompAnimation) + ); + THROW_IF_FAILED( + variable->GetCurve(dcompAnimation.get()) + ); + + return dcompAnimation; + } + + return com_ptr{nullptr}; + }; + + float width + { + static_cast(windowRect.right - windowRect.left) + }; + float height + { + static_cast(windowRect.bottom - windowRect.top) + }; + + if (m_animationStyle == 0) + { + constexpr double endValue{0.}; + double beginValue{0.}; + + if (reverse) + { + beginValue = static_cast(size.cy) * (1. - static_cast(m_ratio)); + } + else + { + beginValue = static_cast(size.cy) * (-1. + static_cast(m_ratio)); + } + + com_ptr dcompAnimation + { + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition(static_cast(m_popupInDuration.count()) / 1000., endValue, 0, 0, 0, 1, &transition) + ); + THROW_IF_FAILED( + transition->SetInitialValue(beginValue) + ); + + return transition; + }) + }; + + THROW_IF_FAILED(m_thumbnailVisual->SetOffsetX(0.f)); + THROW_IF_FAILED(m_thumbnailVisual->SetOffsetY(dcompAnimation.get())); + + THROW_IF_FAILED(m_backdropThumbnailVisual->SetOffsetX(0.f)); + THROW_IF_FAILED(m_backdropThumbnailVisual->SetOffsetY(dcompAnimation.get())); + } + + if (m_animationStyle == 1) { - com_ptr dcompAnimation{nullptr}; + POINT clientPoint{m_cursorPos}; + THROW_IF_WIN32_BOOL_FALSE(ScreenToClient(m_menuWindow, &clientPoint)); + + D2D1_POINT_2F startPoint + { + static_cast(min(max(0., static_cast(clientPoint.x)), width)), + static_cast( + abs(height - static_cast(clientPoint.y)) > + abs(0. - static_cast(clientPoint.y)) + ? 0. : height + ) + }; + double maxRadius{sqrt(width * width + height * height)}; + + com_ptr clip{nullptr}; + THROW_IF_FAILED(dcompDevice->CreateRectangleClip(&clip)); THROW_IF_FAILED( - dcompDevice->CreateAnimation(&dcompAnimation) + clip->SetTop( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.y) - static_cast(maxRadius), + 0, 0, 0, 1, &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.y) - static_cast(maxRadius) * m_ratio) + ); + + return transition; + }).get() + ) ); - - com_ptr variable{nullptr}; - com_ptr storyboard{nullptr}; - com_ptr transition{nullptr}; THROW_IF_FAILED( - manager->CreateAnimationVariable(beginValue, &variable) + clip->SetBottom( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.y) + static_cast(maxRadius), + 0, 0, 0, 1, &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.y) + static_cast(maxRadius) * m_ratio) + ); + + return transition; + }).get() + ) ); THROW_IF_FAILED( - manager->CreateStoryboard(&storyboard) + clip->SetLeft( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.x) - static_cast(maxRadius), + 0, 0, 0, 1, &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.x) - static_cast(maxRadius) * m_ratio) + ); + + return transition; + }).get() + ) ); THROW_IF_FAILED( - library->CreateCubicBezierLinearTransition(static_cast(m_popupInDuration.count()) / 1000.f, endValue, 0, 0, 0, 1, &transition) + clip->SetRight( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.x) + static_cast(maxRadius), + 0, 0, 0, 1, &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.x) + static_cast(maxRadius) * m_ratio) + ); + + return transition; + }).get() + ) ); + + auto dcompAnimation + { + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(maxRadius), + 0, 0, 0, 1, &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(0.) + ); + + return transition; + }) + }; + THROW_IF_FAILED(clip->SetBottomLeftRadiusX(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetBottomLeftRadiusY(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetBottomRightRadiusX(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetBottomRightRadiusY(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetTopLeftRadiusX(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetTopLeftRadiusY(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetTopRightRadiusX(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetTopRightRadiusY(dcompAnimation.get())); + + THROW_IF_FAILED(m_thumbnailVisual->SetClip(clip.get())); + THROW_IF_FAILED(m_backdropThumbnailVisual->SetClip(clip.get())); + } + + if (m_animationStyle == 2) + { + POINT clientPoint{m_cursorPos}; + THROW_IF_WIN32_BOOL_FALSE(ScreenToClient(m_menuWindow, &clientPoint)); + + D2D1_POINT_2F startPoint + { + abs(width - static_cast(clientPoint.x)) > + abs(0.f - static_cast(clientPoint.x)) + ? 0.f : width, + abs(height - static_cast(clientPoint.y)) > + abs(0.f - static_cast(clientPoint.y)) + ? 0.f : height + }; + + com_ptr clip{nullptr}; + THROW_IF_FAILED(dcompDevice->CreateRectangleClip(&clip)); + THROW_IF_FAILED( - storyboard->AddTransition(variable.get(), transition.get()) + clip->SetTop( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateSmoothStopTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.y) - static_cast(height), + &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.y) - static_cast(height) * m_ratio) + ); + + return transition; + }).get() + ) ); THROW_IF_FAILED( - manager->Update(timeNow) + clip->SetBottom( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateSmoothStopTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.y) + static_cast(height), + &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.y) + static_cast(height) * m_ratio) + ); + + return transition; + }).get() + ) ); THROW_IF_FAILED( - storyboard->Schedule(timeNow) + clip->SetLeft( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateSmoothStopTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.x) - static_cast(width), + &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.x) - static_cast(width) * m_ratio) + ); + + return transition; + }).get() + ) ); THROW_IF_FAILED( - variable->GetCurve(dcompAnimation.get()) + clip->SetRight( + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateSmoothStopTransition( + static_cast(m_popupInDuration.count()) / 1000., + static_cast(startPoint.x) + static_cast(width), + &transition + ) + ); + THROW_IF_FAILED( + transition->SetInitialValue(static_cast(startPoint.x) + static_cast(width) * m_ratio) + ); + + return transition; + }).get() + ) ); - THROW_IF_FAILED(m_thumbnailVisual->SetOffsetX(0.f)); - THROW_IF_FAILED(m_thumbnailVisual->SetOffsetY(dcompAnimation.get())); + THROW_IF_FAILED(clip->SetBottomLeftRadiusX(m_cornerRadius)); + THROW_IF_FAILED(clip->SetBottomLeftRadiusY(m_cornerRadius)); + THROW_IF_FAILED(clip->SetBottomRightRadiusX(m_cornerRadius)); + THROW_IF_FAILED(clip->SetBottomRightRadiusY(m_cornerRadius)); + THROW_IF_FAILED(clip->SetTopLeftRadiusX(m_cornerRadius)); + THROW_IF_FAILED(clip->SetTopLeftRadiusY(m_cornerRadius)); + THROW_IF_FAILED(clip->SetTopRightRadiusX(m_cornerRadius)); + THROW_IF_FAILED(clip->SetTopRightRadiusY(m_cornerRadius)); - THROW_IF_FAILED(m_backdropThumbnailVisual->SetOffsetX(0.f)); - THROW_IF_FAILED(m_backdropThumbnailVisual->SetOffsetY(dcompAnimation.get())); + THROW_IF_FAILED(m_thumbnailVisual->SetClip(clip.get())); + THROW_IF_FAILED(m_backdropThumbnailVisual->SetClip(clip.get())); + + com_ptr dcompAnimation + { + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition(static_cast(m_popupInDuration.count()) / 1000., 0., 0, 0, 0, 1, &transition) + ); + THROW_IF_FAILED( + transition->SetInitialValue( + static_cast(-width) * static_cast(m_ratio) + + static_cast(startPoint.x) + ) + ); + + return transition; + }) + }; + + THROW_IF_FAILED(m_thumbnailVisual->SetOffsetX(dcompAnimation.get())); } + if (m_animationStyle == 3) { - com_ptr dcompAnimation{nullptr}; - THROW_IF_FAILED( - dcompDevice->CreateAnimation(&dcompAnimation) - ); + com_ptr dcompAnimation + { + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateCubicBezierLinearTransition(static_cast(m_popupInDuration.count()) / 1000., 1., 0, 0, 0, 1, &transition) + ); + THROW_IF_FAILED( + transition->SetInitialValue( + 0.85 + ) + ); + + return transition; + }) + }; - com_ptr variable{nullptr}; - com_ptr storyboard{nullptr}; - com_ptr transition{nullptr}; + com_ptr transform{nullptr}; THROW_IF_FAILED( - manager->CreateAnimationVariable(0.f, &variable) - ); - THROW_IF_FAILED( - manager->CreateStoryboard(&storyboard) - ); - THROW_IF_FAILED( - library->CreateLinearTransition(static_cast(m_fadeInDuration.count()) / 1000.f, 1.f, &transition) + dcompDevice->CreateScaleTransform3D(&transform) ); + THROW_IF_FAILED( - storyboard->AddTransition(variable.get(), transition.get()) + transform->SetCenterX(static_cast(width / 2.)) ); THROW_IF_FAILED( - manager->Update(timeNow) + transform->SetCenterY(static_cast(width / 2.)) ); THROW_IF_FAILED( - storyboard->Schedule(timeNow) + transform->SetScaleX(dcompAnimation.get()) ); THROW_IF_FAILED( - variable->GetCurve(dcompAnimation.get()) + transform->SetScaleY(dcompAnimation.get()) ); + THROW_IF_FAILED(m_thumbnailVisual.query()->SetTransform(transform.get())); + THROW_IF_FAILED(m_backdropThumbnailVisual.query()->SetTransform(transform.get())); + } + + { + com_ptr dcompAnimation + { + MakeAnimation([&](com_ptr variable) + { + com_ptr transition{nullptr}; + THROW_IF_FAILED( + library->CreateLinearTransition(static_cast(m_fadeInDuration.count()) / 1000., 1., &transition) + ); + THROW_IF_FAILED( + transition->SetInitialValue(0.) + ); + + return transition; + }) + }; + THROW_IF_FAILED(m_thumbnailVisual.query()->SetOpacity(dcompAnimation.get())); THROW_IF_FAILED(m_backdropThumbnailVisual.query()->SetOpacity(dcompAnimation.get())); } @@ -595,14 +942,22 @@ namespace TranslucentFlyouts::MenuAnimation dcompDevice->Commit() ); + if (m_useSysDropShadow) + { + SetClassLongPtr(window, GCL_STYLE, GetClassLongPtr(window, GCL_STYLE) | CS_DROPSHADOW); + } THROW_IF_WIN32_BOOL_FALSE( SetWindowPos( window, nullptr, windowRect.left, windowRect.top, size.cx, size.cy, - SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED + SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED | SWP_SHOWWINDOW ) ); Utils::CloakWindow(window, FALSE); + if (m_useSysDropShadow) + { + SetClassLongPtr(window, GCL_STYLE, GetClassLongPtr(window, GCL_STYLE) & ~CS_DROPSHADOW); + } Restart(m_totDuration); @@ -658,11 +1013,21 @@ namespace TranslucentFlyouts::MenuAnimation const auto& windowPos{*reinterpret_cast(lParam)}; if (windowPos.flags & SWP_SHOWWINDOW) { + LRESULT lr{DefSubclassProc(hWnd, uMsg, wParam, lParam)}; + + HWND backdropWindow{GetWindow(hWnd, GW_HWNDNEXT)}; + if (Utils::IsWindowClass(backdropWindow, L"SysShadow") && IsWindowVisible(backdropWindow)) + { + popupInAnimation.m_useSysDropShadow = true; + } + popupInAnimation.Start( abs(popupInAnimation.m_cursorPos.y - windowPos.y) > abs(popupInAnimation.m_cursorPos.y - (windowPos.y + windowPos.cy)) ? true : false ); + + return lr; } if (windowPos.flags & SWP_HIDEWINDOW) @@ -671,6 +1036,25 @@ namespace TranslucentFlyouts::MenuAnimation } } + if (uMsg == MenuHandler::MN_SELECTITEM) + { + auto position{static_cast(wParam)}; + if (position != -1) + { + if ( + RegHelper::GetDword( + L"Menu\\Animation", + L"EnableImmediateInterupting", + 0, + false + ) + ) + { + popupInAnimation.Abort(); + } + } + } + if (uMsg == WM_NCDESTROY) { popupInAnimation.Abort(); @@ -687,7 +1071,7 @@ namespace TranslucentFlyouts::MenuAnimation public: #pragma push_macro("max") #undef max - PopupIn(HWND hWnd, float startPosRatio, std::chrono::milliseconds popupInDuration, std::chrono::milliseconds fadeInDuration) try : AnimationInfo{chrono::milliseconds::max()}, m_totDuration{max(popupInDuration, fadeInDuration)}, m_menuWindow{hWnd}, m_fadeInDuration{fadeInDuration}, m_popupInDuration{popupInDuration}, m_ratio{startPosRatio} + PopupIn(HWND hWnd, float startPosRatio, std::chrono::milliseconds popupInDuration, std::chrono::milliseconds fadeInDuration, DWORD animationStyle) try : AnimationInfo{chrono::milliseconds::max()}, m_totDuration{max(popupInDuration, fadeInDuration)}, m_menuWindow{hWnd}, m_fadeInDuration{fadeInDuration}, m_popupInDuration{popupInDuration}, m_ratio{startPosRatio}, m_animationStyle{animationStyle} #pragma pop_macro("max") { THROW_HR_IF( @@ -849,11 +1233,12 @@ HRESULT MenuAnimation::CreatePopupIn( HWND hWnd, float startPosRatio, std::chrono::milliseconds popupInDuration, - std::chrono::milliseconds fadeInDuration + std::chrono::milliseconds fadeInDuration, + DWORD animationStyle ) try { auto& animationWorker{AnimationWorker::GetInstance()}; - animationWorker.Schedule(make_shared(hWnd, startPosRatio, popupInDuration, fadeInDuration)); + animationWorker.Schedule(make_shared(hWnd, startPosRatio, popupInDuration, fadeInDuration, animationStyle)); return S_OK; } diff --git a/TFMain/MenuAnimation.hpp b/TFMain/MenuAnimation.hpp index 9376a26..532273f 100644 --- a/TFMain/MenuAnimation.hpp +++ b/TFMain/MenuAnimation.hpp @@ -9,8 +9,10 @@ namespace TranslucentFlyouts { using namespace std::chrono; using namespace std::chrono_literals; + // Defined in win32kfull.sys!zzzMNFadeSelection constexpr milliseconds standardFadeoutDuration{350ms}; + // Defined in https://learn.microsoft.com/en-us/windows/apps/design/signature-experiences/motion constexpr milliseconds standardPopupInDuration{250ms}; constexpr milliseconds standardFadeInDuration{87ms}; @@ -28,7 +30,8 @@ namespace TranslucentFlyouts HWND hWnd, float startPosRatio, std::chrono::milliseconds popInDuration, - std::chrono::milliseconds fadeInDuration + std::chrono::milliseconds fadeInDuration, + DWORD animationStyle ); }; } \ No newline at end of file diff --git a/TFMain/MenuHandler.cpp b/TFMain/MenuHandler.cpp index 84e4224..c526790 100644 --- a/TFMain/MenuHandler.cpp +++ b/TFMain/MenuHandler.cpp @@ -336,7 +336,7 @@ MenuHandler::MenuRenderingInfo MenuHandler::GetMenuRenderingInfo(HWND hWnd) try { auto selectedObject{wil::SelectObject(memoryDC.get(), bitmap.get())}; - SendMessageW(hWnd, WM_PRINT, reinterpret_cast(memoryDC.get()), PRF_CHILDREN | PRF_NONCLIENT); + THROW_IF_WIN32_BOOL_FALSE(PrintWindow(hWnd, memoryDC.get(), 0)); } swap(g_sharedMenuInfo, info); @@ -414,7 +414,7 @@ LRESULT CALLBACK MenuHandler::SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, { // User didn't click on the menu item auto position{static_cast(wParam)}; - THROW_HR_IF(E_INVALIDARG, position == 0xFFFFFFFF); + THROW_HR_IF(E_INVALIDARG, position == -1); int param{0}; SystemParametersInfoW(SPI_GETSELECTIONFADE, 0, ¶m, 0); @@ -441,7 +441,15 @@ LRESULT CALLBACK MenuHandler::SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, THROW_IF_FAILED( MenuAnimation::CreateFadeOut( - hWnd, mbi, MenuAnimation::standardFadeoutDuration + hWnd, mbi, + std::chrono::milliseconds{ + RegHelper::GetDword( + L"Menu\\Animation", + L"FadeOutTime", + static_cast(MenuAnimation::standardFadeoutDuration.count()), + false + ) + } ) ); @@ -485,10 +493,76 @@ LRESULT CALLBACK MenuHandler::SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, }; if (enableFluentAnimation) { + float ratio + { + static_cast( + RegHelper::GetDword( + L"Menu\\Animation", + L"StartRatio", + lround(MenuAnimation::standardStartPosRatio * 100.f), + false + ) + ) / 100.f + }; MenuAnimation::CreatePopupIn( - hWnd, MenuAnimation::standardStartPosRatio, MenuAnimation::standardPopupInDuration, MenuAnimation::standardFadeInDuration + hWnd, + ratio, + std::chrono::milliseconds{ + RegHelper::GetDword( + L"Menu\\Animation", + L"PopInTime", + static_cast(MenuAnimation::standardPopupInDuration.count()), + false + ) + }, + std::chrono::milliseconds{ + RegHelper::GetDword( + L"Menu\\Animation", + L"FadeInTime", + static_cast(MenuAnimation::standardFadeInDuration.count()), + false + ) + }, + RegHelper::GetDword( + L"Menu\\Animation", + L"PopInStyle", + 0, + false + ) ); } + + DwmTransitionOwnedWindow(hWnd, DWMTRANSITION_OWNEDWINDOW_REPOSITION); + InvalidateRect(hWnd, nullptr, TRUE); + UpdateWindow(hWnd); + } + + if (uMsg == WM_WINDOWPOSCHANGED) + { + const auto& windowPos{*reinterpret_cast(lParam)}; + if (windowPos.flags & SWP_SHOWWINDOW) + { + handled = true; + result = DefSubclassProc(hWnd, uMsg, wParam, lParam); + + DWORD noSystemDropShadow + { + RegHelper::GetDword( + L"Menu", + L"NoSystemDropShadow", + 0, + false + ) + }; + if (noSystemDropShadow) + { + HWND backdropWindow{GetWindow(hWnd, GW_HWNDNEXT)}; + if (Utils::IsWindowClass(backdropWindow, L"SysShadow")) + { + ShowWindow(backdropWindow, SW_HIDE); + } + } + } } if (uMsg == WM_PRINT) @@ -496,29 +570,40 @@ LRESULT CALLBACK MenuHandler::SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, if (IsImmersiveContextMenu(hWnd)) { handled = true; + result = DefSubclassProc(hWnd, uMsg, wParam, lParam); POINT pt{}; Utils::unique_ext_hdc hdc{reinterpret_cast(wParam)}; - RECT windowRect{}; - GetWindowRect(hWnd, &windowRect); - OffsetRect(&windowRect, -windowRect.left, -windowRect.top); + RECT paintRect{}; + GetWindowRect(hWnd, &paintRect); + OffsetRect(&paintRect, -paintRect.left, -paintRect.top); { Utils::unique_ext_hdc dc{hdc.get()}; - ExcludeClipRect(dc.get(), windowRect.left + nonClientMarginSize, windowRect.top + nonClientMarginSize, windowRect.right - nonClientMarginSize, windowRect.bottom - nonClientMarginSize); - FillRect(dc.get(), &windowRect, GetStockBrush(BLACK_BRUSH)); + ExcludeClipRect(dc.get(), paintRect.left + nonClientMarginSize, paintRect.top + nonClientMarginSize, paintRect.right - nonClientMarginSize, paintRect.bottom - nonClientMarginSize); + FillRect(dc.get(), &paintRect, GetStockBrush(BLACK_BRUSH)); } - SetViewportOrgEx(hdc.get(), nonClientMarginSize, nonClientMarginSize, &pt); - result = DefSubclassProc(hWnd, WM_PRINTCLIENT, wParam, lParam); - SetViewportOrgEx(hdc.get(), pt.x, pt.y, nullptr); - - if (!menuHandler.HandlePopupMenuNCBorderColors(hdc.get(), g_sharedMenuInfo.useDarkMode, windowRect)) + if (!menuHandler.HandlePopupMenuNCBorderColors(hdc.get(), g_sharedMenuInfo.useDarkMode, paintRect)) { - Utils::unique_ext_hdc dc{hdc.get()}; - ExcludeClipRect(dc.get(), windowRect.left + systemOutlineSize, windowRect.top + systemOutlineSize, windowRect.right - systemOutlineSize, windowRect.bottom - systemOutlineSize); - result = DefSubclassProc(hWnd, WM_PRINT, wParam, lParam); + unique_hrgn windowRegion{CreateRectRgnIndirect(&paintRect)}; + unique_hrgn windowRegionWithoutOutline{CreateRectRgn(paintRect.left + systemOutlineSize, paintRect.top + systemOutlineSize, paintRect.right - systemOutlineSize, paintRect.bottom - systemOutlineSize)}; + CombineRgn(windowRegion.get(), windowRegion.get(), windowRegionWithoutOutline.get(), RGN_XOR); + unique_hrgn clientRegion{CreateRectRgn(paintRect.left + nonClientMarginSize, paintRect.top + nonClientMarginSize, paintRect.right - nonClientMarginSize, paintRect.bottom - nonClientMarginSize)}; + CombineRgn(windowRegion.get(), windowRegion.get(), clientRegion.get(), RGN_OR); + + { + Utils::unique_ext_hdc dc{hdc.get()}; + SelectClipRgn(dc.get(), windowRegion.get()); + result = DefSubclassProc(hWnd, uMsg, wParam, lParam); + } + } + else + { + SetViewportOrgEx(hdc.get(), nonClientMarginSize, nonClientMarginSize, &pt); + result = DefSubclassProc(hWnd, WM_PRINTCLIENT, wParam, lParam); + SetViewportOrgEx(hdc.get(), pt.x, pt.y, nullptr); } } } @@ -536,21 +621,26 @@ LRESULT CALLBACK MenuHandler::SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, SelectClipRgn(hdc.get(), reinterpret_cast(wParam)); } - RECT windowRect{}; - GetWindowRect(hWnd, &windowRect); - OffsetRect(&windowRect, -windowRect.left, -windowRect.top); + RECT paintRect{}; + GetWindowRect(hWnd, &paintRect); + OffsetRect(&paintRect, -paintRect.left, -paintRect.top); { Utils::unique_ext_hdc dc{hdc.get()}; - ExcludeClipRect(dc.get(), windowRect.left + nonClientMarginSize, windowRect.top + nonClientMarginSize, windowRect.right - nonClientMarginSize, windowRect.bottom - nonClientMarginSize); - FillRect(dc.get(), &windowRect, GetStockBrush(BLACK_BRUSH)); + ExcludeClipRect(dc.get(), paintRect.left + nonClientMarginSize, paintRect.top + nonClientMarginSize, paintRect.right - nonClientMarginSize, paintRect.bottom - nonClientMarginSize); + FillRect(dc.get(), &paintRect, GetStockBrush(BLACK_BRUSH)); } - if (!menuHandler.HandlePopupMenuNCBorderColors(hdc.get(), g_sharedMenuInfo.useDarkMode, windowRect)) + if (!menuHandler.HandlePopupMenuNCBorderColors(hdc.get(), g_sharedMenuInfo.useDarkMode, paintRect)) { - Utils::unique_ext_hdc dc{hdc.get()}; - ExcludeClipRect(dc.get(), windowRect.left + systemOutlineSize, windowRect.top + systemOutlineSize, windowRect.right - systemOutlineSize, windowRect.bottom - systemOutlineSize); - DefSubclassProc(hWnd, WM_PRINT, reinterpret_cast(dc.get()), lParam); + RECT windowRect{}; + GetWindowRect(hWnd, &windowRect); + + unique_hrgn windowRegion{CreateRectRgnIndirect(&windowRect)}; + unique_hrgn windowRegionWithoutOutline{CreateRectRgn(windowRect.left + systemOutlineSize, windowRect.top + systemOutlineSize, windowRect.right - systemOutlineSize, windowRect.bottom - systemOutlineSize)}; + CombineRgn(windowRegion.get(), windowRegion.get(), windowRegionWithoutOutline.get(), RGN_XOR); + + DefSubclassProc(hWnd, WM_NCPAINT, reinterpret_cast(windowRegion.get()), 0); } } } diff --git a/TFMain/MenuHandler.hpp b/TFMain/MenuHandler.hpp index a58d813..708a683 100644 --- a/TFMain/MenuHandler.hpp +++ b/TFMain/MenuHandler.hpp @@ -121,6 +121,28 @@ namespace TranslucentFlyouts static constexpr DWORD separatorWidth{1000}; static constexpr int systemOutlineSize{1}; + + static constexpr UINT MN_SETHMENU{0x01E0}; +#ifndef MN_GETHMENU + static constexpr UINT MN_GETHMENU{0x01E1}; +#endif // !MN_GETHMENU + static constexpr UINT MN_SIZEWINDOW{0x01E2}; + static constexpr UINT MN_OPENHIERARCHY{0x01E3}; + static constexpr UINT MN_CLOSEHIERARCHY{0x01E4}; + static constexpr UINT MN_SELECTITEM{0x01E5}; + static constexpr UINT MN_CANCELMENUS{0x01E6}; + static constexpr UINT MN_SELECTFIRSTVALIDITEM{0x01E7}; + static constexpr UINT MN_GETPOPUPMENU{0x01EA}; // obsolete + static constexpr UINT MN_FINDMENUWINDOWFROMPOINT{0x01EB}; + static constexpr UINT MN_SHOWPOPUPWINDOW{0x01EC}; + static constexpr UINT MN_MOUSEMOVE{0x01EE}; + static constexpr UINT MN_BUTTONDOWN{0x01ED}; + static constexpr UINT MN_BUTTONUP{0x01EF}; + static constexpr UINT MN_SETTIMERTOOPENHIERARCHY{0x01F0}; + static constexpr UINT MN_DBLCLK{0x01F1}; + static constexpr UINT MN_ENDMENU{0x01F2}; + static constexpr UINT MN_DODRAGDROP{0x01F3}; + static constexpr UINT MN_ENDMENU2{0x01F4}; private: struct MenuRenderingContext { @@ -159,28 +181,6 @@ namespace TranslucentFlyouts static constexpr UINT WM_UAHMEASUREMENUITEM{0x0094}; // lParam is UAHMEASUREMENUITEM, return TRUE after handling it static constexpr UINT WM_UAHNCPAINTMENUPOPUP{0x0095}; // lParam is UAHMENU, return TRUE after handling it - static constexpr UINT MN_SETHMENU{0x01E0}; -#ifndef MN_GETHMENU - static constexpr UINT MN_GETHMENU{0x01E1}; -#endif // !MN_GETHMENU - static constexpr UINT MN_SIZEWINDOW{0x01E2}; - static constexpr UINT MN_OPENHIERARCHY{0x01E3}; - static constexpr UINT MN_CLOSEHIERARCHY{0x01E4}; - static constexpr UINT MN_SELECTITEM{0x01E5}; - static constexpr UINT MN_CANCELMENUS{0x01E6}; - static constexpr UINT MN_SELECTFIRSTVALIDITEM{0x01E7}; - static constexpr UINT MN_GETPOPUPMENU{0x01EA}; // obsolete - static constexpr UINT MN_FINDMENUWINDOWFROMPOINT{0x01EB}; - static constexpr UINT MN_SHOWPOPUPWINDOW{0x01EC}; - static constexpr UINT MN_MOUSEMOVE{0x01EE}; - static constexpr UINT MN_BUTTONDOWN{0x01ED}; - static constexpr UINT MN_BUTTONUP{0x01EF}; - static constexpr UINT MN_SETTIMERTOOPENHIERARCHY{0x01F0}; - static constexpr UINT MN_DBLCLK{0x01F1}; - static constexpr UINT MN_ENDMENU{0x01F2}; - static constexpr UINT MN_DODRAGDROP{0x01F3}; - static constexpr UINT MN_ENDMENU2{0x01F4}; - static constexpr int nonClientMarginSize{3}; static constexpr int popupMenuSubclassId{0}; static constexpr int dropDownSubclassId{0}; diff --git a/TFMain/TFMain.cpp b/TFMain/TFMain.cpp index 8fe9374..5fd8b21 100644 --- a/TFMain/TFMain.cpp +++ b/TFMain/TFMain.cpp @@ -25,7 +25,9 @@ const array g_blockList L"GameBarFTServer.exe"sv, L"ShellExperienceHost.exe"sv, L"StartMenuExperienceHost.exe"sv, - L"msedgewebview2.exe"sv + L"msedgewebview2.exe"sv, + // For compatibility issues + L"StartAllBackX64.dll"sv }; #pragma data_seg("hook") diff --git a/to-do.txt b/to-do.txt deleted file mode 100644 index e0bc28f..0000000 --- a/to-do.txt +++ /dev/null @@ -1,19 +0,0 @@ -自定义绘制 -Menu->(default) -Menu -->Hot -->Focusing -->DisabledHot -->Separator -->->Disabled -->->CornerRadius -->->LightMode_Color -->->LightMode_Opacity -->->DarkMode_Color -->->DarkMode_Opacity - -//2、StartAllBack 冲突和解决 -6、配置文件 -7、UI -8、Readme -9、动画 \ No newline at end of file