Mercurial > emacs
comparison src/gtkutil.c @ 55342:44d086f5e08a
* gtkutil.c (xg_update_scrollbar_pos): Call XClearWindow to clear
"under" scroll bar when size/position changes.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Mon, 03 May 2004 15:27:48 +0000 |
parents | a07a0bae1990 |
children | e4cfda8330d5 |
comparison
equal
deleted
inserted
replaced
55341:7ee62cfb248c | 55342:44d086f5e08a |
---|---|
2758 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); | 2758 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); |
2759 | 2759 |
2760 if (wscroll) | 2760 if (wscroll) |
2761 { | 2761 { |
2762 GtkWidget *wfixed = f->output_data.x->edit_widget; | 2762 GtkWidget *wfixed = f->output_data.x->edit_widget; |
2763 int winextra = canon_width > width ? (canon_width - width) / 2 : 0; | 2763 |
2764 int bottom = top + height; | 2764 gtk_container_set_reallocate_redraws (GTK_CONTAINER (wfixed), TRUE); |
2765 | 2765 |
2766 gint slider_width; | 2766 /* Move and resize to new values. */ |
2767 int oldtop, oldleft, oldbottom; | 2767 gtk_fixed_move (GTK_FIXED (wfixed), wscroll, left, top); |
2768 GtkRequisition req; | 2768 gtk_widget_set_size_request (wscroll, width, height); |
2769 | 2769 |
2770 /* Get old values. */ | 2770 /* Must force out update so changed scroll bars gets redrawn. */ |
2771 xg_find_top_left_in_fixed (wscroll, wfixed, &oldleft, &oldtop); | 2771 gdk_window_process_all_updates (); |
2772 gtk_widget_size_request (wscroll, &req); | 2772 |
2773 oldbottom = oldtop + req.height; | |
2774 | |
2775 /* Scroll bars in GTK has a fixed width, so if we say width 16, it | 2773 /* Scroll bars in GTK has a fixed width, so if we say width 16, it |
2776 will only be its fixed width (14 is default) anyway, the rest is | 2774 will only be its fixed width (14 is default) anyway, the rest is |
2777 blank. We are drawing the mode line across scroll bars when | 2775 blank. We are drawing the mode line across scroll bars when |
2778 the frame is split: | 2776 the frame is split: |
2779 |bar| |fringe| | 2777 |bar| |fringe| |
2797 Also, the canonical width may be wider than the width for the | 2795 Also, the canonical width may be wider than the width for the |
2798 scroll bar so that there is some space (typically 1 pixel) between | 2796 scroll bar so that there is some space (typically 1 pixel) between |
2799 the scroll bar and the edge of the window and between the scroll | 2797 the scroll bar and the edge of the window and between the scroll |
2800 bar and the fringe. */ | 2798 bar and the fringe. */ |
2801 | 2799 |
2802 if (oldtop != -1 && oldleft != -1) | 2800 XClearWindow (FRAME_X_DISPLAY (f), GTK_WIDGET_TO_X_WIN (wscroll)); |
2803 { | |
2804 int gtkextral, gtkextrah; | |
2805 int xl, xr, wbl, wbr; | |
2806 int bottomdiff, topdiff; | |
2807 | |
2808 gtk_widget_style_get (wscroll, "slider_width", &slider_width, NULL); | |
2809 gtkextral = width > slider_width ? (width - slider_width) / 2 : 0; | |
2810 gtkextrah = gtkextral ? (width - slider_width - gtkextral) : 0; | |
2811 | |
2812 xl = real_left; | |
2813 wbl = gtkextral + winextra; | |
2814 wbr = gtkextrah + winextra; | |
2815 xr = left + gtkextral + slider_width; | |
2816 bottomdiff = abs (oldbottom - bottom); | |
2817 topdiff = abs (oldtop - top); | |
2818 | |
2819 if (oldleft != left) | |
2820 { | |
2821 gdk_window_clear_area (wfixed->window, xl, top, wbl, height); | |
2822 gdk_window_clear_area (wfixed->window, xr, top, wbr, height); | |
2823 } | |
2824 | |
2825 if (oldtop > top) | |
2826 { | |
2827 gdk_window_clear_area (wfixed->window, xl, top, wbl, topdiff); | |
2828 gdk_window_clear_area (wfixed->window, xr, top, wbr, topdiff); | |
2829 } | |
2830 else if (oldtop < top) | |
2831 { | |
2832 gdk_window_clear_area (wfixed->window, xl, oldtop, wbl, topdiff); | |
2833 gdk_window_clear_area (wfixed->window, xr, oldtop, wbr, topdiff); | |
2834 } | |
2835 | |
2836 if (oldbottom > bottom) | |
2837 { | |
2838 gdk_window_clear_area (wfixed->window, xl, bottom, wbl, | |
2839 bottomdiff); | |
2840 gdk_window_clear_area (wfixed->window, xr, bottom, wbr, | |
2841 bottomdiff); | |
2842 } | |
2843 else if (oldbottom < bottom) | |
2844 { | |
2845 gdk_window_clear_area (wfixed->window, xl, oldbottom, wbl, | |
2846 bottomdiff); | |
2847 gdk_window_clear_area (wfixed->window, xr, oldbottom, wbr, | |
2848 bottomdiff); | |
2849 } | |
2850 } | |
2851 | |
2852 /* Move and resize to new values. */ | |
2853 gtk_fixed_move (GTK_FIXED (wfixed), wscroll, left, top); | |
2854 gtk_widget_set_size_request (wscroll, width, height); | |
2855 | |
2856 /* Must force out update so changed scroll bars gets redrawn. */ | |
2857 gdk_window_process_all_updates (); | |
2858 | 2801 |
2859 SET_FRAME_GARBAGED (f); | 2802 SET_FRAME_GARBAGED (f); |
2860 cancel_mouse_face (f); | 2803 cancel_mouse_face (f); |
2861 } | 2804 } |
2862 } | 2805 } |