Structure padding plans (GTK+)



Here are my plans for adding padding to structures to help with binary
compatibility.

For class structures, I think we should pad all of the structures 
listed under "Need to be padded" below. For most of the structures,
I want to add 4 pointers worth of padding. 

GdkDrawable and GtkStyle should get more ... I think 10 pointers worth
of padding would be appropriate for these structures.

I think we don't need to do any padding of instance structures since 
object data provides a fairly good way of extending such structures.
There are two forms of padding which might make some sense for
efficiency reasons:
 
 a) Add one pointer that can be turned into a 'private' pointer to 
    a supplemental structure.

 b) Add 32-bits of bit field space if there are no spare bitfields
    in the structure. 

But neither is essential, and I don't plan to do them at this point.
(if nothing else, for lack of time.)

Non-object, non-instance structures are easy to extend unless they are
allocated by a caller. In fact, to be able to extend such a structure
in a source-compatible fashion, we need the ability to tell what
fields are initialized, which makes the question of padding not
relevant. (Unless arrays of the structures are passed in.)

Unfortunately, most such structures we have don't have any way
of telling what fields are initialized. Luckily, we don't have many
such structures.

Structures of some concern for source or binary compatibility:

 GdkEvent, GdkWindowPointerHooks, GtkItemFactoryEntry, GtkStockItem, 
 GtkTargetEntry, GdkGCValues (*)

(*) GdkGCValues can be extended, but gdk_gc_get_values() can
    only ever return the current set of values.

I don't think there is anything we can really do usefully about these,
and there are workarounds we can do - e.g.:

 void	gtk_item_factory_create_items_ex (GtkItemFactory	*ifactory,
					  guint			 n_entries,
					  GtkItemFactoryEntryEx	*entries,
					  gpointer		 callback_data);

A similar analysis still needs to be done for GLib and for Pango.

Regards,
                                        Owen

Need to be padded
=================
GdkDrawableClass
GdkGCClass
GtkAccelGroupClass
GtkAccelLabelClass
GtkAccessibleClass
GtkAdjustmentClass
GtkButtonClass
GtkCalendarClass
GtkCellRendererClass
GtkCellRendererPixbufClass
GtkCellRendererTextClass
GtkCellRendererToggleClass
GtkCheckButtonClass
GtkCheckMenuItemClass
GtkColorSelectionClass
GtkColorSelectionDialogClass
GtkComboClass
GtkContainerClass
GtkCurveClass
GtkDialogClass
GtkDrawingAreaClass
GtkEditableClass
GtkEntryClass
GtkEventBoxClass
GtkFileSelectionClass
GtkFixedClass
GtkFontSelectionClass
GtkFontSelectionDialogClass
GtkGammaCurveClass
GtkHandleBoxClass
GtkIconFactoryClass
GtkImageClass
GtkImageMenuItemClass
GtkIMContextClass
GtkIMMulticontextClass
GtkInputDialogClass
GtkInvisibleClass
GtkItemClass
GtkItemFactoryClass
GtkLabelClass
GtkLayoutClass
GtkListStoreClass
GtkMenuClass
GtkMenuBarClass
GtkMenuItemClass
GtkMenuShellClass
GtkMessageDialogClass
GtkNotebookClass
GtkObjectClass
GtkOptionMenuClass
GtkPanedClass
GtkPlugClass
GtkProgressBarClass
GtkRadioButtonClass
GtkRadioMenuItemClass
GtkRangeClass
GtkRcStyleClass
GtkRulerClass
GtkScaleClass
GtkScrollbarClass
GtkScrolledWindowClass
GtkSizeGroupClass
GtkSocketClass
GtkSpinButtonClass
GtkStatusbarClass
GtkStyleClass
GtkTearoffMenuItemClass
GtkTextBufferClass
GtkTextChildAnchorClass
GtkTextLayoutClass
GtkTextMarkClass
GtkTextTagClass
GtkTextTagTableClass
GtkTextViewClass
GtkTipsQueryClass
GtkToggleButtonClass
GtkToolbarClass
GtkTooltipsClass
GtkTreeModelSortClass
GtkTreeStoreClass
GtkTreeViewClass
GtkTreeSelectionClass
GtkTreeViewColumnClass
GtkWidgetClass
GtkWindowClass
GtkWindowGroupClass
GtkCellEditableIface
GtkTreeDragSourceIface
GtkTreeDragDestIface
GtkTreeModelIface
GtkTreeSortableIface


Containers [?]
==============
GtkAlignmentClass
GtkAspectFrameClass
GtkBoxClass
GtkButtonBoxClass
GtkBinClass
GtkFrameClass
GtkTableClass

Trivial [?]
===========
GtkArrowClass
GtkMiscClass
GtkSeparatorClass
GtkSeparatorMenuItemClass

Not Derivable
=============
GdkColormapClass
GdkDeviceClass
GdkDragContextClass
GdkImageClass
GdkKeymapClass
GdkPixmapObjectClass
GdkVisualClass
GdkWindowObjectClass
GtkSettingsClass

[H/V]
=======
GtkVPanedClass
GtkHButtonBoxClass
GtkHBoxClass
GtkHPanedClass
GtkHRulerClass
GtkHScaleClass
GtkHScrollbarClass
GtkHSeparatorClass
GtkVButtonBoxClass
GtkVBoxClass
GtkViewportClass
GtkVRulerClass
GtkVScaleClass
GtkVScrollbarClass
GtkVSeparatorClass

Deprecated
==========
GtkCListClass
GtkCTreeClass
GtkListClass
GtkListItemClass
GtkPixmapClass
GtkPreviewClass
GtkProgressClass
GtkTreeClass
GtkTreeItemClass
GtkOldEditableClass
GtkTextClass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]