diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index bf4d5c0..819ab1a 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -2504,6 +2504,13 @@ Font and Color Parameters
 while keeping foreground elements such as text fully opaque.  It
 should be an integer between 0 and 100, where 0 means
 completely transparent and 100 means completely opaque (default).
+
+@vindex borders-respect-alpha-background@r{, a frame parameter}
+@item borders-respect-alpha-background
+@cindex opacity, frame
+@cindex transparency, frame
+When non-@code{nil}, internal borders and window dividers are
+transparent according to @code{alpha-background}.
 @end table
 
 The following frame parameters are semi-obsolete in that they are
diff --git a/src/frame.c b/src/frame.c
index 7f4bf27..cb8668a 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4003,56 +4003,57 @@ DEFUN ("frame-scale-factor", Fframe_scale_factor, Sframe_scale_factor,
 
 static const struct frame_parm_table frame_parms[] =
 {
-  {"auto-raise",		SYMBOL_INDEX (Qauto_raise)},
-  {"auto-lower",		SYMBOL_INDEX (Qauto_lower)},
-  {"background-color",		-1},
-  {"border-color",		SYMBOL_INDEX (Qborder_color)},
-  {"border-width",		SYMBOL_INDEX (Qborder_width)},
-  {"cursor-color",		SYMBOL_INDEX (Qcursor_color)},
-  {"cursor-type",		SYMBOL_INDEX (Qcursor_type)},
-  {"font",			-1},
-  {"foreground-color",		-1},
-  {"icon-name",			SYMBOL_INDEX (Qicon_name)},
-  {"icon-type",			SYMBOL_INDEX (Qicon_type)},
-  {"child-frame-border-width",	SYMBOL_INDEX (Qchild_frame_border_width)},
-  {"internal-border-width",	SYMBOL_INDEX (Qinternal_border_width)},
-  {"right-divider-width",	SYMBOL_INDEX (Qright_divider_width)},
-  {"bottom-divider-width",	SYMBOL_INDEX (Qbottom_divider_width)},
-  {"menu-bar-lines",		SYMBOL_INDEX (Qmenu_bar_lines)},
-  {"mouse-color",		SYMBOL_INDEX (Qmouse_color)},
-  {"name",			SYMBOL_INDEX (Qname)},
-  {"scroll-bar-width",		SYMBOL_INDEX (Qscroll_bar_width)},
-  {"scroll-bar-height",		SYMBOL_INDEX (Qscroll_bar_height)},
-  {"title",			SYMBOL_INDEX (Qtitle)},
-  {"unsplittable",		SYMBOL_INDEX (Qunsplittable)},
-  {"vertical-scroll-bars",	SYMBOL_INDEX (Qvertical_scroll_bars)},
-  {"horizontal-scroll-bars",	SYMBOL_INDEX (Qhorizontal_scroll_bars)},
-  {"visibility",		SYMBOL_INDEX (Qvisibility)},
-  {"tab-bar-lines",		SYMBOL_INDEX (Qtab_bar_lines)},
-  {"tool-bar-lines",		SYMBOL_INDEX (Qtool_bar_lines)},
-  {"scroll-bar-foreground",	SYMBOL_INDEX (Qscroll_bar_foreground)},
-  {"scroll-bar-background",	SYMBOL_INDEX (Qscroll_bar_background)},
-  {"screen-gamma",		SYMBOL_INDEX (Qscreen_gamma)},
-  {"line-spacing",		SYMBOL_INDEX (Qline_spacing)},
-  {"left-fringe",		SYMBOL_INDEX (Qleft_fringe)},
-  {"right-fringe",		SYMBOL_INDEX (Qright_fringe)},
-  {"wait-for-wm",		SYMBOL_INDEX (Qwait_for_wm)},
-  {"fullscreen",                SYMBOL_INDEX (Qfullscreen)},
-  {"font-backend",		SYMBOL_INDEX (Qfont_backend)},
-  {"alpha",			SYMBOL_INDEX (Qalpha)},
-  {"sticky",			SYMBOL_INDEX (Qsticky)},
-  {"tool-bar-position",		SYMBOL_INDEX (Qtool_bar_position)},
-  {"inhibit-double-buffering",  SYMBOL_INDEX (Qinhibit_double_buffering)},
-  {"undecorated",		SYMBOL_INDEX (Qundecorated)},
-  {"parent-frame",		SYMBOL_INDEX (Qparent_frame)},
-  {"skip-taskbar",		SYMBOL_INDEX (Qskip_taskbar)},
-  {"no-focus-on-map",		SYMBOL_INDEX (Qno_focus_on_map)},
-  {"no-accept-focus",		SYMBOL_INDEX (Qno_accept_focus)},
-  {"z-group",			SYMBOL_INDEX (Qz_group)},
-  {"override-redirect",		SYMBOL_INDEX (Qoverride_redirect)},
-  {"no-special-glyphs",		SYMBOL_INDEX (Qno_special_glyphs)},
-  {"alpha-background",		SYMBOL_INDEX (Qalpha_background)},
-  {"use-frame-synchronization",	SYMBOL_INDEX (Quse_frame_synchronization)},
+  {"auto-raise",			SYMBOL_INDEX (Qauto_raise)},
+  {"auto-lower",			SYMBOL_INDEX (Qauto_lower)},
+  {"background-color",			-1},
+  {"border-color",			SYMBOL_INDEX (Qborder_color)},
+  {"border-width",			SYMBOL_INDEX (Qborder_width)},
+  {"cursor-color",			SYMBOL_INDEX (Qcursor_color)},
+  {"cursor-type",			SYMBOL_INDEX (Qcursor_type)},
+  {"font",				-1},
+  {"foreground-color",			-1},
+  {"icon-name",				SYMBOL_INDEX (Qicon_name)},
+  {"icon-type",				SYMBOL_INDEX (Qicon_type)},
+  {"child-frame-border-width",		SYMBOL_INDEX (Qchild_frame_border_width)},
+  {"internal-border-width",		SYMBOL_INDEX (Qinternal_border_width)},
+  {"right-divider-width",		SYMBOL_INDEX (Qright_divider_width)},
+  {"bottom-divider-width",		SYMBOL_INDEX (Qbottom_divider_width)},
+  {"menu-bar-lines",			SYMBOL_INDEX (Qmenu_bar_lines)},
+  {"mouse-color",			SYMBOL_INDEX (Qmouse_color)},
+  {"name",				SYMBOL_INDEX (Qname)},
+  {"scroll-bar-width",			SYMBOL_INDEX (Qscroll_bar_width)},
+  {"scroll-bar-height",			SYMBOL_INDEX (Qscroll_bar_height)},
+  {"title",				SYMBOL_INDEX (Qtitle)},
+  {"unsplittable",			SYMBOL_INDEX (Qunsplittable)},
+  {"vertical-scroll-bars",		SYMBOL_INDEX (Qvertical_scroll_bars)},
+  {"horizontal-scroll-bars",		SYMBOL_INDEX (Qhorizontal_scroll_bars)},
+  {"visibility",			SYMBOL_INDEX (Qvisibility)},
+  {"tab-bar-lines",			SYMBOL_INDEX (Qtab_bar_lines)},
+  {"tool-bar-lines",			SYMBOL_INDEX (Qtool_bar_lines)},
+  {"scroll-bar-foreground",		SYMBOL_INDEX (Qscroll_bar_foreground)},
+  {"scroll-bar-background",		SYMBOL_INDEX (Qscroll_bar_background)},
+  {"screen-gamma",			SYMBOL_INDEX (Qscreen_gamma)},
+  {"line-spacing",			SYMBOL_INDEX (Qline_spacing)},
+  {"left-fringe",			SYMBOL_INDEX (Qleft_fringe)},
+  {"right-fringe",			SYMBOL_INDEX (Qright_fringe)},
+  {"wait-for-wm",			SYMBOL_INDEX (Qwait_for_wm)},
+  {"fullscreen",                	SYMBOL_INDEX (Qfullscreen)},
+  {"font-backend",			SYMBOL_INDEX (Qfont_backend)},
+  {"alpha",				SYMBOL_INDEX (Qalpha)},
+  {"sticky",				SYMBOL_INDEX (Qsticky)},
+  {"tool-bar-position",			SYMBOL_INDEX (Qtool_bar_position)},
+  {"inhibit-double-buffering",  	SYMBOL_INDEX (Qinhibit_double_buffering)},
+  {"undecorated",			SYMBOL_INDEX (Qundecorated)},
+  {"parent-frame",			SYMBOL_INDEX (Qparent_frame)},
+  {"skip-taskbar",			SYMBOL_INDEX (Qskip_taskbar)},
+  {"no-focus-on-map",			SYMBOL_INDEX (Qno_focus_on_map)},
+  {"no-accept-focus",			SYMBOL_INDEX (Qno_accept_focus)},
+  {"z-group",				SYMBOL_INDEX (Qz_group)},
+  {"override-redirect",			SYMBOL_INDEX (Qoverride_redirect)},
+  {"no-special-glyphs",			SYMBOL_INDEX (Qno_special_glyphs)},
+  {"alpha-background",			SYMBOL_INDEX (Qalpha_background)},
+  {"borders-respect-alpha-background",	SYMBOL_INDEX (Qborders_respect_alpha_background)},
+  {"use-frame-synchronization",		SYMBOL_INDEX (Quse_frame_synchronization)},
 #ifdef HAVE_X_WINDOWS
   {"shaded",			SYMBOL_INDEX (Qshaded)},
 #endif
@@ -5238,6 +5239,12 @@ gui_set_alpha_background (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
   SET_FRAME_GARBAGED (f);
 }
 
+void
+gui_set_borders_respect_alpha_background (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+{
+  f->borders_respect_alpha_background = !NILP (arg);
+}
+
 /**
  * gui_set_no_special_glyphs:
  *
@@ -6400,6 +6407,7 @@ syms_of_frame (void)
 
   DEFSYM (Qalpha, "alpha");
   DEFSYM (Qalpha_background, "alpha-background");
+  DEFSYM (Qborders_respect_alpha_background, "borders-respect-alpha-background");
   DEFSYM (Qauto_lower, "auto-lower");
   DEFSYM (Qauto_raise, "auto-raise");
   DEFSYM (Qborder_color, "border-color");
diff --git a/src/frame.h b/src/frame.h
index 1d920d1..0e353a0 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -544,6 +544,10 @@ #define EMACS_FRAME_H
      selected window in the frame, assuming there is still an active
      minibuffer in that mini-window.  */
   bool_bf select_mini_window_flag : 1;
+
+  /* Set to true when borders' transparencies should match the
+     background opacity.  */
+  bool_bf borders_respect_alpha_background : 1;
   /* Bitfield area ends here.  */
 
   /* This frame's change stamp, set the last time window change
@@ -1867,6 +1871,7 @@ #define EMACS_CLASS "Emacs"
 
 extern void gui_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
 extern void gui_set_alpha_background (struct frame *, Lisp_Object, Lisp_Object);
+extern void gui_set_borders_respect_alpha_background (struct frame *, Lisp_Object, Lisp_Object);
 extern void gui_set_no_special_glyphs (struct frame *, Lisp_Object, Lisp_Object);
 
 extern void validate_x_resource_name (void);
diff --git a/src/xfns.c b/src/xfns.c
index 3f0d8f3..d031916 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5315,6 +5315,9 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
                          "alpha", "Alpha", RES_TYPE_NUMBER);
   gui_default_parameter (f, parms, Qalpha_background, Qnil,
                          "alphaBackground", "AlphaBackground", RES_TYPE_NUMBER);
+  gui_default_parameter (f, parms, Qborders_respect_alpha_background, Qnil,
+                         "bordersRespectAlphaBackground",
+                         "BordersRespectAlphaBackground", RES_TYPE_NUMBER);
 
   if (!NILP (parent_frame))
     {
@@ -10170,6 +10173,7 @@ DEFUN ("x-test-string-conversion", Fx_test_string_conversion,
   x_set_override_redirect,
   gui_set_no_special_glyphs,
   x_set_alpha_background,
+  gui_set_borders_respect_alpha_background,
   x_set_use_frame_synchronization,
   x_set_shaded,
 };
diff --git a/src/xterm.c b/src/xterm.c
index 0c20d38..3259f50 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7497,13 +7497,16 @@ x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
     {
       XSetForeground (display, f->output_data.x->normal_gc, color_first);
       x_fill_rectangle (f, f->output_data.x->normal_gc,
-			x0, y0, 1, y1 - y0, false);
+			x0, y0, 1, y1 - y0,
+                        f->borders_respect_alpha_background);
       XSetForeground (display, f->output_data.x->normal_gc, color);
       x_fill_rectangle (f, f->output_data.x->normal_gc,
-			x0 + 1, y0, x1 - x0 - 2, y1 - y0, false);
+			x0 + 1, y0, x1 - x0 - 2, y1 - y0,
+                        f->borders_respect_alpha_background);
       XSetForeground (display, f->output_data.x->normal_gc, color_last);
       x_fill_rectangle (f, f->output_data.x->normal_gc,
-			x1 - 1, y0, 1, y1 - y0, false);
+			x1 - 1, y0, 1, y1 - y0,
+                        f->borders_respect_alpha_background);
     }
   else if ((x1 - x0 > y1 - y0) && (y1 - y0 >= 3))
     /* A horizontal divider, at least three pixels high: Draw first and
@@ -7511,13 +7514,16 @@ x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
     {
       XSetForeground (display, f->output_data.x->normal_gc, color_first);
       x_fill_rectangle (f, f->output_data.x->normal_gc,
-			x0, y0, x1 - x0, 1, false);
+			x0, y0, x1 - x0, 1,
+                        f->borders_respect_alpha_background);
       XSetForeground (display, f->output_data.x->normal_gc, color);
       x_fill_rectangle (f, f->output_data.x->normal_gc,
-			x0, y0 + 1, x1 - x0, y1 - y0 - 2, false);
+			x0, y0 + 1, x1 - x0, y1 - y0 - 2,
+                        f->borders_respect_alpha_background);
       XSetForeground (display, f->output_data.x->normal_gc, color_last);
       x_fill_rectangle (f, f->output_data.x->normal_gc,
-			x0, y1 - 1, x1 - x0, 1, false);
+			x0, y1 - 1, x1 - x0, 1,
+                        f->borders_respect_alpha_background);
     }
   else
     {
@@ -7525,7 +7531,8 @@ x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
        differently.  */
       XSetForeground (display, f->output_data.x->normal_gc, color);
       x_fill_rectangle (f, f->output_data.x->normal_gc,
-			x0, y0, x1 - x0, y1 - y0, false);
+			x0, y0, x1 - x0, y1 - y0,
+                        f->borders_respect_alpha_background);
     }
 }
 
@@ -7732,11 +7739,15 @@ x_clear_under_internal_border (struct frame *f)
 	  GC gc = f->output_data.x->normal_gc;
 
 	  XSetForeground (display, gc, color);
-	  x_fill_rectangle (f, gc, 0, margin, width, border, false);
-	  x_fill_rectangle (f, gc, 0, 0, border, height, false);
-	  x_fill_rectangle (f, gc, width - border, 0, border, height, false);
+	  x_fill_rectangle (f, gc, 0, margin, width, border,
+            f->borders_respect_alpha_background);
+	  x_fill_rectangle (f, gc, 0, 0, border, height,
+            f->borders_respect_alpha_background);
+	  x_fill_rectangle (f, gc, width - border, 0, border, height,
+            f->borders_respect_alpha_background);
 	  x_fill_rectangle (f, gc, 0, height - bottom_margin - border,
-			    width, border, false);
+			    width, border,
+                            f->borders_respect_alpha_background);
 	  XSetForeground (display, gc, FRAME_FOREGROUND_PIXEL (f));
 	}
       else
