CtrlCore: Another attempt at Pen integration

git-svn-id: svn://ultimatepp.org/upp/trunk@15891 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2021-04-02 09:42:01 +00:00
parent 82a36e0e03
commit b0ba61c847
3 changed files with 16 additions and 4 deletions

View file

@ -103,6 +103,8 @@ enum {
K_OPTION = 0x4000000,
#endif
K_PEN = 0x8000000,
IK_DBL_CLICK = 0x40000001, // this is just to get the info that the entry is equal to dbl-click to the menu
K_MOUSE_FORWARD = 0x80000001,
@ -544,6 +546,7 @@ private:
static Point repeatMousePos;
static PenInfo pen;
static bool is_pen_event;
static Vector<MouseHook>& mousehook();
static Vector<KeyHook>& keyhook();
@ -1240,6 +1243,8 @@ public:
bool IsDragAndDropTarget() { return this == GetDragAndDropTarget(); }
static Size StdSampleSize() { return Size(DPI(126), DPI(106)); }
static PenInfo GetPenInfo() { return pen; }
public:
static void SetSkin(void (*skin)());

View file

@ -19,6 +19,7 @@ Point Ctrl::rightmousepos = Null;
Point Ctrl::middlemousepos = Null;
PenInfo Ctrl::pen;
bool Ctrl::is_pen_event;
dword GetMouseFlags() {
dword style = 0;
@ -317,6 +318,8 @@ Image Ctrl::MEvent0(int e, Point p, int zd)
mm |= K_MOUSEDOUBLE;
if((e & ACTION) == TRIPLE)
mm |= K_MOUSETRIPLE;
if(is_pen_event)
mm |= K_PEN;
Rect view = GetView();
if(mouseCtrl != this) {
if(mouseCtrl) {

View file

@ -68,6 +68,8 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
// LLOG("Ctrl::WindowProc(" << message << ") in " << ::Name(this) << ", focus " << (void *)::GetFocus());
Ptr<Ctrl> _this = this;
HWND hwnd = GetHWND();
is_pen_event = (GetMessageExtraInfo() & 0xFFFFFF00) == 0xFF515700;
POINT p;
if(::GetCursorPos(&p))
@ -126,7 +128,7 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
if(ppi.penMask & PEN_MASK_TILT_Y)
pen.tilt.y = ppi.tiltY * M_2PI / 360;
};
/*
auto DoPen = [&](Point p) {
GuiLock __;
eventCtrl = this;
@ -137,11 +139,12 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
SyncCaret();
return b;
};
*/
UINT32 pointerId = GET_POINTERID_WPARAM(wParam);
if(GetPointerType(pointerId, &pointerType) && pointerType == PT_PEN) {
UINT32 hc = 256;
Buffer<POINTER_PEN_INFO> ppit(hc);
/*
if(message == WM_POINTERUPDATE && GetPointerPenInfoHistory(pointerId, &hc, ppit)) {
bool processed = false;
for(int i = hc - 1; i >= 0; i--) {
@ -156,10 +159,11 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
else
break;
}
*/
POINTER_PEN_INFO ppi;
if(GetPointerPenInfo(pointerId, &ppi))
ProcessPenInfo(ppi);
switch(message) {
/* switch(message) {
case WM_POINTERDOWN:
pen.action = PEN_DOWN;
ClickActivateWnd();
@ -170,7 +174,7 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
}
if(DoPen(p))
return 0L;
break;
break;*/
}
}
break;