diff options
| author | Simon Parri <simonparri@ganzeria.com> | 2025-10-23 22:31:06 -0500 |
|---|---|---|
| committer | Simon Parri <simonparri@ganzeria.com> | 2025-10-23 22:31:06 -0500 |
| commit | fc21e3ca69646ea1e031d0a677606d27b4323eba (patch) | |
| tree | 7dd71df46773391233894d9ff659aa60a2108efc /modules/overlays | |
| parent | 2d7e31fbfb09ec2a5575ebaacb2b545afc1969ce (diff) | |
| download | nixos-config-fc21e3ca69646ea1e031d0a677606d27b4323eba.tar.gz nixos-config-fc21e3ca69646ea1e031d0a677606d27b4323eba.zip | |
modules/overlays/emacs: Patch to make window dividers transparent
From https://github.com/djeis97/emacs/tree/transparency, modified to apply on
current Emacs.
Diffstat (limited to 'modules/overlays')
| -rw-r--r-- | modules/overlays/emacs-alpha-dividers.patch | 113 | ||||
| -rw-r--r-- | modules/overlays/emacs.nix | 1 |
2 files changed, 114 insertions, 0 deletions
diff --git a/modules/overlays/emacs-alpha-dividers.patch b/modules/overlays/emacs-alpha-dividers.patch new file mode 100644 index 0000000..1246e89 --- /dev/null +++ b/modules/overlays/emacs-alpha-dividers.patch @@ -0,0 +1,113 @@ +--- a/src/xterm.c 1969-12-31 18:00:01.000000000 -0600 ++++ a/src/xterm.c 2025-10-23 21:31:03.245064218 -0500 +@@ -7460,69 +7460,32 @@ + #endif + } + ++ ++static void ++x_fill_rectangle_transp (struct frame *f, int x, int y, int width, int height) ++{ ++#ifdef USE_CAIRO ++ Display *dpy = FRAME_X_DISPLAY (f); ++ cairo_t *cr; ++ ++ cr = x_begin_cr_clip (f, f->output_data.x->normal_gc); ++ cairo_set_source_rgba(cr, 1, 1, 1, 0); ++ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); ++ cairo_rectangle (cr, x, y, width, height); ++ cairo_fill (cr); ++ x_end_cr_clip (f); ++#endif ++} ++ ++ + /* Draw a window divider from (x0,y0) to (x1,y1) */ + + static void + x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) + { + struct frame *f = XFRAME (WINDOW_FRAME (w)); +- struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID); +- struct face *face_first +- = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID); +- struct face *face_last +- = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID); +- unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f); +- unsigned long color_first = (face_first +- ? face_first->foreground +- : FRAME_FOREGROUND_PIXEL (f)); +- unsigned long color_last = (face_last +- ? face_last->foreground +- : FRAME_FOREGROUND_PIXEL (f)); +- Display *display = FRAME_X_DISPLAY (f); +- +- if ((y1 - y0 > x1 - x0) && (x1 - x0 >= 3)) +- /* A vertical divider, at least three pixels wide: Draw first and +- last pixels differently. */ +- { +- 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, +- 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, +- 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, +- 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 +- last pixels differently. */ +- { +- 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, +- 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, +- 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, +- f->borders_respect_alpha_background); +- } +- else +- { +- /* In any other case do not draw the first and last pixels +- 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, +- f->borders_respect_alpha_background); +- } ++ ++ x_fill_rectangle_transp(f, x0, y0, x1-x0, y1-y0); + } + + #ifdef HAVE_XDBE +@@ -7722,15 +7685,11 @@ + GC gc = f->output_data.x->normal_gc; + + XSetForeground (display, gc, color); +- 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, +- f->borders_respect_alpha_background); ++ x_fill_rectangle_transp (f, 0, margin, width, border); ++ x_fill_rectangle_transp (f, 0, 0, border, height); ++ x_fill_rectangle_transp (f, width - border, 0, border, height); ++ x_fill_rectangle_transp (f, 0, height - bottom_margin - border, ++ width, border); + XSetForeground (display, gc, FRAME_FOREGROUND_PIXEL (f)); + } + else diff --git a/modules/overlays/emacs.nix b/modules/overlays/emacs.nix index b94b13b..da7cc0e 100644 --- a/modules/overlays/emacs.nix +++ b/modules/overlays/emacs.nix @@ -10,6 +10,7 @@ final: prev: { ["--with-x-toolkit=lucid" "--with-toolkit-scroll-bars"]) configureFlags ++ ["--with-x-toolkit=no" "--without-toolkit-scroll-bars"]; version = "31.0.50"; + patches = patches ++ [./emacs-alpha-dividers.patch]; src = prev.fetchFromSavannah { repo = "emacs"; rev = "ce7f2b93bb4dc17ae083ca33327c618a2038f420"; |
