Commit 3a8a22fc authored by Jan Djärv's avatar Jan Djärv
Browse files

Another fix for BadGC.

parent 504feff5
......@@ -2301,6 +2301,27 @@ xg_get_widget_from_map (idx)
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 @@ xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name)
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 @@ xg_tool_bar_help_callback (w, event, client_data)
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 @@ xg_tool_bar_expose_callback (w, event, client_data)
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 @@ xg_create_tool_bar (f)
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 @@ update_frame_tool_bar (f)
(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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment