mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-19 18:26:13 +03:00
render: bar cursor style
This commit is contained in:
@ -22,11 +22,12 @@ uniform sampler2D text;
|
||||
// Dimensions of the cell
|
||||
uniform vec2 cell_size;
|
||||
|
||||
// See fragment shader
|
||||
// See vertex shader
|
||||
const uint MODE_BG = 1u;
|
||||
const uint MODE_FG = 2u;
|
||||
const uint MODE_CURSOR_RECT = 3u;
|
||||
const uint MODE_CURSOR_RECT_HOLLOW = 4u;
|
||||
const uint MODE_CURSOR_BAR = 5u;
|
||||
|
||||
void main() {
|
||||
switch (mode) {
|
||||
@ -78,5 +79,9 @@ void main() {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MODE_CURSOR_BAR:
|
||||
out_FragColor = color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ const uint MODE_BG = 1u;
|
||||
const uint MODE_FG = 2u;
|
||||
const uint MODE_CURSOR_RECT = 3u;
|
||||
const uint MODE_CURSOR_RECT_HOLLOW = 4u;
|
||||
const uint MODE_CURSOR_BAR = 5u;
|
||||
|
||||
// The grid coordinates (x, y) where x < columns and y < rows
|
||||
layout (location = 0) in vec2 grid_coord;
|
||||
@ -143,6 +144,17 @@ void main() {
|
||||
// Same as background since we're taking up the whole cell.
|
||||
cell_pos = cell_pos + cell_size * position;
|
||||
|
||||
gl_Position = projection * vec4(cell_pos, 0.0, 1.0);
|
||||
color = bg_color_in / 255.0;
|
||||
break;
|
||||
|
||||
case MODE_CURSOR_BAR:
|
||||
// Make the bar a smaller version of our cell
|
||||
vec2 bar_size = vec2(cell_size.x * 0.2, cell_size.y);
|
||||
|
||||
// Same as background since we're taking up the whole cell.
|
||||
cell_pos = cell_pos + bar_size * position;
|
||||
|
||||
gl_Position = projection * vec4(cell_pos, 0.0, 1.0);
|
||||
color = bg_color_in / 255.0;
|
||||
break;
|
||||
|
@ -45,9 +45,12 @@ cursor_style: CursorStyle,
|
||||
/// Default foreground color
|
||||
foreground: terminal.color.RGB,
|
||||
|
||||
/// Available cursor styles for drawing. The values represents the mode value
|
||||
/// in the shader.
|
||||
const CursorStyle = enum(u8) {
|
||||
box = 3,
|
||||
box_hollow = 4,
|
||||
bar = 5,
|
||||
};
|
||||
|
||||
/// The raw structure that maps directly to the buffer sent to the vertex shader.
|
||||
|
Reference in New Issue
Block a user