Ajouter hwnds pour les fenêtres autochtones sur Windows

This commit is contained in:
yaw-man 2022-08-08 18:46:40 -03:00
parent d6380607a7
commit e488b14a52
2 changed files with 15 additions and 7 deletions

View File

@ -11,10 +11,14 @@
class Tablet { class Tablet {
public: public:
Tablet() { Tablet(HWND hwnd) {
if (!hwnd) { return; }
if (!LoadWintab() || !gpWTInfoA(0, 0, nullptr)) { if (!LoadWintab() || !gpWTInfoA(0, 0, nullptr)) {
return; return;
} }
NewContext(hwnd);
} }
~Tablet() { ~Tablet() {
@ -23,13 +27,13 @@ public:
private: private:
HCTX hctx = NULL; HCTX hctx = nullptr;
UINT wDevice = 0; UINT wDevice = 0;
AXIS TabletX = { 0 }; AXIS TabletX = { 0 };
AXIS TabletY = { 0 }; AXIS TabletY = { 0 };
LOGCONTEXT ctx = {}; LOGCONTEXT ctx = {};
void NewContext() { void NewContext(HWND hwnd) {
ctx.lcOptions |= CXO_SYSTEM; ctx.lcOptions |= CXO_SYSTEM;
gpWTInfoA(WTI_DEFSYSCTX, 0, &ctx); gpWTInfoA(WTI_DEFSYSCTX, 0, &ctx);
ctx.lcOptions |= CXO_MESSAGES; //TODO: checker çela ctx.lcOptions |= CXO_MESSAGES; //TODO: checker çela
@ -50,8 +54,7 @@ private:
ctx.lcOutExtX = GetSystemMetrics(SM_CXVIRTUALSCREEN); ctx.lcOutExtX = GetSystemMetrics(SM_CXVIRTUALSCREEN);
ctx.lcOutExtY = -GetSystemMetrics(SM_CYVIRTUALSCREEN); ctx.lcOutExtY = -GetSystemMetrics(SM_CYVIRTUALSCREEN);
hctx = gpWTOpenA(, &ctx, FALSE); hctx = gpWTOpenA(hwnd, &ctx, FALSE);
} }
}; };

View File

@ -1,4 +1,5 @@
#include "DistrhoUI.hpp" #include "DistrhoUI.hpp"
#include "tab.cpp"
START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO
@ -13,7 +14,8 @@ public:
fSampleRate(getSampleRate()), fSampleRate(getSampleRate()),
fResizable(isResizable()), fResizable(isResizable()),
fScale(1.0f), fScale(1.0f),
fScaleFactor(getScaleFactor()) fScaleFactor(getScaleFactor()),
tab(getWindow().getNativeWindowHandle())
{ {
std::memset(fParameters, 0, sizeof(float) * kParameterCount); std::memset(fParameters, 0, sizeof(float) * kParameterCount);
std::memset(fStrBuf, 0, sizeof(char) * (0xff + 1)); std::memset(fStrBuf, 0, sizeof(char) * (0xff + 1));
@ -23,7 +25,7 @@ public:
#else #else
loadSharedResources(); loadSharedResources();
#endif #endif
setGeometryConstraints(kInitialWidth, kInitialHeight, true); setGeometryConstraints(kInitialWidth, kInitialHeight, true);
} }
@ -187,6 +189,9 @@ private:
float fScale; // our internal scaling float fScale; // our internal scaling
double fScaleFactor; // host reported scale factor double fScaleFactor; // host reported scale factor
// Tablet context handler
Tablet tab;
// temp buf for text // temp buf for text
char fStrBuf[0xff + 1]; char fStrBuf[0xff + 1];