mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Disabled DWM transitions and nonclient area rendering
Disabling DWM nonclient area rendering restores proper hit testing for the non-themed caption buttons. Transitions are disabled just in case.
This commit is contained in:
parent
e258a17b18
commit
acd61bbed3
@ -1,5 +1,6 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
#include <dwmapi.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
#include "CompatGdi.h"
|
#include "CompatGdi.h"
|
||||||
@ -9,6 +10,7 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
void disableDwmAttributes(HWND hwnd);
|
||||||
void eraseBackground(HWND hwnd, HDC dc);
|
void eraseBackground(HWND hwnd, HDC dc);
|
||||||
bool isScrollBarVisible(HWND hwnd, LONG windowStyles, LONG sbStyle, LONG sbObjectId);
|
bool isScrollBarVisible(HWND hwnd, LONG windowStyles, LONG sbStyle, LONG sbObjectId);
|
||||||
void ncPaint(HWND hwnd);
|
void ncPaint(HWND hwnd);
|
||||||
@ -19,7 +21,11 @@ namespace
|
|||||||
if (HC_ACTION == nCode)
|
if (HC_ACTION == nCode)
|
||||||
{
|
{
|
||||||
auto ret = reinterpret_cast<CWPRETSTRUCT*>(lParam);
|
auto ret = reinterpret_cast<CWPRETSTRUCT*>(lParam);
|
||||||
if (WM_ERASEBKGND == ret->message)
|
if (WM_CREATE == ret->message)
|
||||||
|
{
|
||||||
|
disableDwmAttributes(ret->hwnd);
|
||||||
|
}
|
||||||
|
else if (WM_ERASEBKGND == ret->message)
|
||||||
{
|
{
|
||||||
if (0 != ret->lResult)
|
if (0 != ret->lResult)
|
||||||
{
|
{
|
||||||
@ -46,6 +52,17 @@ namespace
|
|||||||
return CallNextHookEx(nullptr, nCode, wParam, lParam);
|
return CallNextHookEx(nullptr, nCode, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void disableDwmAttributes(HWND hwnd)
|
||||||
|
{
|
||||||
|
DWMNCRENDERINGPOLICY ncRenderingPolicy = DWMNCRP_DISABLED;
|
||||||
|
DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY,
|
||||||
|
&ncRenderingPolicy, sizeof(ncRenderingPolicy));
|
||||||
|
|
||||||
|
BOOL disableTransitions = TRUE;
|
||||||
|
DwmSetWindowAttribute(hwnd, DWMWA_TRANSITIONS_FORCEDISABLED,
|
||||||
|
&disableTransitions, sizeof(disableTransitions));
|
||||||
|
}
|
||||||
|
|
||||||
void drawSizeBox(HWND hwnd, HDC compatDc, const RECT& windowRect, const RECT& clientRect)
|
void drawSizeBox(HWND hwnd, HDC compatDc, const RECT& windowRect, const RECT& clientRect)
|
||||||
{
|
{
|
||||||
LONG style = GetWindowLongPtr(hwnd, GWL_STYLE);
|
LONG style = GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>DDrawCompat.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>DDrawCompat.def</ModuleDefinitionFile>
|
||||||
<AdditionalDependencies>dxguid.lib;detours.lib;msimg32.lib;oleacc.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>dxguid.lib;detours.lib;msimg32.lib;oleacc.lib;uxtheme.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@ -121,7 +121,7 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>DDrawCompat.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>DDrawCompat.def</ModuleDefinitionFile>
|
||||||
<AdditionalDependencies>dxguid.lib;detours.lib;msimg32.lib;oleacc.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>dxguid.lib;detours.lib;msimg32.lib;oleacc.lib;uxtheme.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<GenerateDebugInformation>No</GenerateDebugInformation>
|
<GenerateDebugInformation>No</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user