Mercurial > emacs
changeset 59084:6a0b8f23858b
* gtkutil.c (update_frame_tool_bar): Make the value of
tool-bar-button-margin control margins of images in tool bar.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sat, 25 Dec 2004 20:46:26 +0000 |
parents | 4295cf593352 |
children | 4ee3b3653b2e |
files | src/ChangeLog src/gtkutil.c |
diffstat | 2 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Dec 25 10:31:36 2004 +0000 +++ b/src/ChangeLog Sat Dec 25 20:46:26 2004 +0000 @@ -1,5 +1,8 @@ 2004-12-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + * gtkutil.c (update_frame_tool_bar): Make the value of + tool-bar-button-margin control margins of images in tool bar. + * alloc.c (check_depth): New variable. (overrun_check_malloc, overrun_check_realloc): Only add overhead and write check pattern if check_depth is 1 (to handle
--- a/src/gtkutil.c Sat Dec 25 10:31:36 2004 +0000 +++ b/src/gtkutil.c Sat Dec 25 20:46:26 2004 +0000 @@ -3356,12 +3356,37 @@ GList *icon_list; GList *iter; struct x_output *x = f->output_data.x; + int hmargin, vmargin; if (! FRAME_GTK_WIDGET (f)) return; BLOCK_INPUT; + if (INTEGERP (Vtool_bar_button_margin) + && XINT (Vtool_bar_button_margin) > 0) + { + hmargin = XFASTINT (Vtool_bar_button_margin); + vmargin = XFASTINT (Vtool_bar_button_margin); + } + else if (CONSP (Vtool_bar_button_margin)) + { + if (INTEGERP (XCAR (Vtool_bar_button_margin)) + && XINT (XCAR (Vtool_bar_button_margin)) > 0) + hmargin = XFASTINT (XCAR (Vtool_bar_button_margin)); + + if (INTEGERP (XCDR (Vtool_bar_button_margin)) + && XINT (XCDR (Vtool_bar_button_margin)) > 0) + vmargin = XFASTINT (XCDR (Vtool_bar_button_margin)); + } + + /* The natural size (i.e. when GTK uses 0 as margin) looks best, + so take DEFAULT_TOOL_BAR_BUTTON_MARGIN to mean "default for GTK", + i.e. zero. This means that margins less than + DEFAULT_TOOL_BAR_BUTTON_MARGIN has no effect. */ + hmargin = max (0, hmargin - DEFAULT_TOOL_BAR_BUTTON_MARGIN); + vmargin = max (0, vmargin - DEFAULT_TOOL_BAR_BUTTON_MARGIN); + if (! x->toolbar_widget) xg_create_tool_bar (f); @@ -3425,6 +3450,8 @@ { GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); + gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); + gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), 0, 0, 0, w, @@ -3480,6 +3507,8 @@ XG_TOOL_BAR_IMAGE_DATA); g_list_free (chlist); + gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin); + if (old_img != img->pixmap) (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);