In WebKitGtk+, how can I access parameters in an event listener?
- by Matthew
Here is an example in javascript of what I want to do:
function handleDragStart(e) {
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/plain', 'some data');
}
var dragSource = document.querySelector('#dragSource');
dragSource.addEventListener('dragstart', handleDragStart, false, null);
But I am having trouble translating this to a GLib-based system. Here is an example in Vala:
void on_dragstart(EventTarget event_target) {
// How can I access the equivalent of e.dataTransfer?
}
WebKit.WebView web_view = ...
WebKit.DOM.Document document = web_view.get_dom_document();
WebKit.DOM.Element drag_source = document.query_selector('#dragSource');
drag_source.add_event_listener("dragstart", (Callback) on_dragstart, false, null);
While I am using Vala, an answer in any language interacting with WebKitGtk+ directly would be helpful.