From e488b14a523a3ed9612613aaeef5a95bff945821 Mon Sep 17 00:00:00 2001 From: yaw-man Date: Mon, 8 Aug 2022 18:46:40 -0300 Subject: [PATCH] =?UTF-8?q?Ajouter=20hwnds=20pour=20les=20fen=C3=AAtres=20?= =?UTF-8?q?autochtones=20sur=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/yaw-tab/tab.cpp | 13 ++++++++----- src/yaw-tab/ui.cpp | 9 +++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) 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];