emacs-diffs
[Top][All Lists]
Advanced

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

master c77ef7d193: Make sure rectangles are drawn correctly on X


From: Po Lu
Subject: master c77ef7d193: Make sure rectangles are drawn correctly on X
Date: Mon, 2 May 2022 23:44:31 -0400 (EDT)

branch: master
commit c77ef7d193cfba2e06846012abeb684e37d228a9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Make sure rectangles are drawn correctly on X
    
    * src/xfaces.c (prepare_face_for_display): Always use line-width
    of 1.
    * src/xfns.c (x_make_gc): Likewise.
    * src/xterm.c (x_scroll_bar_expose): Comment out obsolete code.
---
 src/xfaces.c | 13 +++++++++++--
 src/xfns.c   |  2 +-
 src/xterm.c  |  7 +++++--
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/xfaces.c b/src/xfaces.c
index 8ebb33c5ab..05e0df4b7d 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4447,17 +4447,26 @@ free_realized_face (struct frame *f, struct face *face)
 void
 prepare_face_for_display (struct frame *f, struct face *face)
 {
+  Emacs_GC egc;
+  unsigned long mask;
+
   eassert (FRAME_WINDOW_P (f));
 
   if (face->gc == 0)
     {
-      Emacs_GC egc;
-      unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures;
+      mask = GCForeground | GCBackground | GCGraphicsExposures;
 
       egc.foreground = face->foreground;
       egc.background = face->background;
 #ifdef HAVE_X_WINDOWS
       egc.graphics_exposures = False;
+
+      /* While this was historically slower than a line_width of 0,
+        the difference no longer matters on modern X servers, so set
+        it to 1 in order for PolyLine requests to behave consistently
+        everywhere.  */
+      mask |= GCLineWidth;
+      egc.line_width = 1;
 #endif
 
       block_input ();
diff --git a/src/xfns.c b/src/xfns.c
index 14721c6ce8..dc8f02780c 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4237,7 +4237,7 @@ x_make_gc (struct frame *f)
 
   gc_values.foreground = FRAME_FOREGROUND_PIXEL (f);
   gc_values.background = FRAME_BACKGROUND_PIXEL (f);
-  gc_values.line_width = 0;    /* Means 1 using fast algorithm.  */
+  gc_values.line_width = 1;
   f->output_data.x->normal_gc
     = XCreateGC (FRAME_X_DISPLAY (f),
                  FRAME_X_DRAWABLE (f),
diff --git a/src/xterm.c b/src/xterm.c
index adfe90522d..367e69fb95 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -13183,8 +13183,11 @@ x_scroll_bar_expose (struct scroll_bar *bar, const 
XEvent *event)
                  /* x, y, width, height */
                  0, 0, bar->width - 1, bar->height - 1);
 
-  XDrawPoint (FRAME_X_DISPLAY (f), w, gc,
-             bar->width - 1, bar->height - 1);
+  /* XDrawPoint (FRAME_X_DISPLAY (f), w, gc,
+                bar->width - 1, bar->height - 1);
+
+     This code is no longer required since the normal GC now uses the
+     regular line width.  */
 
   /* Restore the foreground color of the GC if we changed it above.  */
   if (f->output_data.x->scroll_bar_foreground_pixel != -1)



reply via email to

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