I'm concerned that copying the whole gtk2 directory is not going to lead to
the easiest way to maintain gtk2 and gtk3 ports.
Of 56 files copied, only 25 files include changes, and few of these have
significant changes.
Some of the minor changes would be fine even for our GTK2 builds
(against GTK+-2.10).
The majority of the other changes seem to be just changing from accessing
structs directly to using accessor methods.
This suggests that the best approach is to copy only the files with major
changes but keeping it in the same directory, just changing the makefile.
gtk3drawing.c deserves a copy for sure. I don't know whether there's any
other candidates.
Then there's a number of situations where the same code would work fine for
GTK 2 and 3. gdk_x11_display_get_xdisplay(gdk_display_get_default()) or
DefaultXDisplay() in X11Util.h, for example can replace GDK_DISPLAY() and are
fine in both ports. (Sometimes there's even a more appropriate function such
as gtk_clipboard_get_display().) gtk_window_get_group() is suitable for both ports.
nsBidiKeyboard.cpp can use PR_FindFunctionSymbolAndLibrary instead of choosing
the library by soname. (If there's a reason why "We don't want it" for GTK3
then it should be stated.)
For nsGTKToolkit, GetSharedGC is not used so can be removed (or a stub if necessary).
For all the accessor methods, this can be simplified by modifying existing
files to use the new accessor functions, and adding a header file that is
included to define accessor functions when not available.
For example, one entry would be:
I'm concerned that copying the whole gtk2 directory is not going to lead to
the easiest way to maintain gtk2 and gtk3 ports.
Of 56 files copied, only 25 files include changes, and few of these have
significant changes.
Some of the minor changes would be fine even for our GTK2 builds
(against GTK+-2.10).
The majority of the other changes seem to be just changing from accessing
structs directly to using accessor methods.
This suggests that the best approach is to copy only the files with major
changes but keeping it in the same directory, just changing the makefile.
gtk3drawing.c deserves a copy for sure. I don't know whether there's any
other candidates.
Then there's a number of situations where the same code would work fine for display_ get_xdisplay( gdk_display_ get_default( )) or get_display( ).) gtk_window_ get_group( ) is suitable for both ports.
GTK 2 and 3. gdk_x11_
DefaultXDisplay() in X11Util.h, for example can replace GDK_DISPLAY() and are
fine in both ports. (Sometimes there's even a more appropriate function such
as gtk_clipboard_
nsBidiKeyboard.cpp can use PR_FindFunction SymbolAndLibrar y instead of choosing
the library by soname. (If there's a reason why "We don't want it" for GTK3
then it should be stated.)
For nsGTKToolkit, GetSharedGC is not used so can be removed (or a stub if necessary).
For all the accessor methods, this can be simplified by modifying existing
files to use the new accessor functions, and adding a header file that is
included to define accessor functions when not available.
For example, one entry would be:
#if !GTK_CHECK_ VERSION( 2, 14, 0) get_window( GtkWidget *widget)
static inline GdkWindow*
gtk_widget_
{
return widget->window;
}
#endif