Krzysztof Kosiński wrote:
Arcadie M. Cracan wrote:
I don't really understand what I am doing wrong. I have a button on the toolbar of the connector tool (InkAction) that, when gets pressed, basically creates a new knot that follows the mouse pointer.
At this point (after the button is pressed) SPEventContext (for the connector tool) stops receiving any button1 press/release events. Other buttons press/release, pointer motion events are received.
That's because those events are processed by the knot. It would be impossible to write anything if you also received those events on the context. Instead of button 1 events on the context, you get emissions of the "clicked", "grabbed", "request" and "ungrabbed" signals on the knot.
Well, my thought was the same, that events get processed by the knot. The events for the knots are processed by the function cc_generic_knot_handler. Here are some more excerpts from my tentatives to find the bug: - the way knots are created: ... SPKnot *knot = sp_knot_new(desktop, 0); ... // We don't want to use the standard knot handler.
g_signal_handler_disconnect(G_OBJECT(knot->item), knot->_event_handler_id); knot->_event_handler_id = 0;
gtk_signal_connect(GTK_OBJECT(knot->item), "event", GTK_SIGNAL_FUNC(cc_generic_knot_handler), knot); ...
- an excerpt from cc_generic_knot_handler: ... if (event->type == GDK_BUTTON_PRESS) std::cout<<"generic_knot_handler: A button has been pressed."<<std::endl; ...
I have similar messages in all functions that process events (root_handler, item_handler) and I never see a message when I click button1. That's what bugs me most :), I can't figure out where these events are "lost".
Too bad you already wrote some code using the old SPKnot class, because as part of my GSoC work I wrote a C++ class for a control point that has more features and is easier to use (for example, it uses libsigc++ signals).
I guess there are more improvements that you already made that I could use for the connector tool (I'm intending to make use of the node tool for editing connection points), but I will look to them after GSoC.
Thank you for the reply.
Regards, Arcadie