Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 374994 - Use gtk_scrolled_window_get_[h|v]scrollbar functions for GTK >= 2.8.
Summary: Use gtk_scrolled_window_get_[h|v]scrollbar functions for GTK >= 2.8.
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.8   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M1   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-03-21 17:53 EDT by Alexander Kurtakov CLA
Modified: 2012-08-10 08:07 EDT (History)
0 users

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-03-21 17:53:02 EDT
The old way of accessing the struct directly is made dynamic as they are no longer exposed in GTK 3.

Commit/patch:
http://fedorapeople.org/gitweb?p=akurtakov/public_git/eclipse.platform.swt.git;a=commit;h=034cc5eace7750f76bc08a765682bf9889967674
Comment 1 Silenio Quarti CLA 2012-03-26 14:45:21 EDT
The natives GTK_SCROLLED_WINDOW_HSCROLLBAR and GTK_SCROLLED_WINDOW_VSCROLLBAR cannot be made dynamic since they are just #define in os_custom.h. They are not symbols exported by the gtk library.
Comment 2 Alexander Kurtakov CLA 2012-03-26 14:52:26 EDT
(In reply to comment #1)
> The natives GTK_SCROLLED_WINDOW_HSCROLLBAR and GTK_SCROLLED_WINDOW_VSCROLLBAR
> cannot be made dynamic since they are just #define in os_custom.h. They are not
> symbols exported by the gtk library.

I know that but marking them dynamic makes the generated code in os.c use LOAD_FUNCTION which allows to compile when you have sealing enabled. I'll test it further but just wanted to explain the reasoning behind that.
Comment 3 Alexander Kurtakov CLA 2012-04-09 14:13:46 EDT
Ok, my patch is working for gtk 2.8+ via the new call but it failing miserably when the old way (access the struct) was used. How should we proceed in this case? I don't see a clean way to compile the struct access in for newer gtk versions that don't expose the internals.
Comment 4 Silenio Quarti CLA 2012-04-10 13:34:25 EDT
For compatibility reasons, I believe we have to compile against the oldest GTK version we want to support. So the field accessors in os_custom.h would not cause a compiler error. They would not cause a runtime error either because the native call in Java should be protected with a version check (i.e, code would not run for gtk3).

If we want to allow people to compile against a newer version of GTK, we could add a version check in os_custom.h. Something like:


#if GTK_CHECK_VERSION(2,8,0)
#define GTK_SCROLLED_WINDOW_HSCROLLBAR(arg0) 0
#else
#define GTK_SCROLLED_WINDOW_HSCROLLBAR(arg0) (arg0)->hscrollbar
#endif

but note that SWT libraries compiled this way would not work when running in older versions. This is probably ok if the app (i.e. eclipse, etc) gets compiled for a given distribution. This is not the case for the eclipse.org downloads.

Would that work?
Comment 5 Alexander Kurtakov CLA 2012-06-20 09:30:53 EDT
(In reply to comment #4)
> For compatibility reasons, I believe we have to compile against the oldest GTK
> version we want to support. So the field accessors in os_custom.h would not
> cause a compiler error. They would not cause a runtime error either because the
> native call in Java should be protected with a version check (i.e, code would
> not run for gtk3).
> 
> If we want to allow people to compile against a newer version of GTK, we could
> add a version check in os_custom.h. Something like:
> 
> 
> #if GTK_CHECK_VERSION(2,8,0)
> #define GTK_SCROLLED_WINDOW_HSCROLLBAR(arg0) 0
> #else
> #define GTK_SCROLLED_WINDOW_HSCROLLBAR(arg0) (arg0)->hscrollbar
> #endif
> 
> but note that SWT libraries compiled this way would not work when running in
> older versions. This is probably ok if the app (i.e. eclipse, etc) gets
> compiled for a given distribution. This is not the case for the eclipse.org
> downloads.
> 
> Would that work?

Yes, this would definetely work for our case where we have to compile against newer libs. I'll prepare a new patch .
Sorry for taking so long, this bug just got lost in my query.