# HG changeset patch # User Jan Dj¸«£rv # Date 1047242499 0 # Node ID 464ffd8b9e33f7b72ffc90f0d3b1c95ea9f6123e # Parent b43d8c1413ded494c2225f6b8dada2ab539e0523 Another fix for BadGC. diff -r b43d8c1413de -r 464ffd8b9e33 src/gtkutil.c --- a/src/gtkutil.c Sun Mar 09 14:05:25 2003 +0000 +++ b/src/gtkutil.c Sun Mar 09 20:41:39 2003 +0000 @@ -2301,6 +2301,27 @@ return 0; } +/* Return the scrollbar id for X Window WID. + Return -1 if WID not in id_to_widget. */ +int +xg_get_scroll_id_for_window (wid) + Window wid; +{ + int idx; + GtkWidget *w; + + w = xg_win_to_widget (wid); + + if (w) + { + for (idx = 0; idx < id_to_widget.max_size; ++idx) + if (id_to_widget.widgets[idx] == w) + return idx; + } + + return -1; +} + /* Callback invoked when scroll bar WIDGET is destroyed. DATA is the index into id_to_widget for WIDGET. We free pointer to last scroll bar value here and remove the index. */ @@ -2381,7 +2402,7 @@ g_signal_connect (G_OBJECT (wscroll), "button-press-event", G_CALLBACK (scroll_bar_button_cb), - (gpointer)1); + 0); g_signal_connect (G_OBJECT (wscroll), "button-release-event", G_CALLBACK (scroll_bar_button_cb), @@ -2676,7 +2697,7 @@ Returns FALSE to tell GTK to keep processing this event. */ static gboolean -xg_tool_bar_expose_callback (w, event, client_data) +xg_tool_bar_item_expose_callback (w, event, client_data) GtkWidget *w; GdkEventExpose *event; gpointer client_data; @@ -2686,6 +2707,24 @@ return FALSE; } +/* This callback is called when a tool bar shall be redrawn. + We need to update the tool bar from here in case the image cache + has deleted the pixmaps used in the tool bar. + W is the GtkToolbar to be redrawn. + EVENT is the expose event for W. + CLIENT_DATA is pointing to the frame for this tool bar. + + Returns FALSE to tell GTK to keep processing this event. */ +static gboolean +xg_tool_bar_expose_callback (w, event, client_data) + GtkWidget *w; + GdkEventExpose *event; + gpointer client_data; +{ + update_frame_tool_bar((FRAME_PTR)client_data); + return FALSE; +} + static void xg_create_tool_bar (f) FRAME_PTR f; @@ -2722,6 +2761,10 @@ G_CALLBACK (xg_tool_bar_detach_callback), f); g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", G_CALLBACK (xg_tool_bar_attach_callback), f); + g_signal_connect (G_OBJECT (x->toolbar_widget), + "expose-event", + G_CALLBACK (xg_tool_bar_expose_callback), + f); gtk_widget_show_all (x->handlebox_widget); @@ -2828,10 +2871,10 @@ (gpointer)img->pixmap); /* Catch expose events to overcome an annoying redraw bug, see - comment for xg_tool_bar_expose_callback. */ + comment for xg_tool_bar_item_expose_callback. */ g_signal_connect (G_OBJECT (w), "expose-event", - G_CALLBACK (xg_tool_bar_expose_callback), + G_CALLBACK (xg_tool_bar_item_expose_callback), 0); /* We must set sensitive on the button that is the parent