Re: Multitouch in goocanvasmm
- From: Damon Chaplin <damonachaplin gmail com>
- To: Klaus Rudolph <lts-rudolph gmx de>
- Cc: goocanvas-list gnome org, gtkmm-list gnome org
- Subject: Re: Multitouch in goocanvasmm
- Date: Sat, 13 Dec 2014 08:34:54 +0000
On Fri, 2014-12-12 at 21:58 +0100, Klaus Rudolph wrote:
Hi all,
I want to use goocanvasmm to recognize touch events. I did the following:
m_canvas->add_events( Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK |
Gdk::TOUCH_MASK);
sigc::connection conn_t1 = m_canvas->signal_event().connect( sigc::ptr_fun( &AnyEvent));
My event handler starts like this:
bool AnyEvent( GdkEvent* ev)
{
switch( ev->type )
{
case GDK_TOUCH_BEGIN:
{
GdkEventTouch* tev = (GdkEventTouch*)ev;
cout << "Begin" << endl;
cout << tev->x << " " << tev->y << endl;
}
break;
...
All that work fine! I see the events GDK_TOUCH(BEGIN/UPDATE/END) coming in the canvas signal handler!
Well, here is my question:
What I would like to do now is something like:
sigc::connection conn1 = m_rect->signal_???????_event().connect( sigc::ptr_fun( &TouchFunc ));
I believe that there is no function which can directly see the touch events. Is this right? If not,
which signal_?????_event() method can I use to connect the touch signals from an item drawn on the canvas
to the touch event?
If there is actually no method which can deal with touch events directly for the canvas items, is there a
way to forward the
catched events again into the canvas, maybe as button events, which then will be forwarded to the correct
item of the canvas?
I have no idea if there is a send_event or any other function which could do the job. The only thing I
would achieve is, that from the received
coordinates on the canvas window the correct canvas item would be found and then the event is forwarded
exactly on only to this item.
As additional information: Yes, the first touch event is also recognized as key_press_event by the item.
But there is no way to get additional
touch events there from more then the first finger tipped on the touch.
Maybe it is also a solution to enable multiple press/move/release events. But I have no idea how to do
this. It would be nice if someone can point me to the
information.
GooCanvas was written before touch events were supported in GTK+, so it
doesn't support them at the moment. (I don't have a touch screen so it
might be hard for me to add support myself.)
You may be able to use your event handler to receive the touch events,
and then convert them to button press/release events, and use
g_signal_emit() to send them back to the canvas. I'm not sure how well
that would work though.
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]