Commit 0085b9be authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

* 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.
parent b9bef71f
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.
......
......@@ -3328,6 +3328,7 @@ void ignore_sigio (void);
/* 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
......@@ -3339,7 +3340,6 @@ void clear_face_cache (int);
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 *);
......
......@@ -1596,10 +1596,7 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor,
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)
{
......@@ -6001,17 +5998,6 @@ x_free_frame_resources (struct frame *f)
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);
......
......@@ -376,7 +376,6 @@ struct w32_output
{
XGCValues *gc;
unsigned long pixel;
int allocated_p;
}
black_relief, white_relief;
......
......@@ -1293,30 +1293,28 @@ load_face_colors (struct frame *f, struct face *face,
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;
......@@ -1363,9 +1361,10 @@ free_face_colors (struct frame *f, struct face *face)
}
unblock_input ();
#endif /* HAVE_X_WINDOWS */
}
#endif /* HAVE_X_WINDOWS */
#endif /* HAVE_WINDOW_SYSTEM */
......@@ -4039,8 +4038,9 @@ free_realized_face (struct frame *f, struct face *face)
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 */
......
......@@ -2880,6 +2880,8 @@ This function is an internal primitive--use `make-frame' instead. */)
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",
......@@ -4824,6 +4826,9 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
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;
......
......@@ -1774,11 +1774,10 @@ x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int
/* 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. */
......@@ -1786,10 +1785,7 @@ x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int
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)
{
......@@ -9338,9 +9334,9 @@ x_free_frame_resources (struct frame *f)
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);
......
......@@ -605,7 +605,6 @@ struct x_output
{
GC gc;
unsigned long pixel;
int allocated_p;
}
black_relief, white_relief;
......
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