diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gtkutil.c | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index bae21969656..2c6fb10ccb3 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2301,6 +2301,27 @@ xg_get_widget_from_map (idx) | |||
| 2301 | return 0; | 2301 | return 0; |
| 2302 | } | 2302 | } |
| 2303 | 2303 | ||
| 2304 | /* Return the scrollbar id for X Window WID. | ||
| 2305 | Return -1 if WID not in id_to_widget. */ | ||
| 2306 | int | ||
| 2307 | xg_get_scroll_id_for_window (wid) | ||
| 2308 | Window wid; | ||
| 2309 | { | ||
| 2310 | int idx; | ||
| 2311 | GtkWidget *w; | ||
| 2312 | |||
| 2313 | w = xg_win_to_widget (wid); | ||
| 2314 | |||
| 2315 | if (w) | ||
| 2316 | { | ||
| 2317 | for (idx = 0; idx < id_to_widget.max_size; ++idx) | ||
| 2318 | if (id_to_widget.widgets[idx] == w) | ||
| 2319 | return idx; | ||
| 2320 | } | ||
| 2321 | |||
| 2322 | return -1; | ||
| 2323 | } | ||
| 2324 | |||
| 2304 | /* Callback invoked when scroll bar WIDGET is destroyed. | 2325 | /* Callback invoked when scroll bar WIDGET is destroyed. |
| 2305 | DATA is the index into id_to_widget for WIDGET. | 2326 | DATA is the index into id_to_widget for WIDGET. |
| 2306 | We free pointer to last scroll bar value here and remove the index. */ | 2327 | 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) | |||
| 2381 | g_signal_connect (G_OBJECT (wscroll), | 2402 | g_signal_connect (G_OBJECT (wscroll), |
| 2382 | "button-press-event", | 2403 | "button-press-event", |
| 2383 | G_CALLBACK (scroll_bar_button_cb), | 2404 | G_CALLBACK (scroll_bar_button_cb), |
| 2384 | (gpointer)1); | 2405 | 0); |
| 2385 | g_signal_connect (G_OBJECT (wscroll), | 2406 | g_signal_connect (G_OBJECT (wscroll), |
| 2386 | "button-release-event", | 2407 | "button-release-event", |
| 2387 | G_CALLBACK (scroll_bar_button_cb), | 2408 | G_CALLBACK (scroll_bar_button_cb), |
| @@ -2676,7 +2697,7 @@ xg_tool_bar_help_callback (w, event, client_data) | |||
| 2676 | 2697 | ||
| 2677 | Returns FALSE to tell GTK to keep processing this event. */ | 2698 | Returns FALSE to tell GTK to keep processing this event. */ |
| 2678 | static gboolean | 2699 | static gboolean |
| 2679 | xg_tool_bar_expose_callback (w, event, client_data) | 2700 | xg_tool_bar_item_expose_callback (w, event, client_data) |
| 2680 | GtkWidget *w; | 2701 | GtkWidget *w; |
| 2681 | GdkEventExpose *event; | 2702 | GdkEventExpose *event; |
| 2682 | gpointer client_data; | 2703 | gpointer client_data; |
| @@ -2686,6 +2707,24 @@ xg_tool_bar_expose_callback (w, event, client_data) | |||
| 2686 | return FALSE; | 2707 | return FALSE; |
| 2687 | } | 2708 | } |
| 2688 | 2709 | ||
| 2710 | /* This callback is called when a tool bar shall be redrawn. | ||
| 2711 | We need to update the tool bar from here in case the image cache | ||
| 2712 | has deleted the pixmaps used in the tool bar. | ||
| 2713 | W is the GtkToolbar to be redrawn. | ||
| 2714 | EVENT is the expose event for W. | ||
| 2715 | CLIENT_DATA is pointing to the frame for this tool bar. | ||
| 2716 | |||
| 2717 | Returns FALSE to tell GTK to keep processing this event. */ | ||
| 2718 | static gboolean | ||
| 2719 | xg_tool_bar_expose_callback (w, event, client_data) | ||
| 2720 | GtkWidget *w; | ||
| 2721 | GdkEventExpose *event; | ||
| 2722 | gpointer client_data; | ||
| 2723 | { | ||
| 2724 | update_frame_tool_bar((FRAME_PTR)client_data); | ||
| 2725 | return FALSE; | ||
| 2726 | } | ||
| 2727 | |||
| 2689 | static void | 2728 | static void |
| 2690 | xg_create_tool_bar (f) | 2729 | xg_create_tool_bar (f) |
| 2691 | FRAME_PTR f; | 2730 | FRAME_PTR f; |
| @@ -2722,6 +2761,10 @@ xg_create_tool_bar (f) | |||
| 2722 | G_CALLBACK (xg_tool_bar_detach_callback), f); | 2761 | G_CALLBACK (xg_tool_bar_detach_callback), f); |
| 2723 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", | 2762 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", |
| 2724 | G_CALLBACK (xg_tool_bar_attach_callback), f); | 2763 | G_CALLBACK (xg_tool_bar_attach_callback), f); |
| 2764 | g_signal_connect (G_OBJECT (x->toolbar_widget), | ||
| 2765 | "expose-event", | ||
| 2766 | G_CALLBACK (xg_tool_bar_expose_callback), | ||
| 2767 | f); | ||
| 2725 | 2768 | ||
| 2726 | gtk_widget_show_all (x->handlebox_widget); | 2769 | gtk_widget_show_all (x->handlebox_widget); |
| 2727 | 2770 | ||
| @@ -2828,10 +2871,10 @@ update_frame_tool_bar (f) | |||
| 2828 | (gpointer)img->pixmap); | 2871 | (gpointer)img->pixmap); |
| 2829 | 2872 | ||
| 2830 | /* Catch expose events to overcome an annoying redraw bug, see | 2873 | /* Catch expose events to overcome an annoying redraw bug, see |
| 2831 | comment for xg_tool_bar_expose_callback. */ | 2874 | comment for xg_tool_bar_item_expose_callback. */ |
| 2832 | g_signal_connect (G_OBJECT (w), | 2875 | g_signal_connect (G_OBJECT (w), |
| 2833 | "expose-event", | 2876 | "expose-event", |
| 2834 | G_CALLBACK (xg_tool_bar_expose_callback), | 2877 | G_CALLBACK (xg_tool_bar_item_expose_callback), |
| 2835 | 0); | 2878 | 0); |
| 2836 | 2879 | ||
| 2837 | /* We must set sensitive on the button that is the parent | 2880 | /* We must set sensitive on the button that is the parent |