# HG changeset patch # User Bram Moolenaar # Date 1603289704 -7200 # Node ID 8623ab39b4216823169421c6a7b167669127560d # Parent 05d69fc68432d712a894e6ea611497f07ad17327 patch 8.2.1878: GTK: error for redefining function Commit: https://github.com/vim/vim/commit/8a99e66b4f7616d9b0b9cefe742f82f9122087d5 Author: Bram Moolenaar Date: Wed Oct 21 16:10:21 2020 +0200 patch 8.2.1878: GTK: error for redefining function Problem: GTK: error for redefining function. (Tony Mechelynck) Solution: Remove "gtk_" prefix from local functions and prepend "gui_" to global functions. diff --git a/src/gui_gtk.c b/src/gui_gtk.c --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -810,7 +810,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, i void gui_mch_set_text_area_pos(int x, int y, int w, int h) { - gtk_form_move_resize(GTK_FORM(gui.formwin), gui.drawarea, x, y, w, h); + gui_gtk_form_move_resize(GTK_FORM(gui.formwin), gui.drawarea, x, y, w, h); } @@ -1005,7 +1005,7 @@ gui_mch_set_scrollbar_thumb(scrollbar_T gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h) { if (sb->id != NULL) - gtk_form_move_resize(GTK_FORM(gui.formwin), sb->id, x, y, w, h); + gui_gtk_form_move_resize(GTK_FORM(gui.formwin), sb->id, x, y, w, h); } int @@ -1111,7 +1111,7 @@ gui_mch_create_scrollbar(scrollbar_T *sb GtkAdjustment *adjustment; gtk_widget_set_can_focus(sb->id, FALSE); - gtk_form_put(GTK_FORM(gui.formwin), sb->id, 0, 0); + gui_gtk_form_put(GTK_FORM(gui.formwin), sb->id, 0, 0); adjustment = gtk_range_get_adjustment(GTK_RANGE(sb->id)); diff --git a/src/gui_gtk_f.c b/src/gui_gtk_f.c --- a/src/gui_gtk_f.c +++ b/src/gui_gtk_f.c @@ -11,7 +11,6 @@ * (C) 1998,1999 by Marcin Dalecki * * Support for GTK+ 2 was added by: - * * (C) 2002,2003 Jason Hildebrand * Daniel Elstner * @@ -21,7 +20,6 @@ * long time. * * Support for GTK+ 3 was added by: - * * 2016 Kazunobu Kuriyama */ @@ -50,52 +48,36 @@ struct _GtkFormChild }; -static void gtk_form_class_init(GtkFormClass *klass); -static void gtk_form_init(GtkForm *form, void *g_class); +static void form_class_init(GtkFormClass *klass); +static void form_init(GtkForm *form, void *g_class); -static void gtk_form_realize(GtkWidget *widget); -static void gtk_form_unrealize(GtkWidget *widget); -static void gtk_form_map(GtkWidget *widget); -static void gtk_form_size_request(GtkWidget *widget, - GtkRequisition *requisition); +static void form_realize(GtkWidget *widget); +static void form_unrealize(GtkWidget *widget); +static void form_map(GtkWidget *widget); +static void form_size_request(GtkWidget *widget, GtkRequisition *requisition); #if GTK_CHECK_VERSION(3,0,0) -static void gtk_form_get_preferred_width(GtkWidget *widget, - gint *minimal_width, - gint *natural_width); -static void gtk_form_get_preferred_height(GtkWidget *widget, - gint *minimal_height, - gint *natural_height); +static void form_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width); +static void form_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height); #endif -static void gtk_form_size_allocate(GtkWidget *widget, - GtkAllocation *allocation); +static void form_size_allocate(GtkWidget *widget, GtkAllocation *allocation); #if GTK_CHECK_VERSION(3,0,0) -static gboolean gtk_form_draw(GtkWidget *widget, - cairo_t *cr); +static gboolean form_draw(GtkWidget *widget, cairo_t *cr); #else -static gint gtk_form_expose(GtkWidget *widget, - GdkEventExpose *event); +static gint form_expose(GtkWidget *widget, GdkEventExpose *event); #endif -static void gtk_form_remove(GtkContainer *container, - GtkWidget *widget); -static void gtk_form_forall(GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); +static void form_remove(GtkContainer *container, GtkWidget *widget); +static void form_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); -static void gtk_form_attach_child_window(GtkForm *form, - GtkFormChild *child); -static void gtk_form_realize_child(GtkForm *form, - GtkFormChild *child); -static void gtk_form_position_child(GtkForm *form, - GtkFormChild *child, - gboolean force_allocate); -static void gtk_form_position_children(GtkForm *form); +static void form_attach_child_window(GtkForm *form, GtkFormChild *child); +static void form_realize_child(GtkForm *form, GtkFormChild *child); +static void form_position_child(GtkForm *form, GtkFormChild *child, gboolean force_allocate); +static void form_position_children(GtkForm *form); -static void gtk_form_send_configure(GtkForm *form); +static void form_send_configure(GtkForm *form); -static void gtk_form_child_map(GtkWidget *widget, gpointer user_data); -static void gtk_form_child_unmap(GtkWidget *widget, gpointer user_data); +static void form_child_map(GtkWidget *widget, gpointer user_data); +static void form_child_unmap(GtkWidget *widget, gpointer user_data); #if !GTK_CHECK_VERSION(3,0,0) static GtkWidgetClass *parent_class = NULL; @@ -104,24 +86,25 @@ static GtkWidgetClass *parent_class = NU // Public interface GtkWidget * -gtk_form_new(void) +gui_gtk_form_new(void) { GtkForm *form; #if GTK_CHECK_VERSION(3,0,0) form = g_object_new(GTK_TYPE_FORM, NULL); #else - form = gtk_type_new(gtk_form_get_type()); + form = gtk_type_new(gui_gtk_form_get_type()); #endif return GTK_WIDGET(form); } void -gtk_form_put(GtkForm *form, - GtkWidget *child_widget, - gint x, - gint y) +gui_gtk_form_put( + GtkForm *form, + GtkWidget *child_widget, + gint x, + gint y) { GtkFormChild *child; @@ -151,22 +134,23 @@ gtk_form_put(GtkForm *form, // that gtk_widget_set_parent() realizes the widget if it's visible // and its parent is mapped. if (gtk_widget_get_realized(GTK_WIDGET(form))) - gtk_form_attach_child_window(form, child); + form_attach_child_window(form, child); gtk_widget_set_parent(child_widget, GTK_WIDGET(form)); if (gtk_widget_get_realized(GTK_WIDGET(form)) && !gtk_widget_get_realized(child_widget)) - gtk_form_realize_child(form, child); + form_realize_child(form, child); - gtk_form_position_child(form, child, TRUE); + form_position_child(form, child, TRUE); } void -gtk_form_move(GtkForm *form, - GtkWidget *child_widget, - gint x, - gint y) +gui_gtk_form_move( + GtkForm *form, + GtkWidget *child_widget, + gint x, + gint y) { GList *tmp_list; GtkFormChild *child; @@ -181,14 +165,14 @@ gtk_form_move(GtkForm *form, child->x = x; child->y = y; - gtk_form_position_child(form, child, TRUE); + form_position_child(form, child, TRUE); return; } } } void -gtk_form_freeze(GtkForm *form) +gui_gtk_form_freeze(GtkForm *form) { g_return_if_fail(GTK_IS_FORM(form)); @@ -196,7 +180,7 @@ gtk_form_freeze(GtkForm *form) } void -gtk_form_thaw(GtkForm *form) +gui_gtk_form_thaw(GtkForm *form) { g_return_if_fail(GTK_IS_FORM(form)); @@ -204,7 +188,7 @@ gtk_form_thaw(GtkForm *form) { if (!(--form->freeze_count)) { - gtk_form_position_children(form); + form_position_children(form); gtk_widget_queue_draw(GTK_WIDGET(form)); } } @@ -215,7 +199,7 @@ gtk_form_thaw(GtkForm *form) G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER) #else GtkType -gtk_form_get_type(void) +gui_gtk_form_get_type(void) { static GtkType form_type = 0; @@ -227,8 +211,8 @@ gtk_form_get_type(void) form_info.type_name = "GtkForm"; form_info.object_size = sizeof(GtkForm); form_info.class_size = sizeof(GtkFormClass); - form_info.class_init_func = (GtkClassInitFunc)gtk_form_class_init; - form_info.object_init_func = (GtkObjectInitFunc)gtk_form_init; + form_info.class_init_func = (GtkClassInitFunc)form_class_init; + form_info.object_init_func = (GtkObjectInitFunc)form_init; form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info); } @@ -237,7 +221,7 @@ gtk_form_get_type(void) #endif // !GTK_CHECK_VERSION(3,0,0) static void -gtk_form_class_init(GtkFormClass *klass) +form_class_init(GtkFormClass *klass) { GtkWidgetClass *widget_class; GtkContainerClass *container_class; @@ -249,28 +233,28 @@ gtk_form_class_init(GtkFormClass *klass) parent_class = gtk_type_class(gtk_container_get_type()); #endif - widget_class->realize = gtk_form_realize; - widget_class->unrealize = gtk_form_unrealize; - widget_class->map = gtk_form_map; + widget_class->realize = form_realize; + widget_class->unrealize = form_unrealize; + widget_class->map = form_map; #if GTK_CHECK_VERSION(3,0,0) - widget_class->get_preferred_width = gtk_form_get_preferred_width; - widget_class->get_preferred_height = gtk_form_get_preferred_height; + widget_class->get_preferred_width = form_get_preferred_width; + widget_class->get_preferred_height = form_get_preferred_height; #else - widget_class->size_request = gtk_form_size_request; + widget_class->size_request = form_size_request; #endif - widget_class->size_allocate = gtk_form_size_allocate; + widget_class->size_allocate = form_size_allocate; #if GTK_CHECK_VERSION(3,0,0) - widget_class->draw = gtk_form_draw; + widget_class->draw = form_draw; #else - widget_class->expose_event = gtk_form_expose; + widget_class->expose_event = form_expose; #endif - container_class->remove = gtk_form_remove; - container_class->forall = gtk_form_forall; + container_class->remove = form_remove; + container_class->forall = form_forall; } static void -gtk_form_init(GtkForm *form, void *g_class UNUSED) +form_init(GtkForm *form, void *g_class UNUSED) { #if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_has_window(GTK_WIDGET(form), TRUE); @@ -285,7 +269,7 @@ gtk_form_init(GtkForm *form, void *g_cla */ static void -gtk_form_realize(GtkWidget *widget) +form_realize(GtkWidget *widget) { GList *tmp_list; GtkForm *form; @@ -353,10 +337,10 @@ gtk_form_realize(GtkWidget *widget) { GtkFormChild *child = tmp_list->data; - gtk_form_attach_child_window(form, child); + form_attach_child_window(form, child); if (gtk_widget_get_visible(child->widget)) - gtk_form_realize_child(form, child); + form_realize_child(form, child); } } @@ -369,7 +353,7 @@ gtk_form_realize(GtkWidget *widget) // Well, I reckon at least the gdk_window_show(form->bin_window) // is necessary. GtkForm is anything but a usual container widget. static void -gtk_form_map(GtkWidget *widget) +form_map(GtkWidget *widget) { GList *tmp_list; GtkForm *form; @@ -394,7 +378,7 @@ gtk_form_map(GtkWidget *widget) } static void -gtk_form_unrealize(GtkWidget *widget) +form_unrealize(GtkWidget *widget) { GList *tmp_list; GtkForm *form; @@ -416,10 +400,10 @@ gtk_form_unrealize(GtkWidget *widget) if (child->window != NULL) { g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), - FUNC2GENERIC(gtk_form_child_map), + FUNC2GENERIC(form_child_map), child); g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), - FUNC2GENERIC(gtk_form_child_unmap), + FUNC2GENERIC(form_child_unmap), child); gdk_window_set_user_data(child->window, NULL); @@ -441,7 +425,7 @@ gtk_form_unrealize(GtkWidget *widget) } static void -gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition) +form_size_request(GtkWidget *widget, GtkRequisition *requisition) { g_return_if_fail(GTK_IS_FORM(widget)); g_return_if_fail(requisition != NULL); @@ -452,26 +436,26 @@ gtk_form_size_request(GtkWidget *widget, #if GTK_CHECK_VERSION(3,0,0) static void -gtk_form_get_preferred_width(GtkWidget *widget, +form_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width) { GtkRequisition requisition; - gtk_form_size_request(widget, &requisition); + form_size_request(widget, &requisition); *minimal_width = requisition.width; *natural_width = requisition.width; } static void -gtk_form_get_preferred_height(GtkWidget *widget, +form_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height) { GtkRequisition requisition; - gtk_form_size_request(widget, &requisition); + form_size_request(widget, &requisition); *minimal_height = requisition.height; *natural_height = requisition.height; @@ -479,7 +463,7 @@ gtk_form_get_preferred_height(GtkWidget #endif // GTK_CHECK_VERSION(3,0,0) static void -gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) +form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { GList *tmp_list; GtkForm *form; @@ -507,7 +491,7 @@ gtk_form_size_allocate(GtkWidget *widget while (tmp_list) { GtkFormChild *child = tmp_list->data; - gtk_form_position_child(form, child, TRUE); + form_position_child(form, child, TRUE); tmp_list = tmp_list->next; } @@ -524,7 +508,7 @@ gtk_form_size_allocate(GtkWidget *widget } gtk_widget_set_allocation(widget, allocation); if (need_reposition) - gtk_form_send_configure(form); + form_send_configure(form); } #if GTK_CHECK_VERSION(3,0,0) @@ -538,7 +522,7 @@ gtk_form_render_background(GtkWidget *wi } static gboolean -gtk_form_draw(GtkWidget *widget, cairo_t *cr) +form_draw(GtkWidget *widget, cairo_t *cr) { GList *tmp_list = NULL; GtkForm *form = NULL; @@ -563,9 +547,9 @@ gtk_form_draw(GtkWidget *widget, cairo_t // gtk_widget_draw() fails and the relevant scrollbar won't // appear on the screen. // - // Calling gtk_form_position_child() like this is one of ways + // Calling form_position_child() like this is one of ways // to make sure of that. - gtk_form_position_child(form, formchild, TRUE); + form_position_child(form, formchild, TRUE); gtk_form_render_background(formchild->widget, cr); } @@ -575,7 +559,7 @@ gtk_form_draw(GtkWidget *widget, cairo_t } #else // !GTK_CHECK_VERSION(3,0,0) static gint -gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) +form_expose(GtkWidget *widget, GdkEventExpose *event) { GList *tmp_list; GtkForm *form; @@ -598,7 +582,7 @@ gtk_form_expose(GtkWidget *widget, GdkEv // Container method static void -gtk_form_remove(GtkContainer *container, GtkWidget *widget) +form_remove(GtkContainer *container, GtkWidget *widget) { GList *tmp_list; GtkForm *form; @@ -625,9 +609,9 @@ gtk_form_remove(GtkContainer *container, if (child->window) { g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), - FUNC2GENERIC(>k_form_child_map), child); + FUNC2GENERIC(&form_child_map), child); g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), - FUNC2GENERIC(>k_form_child_unmap), child); + FUNC2GENERIC(&form_child_unmap), child); // FIXME: This will cause problems for reparenting NO_WINDOW // widgets out of a GtkForm @@ -646,7 +630,7 @@ gtk_form_remove(GtkContainer *container, } static void -gtk_form_forall(GtkContainer *container, +form_forall(GtkContainer *container, gboolean include_internals UNUSED, GtkCallback callback, gpointer callback_data) @@ -673,7 +657,7 @@ gtk_form_forall(GtkContainer *container, // Operations on children static void -gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) +form_attach_child_window(GtkForm *form, GtkFormChild *child) { if (child->window != NULL) return; // been there, done that @@ -734,9 +718,9 @@ gtk_form_attach_child_window(GtkForm *fo * alongside with the actual widget. */ g_signal_connect(G_OBJECT(child->widget), "map", - G_CALLBACK(>k_form_child_map), child); + G_CALLBACK(&form_child_map), child); g_signal_connect(G_OBJECT(child->widget), "unmap", - G_CALLBACK(>k_form_child_unmap), child); + G_CALLBACK(&form_child_unmap), child); } else if (!gtk_widget_get_realized(child->widget)) { @@ -745,15 +729,14 @@ gtk_form_attach_child_window(GtkForm *fo } static void -gtk_form_realize_child(GtkForm *form, GtkFormChild *child) +form_realize_child(GtkForm *form, GtkFormChild *child) { - gtk_form_attach_child_window(form, child); + form_attach_child_window(form, child); gtk_widget_realize(child->widget); } static void -gtk_form_position_child(GtkForm *form, GtkFormChild *child, - gboolean force_allocate) +form_position_child(GtkForm *form, GtkFormChild *child, gboolean force_allocate) { gint x; gint y; @@ -826,16 +809,16 @@ gtk_form_position_child(GtkForm *form, G } static void -gtk_form_position_children(GtkForm *form) +form_position_children(GtkForm *form) { GList *tmp_list; for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) - gtk_form_position_child(form, tmp_list->data, FALSE); + form_position_child(form, tmp_list->data, FALSE); } void -gtk_form_move_resize(GtkForm *form, GtkWidget *widget, +gui_gtk_form_move_resize(GtkForm *form, GtkWidget *widget, gint x, gint y, gint w, gint h) { #if GTK_CHECK_VERSION(3,0,0) @@ -845,11 +828,11 @@ gtk_form_move_resize(GtkForm *form, GtkW widget->requisition.height = h; #endif - gtk_form_move(form, widget, x, y); + gui_gtk_form_move(form, widget, x, y); } static void -gtk_form_send_configure(GtkForm *form) +form_send_configure(GtkForm *form) { GtkWidget *widget; GdkEventConfigure event; @@ -869,7 +852,7 @@ gtk_form_send_configure(GtkForm *form) } static void -gtk_form_child_map(GtkWidget *widget UNUSED, gpointer user_data) +form_child_map(GtkWidget *widget UNUSED, gpointer user_data) { GtkFormChild *child; @@ -880,7 +863,7 @@ gtk_form_child_map(GtkWidget *widget UNU } static void -gtk_form_child_unmap(GtkWidget *widget UNUSED, gpointer user_data) +form_child_unmap(GtkWidget *widget UNUSED, gpointer user_data) { GtkFormChild *child; diff --git a/src/gui_gtk_f.h b/src/gui_gtk_f.h --- a/src/gui_gtk_f.h +++ b/src/gui_gtk_f.h @@ -21,7 +21,7 @@ extern "C" { #endif -#define GTK_TYPE_FORM (gtk_form_get_type ()) +#define GTK_TYPE_FORM (gui_gtk_form_get_type ()) #ifdef USE_GTK3 #define GTK_FORM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_FORM, GtkForm)) #define GTK_FORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_FORM, GtkFormClass)) @@ -53,29 +53,25 @@ struct _GtkFormClass }; #ifdef USE_GTK3 -GType gtk_form_get_type(void); +GType gui_gtk_form_get_type(void); #else -GtkType gtk_form_get_type(void); +GtkType gui_gtk_form_get_type(void); #endif -GtkWidget *gtk_form_new(void); +GtkWidget *gui_gtk_form_new(void); -void gtk_form_put(GtkForm * form, GtkWidget * widget, - gint x, gint y); +void gui_gtk_form_put(GtkForm * form, GtkWidget * widget, gint x, gint y); -void gtk_form_move(GtkForm *form, GtkWidget * widget, - gint x, gint y); +void gui_gtk_form_move(GtkForm *form, GtkWidget * widget, gint x, gint y); -void gtk_form_move_resize(GtkForm * form, GtkWidget * widget, - gint x, gint y, - gint w, gint h); +void gui_gtk_form_move_resize(GtkForm * form, GtkWidget * widget, gint x, gint y, gint w, gint h); // These disable and enable moving and repainting respectively. If you // want to update the layout's offsets but do not want it to repaint // itself, you should use these functions. -void gtk_form_freeze(GtkForm *form); -void gtk_form_thaw(GtkForm *form); +void gui_gtk_form_freeze(GtkForm *form); +void gui_gtk_form_thaw(GtkForm *form); #ifdef __cplusplus diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3811,7 +3811,7 @@ gui_mch_init(void) G_CALLBACK(on_tabline_menu), G_OBJECT(tabline_menu)); #endif // FEAT_GUI_TABLINE - gui.formwin = gtk_form_new(); + gui.formwin = gui_gtk_form_new(); gtk_container_set_border_width(GTK_CONTAINER(gui.formwin), 0); #if !GTK_CHECK_VERSION(3,0,0) gtk_widget_set_events(gui.formwin, GDK_EXPOSURE_MASK); @@ -3840,7 +3840,7 @@ gui_mch_init(void) GDK_POINTER_MOTION_HINT_MASK); gtk_widget_show(gui.drawarea); - gtk_form_put(GTK_FORM(gui.formwin), gui.drawarea, 0, 0); + gui_gtk_form_put(GTK_FORM(gui.formwin), gui.drawarea, 0, 0); gtk_widget_show(gui.formwin); gtk_box_pack_start(GTK_BOX(vbox), gui.formwin, TRUE, TRUE, 0); @@ -4119,9 +4119,9 @@ form_configure_event(GtkWidget *widget U if (gtk_socket_id != 0) usable_height -= (gui.char_height - (gui.char_height/2)); // sic. - gtk_form_freeze(GTK_FORM(gui.formwin)); + gui_gtk_form_freeze(GTK_FORM(gui.formwin)); gui_resize_shell(event->width, usable_height); - gtk_form_thaw(GTK_FORM(gui.formwin)); + gui_gtk_form_thaw(GTK_FORM(gui.formwin)); return TRUE; } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1878, +/**/ 1877, /**/ 1876,