Community
Participate
Working Groups
This patch makes GDK_WIDGET_FLAGS dynamic: http://fedorapeople.org/cgit/aspektor/public_git/eclipse.platform.swt.git/commit/?h=make_dynamic_flags
#define macros cannot be made dynamic. GTK_WIDGET_FLAGS is only available at compile time (not runtime).
If you take a look at OS.java, you will find out method GTK_WIDGET_FLAGS; public static final native int _GTK_WIDGET_FLAGS(int /*long*/ wid); public static final int GTK_WIDGET_FLAGS(int /*long*/ wid) { lock.lock(); try { return _GTK_WIDGET_FLAGS(wid); } finally { lock.unlock(); } } It does not look like regular #define macros, if I try the approach I used with macros it gives me this: os.c: In function ‘Java_org_eclipse_swt_internal_gtk_OS__1GTK_1WIDGET_1FLAGS’: os.c:1554:13: error: ‘GTK_WIDGET_FLAGS’ undeclared (first use in this function) os.c:1554:13: note: each undeclared identifier is reported only once for each function it appears in
(In reply to comment #2) > If you take a look at OS.java, you will find out method GTK_WIDGET_FLAGS; > > public static final native int _GTK_WIDGET_FLAGS(int /*long*/ wid); > public static final int GTK_WIDGET_FLAGS(int /*long*/ wid) { > lock.lock(); > try { > return _GTK_WIDGET_FLAGS(wid); > } finally { > lock.unlock(); > } > } > > > > It does not look like regular #define macros, if I try the approach I used > with macros it gives me this: > > os.c: In function > ‘Java_org_eclipse_swt_internal_gtk_OS__1GTK_1WIDGET_1FLAGS’: > os.c:1554:13: error: ‘GTK_WIDGET_FLAGS’ undeclared (first use in this > function) > os.c:1554:13: note: each undeclared identifier is reported only once for > each function it appears in by approach I used I meant: #ifndef GTK_WIDGET_FLAGS #define GTK_WIDGET_FLAGS(arg0) 0 #endif
Which gtk version are you compiling against? GTK 3? 1) Would this work? #if GTK_CHECK_VERSION(3,0,0) #define GTK_WIDGET_FLAGS(arg0) 0 #else 2) Another option? #if GTK_CHECK_VERSION(3,0,0) #define NO__1GTK_1WIDGET_1FLAGS #else Option 2 is different from what we have been doing, but it might be a better option. The native would not be compiled (save some space) when the SWT libraries are compiled against GTK 3. If the java code tries to call that native, we would get a java exception instead of silently fail and return 0. It would be easier to track problems.
(In reply to comment #4) > Which gtk version are you compiling against? GTK 3? > > 1) Would this work? > > #if GTK_CHECK_VERSION(3,0,0) > #define GTK_WIDGET_FLAGS(arg0) 0 > #else > > 2) Another option? > > #if GTK_CHECK_VERSION(3,0,0) > #define NO__1GTK_1WIDGET_1FLAGS > #else > > Option 2 is different from what we have been doing, but it might be a better > option. The native would not be compiled (save some space) when the SWT > libraries are compiled against GTK 3. If the java code tries to call that > native, we would get a java exception instead of silently fail and return 0. > It would be easier to track problems. What is supposed to go after #else ? When I try: #if GTK_CHECK_VERSION(3,0,0) #define GTK_WIDGET_FLAGS(arg0) 0 #endif or #if GTK_CHECK_VERSION(3,0,0) #define NO__1GTK_1WIDGET_1FLAGS #endif It gives me in both cases: os.c:1554:13: error: ‘GTK_WIDGET_FLAGS’ undeclared (first use in this function) os.c:1554:13: note: each undeclared identifier is reported only once for each function it appears in
(In reply to comment #5) > What is supposed to go after #else ? #endif instead of #else is right. What gtk version are you compiling against?
(In reply to comment #6) > (In reply to comment #5) > > > What is supposed to go after #else ? > > #endif instead of #else is right. > > What gtk version are you compiling against? against GTK 3
I think the problem with #define was due to some merging problems in my branch. After resetting the branch I tried defining GTK_WIDGET_FLAGS and version guarding it. It seems to work fine for me now. Here is the patch: http://fedorapeople.org/cgit/aspektor/public_git/eclipse.platform.swt.git/commit/?h=make_dynamic_flags I would appreciate if you could double check and let me know if it actually works for you. Regards, Anatoly
Patch works for me. I will push once 4.3 M2 is done.
(In reply to comment #9) > Patch works for me. I will push once 4.3 M2 is done. Ok, thanks!
Pushed to eclipse.org http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2d6a57f6ecbc6b63ed5329bf0b00d776b893cc6f