diff --git a/README.md b/README.md index e7b90918..c1c04797 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,9 @@ This README is being written.
*Note that today's entry (Eastern Time) may be updated later today.* +* **12 May 2018** + * GTK+ and OS X now have a cleaner build process for static libraries which no longer has intermediate files and differing configurations. As a result, certain issues should no longer be present. New naming rules for internal symbols of libui have also started being drafted; runtime symbols and edge cases still need to be handled (and the rules applied to Windows) before this can become a regular thing. + * **18 April 2018** * Migrated all code in the `common/` directory to use `uipriv` prefixes for everything that isn't `static`. This is the first step toward fixing static library oddities within libui, allowing libui to truly be safely used as either a static library or a shared library. diff --git a/unix/CMakeLists.txt b/unix/CMakeLists.txt index b9a5bf21..19e188d1 100644 --- a/unix/CMakeLists.txt +++ b/unix/CMakeLists.txt @@ -56,28 +56,8 @@ list(APPEND _LIBUI_INCLUDEDIRS set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE) set(_LIBUINAME libui PARENT_SCOPE) -if(NOT BUILD_SHARED_LIBS) - set(_LIBUINAME libui-temporary PARENT_SCOPE) -endif() -# TODO remove all these temporary files after linking the final archive file macro(_handle_static) - set_target_properties(${_LIBUINAME} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") - set(_aname $) - set(_oname libui-combined.o) - add_custom_command( - OUTPUT ${_oname} - COMMAND - ld -r --whole-archive ${_aname} -o ${_oname} - COMMAND - objcopy --localize-hidden ${_oname} - COMMENT "Removing hidden symbols") - add_library(libui STATIC ${_oname}) - # otherwise cmake won't know which linker to use - set_target_properties(libui PROPERTIES - LINKER_LANGUAGE C) - set(_aname) - set(_oname) + # do nothing endmacro() # TODO the other variables don't work? diff --git a/unix/alloc.c b/unix/alloc.c index 2fdd2052..3fa0fd41 100644 --- a/unix/alloc.c +++ b/unix/alloc.c @@ -13,7 +13,7 @@ static GPtrArray *allocations; #define CCHAR(p) ((const char **) (p)) #define TYPE(p) CCHAR(UINT8(p) + sizeof (size_t)) -void initAlloc(void) +void uiprivInitAlloc(void) { allocations = g_ptr_array_new(); } @@ -30,7 +30,7 @@ static void uninitComplain(gpointer ptr, gpointer data) *str = str2; } -void uninitAlloc(void) +void uiprivUninitAlloc(void) { char *str = NULL; diff --git a/unix/area.c b/unix/area.c index cba1f5e7..0a2e6d69 100644 --- a/unix/area.c +++ b/unix/area.c @@ -122,7 +122,7 @@ static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr) uiAreaDrawParams dp; double clipX0, clipY0, clipX1, clipY1; - dp.Context = newContext(cr, + dp.Context = uiprivNewContext(cr, gtk_widget_get_style_context(a->widget)); loadAreaSize(a, &(dp.AreaWidth), &(dp.AreaHeight)); @@ -136,7 +136,7 @@ static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr) // no need to save or restore the graphics state to reset transformations; GTK+ does that for us (*(a->ah->Draw))(a->ah, a, &dp); - freeContext(dp.Context); + uiprivFreeContext(dp.Context); return FALSE; } diff --git a/unix/attrstr.c b/unix/attrstr.c index a378e452..f543943b 100644 --- a/unix/attrstr.c +++ b/unix/attrstr.c @@ -57,7 +57,7 @@ static uiForEach processAttribute(const uiAttributedString *s, const uiAttribute (guint16) (g * 65535.0), (guint16) (b * 65535.0))); addattr(p, start, end, - FUTURE_pango_attr_foreground_alpha_new( + uiprivFUTURE_pango_attr_foreground_alpha_new( (guint16) (a * 65535.0))); break; case uiAttributeTypeBackground: @@ -69,7 +69,7 @@ static uiForEach processAttribute(const uiAttributedString *s, const uiAttribute (guint16) (g * 65535.0), (guint16) (b * 65535.0))); addattr(p, start, end, - FUTURE_pango_attr_background_alpha_new( + uiprivFUTURE_pango_attr_background_alpha_new( (guint16) (a * 65535.0))); break; case uiAttributeTypeUnderline: @@ -125,7 +125,7 @@ static uiForEach processAttribute(const uiAttributedString *s, const uiAttribute break; featurestr = uiprivOpenTypeFeaturesToPangoCSSFeaturesString(features); addattr(p, start, end, - FUTURE_pango_attr_font_features_new(featurestr->str)); + uiprivFUTURE_pango_attr_font_features_new(featurestr->str)); g_string_free(featurestr, TRUE); break; default: diff --git a/unix/box.c b/unix/box.c index 23fb7f7c..82cf2dd1 100644 --- a/unix/box.c +++ b/unix/box.c @@ -119,9 +119,9 @@ void uiBoxSetPadded(uiBox *b, int padded) b->padded = padded; if (b->padded) if (b->vertical) - gtk_box_set_spacing(b->box, gtkYPadding); + gtk_box_set_spacing(b->box, uiprivGTKYPadding); else - gtk_box_set_spacing(b->box, gtkXPadding); + gtk_box_set_spacing(b->box, uiprivGTKXPadding); else gtk_box_set_spacing(b->box, 0); } diff --git a/unix/cellrendererbutton.c b/unix/cellrendererbutton.c index e3bbf48b..c3ff4f82 100644 --- a/unix/cellrendererbutton.c +++ b/unix/cellrendererbutton.c @@ -68,7 +68,7 @@ static GtkStyleContext *setButtonStyle(GtkWidget *widget) path = gtk_widget_path_copy(gtk_style_context_get_path(base)); gtk_widget_path_append_type(path, G_TYPE_NONE); - if (!FUTURE_gtk_widget_path_iter_set_object_name(path, -1, "button")) + if (!uiprivFUTURE_gtk_widget_path_iter_set_object_name(path, -1, "button")) // not on 3.20; try the type gtk_widget_path_iter_set_object_type(path, -1, GTK_TYPE_BUTTON); @@ -293,7 +293,7 @@ static void cellRendererButton_class_init(cellRendererButtonClass *class) 1, G_TYPE_STRING); } -GtkCellRenderer *newCellRendererButton(void) +GtkCellRenderer *uiprivNewCellRendererButton(void) { return GTK_CELL_RENDERER(g_object_new(cellRendererButtonType, NULL)); } diff --git a/unix/child.c b/unix/child.c index b6e48807..240cc82a 100644 --- a/unix/child.c +++ b/unix/child.c @@ -3,7 +3,7 @@ // This file contains helpers for managing child controls. -struct child { +struct uiprivChild { uiControl *c; GtkWidget *widget; @@ -26,14 +26,14 @@ struct child { int flag; }; -struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer) +uiprivChild *uiprivNewChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer) { - struct child *c; + uiprivChild *c; if (child == NULL) return NULL; - c = uiprivNew(struct child); + c = uiprivNew(uiprivChild); c->c = child; c->widget = GTK_WIDGET(uiControlHandle(c->c)); @@ -49,27 +49,27 @@ struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parent return c; } -struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined) +uiprivChild *uiprivNewChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined) { - struct child *c; + uiprivChild *c; GtkWidget *box; if (child == NULL) return NULL; box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show(box); - c = newChild(child, parent, GTK_CONTAINER(box)); + c = uiprivNewChild(child, parent, GTK_CONTAINER(box)); gtk_widget_set_hexpand(c->widget, TRUE); gtk_widget_set_halign(c->widget, GTK_ALIGN_FILL); gtk_widget_set_vexpand(c->widget, TRUE); gtk_widget_set_valign(c->widget, GTK_ALIGN_FILL); c->box = box; gtk_container_add(parentContainer, c->box); - childSetMargined(c, margined); + uiprivChildSetMargined(c, margined); return c; } -void childRemove(struct child *c) +void uiprivChildRemove(uiprivChild *c) { uiControlSetParent(c->c, NULL); uiUnixControlSetContainer(uiUnixControl(c->c), c->parent, TRUE); @@ -85,36 +85,36 @@ void childRemove(struct child *c) uiprivFree(c); } -void childDestroy(struct child *c) +void uiprivChildDestroy(uiprivChild *c) { uiControl *child; child = c->c; - childRemove(c); + uiprivChildRemove(c); uiControlDestroy(child); } -GtkWidget *childWidget(struct child *c) +GtkWidget *uiprivChildWidget(uiprivChild *c) { return c->widget; } -int childFlag(struct child *c) +int uiprivChildFlag(uiprivChild *c) { return c->flag; } -void childSetFlag(struct child *c, int flag) +void uiprivChildSetFlag(uiprivChild *c, int flag) { c->flag = flag; } -GtkWidget *childBox(struct child *c) +GtkWidget *uiprivChildBox(uiprivChild *c) { return c->box; } -void childSetMargined(struct child *c, int margined) +void uiprivChildSetMargined(uiprivChild *c, int margined) { - setMargined(GTK_CONTAINER(c->box), margined); + uiprivSetMargined(GTK_CONTAINER(c->box), margined); } diff --git a/unix/draw.c b/unix/draw.c index 15abb611..a8f26d7f 100644 --- a/unix/draw.c +++ b/unix/draw.c @@ -2,7 +2,7 @@ #include "uipriv_unix.h" #include "draw.h" -uiDrawContext *newContext(cairo_t *cr, GtkStyleContext *style) +uiDrawContext *uiprivNewContext(cairo_t *cr, GtkStyleContext *style) { uiDrawContext *c; @@ -12,7 +12,7 @@ uiDrawContext *newContext(cairo_t *cr, GtkStyleContext *style) return c; } -void freeContext(uiDrawContext *c) +void uiprivFreeContext(uiDrawContext *c) { // free neither cr nor style; we own neither uiprivFree(c); @@ -59,7 +59,7 @@ void uiDrawStroke(uiDrawContext *c, uiDrawPath *path, uiDrawBrush *b, uiDrawStro { cairo_pattern_t *pat; - runPath(path, c->cr); + uiprivRunPath(path, c->cr); pat = mkbrush(b); cairo_set_source(c->cr, pat); switch (p->Cap) { @@ -95,10 +95,10 @@ void uiDrawFill(uiDrawContext *c, uiDrawPath *path, uiDrawBrush *b) { cairo_pattern_t *pat; - runPath(path, c->cr); + uiprivRunPath(path, c->cr); pat = mkbrush(b); cairo_set_source(c->cr, pat); - switch (pathFillMode(path)) { + switch (uiprivPathFillMode(path)) { case uiDrawFillModeWinding: cairo_set_fill_rule(c->cr, CAIRO_FILL_RULE_WINDING); break; @@ -114,14 +114,14 @@ void uiDrawTransform(uiDrawContext *c, uiDrawMatrix *m) { cairo_matrix_t cm; - m2c(m, &cm); + uiprivM2C(m, &cm); cairo_transform(c->cr, &cm); } void uiDrawClip(uiDrawContext *c, uiDrawPath *path) { - runPath(path, c->cr); - switch (pathFillMode(path)) { + uiprivRunPath(path, c->cr); + switch (uiprivPathFillMode(path)) { case uiDrawFillModeWinding: cairo_set_fill_rule(c->cr, CAIRO_FILL_RULE_WINDING); break; diff --git a/unix/draw.h b/unix/draw.h index 9eec2846..d46d074f 100644 --- a/unix/draw.h +++ b/unix/draw.h @@ -7,8 +7,8 @@ struct uiDrawContext { }; // drawpath.c -extern void runPath(uiDrawPath *p, cairo_t *cr); -extern uiDrawFillMode pathFillMode(uiDrawPath *path); +extern void uiprivRunPath(uiDrawPath *p, cairo_t *cr); +extern uiDrawFillMode uiprivPathFillMode(uiDrawPath *path); // drawmatrix.c -extern void m2c(uiDrawMatrix *m, cairo_matrix_t *c); +extern void uiprivM2C(uiDrawMatrix *m, cairo_matrix_t *c); diff --git a/unix/drawmatrix.c b/unix/drawmatrix.c index 7d15d920..ffb4db34 100644 --- a/unix/drawmatrix.c +++ b/unix/drawmatrix.c @@ -2,7 +2,7 @@ #include "uipriv_unix.h" #include "draw.h" -void m2c(uiDrawMatrix *m, cairo_matrix_t *c) +static void m2c(uiDrawMatrix *m, cairo_matrix_t *c) { c->xx = m->M11; c->yx = m->M12; @@ -12,6 +12,12 @@ void m2c(uiDrawMatrix *m, cairo_matrix_t *c) c->y0 = m->M32; } +// needed by uiDrawTransform() +void uiprivM2C(uiDrawMatrix *m, cairo_matrix_t *c) +{ + m2c(m, c); +} + static void c2m(cairo_matrix_t *c, uiDrawMatrix *m) { m->M11 = c->xx; diff --git a/unix/drawpath.c b/unix/drawpath.c index 28eeb981..045660f5 100644 --- a/unix/drawpath.c +++ b/unix/drawpath.c @@ -138,7 +138,7 @@ void uiDrawPathEnd(uiDrawPath *p) p->ended = TRUE; } -void runPath(uiDrawPath *p, cairo_t *cr) +void uiprivRunPath(uiDrawPath *p, cairo_t *cr) { guint i; struct piece *piece; @@ -193,7 +193,7 @@ void runPath(uiDrawPath *p, cairo_t *cr) } } -uiDrawFillMode pathFillMode(uiDrawPath *path) +uiDrawFillMode uiprivPathFillMode(uiDrawPath *path) { return path->fillMode; } diff --git a/unix/form.c b/unix/form.c index 54422b3d..36ad77d5 100644 --- a/unix/form.c +++ b/unix/form.c @@ -133,8 +133,8 @@ void uiFormSetPadded(uiForm *f, int padded) { f->padded = padded; if (f->padded) { - gtk_grid_set_row_spacing(f->grid, gtkYPadding); - gtk_grid_set_column_spacing(f->grid, gtkXPadding); + gtk_grid_set_row_spacing(f->grid, uiprivGTKYPadding); + gtk_grid_set_column_spacing(f->grid, uiprivGTKXPadding); } else { gtk_grid_set_row_spacing(f->grid, 0); gtk_grid_set_column_spacing(f->grid, 0); diff --git a/unix/future.c b/unix/future.c index 68730ead..475dbc19 100644 --- a/unix/future.c +++ b/unix/future.c @@ -14,7 +14,7 @@ static PangoAttribute *(*newBGAlphaAttr)(guint16 alpha) = NULL; static void (*gwpIterSetObjectName)(GtkWidgetPath *path, gint pos, const char *name) = NULL; // note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed) -void loadFutures(void) +void uiprivLoadFutures(void) { void *handle; @@ -30,28 +30,28 @@ void loadFutures(void) dlclose(handle); } -PangoAttribute *FUTURE_pango_attr_font_features_new(const gchar *features) +PangoAttribute *uiprivFUTURE_pango_attr_font_features_new(const gchar *features) { if (newFeaturesAttr == NULL) return NULL; return (*newFeaturesAttr)(features); } -PangoAttribute *FUTURE_pango_attr_foreground_alpha_new(guint16 alpha) +PangoAttribute *uiprivFUTURE_pango_attr_foreground_alpha_new(guint16 alpha) { if (newFGAlphaAttr == NULL) return NULL; return (*newFGAlphaAttr)(alpha); } -PangoAttribute *FUTURE_pango_attr_background_alpha_new(guint16 alpha) +PangoAttribute *uiprivFUTURE_pango_attr_background_alpha_new(guint16 alpha) { if (newBGAlphaAttr == NULL) return NULL; return (*newBGAlphaAttr)(alpha); } -gboolean FUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name) +gboolean uiprivFUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name) { if (gwpIterSetObjectName == NULL) return FALSE; diff --git a/unix/grid.c b/unix/grid.c index 6d9813b3..7759cecc 100644 --- a/unix/grid.c +++ b/unix/grid.c @@ -117,8 +117,8 @@ void uiGridSetPadded(uiGrid *g, int padded) { g->padded = padded; if (g->padded) { - gtk_grid_set_row_spacing(g->grid, gtkYPadding); - gtk_grid_set_column_spacing(g->grid, gtkXPadding); + gtk_grid_set_row_spacing(g->grid, uiprivGTKYPadding); + gtk_grid_set_column_spacing(g->grid, uiprivGTKXPadding); } else { gtk_grid_set_row_spacing(g->grid, 0); gtk_grid_set_column_spacing(g->grid, 0); diff --git a/unix/group.c b/unix/group.c index 6238a1b6..545c7121 100644 --- a/unix/group.c +++ b/unix/group.c @@ -8,8 +8,8 @@ struct uiGroup { GtkBin *bin; GtkFrame *frame; - // unfortunately, even though a GtkFrame is a GtkBin, calling gtk_container_set_border_width() on it /includes/ the GtkFrame's label; we don't want tht - struct child *child; + // unfortunately, even though a GtkFrame is a GtkBin, calling gtk_container_set_border_width() on it /includes/ the GtkFrame's label; we don't want that + uiprivChild *child; int margined; }; @@ -21,7 +21,7 @@ static void uiGroupDestroy(uiControl *c) uiGroup *g = uiGroup(c); if (g->child != NULL) - childDestroy(g->child); + uiprivChildDestroy(g->child); g_object_unref(g->widget); uiFreeControl(uiControl(g)); } @@ -39,8 +39,8 @@ void uiGroupSetTitle(uiGroup *g, const char *text) void uiGroupSetChild(uiGroup *g, uiControl *child) { if (g->child != NULL) - childRemove(g->child); - g->child = newChildWithBox(child, uiControl(g), g->container, g->margined); + uiprivChildRemove(g->child); + g->child = uiprivNewChildWithBox(child, uiControl(g), g->container, g->margined); } int uiGroupMargined(uiGroup *g) @@ -52,7 +52,7 @@ void uiGroupSetMargined(uiGroup *g, int margined) { g->margined = margined; if (g->child != NULL) - childSetMargined(g->child, g->margined); + uiprivChildSetMargined(g->child, g->margined); } uiGroup *uiNewGroup(const char *text) diff --git a/unix/image.c b/unix/image.c index 1bdf0d64..3b5db020 100644 --- a/unix/image.c +++ b/unix/image.c @@ -105,7 +105,7 @@ writeMatch: m->distY = abs(m->targetY - y); } -cairo_surface_t *imageAppropriateSurface(uiImage *i, GtkWidget *w) +cairo_surface_t *uiprivImageAppropriateSurface(uiImage *i, GtkWidget *w) { struct matcher m; diff --git a/unix/main.c b/unix/main.c index 650fe06f..8ebdf5f5 100644 --- a/unix/main.c +++ b/unix/main.c @@ -14,15 +14,15 @@ const char *uiInit(uiInitOptions *o) g_error_free(err); return msg; } - initAlloc(); - loadFutures(); + uiprivInitAlloc(); + uiprivLoadFutures(); return NULL; } void uiUninit(void) { - uninitMenus(); - uninitAlloc(); + uiprivUninitMenus(); + uiprivUninitAlloc(); } void uiFreeInitError(const char *err) diff --git a/unix/menu.c b/unix/menu.c index 17189c8e..a3142ee0 100644 --- a/unix/menu.c +++ b/unix/menu.c @@ -266,7 +266,7 @@ static void appendMenuItem(GtkMenuShell *submenu, uiMenuItem *item, uiWindow *w) g_hash_table_insert(item->windows, menuitem, ww); } -GtkWidget *makeMenubar(uiWindow *w) +GtkWidget *uiprivMakeMenubar(uiWindow *w) { GtkWidget *menubar; guint i, j; @@ -330,7 +330,7 @@ static void freeMenu(GtkWidget *widget, gpointer data) (*i)++; } -void freeMenubar(GtkWidget *mb) +void uiprivFreeMenubar(GtkWidget *mb) { guint i; @@ -339,7 +339,7 @@ void freeMenubar(GtkWidget *mb) // no need to worry about destroying any widgets; destruction of the window they're in will do it for us } -void uninitMenus(void) +void uiprivUninitMenus(void) { uiMenu *m; uiMenuItem *item; diff --git a/unix/tab.c b/unix/tab.c index 552e0e31..b49c98b9 100644 --- a/unix/tab.c +++ b/unix/tab.c @@ -8,7 +8,7 @@ struct uiTab { GtkContainer *container; GtkNotebook *notebook; - GArray *pages; // []*struct child + GArray *pages; // []*uiprivChild }; uiUnixControlAllDefaultsExceptDestroy(uiTab) @@ -17,11 +17,11 @@ static void uiTabDestroy(uiControl *c) { uiTab *t = uiTab(c); guint i; - struct child *page; + uiprivChild *page; for (i = 0; i < t->pages->len; i++) { - page = g_array_index(t->pages, struct child *, i); - childDestroy(page); + page = g_array_index(t->pages, uiprivChild *, i); + uiprivChildDestroy(page); } g_array_free(t->pages, TRUE); // and free ourselves @@ -36,24 +36,24 @@ void uiTabAppend(uiTab *t, const char *name, uiControl *child) void uiTabInsertAt(uiTab *t, const char *name, int n, uiControl *child) { - struct child *page; + uiprivChild *page; // this will create a tab, because of gtk_container_add() - page = newChildWithBox(child, uiControl(t), t->container, 0); + page = uiprivNewChildWithBox(child, uiControl(t), t->container, 0); - gtk_notebook_set_tab_label_text(t->notebook, childBox(page), name); - gtk_notebook_reorder_child(t->notebook, childBox(page), n); + gtk_notebook_set_tab_label_text(t->notebook, uiprivChildBox(page), name); + gtk_notebook_reorder_child(t->notebook, uiprivChildBox(page), n); g_array_insert_val(t->pages, n, page); } void uiTabDelete(uiTab *t, int n) { - struct child *page; + uiprivChild *page; - page = g_array_index(t->pages, struct child *, n); + page = g_array_index(t->pages, uiprivChild *, n); // this will remove the tab, because gtk_widget_destroy() calls gtk_container_remove() - childRemove(page); + uiprivChildRemove(page); g_array_remove_index(t->pages, n); } @@ -64,19 +64,19 @@ int uiTabNumPages(uiTab *t) int uiTabMargined(uiTab *t, int n) { - struct child *page; + uiprivChild *page; - page = g_array_index(t->pages, struct child *, n); - return childFlag(page); + page = g_array_index(t->pages, uiprivChild *, n); + return uiprivChildFlag(page); } void uiTabSetMargined(uiTab *t, int n, int margined) { - struct child *page; + uiprivChild *page; - page = g_array_index(t->pages, struct child *, n); - childSetFlag(page, margined); - childSetMargined(page, childFlag(page)); + page = g_array_index(t->pages, uiprivChild *, n); + uiprivChildSetFlag(page, margined); + uiprivChildSetMargined(page, uiprivChildFlag(page)); } uiTab *uiNewTab(void) @@ -91,7 +91,7 @@ uiTab *uiNewTab(void) gtk_notebook_set_scrollable(t->notebook, TRUE); - t->pages = g_array_new(FALSE, TRUE, sizeof (struct child *)); + t->pages = g_array_new(FALSE, TRUE, sizeof (uiprivChild *)); return t; } diff --git a/unix/uipriv_unix.h b/unix/uipriv_unix.h index ba592a97..27fd673b 100644 --- a/unix/uipriv_unix.h +++ b/unix/uipriv_unix.h @@ -14,47 +14,49 @@ #include "../ui_unix.h" #include "../common/uipriv.h" -#define gtkXMargin 12 -#define gtkYMargin 12 -#define gtkXPadding 12 -#define gtkYPadding 6 +#define uiprivGTKXMargin 12 +#define uiprivGTKYMargin 12 +#define uiprivGTKXPadding 12 +#define uiprivGTKYPadding 6 // menu.c -extern GtkWidget *makeMenubar(uiWindow *); -extern void freeMenubar(GtkWidget *); -extern void uninitMenus(void); +extern GtkWidget *uiprivMakeMenubar(uiWindow *); +extern void uiprivFreeMenubar(GtkWidget *); +extern void uiprivUninitMenus(void); // alloc.c -extern void initAlloc(void); -extern void uninitAlloc(void); +extern void uiprivInitAlloc(void); +extern void uiprivUninitAlloc(void); // util.c -extern void setMargined(GtkContainer *, int); +extern void uiprivSetMargined(GtkContainer *, int); // child.c -extern struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer); -extern struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined); -extern void childRemove(struct child *c); -extern void childDestroy(struct child *c); -extern GtkWidget *childWidget(struct child *c); -extern int childFlag(struct child *c); -extern void childSetFlag(struct child *c, int flag); -extern GtkWidget *childBox(struct child *c); -extern void childSetMargined(struct child *c, int margined); +typedef struct uiprivChild uiprivChild; +extern uiprivChild *uiprivNewChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer); +extern uiprivChild *uiprivNewChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined); +extern void uiprivChildRemove(uiprivChild *c); +extern void uiprivChildDestroy(uiprivChild *c); +extern GtkWidget *uiprivChildWidget(uiprivChild *c); +extern int uiprivChildFlag(uiprivChild *c); +extern void uiprivChildSetFlag(uiprivChild *c, int flag); +extern GtkWidget *uiprivChildBox(uiprivChild *c); +extern void uiprivChildSetMargined(uiprivChild *c, int margined); // draw.c -extern uiDrawContext *newContext(cairo_t *cr, GtkStyleContext *style); -extern void freeContext(uiDrawContext *); +extern uiDrawContext *uiprivNewContext(cairo_t *cr, GtkStyleContext *style); +extern void uiprivFreeContext(uiDrawContext *); // image.c -extern cairo_surface_t *imageAppropriateSurface(uiImage *i, GtkWidget *w); +/*TODO remove this*/typedef struct uiImage uiImage; +extern cairo_surface_t *uiprivImageAppropriateSurface(uiImage *i, GtkWidget *w); // cellrendererbutton.c -extern GtkCellRenderer *newCellRendererButton(void); +extern GtkCellRenderer *uiprivNewCellRendererButton(void); // future.c -extern void loadFutures(void); -extern PangoAttribute *FUTURE_pango_attr_font_features_new(const gchar *features); -extern PangoAttribute *FUTURE_pango_attr_foreground_alpha_new(guint16 alpha); -extern PangoAttribute *FUTURE_pango_attr_background_alpha_new(guint16 alpha); -extern gboolean FUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name); +extern void uiprivLoadFutures(void); +extern PangoAttribute *uiprivFUTURE_pango_attr_font_features_new(const gchar *features); +extern PangoAttribute *uiprivFUTURE_pango_attr_foreground_alpha_new(guint16 alpha); +extern PangoAttribute *uiprivFUTURE_pango_attr_background_alpha_new(guint16 alpha); +extern gboolean uiprivFUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name); diff --git a/unix/util.c b/unix/util.c index 7f4f43fb..f3929ccb 100644 --- a/unix/util.c +++ b/unix/util.c @@ -1,10 +1,10 @@ // 18 april 2015 #include "uipriv_unix.h" -void setMargined(GtkContainer *c, int margined) +void uiprivSetMargined(GtkContainer *c, int margined) { if (margined) - gtk_container_set_border_width(c, gtkXMargin); + gtk_container_set_border_width(c, uiprivGTKXMargin); else gtk_container_set_border_width(c, 0); } diff --git a/unix/window.c b/unix/window.c index ea9ba370..c5ba2038 100644 --- a/unix/window.c +++ b/unix/window.c @@ -70,7 +70,7 @@ static void uiWindowDestroy(uiControl *c) } // now destroy the menus, if any if (w->menubar != NULL) - freeMenubar(w->menubar); + uiprivFreeMenubar(w->menubar); gtk_widget_destroy(w->childHolderWidget); gtk_widget_destroy(w->vboxWidget); // and finally free ourselves @@ -226,7 +226,7 @@ int uiWindowMargined(uiWindow *w) void uiWindowSetMargined(uiWindow *w, int margined) { w->margined = margined; - setMargined(w->childHolderContainer, w->margined); + uiprivSetMargined(w->childHolderContainer, w->margined); } uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar) @@ -250,7 +250,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar) gtk_container_add(w->container, w->vboxWidget); if (hasMenubar) { - w->menubar = makeMenubar(uiWindow(w)); + w->menubar = uiprivMakeMenubar(uiWindow(w)); gtk_container_add(w->vboxContainer, w->menubar); }