From: Po Lu Date: Tue, 3 May 2022 03:43:32 +0000 (+0800) Subject: Make sure rectangles are drawn correctly on X X-Git-Tag: emacs-29.0.90~1931^2~117 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c77ef7d193cfba2e06846012abeb684e37d228a9;p=emacs.git 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. --- diff --git a/src/xfaces.c b/src/xfaces.c index 8ebb33c5abd..05e0df4b7dc 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 14721c6ce83..dc8f02780ce 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 adfe90522d4..367e69fb956 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)