]> git.eshelyaron.com Git - emacs.git/commitdiff
Make sure rectangles are drawn correctly on X
authorPo Lu <luangruo@yahoo.com>
Tue, 3 May 2022 03:43:32 +0000 (11:43 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 3 May 2022 03:43:32 +0000 (11:43 +0800)
* 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
src/xfns.c
src/xterm.c

index 8ebb33c5abdfcf16a2872575ef3bb82a74c57f65..05e0df4b7dc8243008f405b799901994c59c7da5 100644 (file)
@@ -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 ();
index 14721c6ce83971cc7956012278a97c19df31f1f9..dc8f02780ce5755c0de062ffbb0538b946e69ed9 100644 (file)
@@ -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),
index adfe90522d445491722dc49f060b5e4cfe9f6d90..367e69fb956d42c00d357223c85553511942a55b 100644 (file)
@@ -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)