Optimize code structure for input module.

This commit is contained in:
2023-01-21 17:04:29 +08:00
parent 6779b88055
commit 5198ecec1f
11 changed files with 116 additions and 93 deletions

View File

@@ -61,7 +61,7 @@ namespace Cryville.Common.Unity.Input {
public const int TABLET_DISABLE_PENBARRELFEEDBACK = 0x00000010;
public const int TABLET_DISABLE_FLICKS = 0x00010000;
protected override void ActivateImpl() {
protected override void Activate() {
newWndProc = WndProc;
newWndProcPtr = Marshal.GetFunctionPointerForDelegate(newWndProc);
oldWndProcPtr = SetWindowLongPtr(hMainWindow, -4, newWndProcPtr);
@@ -77,7 +77,7 @@ namespace Cryville.Common.Unity.Input {
);
}
protected override void DeactivateImpl() {
protected override void Deactivate() {
if (pressAndHoldAtomID != 0) {
NativeMethods.RemoveProp(hMainWindow, PRESS_AND_HOLD_ATOM);
NativeMethods.GlobalDeleteAtom(pressAndHoldAtomID);
@@ -142,7 +142,7 @@ namespace Cryville.Common.Unity.Input {
}
public override void Dispose(bool disposing) {
DeactivateImpl();
Deactivate();
if (usePointerMessage)
NativeMethods.EnableMouseInPointer(false);
Instance = null;