aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2013-10-29 09:55:25 +0400
committerDmitry Antipov2013-10-29 09:55:25 +0400
commit0085b9be229be7369300f4f4ab27a9699db641b4 (patch)
treec9f11e1b06eaa030b0a0ebacbaf38f5eef6c5d77
parentb9bef71fd33a3789b2a67a19745f6bbf8f4aff6e (diff)
downloademacs-0085b9be229be7369300f4f4ab27a9699db641b4.tar.gz
emacs-0085b9be229be7369300f4f4ab27a9699db641b4.zip
* 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.
-rw-r--r--src/ChangeLog15
-rw-r--r--src/dispextern.h2
-rw-r--r--src/w32term.c16
-rw-r--r--src/w32term.h1
-rw-r--r--src/xfaces.c14
-rw-r--r--src/xfns.c5
-rw-r--r--src/xterm.c14
-rw-r--r--src/xterm.h1
8 files changed, 34 insertions, 34 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6458b739a52..55ff9390ce6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12013-10-29 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * xterm.h (struct x_output): For 'black_relief' and 'white_relief'
4 fields, drop 'allocated_p' member and use -1 for uninitialized value.
5 * w32term.h (struct w32_output): Similarly but do not use -1 because...
6 * xfaces.c (unload_color) [HAVE_X_WINDOWS]: ...this function is a no-op
7 on MS-Windows anyway.
8 (free_face_colors): Define only if HAVE_X_WINDOWS and...
9 (free_realized_face): ...adjust user.
10 * xfns.c (Fx_create_frame, x_create_tip_frame): Initialize black and
11 white relief pixels to -1.
12 * xterm.c (x_setup_relief_color, x_free_frame_resources): Adjust users.
13 * w32term.c (w32_setup_relief_color, x_free_frame_resources): Likewise.
14 * dispextern.h (unload_color): Move prototype under HAVE_X_WINDOWS.
15
12013-10-28 Paul Eggert <eggert@cs.ucla.edu> 162013-10-28 Paul Eggert <eggert@cs.ucla.edu>
2 17
3 * dispextern.h, image.c (x_bitmap_height, x_bitmap_width): Now static. 18 * dispextern.h, image.c (x_bitmap_height, x_bitmap_width): Now static.
diff --git a/src/dispextern.h b/src/dispextern.h
index e61347ebf91..0d225e9616f 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3328,6 +3328,7 @@ void ignore_sigio (void);
3328/* Defined in xfaces.c */ 3328/* Defined in xfaces.c */
3329 3329
3330#ifdef HAVE_X_WINDOWS 3330#ifdef HAVE_X_WINDOWS
3331void unload_color (struct frame *, unsigned long);
3331void x_free_colors (struct frame *, unsigned long *, int); 3332void x_free_colors (struct frame *, unsigned long *, int);
3332#endif 3333#endif
3333 3334
@@ -3339,7 +3340,6 @@ void clear_face_cache (int);
3339unsigned long load_color (struct frame *, struct face *, Lisp_Object, 3340unsigned long load_color (struct frame *, struct face *, Lisp_Object,
3340 enum lface_attribute_index); 3341 enum lface_attribute_index);
3341#endif 3342#endif
3342void unload_color (struct frame *, unsigned long);
3343char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, 3343char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
3344 int *); 3344 int *);
3345void prepare_face_for_display (struct frame *, struct face *); 3345void prepare_face_for_display (struct frame *, struct face *);
diff --git a/src/w32term.c b/src/w32term.c
index 8bc46734b7d..275df927313 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1596,10 +1596,7 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor,
1596 xgcv.foreground = default_pixel; 1596 xgcv.foreground = default_pixel;
1597 pixel = background; 1597 pixel = background;
1598 if (w32_alloc_lighter_color (f, &pixel, factor, delta)) 1598 if (w32_alloc_lighter_color (f, &pixel, factor, delta))
1599 { 1599 xgcv.foreground = relief->pixel = pixel;
1600 relief->allocated_p = 1;
1601 xgcv.foreground = relief->pixel = pixel;
1602 }
1603 1600
1604 if (relief->gc == 0) 1601 if (relief->gc == 0)
1605 { 1602 {
@@ -6001,17 +5998,6 @@ x_free_frame_resources (struct frame *f)
6001 5998
6002 free_frame_menubar (f); 5999 free_frame_menubar (f);
6003 6000
6004 unload_color (f, FRAME_FOREGROUND_PIXEL (f));
6005 unload_color (f, FRAME_BACKGROUND_PIXEL (f));
6006 unload_color (f, f->output_data.w32->cursor_pixel);
6007 unload_color (f, f->output_data.w32->cursor_foreground_pixel);
6008 unload_color (f, f->output_data.w32->border_pixel);
6009 unload_color (f, f->output_data.w32->mouse_pixel);
6010 if (f->output_data.w32->white_relief.allocated_p)
6011 unload_color (f, f->output_data.w32->white_relief.pixel);
6012 if (f->output_data.w32->black_relief.allocated_p)
6013 unload_color (f, f->output_data.w32->black_relief.pixel);
6014
6015 if (FRAME_FACE_CACHE (f)) 6001 if (FRAME_FACE_CACHE (f))
6016 free_frame_faces (f); 6002 free_frame_faces (f);
6017 6003
diff --git a/src/w32term.h b/src/w32term.h
index 956e03d336c..b3c0cf56c7b 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -376,7 +376,6 @@ struct w32_output
376 { 376 {
377 XGCValues *gc; 377 XGCValues *gc;
378 unsigned long pixel; 378 unsigned long pixel;
379 int allocated_p;
380 } 379 }
381 black_relief, white_relief; 380 black_relief, white_relief;
382 381
diff --git a/src/xfaces.c b/src/xfaces.c
index 313e8634111..21a66d390d1 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1293,30 +1293,28 @@ load_face_colors (struct frame *f, struct face *face,
1293 face->foreground = load_color (f, face, fg, LFACE_FOREGROUND_INDEX); 1293 face->foreground = load_color (f, face, fg, LFACE_FOREGROUND_INDEX);
1294} 1294}
1295 1295
1296#ifdef HAVE_X_WINDOWS
1296 1297
1297/* Free color PIXEL on frame F. */ 1298/* Free color PIXEL on frame F. */
1298 1299
1299void 1300void
1300unload_color (struct frame *f, long unsigned int pixel) 1301unload_color (struct frame *f, long unsigned int pixel)
1301{ 1302{
1302#ifdef HAVE_X_WINDOWS
1303 if (pixel != -1) 1303 if (pixel != -1)
1304 { 1304 {
1305 block_input (); 1305 block_input ();
1306 x_free_colors (f, &pixel, 1); 1306 x_free_colors (f, &pixel, 1);
1307 unblock_input (); 1307 unblock_input ();
1308 } 1308 }
1309#endif
1310} 1309}
1311 1310
1312
1313/* Free colors allocated for FACE. */ 1311/* Free colors allocated for FACE. */
1314 1312
1315static void 1313static void
1316free_face_colors (struct frame *f, struct face *face) 1314free_face_colors (struct frame *f, struct face *face)
1317{ 1315{
1318/* PENDING(NS): need to do something here? */ 1316 /* PENDING(NS): need to do something here? */
1319#ifdef HAVE_X_WINDOWS 1317
1320 if (face->colors_copied_bitwise_p) 1318 if (face->colors_copied_bitwise_p)
1321 return; 1319 return;
1322 1320
@@ -1363,9 +1361,10 @@ free_face_colors (struct frame *f, struct face *face)
1363 } 1361 }
1364 1362
1365 unblock_input (); 1363 unblock_input ();
1366#endif /* HAVE_X_WINDOWS */
1367} 1364}
1368 1365
1366#endif /* HAVE_X_WINDOWS */
1367
1369#endif /* HAVE_WINDOW_SYSTEM */ 1368#endif /* HAVE_WINDOW_SYSTEM */
1370 1369
1371 1370
@@ -4039,8 +4038,9 @@ free_realized_face (struct frame *f, struct face *face)
4039 face->gc = 0; 4038 face->gc = 0;
4040 unblock_input (); 4039 unblock_input ();
4041 } 4040 }
4042 4041#ifdef HAVE_X_WINDOWS
4043 free_face_colors (f, face); 4042 free_face_colors (f, face);
4043#endif /* HAVE_X_WINDOWS */
4044 x_destroy_bitmap (f, face->stipple); 4044 x_destroy_bitmap (f, face->stipple);
4045 } 4045 }
4046#endif /* HAVE_WINDOW_SYSTEM */ 4046#endif /* HAVE_WINDOW_SYSTEM */
diff --git a/src/xfns.c b/src/xfns.c
index 9cd7d3e6627..695a72a7024 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2880,6 +2880,8 @@ This function is an internal primitive--use `make-frame' instead. */)
2880 f->output_data.x->scroll_bar_top_shadow_pixel = -1; 2880 f->output_data.x->scroll_bar_top_shadow_pixel = -1;
2881 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 2881 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
2882#endif /* USE_TOOLKIT_SCROLL_BARS */ 2882#endif /* USE_TOOLKIT_SCROLL_BARS */
2883 f->output_data.x->white_relief.pixel = -1;
2884 f->output_data.x->black_relief.pixel = -1;
2883 2885
2884 fset_icon_name (f, 2886 fset_icon_name (f,
2885 x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", 2887 x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
@@ -4824,6 +4826,9 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4824 f->output_data.x->scroll_bar_top_shadow_pixel = -1; 4826 f->output_data.x->scroll_bar_top_shadow_pixel = -1;
4825 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 4827 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
4826#endif /* USE_TOOLKIT_SCROLL_BARS */ 4828#endif /* USE_TOOLKIT_SCROLL_BARS */
4829 f->output_data.x->white_relief.pixel = -1;
4830 f->output_data.x->black_relief.pixel = -1;
4831
4827 fset_icon_name (f, Qnil); 4832 fset_icon_name (f, Qnil);
4828 FRAME_DISPLAY_INFO (f) = dpyinfo; 4833 FRAME_DISPLAY_INFO (f) = dpyinfo;
4829 f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window; 4834 f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window;
diff --git a/src/xterm.c b/src/xterm.c
index 26ad5267625..c7fe9ec6ac8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1774,11 +1774,10 @@ x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int
1774 /* Free previously allocated color. The color cell will be reused 1774 /* Free previously allocated color. The color cell will be reused
1775 when it has been freed as many times as it was allocated, so this 1775 when it has been freed as many times as it was allocated, so this
1776 doesn't affect faces using the same colors. */ 1776 doesn't affect faces using the same colors. */
1777 if (relief->gc 1777 if (relief->gc && relief->pixel != -1)
1778 && relief->allocated_p)
1779 { 1778 {
1780 x_free_colors (f, &relief->pixel, 1); 1779 x_free_colors (f, &relief->pixel, 1);
1781 relief->allocated_p = 0; 1780 relief->pixel = -1;
1782 } 1781 }
1783 1782
1784 /* Allocate new color. */ 1783 /* Allocate new color. */
@@ -1786,10 +1785,7 @@ x_setup_relief_color (struct frame *f, struct relief *relief, double factor, int
1786 pixel = background; 1785 pixel = background;
1787 if (dpyinfo->n_planes != 1 1786 if (dpyinfo->n_planes != 1
1788 && x_alloc_lighter_color (f, dpy, cmap, &pixel, factor, delta)) 1787 && x_alloc_lighter_color (f, dpy, cmap, &pixel, factor, delta))
1789 { 1788 xgcv.foreground = relief->pixel = pixel;
1790 relief->allocated_p = 1;
1791 xgcv.foreground = relief->pixel = pixel;
1792 }
1793 1789
1794 if (relief->gc == 0) 1790 if (relief->gc == 0)
1795 { 1791 {
@@ -9338,9 +9334,9 @@ x_free_frame_resources (struct frame *f)
9338 if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1) 9334 if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1)
9339 unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel); 9335 unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel);
9340#endif /* USE_TOOLKIT_SCROLL_BARS */ 9336#endif /* USE_TOOLKIT_SCROLL_BARS */
9341 if (f->output_data.x->white_relief.allocated_p) 9337 if (f->output_data.x->white_relief.pixel != -1)
9342 unload_color (f, f->output_data.x->white_relief.pixel); 9338 unload_color (f, f->output_data.x->white_relief.pixel);
9343 if (f->output_data.x->black_relief.allocated_p) 9339 if (f->output_data.x->black_relief.pixel != -1)
9344 unload_color (f, f->output_data.x->black_relief.pixel); 9340 unload_color (f, f->output_data.x->black_relief.pixel);
9345 9341
9346 x_free_gcs (f); 9342 x_free_gcs (f);
diff --git a/src/xterm.h b/src/xterm.h
index 06c0d4882b8..753debff1bb 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -605,7 +605,6 @@ struct x_output
605 { 605 {
606 GC gc; 606 GC gc;
607 unsigned long pixel; 607 unsigned long pixel;
608 int allocated_p;
609 } 608 }
610 black_relief, white_relief; 609 black_relief, white_relief;
611 610