mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added files missing from 2 commits earlier
Some new files were accidentally left out of a previous commit: "Revamping GDI interworking - Part 2" 1999d1c56ef4af2b173764a0dffff0c270357628 The missing files are now added.
This commit is contained in:
parent
1883d919da
commit
2a23cf5636
6
DDrawCompat/CompatGdiCaret.h
Normal file
6
DDrawCompat/CompatGdiCaret.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace CompatGdiCaret
|
||||
{
|
||||
void installHooks();
|
||||
}
|
61
DDrawCompat/CompatGdiWinProc.cpp
Normal file
61
DDrawCompat/CompatGdiWinProc.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include "CompatGdi.h"
|
||||
#include "CompatGdiDc.h"
|
||||
#include "CompatGdiWinProc.h"
|
||||
#include "DDrawLog.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
void eraseBackground(HWND hwnd, HDC dc);
|
||||
|
||||
LRESULT CALLBACK callWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (HC_ACTION == nCode)
|
||||
{
|
||||
auto ret = reinterpret_cast<CWPRETSTRUCT*>(lParam);
|
||||
if (WM_ERASEBKGND == ret->message)
|
||||
{
|
||||
if (0 != ret->lResult)
|
||||
{
|
||||
eraseBackground(ret->hwnd, reinterpret_cast<HDC>(ret->wParam));
|
||||
}
|
||||
}
|
||||
else if (WM_WINDOWPOSCHANGED == ret->message)
|
||||
{
|
||||
CompatGdi::invalidate();
|
||||
}
|
||||
else if (WM_VSCROLL == ret->message || WM_HSCROLL == ret->message)
|
||||
{
|
||||
InvalidateRect(ret->hwnd, nullptr, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return CallNextHookEx(nullptr, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
void eraseBackground(HWND hwnd, HDC dc)
|
||||
{
|
||||
if (CompatGdi::beginGdiRendering())
|
||||
{
|
||||
HDC compatDc = CompatGdiDc::getDc(dc);
|
||||
if (compatDc)
|
||||
{
|
||||
SendMessage(hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(compatDc), 0);
|
||||
CompatGdiDc::releaseDc(dc);
|
||||
}
|
||||
CompatGdi::endGdiRendering();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace CompatGdiWinProc
|
||||
{
|
||||
void installHooks()
|
||||
{
|
||||
const DWORD threadId = GetCurrentThreadId();
|
||||
SetWindowsHookEx(WH_CALLWNDPROCRET, callWndRetProc, nullptr, threadId);
|
||||
}
|
||||
}
|
6
DDrawCompat/CompatGdiWinProc.h
Normal file
6
DDrawCompat/CompatGdiWinProc.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace CompatGdiWinProc
|
||||
{
|
||||
void installHooks();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user