Re: Multitouch in goocanvasmm



Gtk::Widget::signal_touch_event() exists since gtkmm 3.3.20.

Den 2014-12-12 21:58, Klaus Rudolph skrev:
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.

Thanks
  Klaus



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]