]> git.eshelyaron.com Git - emacs.git/commitdiff
* xterm.h (struct x_output): For 'black_relief' and 'white_relief'
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 29 Oct 2013 05:55:25 +0000 (09:55 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 29 Oct 2013 05:55:25 +0000 (09:55 +0400)
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.

src/ChangeLog
src/dispextern.h
src/w32term.c
src/w32term.h
src/xfaces.c
src/xfns.c
src/xterm.c
src/xterm.h

index 6458b739a5268d091c34e0611e18f1fce5052164..55ff9390ce6665effaecf25da53fe7b50414a28e 100644 (file)
@@ -1,3 +1,18 @@
+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.
index e61347ebf916a45f3ec3a29cdad013245fa099b6..0d225e9616f7afc8f1508d9092a5996aa6745698 100644 (file)
@@ -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 *);
index 8bc46734b7d6b3fb429c1b89151858d2e3119b94..275df927313ef1095fd9c8679146801396c9c789 100644 (file)
@@ -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);
 
index 956e03d336c3668e809961c6dee8a32384515ac1..b3c0cf56c7b8001b6ee60e58d6fcf95669d3b699 100644 (file)
@@ -376,7 +376,6 @@ struct w32_output
   {
     XGCValues *gc;
     unsigned long pixel;
-    int allocated_p;
   }
   black_relief, white_relief;
 
index 313e863411130baec6375bec08626ff2519821b0..21a66d390d1365f1782445120ab21cbd5d20eb87 100644 (file)
@@ -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 */
index 9cd7d3e6627ef2149c8654955103bd4defac0b18..695a72a70241d4ced1cd101d503d773408cabaab 100644 (file)
@@ -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;
index 26ad526762558c57058a63f0c719c9ea269a80a7..c7fe9ec6ac8c59089eef3e93f812b4acc481388d 100644 (file)
@@ -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);
index 06c0d4882b8a317de2a0b2cad57378a2a8a3d3d6..753debff1bb0b05b2ae6cb283afbb80ea0107799 100644 (file)
@@ -605,7 +605,6 @@ struct x_output
   {
     GC gc;
     unsigned long pixel;
-    int allocated_p;
   }
   black_relief, white_relief;