fields, drop 'allocated_p' member and use -1 for uninitialized value.
* w32term.h (struct w32_output): Similarly but do not use -1 because...
* xfaces.c (unload_color) [HAVE_X_WINDOWS]: ...this function is a no-op
on MS-Windows anyway.
(free_face_colors): Define only if HAVE_X_WINDOWS and...
(free_realized_face): ...adjust user.
* xfns.c (Fx_create_frame, x_create_tip_frame): Initialize black and
white relief pixels to -1.
* xterm.c (x_setup_relief_color, x_free_frame_resources): Adjust users.
* w32term.c (w32_setup_relief_color, x_free_frame_resources): Likewise.
* dispextern.h (unload_color): Move prototype under HAVE_X_WINDOWS.
+2013-10-29 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * xterm.h (struct x_output): For 'black_relief' and 'white_relief'
+ fields, drop 'allocated_p' member and use -1 for uninitialized value.
+ * w32term.h (struct w32_output): Similarly but do not use -1 because...
+ * xfaces.c (unload_color) [HAVE_X_WINDOWS]: ...this function is a no-op
+ on MS-Windows anyway.
+ (free_face_colors): Define only if HAVE_X_WINDOWS and...
+ (free_realized_face): ...adjust user.
+ * xfns.c (Fx_create_frame, x_create_tip_frame): Initialize black and
+ white relief pixels to -1.
+ * xterm.c (x_setup_relief_color, x_free_frame_resources): Adjust users.
+ * w32term.c (w32_setup_relief_color, x_free_frame_resources): Likewise.
+ * dispextern.h (unload_color): Move prototype under HAVE_X_WINDOWS.
+
2013-10-28 Paul Eggert <eggert@cs.ucla.edu>
* dispextern.h, image.c (x_bitmap_height, x_bitmap_width): Now static.
/* Defined in xfaces.c */
#ifdef HAVE_X_WINDOWS
+void unload_color (struct frame *, unsigned long);
void x_free_colors (struct frame *, unsigned long *, int);
#endif
unsigned long load_color (struct frame *, struct face *, Lisp_Object,
enum lface_attribute_index);
#endif
-void unload_color (struct frame *, unsigned long);
char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
int *);
void prepare_face_for_display (struct frame *, struct face *);
xgcv.foreground = default_pixel;
pixel = background;
if (w32_alloc_lighter_color (f, &pixel, factor, delta))
- {
- relief->allocated_p = 1;
- xgcv.foreground = relief->pixel = pixel;
- }
+ xgcv.foreground = relief->pixel = pixel;
if (relief->gc == 0)
{
free_frame_menubar (f);
- unload_color (f, FRAME_FOREGROUND_PIXEL (f));
- unload_color (f, FRAME_BACKGROUND_PIXEL (f));
- unload_color (f, f->output_data.w32->cursor_pixel);
- unload_color (f, f->output_data.w32->cursor_foreground_pixel);
- unload_color (f, f->output_data.w32->border_pixel);
- unload_color (f, f->output_data.w32->mouse_pixel);
- if (f->output_data.w32->white_relief.allocated_p)
- unload_color (f, f->output_data.w32->white_relief.pixel);
- if (f->output_data.w32->black_relief.allocated_p)
- unload_color (f, f->output_data.w32->black_relief.pixel);
-
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
{
XGCValues *gc;
unsigned long pixel;
- int allocated_p;
}
black_relief, white_relief;
face->foreground = load_color (f, face, fg, LFACE_FOREGROUND_INDEX);
}
+#ifdef HAVE_X_WINDOWS
/* Free color PIXEL on frame F. */
void
unload_color (struct frame *f, long unsigned int pixel)
{
-#ifdef HAVE_X_WINDOWS
if (pixel != -1)
{
block_input ();
x_free_colors (f, &pixel, 1);
unblock_input ();
}
-#endif
}
-
/* Free colors allocated for FACE. */
static void
free_face_colors (struct frame *f, struct face *face)
{
-/* PENDING(NS): need to do something here? */
-#ifdef HAVE_X_WINDOWS
+ /* PENDING(NS): need to do something here? */
+
if (face->colors_copied_bitwise_p)
return;
}
unblock_input ();
-#endif /* HAVE_X_WINDOWS */
}
+#endif /* HAVE_X_WINDOWS */
+
#endif /* HAVE_WINDOW_SYSTEM */
face->gc = 0;
unblock_input ();
}
-
+#ifdef HAVE_X_WINDOWS
free_face_colors (f, face);
+#endif /* HAVE_X_WINDOWS */
x_destroy_bitmap (f, face->stipple);
}
#endif /* HAVE_WINDOW_SYSTEM */
f->output_data.x->scroll_bar_top_shadow_pixel = -1;
f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
#endif /* USE_TOOLKIT_SCROLL_BARS */
+ f->output_data.x->white_relief.pixel = -1;
+ f->output_data.x->black_relief.pixel = -1;
fset_icon_name (f,
x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
f->output_data.x->scroll_bar_top_shadow_pixel = -1;
f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
#endif /* USE_TOOLKIT_SCROLL_BARS */
+ f->output_data.x->white_relief.pixel = -1;
+ f->output_data.x->black_relief.pixel = -1;
+
fset_icon_name (f, Qnil);
FRAME_DISPLAY_INFO (f) = dpyinfo;
f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window;
/* Free previously allocated color. The color cell will be reused
when it has been freed as many times as it was allocated, so this
doesn't affect faces using the same colors. */
- if (relief->gc
- && relief->allocated_p)
+ if (relief->gc && relief->pixel != -1)
{
x_free_colors (f, &relief->pixel, 1);
- relief->allocated_p = 0;
+ relief->pixel = -1;
}
/* Allocate new color. */
pixel = background;
if (dpyinfo->n_planes != 1
&& x_alloc_lighter_color (f, dpy, cmap, &pixel, factor, delta))
- {
- relief->allocated_p = 1;
- xgcv.foreground = relief->pixel = pixel;
- }
+ xgcv.foreground = relief->pixel = pixel;
if (relief->gc == 0)
{
if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1)
unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel);
#endif /* USE_TOOLKIT_SCROLL_BARS */
- if (f->output_data.x->white_relief.allocated_p)
+ if (f->output_data.x->white_relief.pixel != -1)
unload_color (f, f->output_data.x->white_relief.pixel);
- if (f->output_data.x->black_relief.allocated_p)
+ if (f->output_data.x->black_relief.pixel != -1)
unload_color (f, f->output_data.x->black_relief.pixel);
x_free_gcs (f);
{
GC gc;
unsigned long pixel;
- int allocated_p;
}
black_relief, white_relief;