diff --git a/src/yaw-tab/tab.cpp b/src/yaw-tab/tab.cpp index 75fa9e2..ad0bc3c 100644 --- a/src/yaw-tab/tab.cpp +++ b/src/yaw-tab/tab.cpp @@ -11,10 +11,14 @@ class Tablet { public: - Tablet() { + Tablet(HWND hwnd) { + if (!hwnd) { return; } + if (!LoadWintab() || !gpWTInfoA(0, 0, nullptr)) { return; } + + NewContext(hwnd); } ~Tablet() { @@ -23,13 +27,13 @@ public: private: - HCTX hctx = NULL; + HCTX hctx = nullptr; UINT wDevice = 0; AXIS TabletX = { 0 }; AXIS TabletY = { 0 }; LOGCONTEXT ctx = {}; - void NewContext() { + void NewContext(HWND hwnd) { ctx.lcOptions |= CXO_SYSTEM; gpWTInfoA(WTI_DEFSYSCTX, 0, &ctx); ctx.lcOptions |= CXO_MESSAGES; //TODO: checker çela @@ -50,8 +54,7 @@ private: ctx.lcOutExtX = GetSystemMetrics(SM_CXVIRTUALSCREEN); ctx.lcOutExtY = -GetSystemMetrics(SM_CYVIRTUALSCREEN); - hctx = gpWTOpenA(, &ctx, FALSE); - + hctx = gpWTOpenA(hwnd, &ctx, FALSE); } }; \ No newline at end of file diff --git a/src/yaw-tab/ui.cpp b/src/yaw-tab/ui.cpp index ec92507..51bd0b3 100644 --- a/src/yaw-tab/ui.cpp +++ b/src/yaw-tab/ui.cpp @@ -1,4 +1,5 @@ #include "DistrhoUI.hpp" +#include "tab.cpp" START_NAMESPACE_DISTRHO @@ -13,7 +14,8 @@ public: fSampleRate(getSampleRate()), fResizable(isResizable()), fScale(1.0f), - fScaleFactor(getScaleFactor()) + fScaleFactor(getScaleFactor()), + tab(getWindow().getNativeWindowHandle()) { std::memset(fParameters, 0, sizeof(float) * kParameterCount); std::memset(fStrBuf, 0, sizeof(char) * (0xff + 1)); @@ -23,7 +25,7 @@ public: #else loadSharedResources(); #endif - + setGeometryConstraints(kInitialWidth, kInitialHeight, true); } @@ -187,6 +189,9 @@ private: float fScale; // our internal scaling double fScaleFactor; // host reported scale factor + // Tablet context handler + Tablet tab; + // temp buf for text char fStrBuf[0xff + 1];