diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Canvas.cpp | 3 | ||||
-rw-r--r-- | src/node.c | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp index 4f3ca33..9629cab 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -1418,6 +1418,8 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port) ganv_item_grab(GANV_ITEM(port), GDK_POINTER_MOTION_MASK|GDK_BUTTON_RELEASE_MASK, NULL, event->button.time); + GANV_NODE(port)->impl->grabbed = TRUE; + } } else if (!port->impl->is_input) { port_dragging = port_pressed = true; @@ -1499,6 +1501,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port) port_dragging = false; } else if (control_dragging) { control_dragging = false; + GANV_NODE(port)->impl->grabbed = FALSE; } else if (event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) { select_port_toggle(port, event->button.state); } else { @@ -45,7 +45,8 @@ enum { PROP_IS_SOURCE, PROP_SELECTED, PROP_HIGHLIGHTED, - PROP_DRAGGABLE + PROP_DRAGGABLE, + PROP_GRABBED }; static void @@ -151,6 +152,7 @@ ganv_node_set_property(GObject* object, SET_CASE(IS_SOURCE, boolean, impl->is_source); SET_CASE(HIGHLIGHTED, boolean, impl->highlighted); SET_CASE(DRAGGABLE, boolean, impl->draggable); + SET_CASE(GRABBED, boolean, impl->grabbed); case PROP_SELECTED: if (impl->selected != g_value_get_boolean(value)) { GanvItem* item = GANV_ITEM(object); @@ -212,6 +214,7 @@ ganv_node_get_property(GObject* object, GET_CASE(SELECTED, boolean, impl->selected); GET_CASE(HIGHLIGHTED, boolean, impl->highlighted); GET_CASE(DRAGGABLE, boolean, impl->draggable); + GET_CASE(GRABBED, boolean, impl->grabbed); case PROP_CANVAS: g_value_set_object(value, GANV_ITEM(object)->canvas); break; @@ -662,6 +665,14 @@ ganv_node_class_init(GanvNodeClass* klass) 0, G_PARAM_READWRITE)); + g_object_class_install_property( + gobject_class, PROP_GRABBED, g_param_spec_boolean( + "grabbed", + _("Grabbed"), + _("Whether this object is grabbed by the user."), + 0, + G_PARAM_READWRITE)); + signal_moved = g_signal_new("moved", ganv_node_get_type(), G_SIGNAL_RUN_FIRST, |