Logo Search packages:      
Sourcecode: inkscape version File versions

int sp_canvas_item_grab ( SPCanvasItem item,
guint  event_mask,
GdkCursor *  cursor,
guint32  etime 

Grab item under cursor.

!canvas->grabbed_item && item->flags & SP_CANVAS_ITEM_VISIBLE

Definition at line 526 of file sp-canvas.cpp.

References SPCanvasItem::canvas, SPCanvas::current_item, SPCanvas::grabbed_event_mask, and SPCanvas::grabbed_item.

Referenced by pen_handle_motion_notify(), pencil_handle_motion_notify(), sp_event_context_private_root_handler(), and sp_knot_start_dragging().

    g_return_val_if_fail (item != NULL, -1);
    g_return_val_if_fail (SP_IS_CANVAS_ITEM (item), -1);
    g_return_val_if_fail (GTK_WIDGET_MAPPED (item->canvas), -1);

    if (item->canvas->grabbed_item)
        return -1;

    if (!(item->flags & SP_CANVAS_ITEM_VISIBLE))
        return -1;

    /* fixme: Top hack (Lauris) */
    /* fixme: If we add key masks to event mask, Gdk will abort (Lauris) */
    /* fixme: But Canvas actualle does get key events, so all we need is routing these here */
    gdk_pointer_grab (SP_CANVAS_WINDOW (item->canvas), FALSE,
                      (GdkEventMask)(event_mask & (~(GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK))),
                      NULL, cursor, etime);

    item->canvas->grabbed_item = item;
    item->canvas->grabbed_event_mask = event_mask;
    item->canvas->current_item = item; /* So that events go to the grabbed item */

    return 0;

Generated by  Doxygen 1.6.0   Back to index