emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101845: * xterm.c (x_draw_relief_rec


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101845: * xterm.c (x_draw_relief_rect): If box width is larger than 1,
Date: Fri, 08 Oct 2010 01:02:56 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101845
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Fri 2010-10-08 01:02:56 -0400
message:
  * xterm.c (x_draw_relief_rect): If box width is larger than 1,
  draw the outermost line using the black relief, for legibility.
  Omit drawing the four corner pixels.
modified:
  src/ChangeLog
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-10-04 18:16:22 +0000
+++ b/src/ChangeLog     2010-10-08 05:02:56 +0000
@@ -1,3 +1,9 @@
+2010-10-08  Chong Yidong  <address@hidden>
+
+       * xterm.c (x_draw_relief_rect): If box width is larger than 1,
+       draw the outermost line using the black relief, for legibility.
+       Omit drawing the four corner pixels.
+
 2010-10-04  Chong Yidong  <address@hidden>
 
        * keyboard.c (echo_prompt): Function moved into read_key_sequence.

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2010-10-03 15:39:21 +0000
+++ b/src/xterm.c       2010-10-08 05:02:56 +0000
@@ -1942,18 +1942,35 @@
     gc = f->output_data.x->black_relief.gc;
   XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted);
 
+  /* This code is more complicated than it has to be, because of two
+     minor hacks to make the boxes look nicer: (i) if width > 1, draw
+     the outermost line using the black relief.  (ii) Omit the four
+     corner pixels.  */
+
   /* Top.  */
   if (top_p)
-    for (i = 0; i < width; ++i)
-      XDrawLine (dpy, window, gc,
-                left_x + i * left_p, top_y + i,
-                right_x + 1 - i * right_p, top_y + i);
+    {
+      if (width == 1)
+       XDrawLine (dpy, window, gc,
+                  left_x  + (left_p  ? 1 : 0), top_y,
+                  right_x + (right_p ? 0 : 1), top_y);
+
+      for (i = 1; i < width; ++i)
+       XDrawLine (dpy, window, gc,
+                  left_x  + i * left_p, top_y + i,
+                  right_x + 1 - i * right_p, top_y + i);
+    }
 
   /* Left.  */
   if (left_p)
-    for (i = 0; i < width; ++i)
-      XDrawLine (dpy, window, gc,
-                left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
+    {
+      if (width == 1)
+       XDrawLine (dpy, window, gc, left_x, top_y + 1, left_x, bottom_y);
+
+      for (i = (width > 1 ? 1 : 0); i < width; ++i)
+       XDrawLine (dpy, window, gc,
+                  left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
+    }
 
   XSetClipMask (dpy, gc, None);
   if (raised_p)
@@ -1962,12 +1979,30 @@
     gc = f->output_data.x->white_relief.gc;
   XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted);
 
+  if (width > 1)
+    {
+      /* Outermost top line.  */
+      if (top_p)
+       XDrawLine (dpy, window, gc,
+                  left_x  + (left_p  ? 1 : 0), top_y,
+                  right_x + (right_p ? 0 : 1), top_y);
+
+      /* Outermost left line.  */
+      if (left_p)
+       XDrawLine (dpy, window, gc, left_x, top_y + 1, left_x, bottom_y);
+    }
+
   /* Bottom.  */
   if (bot_p)
-    for (i = 0; i < width; ++i)
+    {
       XDrawLine (dpy, window, gc,
-                left_x + i * left_p, bottom_y - i,
-                right_x + 1 - i * right_p, bottom_y - i);
+                left_x  + (left_p  ? 1 : 0), bottom_y,
+                right_x + (right_p ? 0 : 1), bottom_y);
+      for (i = 1; i < width; ++i)
+       XDrawLine (dpy, window, gc,
+                  left_x  + i * left_p, bottom_y - i,
+                  right_x + 1 - i * right_p, bottom_y - i);
+    }
 
   /* Right.  */
   if (right_p)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]