summaryrefslogtreecommitdiff
path: root/src/xfont.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-01-31 10:15:47 +0800
committerPo Lu <luangruo@yahoo.com>2022-01-31 10:15:47 +0800
commit1555453694d9c2861c447b2f030b125f60e48297 (patch)
treecedd9f133ad03b211c4bec5b37c9b2c3324b1c63 /src/xfont.c
parent58bb9eb4005599155a8fce8d5c5beb531a72c534 (diff)
downloademacs-1555453694d9c2861c447b2f030b125f60e48297.tar.gz
emacs-1555453694d9c2861c447b2f030b125f60e48297.tar.bz2
emacs-1555453694d9c2861c447b2f030b125f60e48297.zip
Implement `alpha-background' on non-Cairo builds
* src/frame.c (gui_set_alpha_background): Recompute basic faces so xft face ext info gets reset. * src/gtkutil.c (xg_create_frame_widgets): Attach to style updated signal. (xg_update_frame_menubar): Set menu bar visual correctly. (xg_widget_style_updated): New function. * src/xfns.c (x_set_alpha_background): New function. (x_frame_parm_handlers): Use x_set_alpha_background instead. * src/xfont.c (xfont_draw): * src/xftfont.c (xftfont_draw): Handle `alpha-background' parameter. * src/xterm.c (x_xr_ensure_picture): Export function. (x_update_opaque_region): New function. (x_fill_rectangle): New parameter `respect_alpha_background'. All callers changed. (handle_one_xevent): Set opaque region on ConfigureNotify. (x_drop_xrender_surfaces): Set opaque region. (x_xrender_color_from_gc_foreground): (x_xrender_color_from_gc_background): Premultiply alpha with components if asked for. * src/xterm.h (struct x_display_info): New atom `Xatom_net_wm_opaque_region'.
Diffstat (limited to 'src/xfont.c')
-rw-r--r--src/xfont.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/xfont.c b/src/xfont.c
index b5765cfa7b8..7a50378a006 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -1003,6 +1003,31 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
unblock_input ();
}
+#if defined HAVE_XRENDER && (RENDER_MAJOR > 0 || (RENDER_MINOR >= 2))
+ if (with_background
+ && FRAME_DISPLAY_INFO (s->f)->n_planes == 32
+ && FRAME_CHECK_XR_VERSION (s->f, 0, 2))
+ {
+ x_xr_ensure_picture (s->f);
+
+ if (FRAME_X_PICTURE (s->f) != None)
+ {
+ XRenderColor xc;
+ int height = FONT_HEIGHT (s->font), ascent = FONT_BASE (s->font);
+
+ x_xr_apply_ext_clip (s->f, gc);
+ x_xrender_color_from_gc_background (s->f, gc, &xc, true);
+ XRenderFillRectangle (FRAME_X_DISPLAY (s->f),
+ PictOpSrc, FRAME_X_PICTURE (s->f),
+ &xc, x, y - ascent, s->width, height);
+ x_xr_reset_ext_clip (s->f);
+ x_mark_frame_dirty (s->f);
+
+ with_background = false;
+ }
+ }
+#endif
+
if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0)
{
USE_SAFE_ALLOCA;