summaryrefslogtreecommitdiff
path: root/modules/overlays/emacs-alpha-dividers.patch
blob: 1246e894a07a50e1b6c57e0827f563b736efa052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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