Community
Participate
Working Groups
Build Identifier: I20120503-1800 This patch omits use of deprecated GTK_WIDGET_SET_FLAGS and uses new methods instead: http://fedorapeople.org/gitweb?p=aspektor/public_git/eclipse.platform.swt.git;a=commit;h=92293800b9f236b712c98f8b8cb6ac398f1e13c5 Reproducible: Always
The patch above works fine, however it sends warning about the redefining GTK_WIDGET_SET_FLAGS when you build it. Stack trace can be found here: http://pastebin.com/JnRjZRVF To solve this problem I have put #undef statement before #define in os_custom.h, and it seems to solve this problem. So please refer to this updated version of the patch: http://fedorapeople.org/gitweb?p=aspektor/public_git/eclipse.platform.swt.git;a=commit;h=6af2267f50c6241aaa6242aa5e36c5bec5b42ada Regards, Anatoly
Please add three helper functions (the same way I added for bug#384651). Do we really need? #undef GTK_WIDGET_SET_FLAGS Would the warning be gone if we remove the version check? #ifndef GTK_WIDGET_SET_FLAGS #define GTK_WIDGET_SET_FLAGS(arg0, arg1) #endif
The way you showed is producing this error: os.c:1681:2: error: lvalue required as left operand of assignment If I remove #undef I get even bigger set of errors, as this function is already #defined in gtkwidget.h. Stacktrace if I remove #undef: os_custom.h:365:0: warning: "GTK_WIDGET_SET_FLAGS" redefined [enabled by default] In file included from /usr/include/gtk-2.0/gtk/gtkcontainer.h:35:0, from /usr/include/gtk-2.0/gtk/gtkbin.h:35, from /usr/include/gtk-2.0/gtk/gtkwindow.h:36, from /usr/include/gtk-2.0/gtk/gtkdialog.h:35, from /usr/include/gtk-2.0/gtk/gtkaboutdialog.h:32, from /usr/include/gtk-2.0/gtk/gtk.h:33, from os.h:31, from os_structs.h:16, from os.c:17: /usr/include/gtk-2.0/gtk/gtkwidget.h:459:0: note: this is the location of the previous definition
I only see the error you see if I just define the macro: #define GTK_WIDGET_SET_FLAGS(arg0, arg1) I can compile fine with: #ifndef GTK_WIDGET_SET_FLAGS #define GTK_WIDGET_SET_FLAGS(arg0, arg1) #endif
How are you testing the changes in Composite.setTabItemFocus()? I need to understand why the original code is playing with the GTK_HAS_FCOUS bit (it seems old) and if the new code is equivalent.
Regarding compilation: It is strange that I am getting this warning: os.c:1681:2: error: lvalue required as left operand of assignment and you don't. Regarding HAS_FOCUS in Composite - very strange code, and used only once in this case. All it does just sets focus directly, and it seems that there is no alternative to it in new GTK (maybe it is not even needed?) I was struggling to test it, so I was following direct instructions from: http://developer.gnome.org/gtk/2.24/GtkWidget.html#gtk_has_focus That says: GTK_HAS_FOCUS Set by gtk_widget_grab_focus() for widgets that also have GTK_CAN_FOCUS set. The flag will be unset once another widget grabs the focus. In theory, this should do exactly what old code does.
Regarding compilation: Please take a look here: http://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.h?h=gtk-2-24#n459 You might see that GTK_WIDGET_SET_FLAGS is defined here, and because it is not guarded with GTK_DISABLE_DEPRECATED we need to #undef it before we define. As it is already defined #ifndef won't work in this case.
(In reply to comment #7) > Regarding compilation: > > Please take a look here: > > http://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.h?h=gtk-2-24#n459 > > You might see that GTK_WIDGET_SET_FLAGS is defined here, and because it is > not guarded with GTK_DISABLE_DEPRECATED we need to #undef it before we > define. As it is already defined #ifndef won't work in this case. Ok, I get the problem if I define GTK_DISABLE_DEPRECATED. The problem happens because GTK_WIDGET_SET_FLAGS is not guarded, but GTK_OBJECT_FLAGS is guarded. GTK_OBJECT_FLAGS is used by GTK_WIDGET_FLAGS. This is a bug in GTK IMHO. I believe the appropriated thing to do here is to define GTK_OBJECT_FLAGS instead of undefine GTK_WIDGET_SET_FLAGS. #ifndef GTK_OBJECT_FLAGS #define GTK_OBJECT_FLAGS(wid) 0 #else Does that make sense?
(In reply to comment #8) > (In reply to comment #7) > > Regarding compilation: > > > > Please take a look here: > > > > http://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.h?h=gtk-2-24#n459 > > > > You might see that GTK_WIDGET_SET_FLAGS is defined here, and because it is > > not guarded with GTK_DISABLE_DEPRECATED we need to #undef it before we > > define. As it is already defined #ifndef won't work in this case. > > Ok, I get the problem if I define GTK_DISABLE_DEPRECATED. The problem > happens because GTK_WIDGET_SET_FLAGS is not guarded, but GTK_OBJECT_FLAGS is > guarded. GTK_OBJECT_FLAGS is used by GTK_WIDGET_FLAGS. This is a bug in GTK > IMHO. > > I believe the appropriated thing to do here is to define GTK_OBJECT_FLAGS > instead of undefine GTK_WIDGET_SET_FLAGS. > > #ifndef GTK_OBJECT_FLAGS > #define GTK_OBJECT_FLAGS(wid) 0 > #else > > Does that make sense? In this case, what would you put in #else ? Whenever we don't touch GTK_WIDGET_SET_FLAGS it gives this error: os.c: In function ‘Java_org_eclipse_swt_internal_gtk_OS__1GTK_1WIDGET_1SET_1FLAGS’: os.c:1681:2: error: lvalue required as left operand of assignment And only way I am able to get rid of it is to: #define GTK_WIDGET_SET_FLAGS(arg0, arg1)but than it shows bunch of errors regarding double declaration. So if I just use #ifndef GTK_OBJECT_FLAGS it won't solve left operand required warning.
(In reply to comment #9) > In this case, what would you put in #else ? Sorry, the #else is a typo. It should have been #endif > > Whenever we don't touch GTK_WIDGET_SET_FLAGS it gives this error: > > os.c: In function > ‘Java_org_eclipse_swt_internal_gtk_OS__1GTK_1WIDGET_1SET_1FLAGS’: > os.c:1681:2: error: lvalue required as left operand of assignment > > And only way I am able to get rid of it is to: > #define GTK_WIDGET_SET_FLAGS(arg0, arg1)but than it shows bunch of errors > regarding double declaration. > > So if I just use #ifndef GTK_OBJECT_FLAGS it won't solve left operand > required warning. Strange, if I define GTK_DISABLE_DEPRECATED and GTK_OBJECT_FLAGS like this: #ifndef GTK_OBJECT_FLAGS #define GTK_OBJECT_FLAGS(wid) 0 #endif This error os.c:1681:2: error: lvalue required as left operand of assignment is gone for me when compiling against GTK 2.24. What is different for you? What version are you compiling against?
I am compiling against 2.24. When I use: #ifndef GTK_OBJECT_FLAGS #define GTK_OBJECT_FLAGS(wid) 0 #endif It removes warning regarding GTK_WIDGET_FLAGS. (I am using same code in GTK_WIDGET_FLAGS as you might have seen) But regarding GTK_WIDGET_SET_FLAGS, I still see the same error: os.c: In function ‘Java_org_eclipse_swt_internal_gtk_OS__1GTK_1WIDGET_1SET_1FLAGS’: os.c:1681:2: error: lvalue required as left operand of assignment I have tested it on two separate machines compiling against 2.24, and I am still getting this error on both. Regards, Anatoly
Ok, I was able to reproduce your "lvalue" problem. I released a hack to avoid this problem. Basically the GTK_OBJECT_FLAGS macro has to expand to a variable not a constant. Please update the patch to add the helper functions and leave the GTK_HAS_FOCUS code unchanged. Open a separate bug for that.
(In reply to comment #12) > Ok, I was able to reproduce your "lvalue" problem. I released a hack to > avoid this problem. Basically the GTK_OBJECT_FLAGS macro has to expand to a > variable not a constant. > > Please update the patch to add the helper functions and leave the > GTK_HAS_FOCUS code unchanged. Open a separate bug for that. I have added helper function and omitted GTK_HAS_FOCUS implementation. Here is patch: http://fedorapeople.org/cgit/aspektor/public_git/eclipse.platform.swt.git/commit/?h=gtk_widget_set_flags
Pushed to eclipse.org after fixing a couple of places where the wrong handle was used (in Control and Composite) http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=fc2d2ec1727bbf89af6fa75dcff471c41c95b0be