Bug 391730 - Stop using GtkTargetPair and remove it .
Summary: Stop using GtkTargetPair and remove it .
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M3   Edit
Assignee: Alexander Kurtakov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-10-11 18:25 EDT by Alexander Kurtakov CLA
Modified: 2012-10-24 14:38 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kurtakov CLA 2012-10-11 18:25:44 EDT
It was used in DropTarget.setEventData where the list was iterated using g_list_nth and GtkTargetPair struct recreated on the java side. It is way more simple and effective to use g_list_nth_data which gives us exactly what we need, reduces java/c roundtrips and allows to be compiled on GTK 3.

Commit/patch: http://fedorapeople.org/cgit/akurtakov/public_git/eclipse.platform.swt.git/commit/?h=NoGtkTargetPair&id=68cf18c4dc54af50971bdb807bf2eb3f26ee2696

Silenio, I tested it as much as I can and haven't found any issue but please take a look before I commit it.
Comment 1 Silenio Quarti CLA 2012-10-12 14:40:26 EDT
This works because the "target" is the first field of the GtkTargetPair structure and it is a pointer as well, so the address of struct.targets is the same as the address of the struct.   We can safely assume this is going to work as long as GTK does not break binary compatibility. But if that happens we would have bigger problems.
Comment 2 Alexander Kurtakov CLA 2012-10-12 17:04:29 EDT
Are you fine with merging this in ? I agree that it works by accident but I didn't managed to find another way and if gtk breaks compatibility it will surely be GTK 4.x which I think we can ignore for now.
Comment 3 Silenio Quarti CLA 2012-10-12 17:11:12 EDT
yes, go ahead.