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 {
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);
}
};

View File

@ -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];