Hey, Well I'm trying to nail down why sai paint tool isn't doing its pressure stuff and I think this is starting down the right track but I wanted to get some input from those more familiar with wine messaging and x11 events.
Without the first patch sai can't find an x11 window to attach too and doesn't have any shot at all at getting pressure events from x11. After that patch is applied it attaches to an x11 window but then doesn't pass the information back to the child window that the wintab context was created in. The second patch implements an EnumChildWindows callback function in order to get it back to the child window. I'm asking for this review as while the above works to get the pressure events flowing I'm not sure if its the appropriate way to go. I believe these patches are on the path to fix http://bugs.winehq.org/show_bug.cgi?id=11846 Thanks, John Klehm
From 73b4005211e79a56a80fabf24b6514dd76a9a845 Mon Sep 17 00:00:00 2001 From: John Klehm <[EMAIL PROTECTED]> Date: Mon, 28 Apr 2008 23:06:25 -0500 Subject: winex11.drv: Search more thoroughly for the parent window when attaching a tablet event --- dlls/winex11.drv/wintab.c | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index 333e0b8..3ee032c 100644 --- a/dlls/winex11.drv/wintab.c +++ b/dlls/winex11.drv/wintab.c @@ -928,11 +928,25 @@ int X11DRV_AttachEventQueueToTablet(HWND hOwner) XDeviceInfo *target = NULL; XDevice *the_device; XEventClass event_list[7]; - Window win = X11DRV_get_whole_window( hOwner ); + Window win; + HWND hParent; - if (!win) return 0; + TRACE("hOwner=%p, gNumCursors=%i\n", hOwner, gNumCursors); - TRACE("Creating context for window %p (%lx) %i cursors\n", hOwner, win, gNumCursors); + hParent = GetAncestor(hOwner, GA_ROOT); + TRACE("Trying hParent=GetAncestor(hOwner, GA_ROOT)=%p\n", hParent); + if ( !(win = X11DRV_get_whole_window(hParent)) ) + { + hParent = GetDesktopWindow(); + TRACE("Trying hParent=GetDesktopWindow()=%p\n", hParent); + if ( !(win = X11DRV_get_whole_window(hParent)) ) + { + TRACE("Failed to attach to a window.\n"); + return 0; + } + } + + TRACE("Creating context for hParent=%p, X11 win=%lx\n", hParent, win); wine_tsx11_lock(); devices = pXListInputDevices(data->display, &num_devices); @@ -992,7 +1006,7 @@ int X11DRV_AttachEventQueueToTablet(HWND hOwner) if (NULL != devices) pXFreeDeviceList(devices); wine_tsx11_unlock(); - return 0; + return 1; } /*********************************************************************** -- 1.5.4.5
From f2fca096c69fca71ed31b276abca17ee24ed475c Mon Sep 17 00:00:00 2001 From: John Klehm <[EMAIL PROTECTED]> Date: Tue, 29 Apr 2008 09:59:10 -0500 Subject: wintab32: Add messaging support for wintab child windows --- dlls/winex11.drv/wintab.c | 8 ++++++++ dlls/wintab32/context.c | 20 ++++++++++++++++---- dlls/wintab32/wintab32.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index 3ee032c..05381ac 100644 --- a/dlls/winex11.drv/wintab.c +++ b/dlls/winex11.drv/wintab.c @@ -813,6 +813,9 @@ static void motion_event( HWND hwnd, XEvent *event ) XDeviceMotionEvent *motion = (XDeviceMotionEvent *)event; LPWTI_CURSORS_INFO cursor; int curnum = cursor_from_device(motion->deviceid, &cursor); + + TRACE("hwnd=%p, Xevent=%p\n", hwnd, event); + if (curnum < 0) return; @@ -842,6 +845,9 @@ static void button_event( HWND hwnd, XEvent *event ) XDeviceButtonEvent *button = (XDeviceButtonEvent *) event; LPWTI_CURSORS_INFO cursor; int curnum = cursor_from_device(button->deviceid, &cursor); + + TRACE("hwnd=%p, Xevent=%p\n", hwnd, event); + if (curnum < 0) return; @@ -868,6 +874,8 @@ static void button_event( HWND hwnd, XEvent *event ) static void key_event( HWND hwnd, XEvent *event ) { + TRACE("hwnd=%p, Xevent=%p\n", hwnd, event); + if (event->type == key_press_type) FIXME("Received tablet key press event\n"); else diff --git a/dlls/wintab32/context.c b/dlls/wintab32/context.c index 9551d87..6aaa320 100644 --- a/dlls/wintab32/context.c +++ b/dlls/wintab32/context.c @@ -174,7 +174,8 @@ LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd) ptr = gOpenContexts; while (ptr) { - TRACE("Trying Queue %p (%p %p)\n", ptr->handle, hwnd, ptr->hwndOwner); + /* Too verbose for now + * TRACE("Trying Queue %p (%p %p)\n", ptr->handle, hwnd, ptr->hwndOwner); */ if (ptr->hwndOwner == hwnd) { @@ -231,7 +232,8 @@ LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd) ptr = ptr->next; } LeaveCriticalSection(&csTablet); - TRACE("Done (%p)\n",ptr); + /* Too verbose for now + * TRACE("Done (%p)\n",ptr); */ return ptr; } @@ -455,11 +457,21 @@ HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable) pAttachEventQueueToTablet(hWnd); + if (fEnable) + { + newcontext->enabled = TRUE; + /* TODO: Add to top of overlap order */ + newcontext->context.lcStatus = CXS_ONTOP; + } + else + { + newcontext->enabled = FALSE; + newcontext->context.lcStatus = CXS_DISABLED; + } + TABLET_PostTabletMessage(newcontext, _WT_CTXOPEN(newcontext->context.lcMsgBase), (WPARAM)newcontext->handle, newcontext->context.lcStatus, TRUE); - newcontext->context.lcStatus = CXS_ONTOP; - TABLET_PostTabletMessage(newcontext, _WT_CTXOVERLAP(newcontext->context.lcMsgBase), (WPARAM)newcontext->handle, newcontext->context.lcStatus, TRUE); diff --git a/dlls/wintab32/wintab32.c b/dlls/wintab32/wintab32.c index 5f2afb1..6325eea 100644 --- a/dlls/wintab32/wintab32.c +++ b/dlls/wintab32/wintab32.c @@ -105,6 +105,38 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) return TRUE; } +static BOOL CALLBACK TabletDispatchPacket(HWND hWnd, LPARAM lParam) +{ + static LPOPENCONTEXT handler; + static WTPACKET packet; + pGetCurrentPacket(&packet); + handler = AddPacketToContextQueue(&packet, hWnd); + if (handler && (handler->context.lcOptions & CXO_MESSAGES)) + { + TABLET_PostTabletMessage(handler, _WT_PACKET(handler->context.lcMsgBase), + (WPARAM)packet.pkSerialNumber, + (LPARAM)handler->handle, FALSE); + return FALSE; + } + + return TRUE; +} + +static BOOL CALLBACK TabletDispatchProximity(HWND hWnd, LPARAM lParam) +{ + static WTPACKET packet; + static LPOPENCONTEXT handler; + pGetCurrentPacket(&packet); + handler = AddPacketToContextQueue(&packet, hWnd); + if (handler) + { + TABLET_PostTabletMessage(handler, WT_PROXIMITY, + (WPARAM)handler->handle, lParam, TRUE); + return FALSE; + } + + return TRUE; +} /* * The window proc for the default TABLET window @@ -124,12 +156,16 @@ static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, { WTPACKET packet; LPOPENCONTEXT handler; + pGetCurrentPacket(&packet); handler = AddPacketToContextQueue(&packet,(HWND)lParam); if (handler && handler->context.lcOptions & CXO_MESSAGES) TABLET_PostTabletMessage(handler, _WT_PACKET(handler->context.lcMsgBase), (WPARAM)packet.pkSerialNumber, (LPARAM)handler->handle, FALSE); + else + while (EnumChildWindows((HWND)lParam, (WNDENUMPROC)TabletDispatchPacket, 0)); + break; } case WT_PROXIMITY: @@ -141,6 +177,9 @@ static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, if (handler) TABLET_PostTabletMessage(handler, WT_PROXIMITY, (WPARAM)handler->handle, lParam, TRUE); + else + while (EnumChildWindows((HWND)wParam, (WNDENUMPROC)TabletDispatchProximity, lParam)); + break; } } -- 1.5.4.5