コード例 #1
0
void webkitWebViewBaseStartDrag(WebKitWebViewBase* webViewBase, const DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
{
    WebKitWebViewBasePrivate* priv = webViewBase->priv;

    RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData());
    GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get()));
    GUniquePtr<GdkEvent> currentEvent(gtk_get_current_event());
    GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(webViewBase),
                                             targetList.get(),
                                             dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()),
                                             1, /* button */
                                             currentEvent.get());
    priv->dragAndDropHelper.startedDrag(context, dataObject.get());


    // A drag starting should prevent a double-click from happening. This might
    // happen if a drag is followed very quickly by another click (like in the DRT).
    priv->clickCounter.reset();

    if (dragImage) {
        RefPtr<cairo_surface_t> image(dragImage->createCairoSurface());
        priv->dragIcon.setImage(image.get());
        priv->dragIcon.useForDrag(context);
    } else
        gtk_drag_set_icon_default(context);
}
コード例 #2
0
void ArgumentCoder<DragData>::encode(ArgumentEncoder* encoder, const DragData& dragData)
{
    encoder->encode(dragData.clientPosition());
    encoder->encode(dragData.globalPosition());
    encoder->encode(static_cast<uint64_t>(dragData.draggingSourceOperationMask()));
    encoder->encode(static_cast<uint64_t>(dragData.flags()));

    DataObjectGtk* platformData = dragData.platformData();
    encoder->encode(static_cast<bool>(platformData));
    if (platformData)
        encodeDataObject(encoder, platformData);
}
コード例 #3
0
ファイル: DragAndDropHandler.cpp プロジェクト: sinoory/webv8
void DragAndDropHandler::startDrag(const DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
{
    RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData());
    GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get()));
    GUniquePtr<GdkEvent> currentEvent(gtk_get_current_event());

    GdkDragContext* context = gtk_drag_begin(m_page.viewWidget(), targetList.get(), dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()),
        GDK_BUTTON_PRIMARY, currentEvent.get());
    m_draggingDataObjects.set(context, dataObject.get());

    if (dragImage) {
        RefPtr<cairo_surface_t> image(dragImage->createCairoSurface());
        m_dragIcon.setImage(image.get());
        m_dragIcon.useForDrag(context);
    } else
        gtk_drag_set_icon_default(context);
}