diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 69 |
1 files changed, 62 insertions, 7 deletions
diff --git a/src/xterm.c b/src/xterm.c index 19c0dae49d7..74be684d7d9 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -2942,19 +2942,66 @@ x_draw_glyph_string_foreground (s) | |||
| 2942 | } | 2942 | } |
| 2943 | 2943 | ||
| 2944 | 2944 | ||
| 2945 | #ifdef USE_X_TOOLKIT | ||
| 2946 | |||
| 2947 | /* Allocate the color COLOR->pixel on the screen and display of | ||
| 2948 | widget WIDGET in colormap CMAP. If an exact match cannot be | ||
| 2949 | allocated, try the nearest color available. Value is non-zero | ||
| 2950 | if successful. This is called from lwlib. */ | ||
| 2951 | |||
| 2952 | int | ||
| 2953 | x_alloc_nearest_color_for_widget (widget, cmap, color) | ||
| 2954 | Widget widget; | ||
| 2955 | Colormap cmap; | ||
| 2956 | XColor *color; | ||
| 2957 | { | ||
| 2958 | struct frame *f; | ||
| 2959 | struct x_display_info *dpyinfo; | ||
| 2960 | Lisp_Object tail, frame; | ||
| 2961 | Widget parent; | ||
| 2962 | |||
| 2963 | dpyinfo = x_display_info_for_display (XtDisplay (widget)); | ||
| 2964 | |||
| 2965 | /* Find the top-level shell of the widget. Note that this function | ||
| 2966 | can be called when the widget is not yet realized, so XtWindow | ||
| 2967 | (widget) == 0. That's the reason we can't simply use | ||
| 2968 | x_any_window_to_frame. */ | ||
| 2969 | while (!XtIsTopLevelShell (widget)) | ||
| 2970 | widget = XtParent (widget); | ||
| 2971 | |||
| 2972 | /* Look for a frame with that top-level widget. Allocate the color | ||
| 2973 | on that frame to get the right gamma correction value. */ | ||
| 2974 | for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) | ||
| 2975 | if (GC_FRAMEP (XCAR (tail)) | ||
| 2976 | && (f = XFRAME (XCAR (tail)), | ||
| 2977 | (f->output_data.nothing != 1 | ||
| 2978 | && FRAME_X_DISPLAY_INFO (f) == dpyinfo)) | ||
| 2979 | && f->output_data.x->widget == widget) | ||
| 2980 | return x_alloc_nearest_color (f, cmap, color); | ||
| 2981 | |||
| 2982 | abort (); | ||
| 2983 | } | ||
| 2984 | |||
| 2985 | #endif /* USE_X_TOOLKIT */ | ||
| 2986 | |||
| 2987 | |||
| 2945 | /* Allocate the color COLOR->pixel on SCREEN of DISPLAY, colormap | 2988 | /* Allocate the color COLOR->pixel on SCREEN of DISPLAY, colormap |
| 2946 | CMAP. If an exact match can't be allocated, try the nearest color | 2989 | CMAP. If an exact match can't be allocated, try the nearest color |
| 2947 | available. Value is non-zero if successful. Set *COLOR to the | 2990 | available. Value is non-zero if successful. Set *COLOR to the |
| 2948 | color allocated. */ | 2991 | color allocated. */ |
| 2949 | 2992 | ||
| 2950 | int | 2993 | int |
| 2951 | x_alloc_nearest_color (display, screen, cmap, color) | 2994 | x_alloc_nearest_color (f, cmap, color) |
| 2952 | Display *display; | 2995 | struct frame *f; |
| 2953 | Screen *screen; | ||
| 2954 | Colormap cmap; | 2996 | Colormap cmap; |
| 2955 | XColor *color; | 2997 | XColor *color; |
| 2956 | { | 2998 | { |
| 2957 | int rc = XAllocColor (display, cmap, color); | 2999 | Display *display = FRAME_X_DISPLAY (f); |
| 3000 | Screen *screen = FRAME_X_SCREEN (f); | ||
| 3001 | int rc; | ||
| 3002 | |||
| 3003 | gamma_correct (f, color); | ||
| 3004 | rc = XAllocColor (display, cmap, color); | ||
| 2958 | if (rc == 0) | 3005 | if (rc == 0) |
| 2959 | { | 3006 | { |
| 2960 | /* If we got to this point, the colormap is full, so we're going | 3007 | /* If we got to this point, the colormap is full, so we're going |
| @@ -3024,7 +3071,7 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta) | |||
| 3024 | new.blue = min (0xffff, factor * color.blue); | 3071 | new.blue = min (0xffff, factor * color.blue); |
| 3025 | 3072 | ||
| 3026 | /* Try to allocate the color. */ | 3073 | /* Try to allocate the color. */ |
| 3027 | success_p = x_alloc_nearest_color (display, FRAME_X_SCREEN (f), cmap, &new); | 3074 | success_p = x_alloc_nearest_color (f, cmap, &new); |
| 3028 | if (success_p) | 3075 | if (success_p) |
| 3029 | { | 3076 | { |
| 3030 | if (new.pixel == *pixel) | 3077 | if (new.pixel == *pixel) |
| @@ -3044,8 +3091,7 @@ x_alloc_lighter_color (f, display, cmap, pixel, factor, delta) | |||
| 3044 | new.red = min (0xffff, delta + color.red); | 3091 | new.red = min (0xffff, delta + color.red); |
| 3045 | new.green = min (0xffff, delta + color.green); | 3092 | new.green = min (0xffff, delta + color.green); |
| 3046 | new.blue = min (0xffff, delta + color.blue); | 3093 | new.blue = min (0xffff, delta + color.blue); |
| 3047 | success_p = x_alloc_nearest_color (display, FRAME_X_SCREEN (f), | 3094 | success_p = x_alloc_nearest_color (f, cmap, &new); |
| 3048 | cmap, &new); | ||
| 3049 | } | 3095 | } |
| 3050 | else | 3096 | else |
| 3051 | success_p = 1; | 3097 | success_p = 1; |
| @@ -5275,6 +5321,13 @@ expose_window (w, r) | |||
| 5275 | int yb = window_text_bottom_y (w); | 5321 | int yb = window_text_bottom_y (w); |
| 5276 | int cursor_cleared_p; | 5322 | int cursor_cleared_p; |
| 5277 | 5323 | ||
| 5324 | /* If window is not yet fully initialized, do nothing. This can | ||
| 5325 | happen when toolkit scroll bars are used and a window is split. | ||
| 5326 | Reconfiguring the scroll bar will generate an expose for a newly | ||
| 5327 | created window. */ | ||
| 5328 | if (w->current_matrix == NULL) | ||
| 5329 | return; | ||
| 5330 | |||
| 5278 | TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", | 5331 | TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", |
| 5279 | r->x, r->y, r->width, r->height)); | 5332 | r->x, r->y, r->width, r->height)); |
| 5280 | 5333 | ||
| @@ -7910,8 +7963,10 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 7910 | /* Does the scroll bar exist yet? */ | 7963 | /* Does the scroll bar exist yet? */ |
| 7911 | if (NILP (w->vertical_scroll_bar)) | 7964 | if (NILP (w->vertical_scroll_bar)) |
| 7912 | { | 7965 | { |
| 7966 | BLOCK_INPUT; | ||
| 7913 | XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 7967 | XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 7914 | left, top, width, height, False); | 7968 | left, top, width, height, False); |
| 7969 | UNBLOCK_INPUT; | ||
| 7915 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); | 7970 | bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); |
| 7916 | } | 7971 | } |
| 7917 | else | 7972 | else |