* gtkutil.c (update_frame_tool_bar): Make the value of

tool-bar-button-margin control margins of images in tool bar.
This commit is contained in:
Jan Djärv 2004-12-25 20:46:26 +00:00
parent d8f165a83e
commit 133c01167e
2 changed files with 32 additions and 0 deletions

View file

@ -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

View file

@ -3356,12 +3356,37 @@ update_frame_tool_bar (f)
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 @@ update_frame_tool_bar (f)
{
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 @@ update_frame_tool_bar (f)
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);