aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorallusive-dev <[email protected]>2023-11-04 08:14:28 +1100
committerallusive-dev <[email protected]>2023-11-04 08:14:28 +1100
commitd270894f08bc79177cbb4a20ab681881203510b2 (patch)
tree2be7ce54762db17713d637829ffc3bd1a1b4b3fa /src
parentupdate 1.2.7 (diff)
downloadcompfy-1.2.9.tar.xz
compfy-1.2.9.zip
Fixes for #18 and #231.2.9
Diffstat (limited to 'src')
-rw-r--r--src/backend/gl/gl_common.c6
-rw-r--r--src/backend/gl/gl_common.h1
-rw-r--r--src/backend/gl/shaders.c6
-rw-r--r--src/backend/xrender/xrender.c5
-rw-r--r--src/config.c2
-rw-r--r--src/config.h1
-rw-r--r--src/picom.c2
-rw-r--r--src/win.c56
8 files changed, 28 insertions, 51 deletions
diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c
index a7d2aab..a9ded56 100644
--- a/src/backend/gl/gl_common.c
+++ b/src/backend/gl/gl_common.c
@@ -382,8 +382,9 @@ static void _gl_compose(backend_t *base, struct backend_image *img, GLuint targe
if (win_shader->uniform_invert_color >= 0) {
glUniform1i(win_shader->uniform_invert_color, img->color_inverted);
}
- if (win_shader->uniform_tex >= 0) {
- glUniform1i(win_shader->uniform_tex, 0);
+ if (win_shader->uniform_effective_size >= 0) {
+ glUniform2f(win_shader->uniform_effective_size, (float)img->ewidth,
+ (float)img->eheight);
}
if (win_shader->uniform_dim >= 0) {
glUniform1f(win_shader->uniform_dim, (float)img->dim);
@@ -596,6 +597,7 @@ static bool gl_win_shader_from_stringv(const char **vshader_strv,
bind_uniform(ret, opacity);
bind_uniform(ret, invert_color);
bind_uniform(ret, tex);
+ bind_uniform(ret, effective_size);
bind_uniform(ret, dim);
bind_uniform(ret, brightness);
bind_uniform(ret, max_brightness);
diff --git a/src/backend/gl/gl_common.h b/src/backend/gl/gl_common.h
index 3a78865..f4eee29 100644
--- a/src/backend/gl/gl_common.h
+++ b/src/backend/gl/gl_common.h
@@ -35,6 +35,7 @@ typedef struct {
GLint uniform_opacity;
GLint uniform_invert_color;
GLint uniform_tex;
+ GLint uniform_effective_size;
GLint uniform_dim;
GLint uniform_brightness;
GLint uniform_max_brightness;
diff --git a/src/backend/gl/shaders.c b/src/backend/gl/shaders.c
index 4a18e62..7cee752 100644
--- a/src/backend/gl/shaders.c
+++ b/src/backend/gl/shaders.c
@@ -88,6 +88,7 @@ const char win_shader_glsl[] = GLSL(330,
uniform bool invert_color;
in vec2 texcoord;
uniform sampler2D tex;
+ uniform vec2 effective_size;
uniform sampler2D brightness;
uniform float max_brightness;
// Signed distance field for rectangle center at (0, 0), with size of
@@ -121,7 +122,7 @@ const char win_shader_glsl[] = GLSL(330,
// Using mix() to avoid a branch here.
vec4 rim_color = mix(c, border_color, clamp(border_width, 0.0f, 1.0f));
- vec2 outer_size = vec2(textureSize(tex, 0));
+ vec2 outer_size = effective_size;
vec2 inner_size = outer_size - vec2(corner_radius) * 2.0f;
float rect_distance = rectangle_sdf(texcoord - outer_size / 2.0f,
inner_size / 2.0f) - corner_radius;
@@ -148,7 +149,8 @@ const char win_shader_default[] = GLSL(330,
uniform sampler2D tex;
vec4 default_post_processing(vec4 c);
vec4 window_shader() {
- vec4 c = texelFetch(tex, ivec2(texcoord), 0);
+ vec2 texsize = textureSize(tex, 0);
+ vec4 c = texture2D(tex, texcoord / texsize, 0);
return default_post_processing(c);
}
);
diff --git a/src/backend/xrender/xrender.c b/src/backend/xrender/xrender.c
index 2b7f8e1..79b3ca9 100644
--- a/src/backend/xrender/xrender.c
+++ b/src/backend/xrender/xrender.c
@@ -518,8 +518,9 @@ bind_pixmap(backend_t *base, xcb_pixmap_t pixmap, struct xvisual_info fmt, bool
inner->height = img->base.eheight = r->height;
inner->pixmap = pixmap;
inner->has_alpha = fmt.alpha_size != 0;
- inner->pict =
- x_create_picture_with_visual_and_pixmap(base->c, fmt.visual, pixmap, 0, NULL);
+ xcb_render_create_picture_value_list_t pic_attrs = {.repeat = XCB_RENDER_REPEAT_NORMAL};
+ inner->pict = x_create_picture_with_visual_and_pixmap(
+ base->c, fmt.visual, pixmap, XCB_RENDER_CP_REPEAT, &pic_attrs);
inner->owned = owned;
inner->visual = fmt.visual;
inner->refcount = 1;
diff --git a/src/config.c b/src/config.c
index 27812ab..88de824 100644
--- a/src/config.c
+++ b/src/config.c
@@ -787,6 +787,8 @@ enum wm_support parse_wm_support(const char *src) {
return WM_SUPPORT_NONE;
} else if (strcmp(src, "awesome") == 0) {
return WM_SUPPORT_AWESOME;
+ } else if (strcmp(src, "herb") == 0) {
+ return WM_SUPPORT_HERB;
} else if (strcmp(src, "dwm") == 0) {
return WM_SUPPORT_DWM;
}
diff --git a/src/config.h b/src/config.h
index 6a8e42b..1436495 100644
--- a/src/config.h
+++ b/src/config.h
@@ -57,6 +57,7 @@ enum open_window_animation {
enum wm_support {
WM_SUPPORT_NONE = 0,
WM_SUPPORT_AWESOME,
+ WM_SUPPORT_HERB,
WM_SUPPORT_DWM,
WM_SUPPORT_INVALID,
};
diff --git a/src/picom.c b/src/picom.c
index 4c6f306..b96e8f6 100644
--- a/src/picom.c
+++ b/src/picom.c
@@ -837,6 +837,8 @@ paint_preprocess(session_t *ps, bool *fade_running, bool *animation_running) {
if (ps->o.support_for_wm == WM_SUPPORT_AWESOME) {
win_update_bounding_shape(ps, w);
+ } else if (ps->o.support_for_wm == WM_SUPPORT_HERB) {
+ win_update_bounding_shape(ps, w);
} else {
pixman_region32_clear(&w->bounding_shape);
pixman_region32_fini(&w->bounding_shape);
diff --git a/src/win.c b/src/win.c
index 0741ed8..1d50313 100644
--- a/src/win.c
+++ b/src/win.c
@@ -1160,54 +1160,12 @@ double win_calc_opacity_target(session_t *ps, const struct managed_win *w) {
// Respect active_opacity only when the window is physically
// focused
if (win_is_focused_raw(ps, w)) {
- // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
- // opacity = 1.0;
- // } else {
opacity = ps->o.active_opacity;
- // }
} else if (!w->focused) {
- // Respect inactive_opacity in some cases
- // if (c2_match(ps, w, ps->o.inactive_opacity_blacklist, NULL)) {
- // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
- // opacity = 1.0;
- // } else {
- // opacity = ps->o.active_opacity;
- // }
- // } else {
opacity = ps->o.inactive_opacity;
- // }
}
}
- // // Respect inactive opacity, with support for DWM.
- // if (ps->o.support_for_wm == WM_SUPPORT_DWM) {
- // if (ps->o.inactive_opacity_override && !win_is_focused_raw(ps, w)) {
- // // if (c2_match(ps, w, ps->o.inactive_opacity_blacklist, NULL)) {
- // // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
- // // opacity = 1.0;
- // // } else {
- // // opacity = ps->o.active_opacity;
- // // }
- // // } else {
- // opacity = ps->o.inactive_opacity;
- // // }
- // } else if (!ps->o.inactive_opacity_override && !win_is_focused_raw(ps, w)) {
- // // if (c2_match(ps, w, ps->o.inactive_opacity_blacklist, NULL)) {
- // // if (c2_match(ps, w, ps->o.active_opacity_blacklist, NULL)) {
- // // opacity = 1.0;
- // // } else {
- // // opacity = ps->o.active_opacity;
- // // }
- // // } else {
- // opacity = ps->o.inactive_opacity;
- // // }
- // }
- // } else {
- // if (ps->o.inactive_opacity_override && !w->focused) {
- // opacity = ps->o.inactive_opacity;
- // }
- // }
-
return opacity;
}
@@ -1220,10 +1178,18 @@ bool win_should_dim(session_t *ps, const struct managed_win *w) {
return false;
}
- if (ps->o.inactive_dim > 0 && !(w->focused)) {
- return true;
+ if (ps->o.support_for_wm == WM_SUPPORT_DWM) {
+ if (ps->o.inactive_dim > 0 && !win_is_focused_raw(ps, w)) {
+ return true;
+ } else {
+ return false;
+ }
} else {
- return false;
+ if (ps->o.inactive_dim > 0 && !w->focused) {
+ return true;
+ } else {
+ return false;
+ }
}
}