summaryrefslogtreecommitdiff
path: root/sway/desktop/shaders/tex_rgbx.frag
diff options
context:
space:
mode:
authorWilliam McKinnon <[email protected]>2022-11-11 01:19:02 -0500
committerGitHub <[email protected]>2022-11-11 01:19:02 -0500
commit1930bd0d7136d84900fe1541e4317cbcd7a85ef6 (patch)
tree0953eb462206e0c52c5206370abfd3b33898e1ac /sway/desktop/shaders/tex_rgbx.frag
parent9ee7fa61af58de3dab3d60e325ef1d0c6f40f9fd (diff)
feat: add round titlebars (#26)
Diffstat (limited to 'sway/desktop/shaders/tex_rgbx.frag')
-rw-r--r--sway/desktop/shaders/tex_rgbx.frag15
1 files changed, 9 insertions, 6 deletions
diff --git a/sway/desktop/shaders/tex_rgbx.frag b/sway/desktop/shaders/tex_rgbx.frag
index cb6f1432..4a8b3756 100644
--- a/sway/desktop/shaders/tex_rgbx.frag
+++ b/sway/desktop/shaders/tex_rgbx.frag
@@ -6,13 +6,16 @@ uniform float alpha;
uniform vec2 size;
uniform vec2 position;
uniform float radius;
+uniform bool has_titlebar;
void main() {
gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0) * alpha;
- vec2 corner_distance = min(gl_FragCoord.xy - position, position + size - gl_FragCoord.xy);
- if (max(corner_distance.x, corner_distance.y) < radius) {
- float d = radius - distance(corner_distance, vec2(radius));
- float smooth = smoothstep(-1.0f, 0.5f, d);
- gl_FragColor = mix(vec4(0), gl_FragColor, smooth);
- }
+ if (!has_titlebar || gl_FragCoord.y - position.y > radius) {
+ vec2 corner_distance = min(gl_FragCoord.xy - position, size + position - gl_FragCoord.xy);
+ if (max(corner_distance.x, corner_distance.y) < radius) {
+ float d = radius - distance(corner_distance, vec2(radius));
+ float smooth = smoothstep(-1.0f, 0.5f, d);
+ gl_FragColor = mix(vec4(0), gl_FragColor, smooth);
+ }
+ }
}