CPW - adding an external event

Is there a simple way to add a function that recive an external event (lets say from a tablet or some other device)?

If so, how?

Thanks,
Oren.

That’s a darn good question. Hmm…

Is this a window event? or would this be
some sort of device you would need to poll?

The simplest first approach would be to develop an cpw extension, described in the online docs. If that doesn’t work, and is an event that’s tied to a window,
you can add any number of custom events by doing the following:

  1. add the event to the cpw event types in cpw_event.h
  2. add a host adapter event trigger (like void cpw_hostevent_myinput( pCpw cpw, uint_32 id ); these functions are stored in cpw_event.h/.c
  3. hook the event trigger up to the actual event in cpw_win32.c

If it’s something you want to poll, i’d just hook the polling up in place of a joystick or similar.

Please let me know what your trying to do, this sounds like something that could be automated and made easier.

Regards,
Jim

Hi Jim,

Well, I’m trying to use a Wacom Tablet using the WinTab library, and get the message: WT_PACKET which is a window event (just like WM_KEYDOWN or WM_PAINT etc.)

Do you have an example how to do that?
I only need to know if a WM_PACKET message is waiting, than I’ll get the info. I need (movement, button pressed etc.) by using a WinTab function call.

Thanks again,
Oren.

Originally posted by oshapir:
[b]Hi Jim,

Well, I’m trying to use a Wacom Tablet using the WinTab library, and get the message: WT_PACKET which is a window event (just like WM_KEYDOWN or WM_PAINT etc.)

Do you have an example how to do that?
I only need to know if a WM_PACKET message is waiting, than I’ll get the info. I need (movement, button pressed etc.) by using a WinTab function call.

Thanks again,
Oren.

[/b]

The WT_PACKET message is going ot come into
the main event loop in cpw_win32.c and will
fall through because there is no handler for
it. You can add a handler and pass the
information in through an existing Cpw event
if it fits to something. Or create a new
event for it as I described above. All in
all not a major change to the source.

If I had a tablet I’d do it myself but
I don’t. If you do get something working
please mail it to me so I can add it to
the core library.

Regards,
Jim