closes #26
This commit is contained in:
@@ -517,7 +517,7 @@ void paint_all_new(session_t *ps, struct managed_win *t) {
|
||||
}
|
||||
|
||||
// Draw window on target
|
||||
bool is_animating = 0 < w->animation_progress && w->animation_progress < 1.0;
|
||||
bool is_animating = 0 <= w->animation_progress && w->animation_progress < 1.0;
|
||||
if (w->frame_opacity == 1 && !is_animating) {
|
||||
ps->backend_data->ops->compose(ps->backend_data, w->win_image,
|
||||
window_coord, NULL, dest_coord,
|
||||
|
||||
@@ -497,7 +497,7 @@ void x_rect_to_coords(int nrects, const rect_t *rects, coord_t image_dst,
|
||||
int extent_height, int texture_height, int root_height,
|
||||
bool y_inverted, GLint *coord, GLuint *indices) {
|
||||
image_dst.y = root_height - image_dst.y;
|
||||
image_dst.y -= extent_height;
|
||||
image_dst.y -= extent_height;
|
||||
|
||||
|
||||
for (int i = 0; i < nrects; i++) {
|
||||
|
||||
49
src/picom.c
49
src/picom.c
@@ -804,7 +804,7 @@ paint_preprocess(session_t *ps, bool *fade_running, bool *animation_running) {
|
||||
// IMPORTANT: These window animation steps must happen before any other
|
||||
// [pre]processing. This is because it changes the window's geometry.
|
||||
if (ps->o.animations &&
|
||||
!isnan(w->animation_progress) && w->animation_progress <= 0.999999999 &&
|
||||
!isnan(w->animation_progress) && w->animation_progress != 1.0 &&
|
||||
ps->o.wintype_option[w->window_type].animation != 0 &&
|
||||
win_is_mapped_in_x(w))
|
||||
{
|
||||
@@ -814,15 +814,15 @@ paint_preprocess(session_t *ps, bool *fade_running, bool *animation_running) {
|
||||
w->animation_dest_center_y - w->animation_center_y;
|
||||
double neg_displacement_w = w->animation_dest_w - w->animation_w;
|
||||
double neg_displacement_h = w->animation_dest_h - w->animation_h;
|
||||
double animation_stiffness = ps->o.animation_stiffness;
|
||||
if (!(w->animation_is_tag & ANIM_IN_TAG)) {
|
||||
if (w->animation_is_tag & ANIM_SLOW)
|
||||
animation_stiffness = ps->o.animation_stiffness_tag_change;
|
||||
else if (w->animation_is_tag & ANIM_FAST)
|
||||
animation_stiffness = ps->o.animation_stiffness_tag_change * 1.5;
|
||||
}
|
||||
if (w->state == WSTATE_FADING && !(w->animation_is_tag & ANIM_FADE))
|
||||
w->opacity_target = win_calc_opacity_target(ps, w);
|
||||
double animation_stiffness = ps->o.animation_stiffness;
|
||||
if (!(w->animation_is_tag & ANIM_IN_TAG)) {
|
||||
if (w->animation_is_tag & ANIM_SLOW)
|
||||
animation_stiffness = ps->o.animation_stiffness_tag_change;
|
||||
else if (w->animation_is_tag & ANIM_FAST)
|
||||
animation_stiffness = ps->o.animation_stiffness_tag_change * 1.5;
|
||||
}
|
||||
if (w->state == WSTATE_FADING && !(w->animation_is_tag & ANIM_FADE))
|
||||
w->opacity_target = win_calc_opacity_target(ps, w);
|
||||
double acceleration_x =
|
||||
(animation_stiffness * neg_displacement_x -
|
||||
ps->o.animation_dampening * w->animation_velocity_x) /
|
||||
@@ -925,17 +925,18 @@ paint_preprocess(session_t *ps, bool *fade_running, bool *animation_running) {
|
||||
w->g.width = (uint16_t)new_animation_w;
|
||||
w->g.height = (uint16_t)new_animation_h;
|
||||
|
||||
if (w->animation_is_tag > ANIM_IN_TAG && (((w->animation_is_tag & ANIM_FADE) && w->opacity_target == w->opacity) || ((w->g.width == 0 || w->g.height == 0) && (w->animation_dest_w == 0 || w->animation_dest_h == 0)))) {
|
||||
w->g.x = w->pending_g.x;
|
||||
w->g.y = w->pending_g.y;
|
||||
if (ps->o.animation_for_next_tag < OPEN_WINDOW_ANIMATION_ZOOM) {
|
||||
w->g.width = w->pending_g.width;
|
||||
w->g.height = w->pending_g.height;
|
||||
} else {
|
||||
w->g.width = 0;
|
||||
w->g.height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (w->animation_is_tag > ANIM_IN_TAG && (((w->animation_is_tag & ANIM_FADE) && w->opacity_target == w->opacity) || ((w->g.width == 0 || w->g.height == 0) && (w->animation_dest_w == 0 || w->animation_dest_h == 0)))) {
|
||||
w->g.x = w->pending_g.x;
|
||||
w->g.y = w->pending_g.y;
|
||||
if (ps->o.animation_for_next_tag < OPEN_WINDOW_ANIMATION_ZOOM) {
|
||||
w->g.width = w->pending_g.width;
|
||||
w->g.height = w->pending_g.height;
|
||||
} else {
|
||||
w->g.width = 0;
|
||||
w->g.height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Submit window size change
|
||||
if (size_changed) {
|
||||
@@ -1560,7 +1561,7 @@ static bool redirect_start(session_t *ps) {
|
||||
}
|
||||
|
||||
ps->frame_pacing = !ps->o.no_frame_pacing;
|
||||
if ((ps->o.legacy_backends || ps->o.benchmark || !ps->backend_data->ops->last_render_time) &&
|
||||
if ((ps->o.legacy_backends || ps->o.animations || ps->o.benchmark || !ps->backend_data->ops->last_render_time) &&
|
||||
ps->frame_pacing) {
|
||||
// Disable frame pacing if we are using a legacy backend or if we are in
|
||||
// benchmark mode, or if the backend doesn't report render time
|
||||
@@ -2595,6 +2596,8 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
|
||||
ev_init(&ps->draw_timer, draw_callback);
|
||||
|
||||
ev_init(&ps->fade_timer, fade_timer_callback);
|
||||
ev_init(&ps->animation_timer, animation_timer_callback);
|
||||
|
||||
|
||||
// Set up SIGUSR1 signal handler to reset program
|
||||
ev_signal_init(&ps->usr1_signal, reset_enable, SIGUSR1);
|
||||
@@ -2685,8 +2688,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
|
||||
|
||||
write_pid(ps);
|
||||
|
||||
ev_init(&ps->animation_timer, animation_timer_callback);
|
||||
|
||||
if (fork && stderr_logger) {
|
||||
// Remove the stderr logger if we will fork
|
||||
log_remove_target_tls(stderr_logger);
|
||||
|
||||
45
src/win.c
45
src/win.c
@@ -476,17 +476,11 @@ static void win_update_properties(session_t *ps, struct managed_win *w) {
|
||||
static void init_animation(session_t *ps, struct managed_win *w) {
|
||||
CLEAR_MASK(w->animation_is_tag)
|
||||
static int32_t randr_mon_center_x, randr_mon_center_y;
|
||||
if (w->randr_monitor == -1) {
|
||||
win_update_monitor(&ps->monitors, w);
|
||||
if (w->randr_monitor != -1) {
|
||||
auto e = pixman_region32_extents(&ps->monitors.regions[w->randr_monitor]);
|
||||
randr_mon_center_x = (e->x2 + e->x1) / 2, randr_mon_center_y = (e->y2 + e->y1) / 2;
|
||||
} else {
|
||||
randr_mon_center_x = ps->root_width / 2, randr_mon_center_y = ps->root_height / 2;
|
||||
}
|
||||
} else {
|
||||
if (w->randr_monitor != -1) {
|
||||
auto e = pixman_region32_extents(&ps->monitors.regions[w->randr_monitor]);
|
||||
randr_mon_center_x = (e->x2 + e->x1) / 2, randr_mon_center_y = (e->y2 + e->y1) / 2;
|
||||
} else {
|
||||
randr_mon_center_x = ps->root_width / 2, randr_mon_center_y = ps->root_height / 2;
|
||||
}
|
||||
static double *anim_x, *anim_y, *anim_w, *anim_h;
|
||||
enum open_window_animation animation;
|
||||
@@ -689,7 +683,6 @@ void win_process_update_flags(session_t *ps, struct managed_win *w) {
|
||||
|
||||
// Determine if a window should animate
|
||||
if (win_should_animate(ps, w)) {
|
||||
win_update_bounding_shape(ps, w);
|
||||
if (w->pending_g.y < 0 && w->g.y > 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
|
||||
w->dwm_mask = ANIM_PREV_TAG;
|
||||
else if (w->pending_g.y > 0 && w->g.y < 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
|
||||
@@ -760,12 +753,12 @@ void win_process_update_flags(session_t *ps, struct managed_win *w) {
|
||||
w->g = w->pending_g;
|
||||
}
|
||||
|
||||
if (win_check_flags_all(w, WIN_FLAGS_SIZE_STALE)) {
|
||||
win_on_win_size_change(ps, w);
|
||||
win_update_bounding_shape(ps, w);
|
||||
damaged = true;
|
||||
win_clear_flags(w, WIN_FLAGS_SIZE_STALE);
|
||||
}
|
||||
if (win_check_flags_all(w, WIN_FLAGS_SIZE_STALE)) {
|
||||
win_on_win_size_change(ps, w);
|
||||
win_update_bounding_shape(ps, w);
|
||||
damaged = true;
|
||||
win_clear_flags(w, WIN_FLAGS_SIZE_STALE);
|
||||
}
|
||||
|
||||
if (win_check_flags_all(w, WIN_FLAGS_POSITION_STALE)) {
|
||||
damaged = true;
|
||||
@@ -1496,10 +1489,8 @@ void win_on_factor_change(session_t *ps, struct managed_win *w) {
|
||||
// focused state of the window
|
||||
win_update_focused(ps, w);
|
||||
|
||||
if (w->animation_progress > 0.99999999 || (w->animation_progress == 0.0 && ps->animation_time != 0L)) {
|
||||
win_determine_shadow(ps, w);
|
||||
win_determine_clip_shadow_above(ps, w);
|
||||
}
|
||||
win_determine_shadow(ps, w);
|
||||
win_determine_clip_shadow_above(ps, w);
|
||||
win_determine_invert_color(ps, w);
|
||||
win_determine_blur_background(ps, w);
|
||||
win_determine_rounded_corners(ps, w);
|
||||
@@ -1810,7 +1801,7 @@ struct win *fill_win(session_t *ps, struct win *w) {
|
||||
.animation_velocity_y = 0.0, // updated by window geometry changes
|
||||
.animation_velocity_w = 0.0, // updated by window geometry changes
|
||||
.animation_velocity_h = 0.0, // updated by window geometry changes
|
||||
.animation_progress = 0.0, // updated by window geometry changes
|
||||
.animation_progress = 1.0, // updated by window geometry changes
|
||||
.animation_inv_og_distance = NAN, // updated by window geometry changes
|
||||
.reg_ignore_valid = false, // set to true when damaged
|
||||
.flags = WIN_FLAGS_IMAGES_NONE, // updated by property/attributes/etc
|
||||
@@ -2697,8 +2688,8 @@ void unmap_win_start(session_t *ps, struct managed_win *w) {
|
||||
w->opacity_target = win_calc_opacity_target(ps, w);
|
||||
|
||||
if (ps->o.animations && ps->o.animation_for_unmap_window != OPEN_WINDOW_ANIMATION_NONE && ps->o.wintype_option[w->window_type].animation) {
|
||||
w->dwm_mask = ANIM_UNMAP;
|
||||
init_animation(ps, w);
|
||||
w->dwm_mask = ANIM_UNMAP;
|
||||
init_animation(ps, w);
|
||||
|
||||
double x_dist = w->animation_dest_center_x - w->animation_center_x;
|
||||
double y_dist = w->animation_dest_center_y - w->animation_center_y;
|
||||
@@ -3059,10 +3050,6 @@ win_is_fullscreen_xcb(xcb_connection_t *c, const struct atom *a, const xcb_windo
|
||||
void win_set_flags(struct managed_win *w, uint64_t flags) {
|
||||
log_debug("Set flags %" PRIu64 " to window %#010x (%s)", flags, w->base.id, w->name);
|
||||
if (unlikely(w->state == WSTATE_DESTROYING)) {
|
||||
if (w->animation_progress != 1.0) {
|
||||
// Return because animation will trigger some of the flags
|
||||
return;
|
||||
}
|
||||
log_error("Flags set on a destroyed window %#010x (%s)", w->base.id, w->name);
|
||||
return;
|
||||
}
|
||||
@@ -3075,10 +3062,6 @@ void win_clear_flags(struct managed_win *w, uint64_t flags) {
|
||||
log_debug("Clear flags %" PRIu64 " from window %#010x (%s)", flags, w->base.id,
|
||||
w->name);
|
||||
if (unlikely(w->state == WSTATE_DESTROYING)) {
|
||||
if (w->animation_progress != 1.0) {
|
||||
// Return because animation will trigger some of the flags
|
||||
return;
|
||||
}
|
||||
log_warn("Flags cleared on a destroyed window %#010x (%s)", w->base.id,
|
||||
w->name);
|
||||
return;
|
||||
|
||||
14
src/win.h
14
src/win.h
@@ -166,8 +166,8 @@ struct managed_win {
|
||||
/// opacity state, window geometry, window mapped/unmapped state,
|
||||
/// window mode of the windows above. DOES NOT INCLUDE the body of THIS WINDOW.
|
||||
/// NULL means reg_ignore has not been calculated for this window.
|
||||
/// 1 = tag prev , 2 = tag next, 4 = unmap
|
||||
uint32_t dwm_mask;
|
||||
/// 1 = tag prev , 2 = tag next, 4 = unmap
|
||||
uint32_t dwm_mask;
|
||||
rc_region_t *reg_ignore;
|
||||
/// Whether the reg_ignore of all windows beneath this window are valid
|
||||
bool reg_ignore_valid;
|
||||
@@ -198,11 +198,11 @@ struct managed_win {
|
||||
/// Inverse of the window distance at the start of animation, for
|
||||
/// tracking animation progress
|
||||
double animation_inv_og_distance;
|
||||
/// Animation info if it is a tag change & check if its changing window sizes
|
||||
/// 0: no tag change
|
||||
/// 1: normal tag change animation
|
||||
/// 2: tag change animation that effects window size
|
||||
uint16_t animation_is_tag;
|
||||
/// Animation info if it is a tag change & check if its changing window sizes
|
||||
/// 0: no tag change
|
||||
/// 1: normal tag change animation
|
||||
/// 2: tag change animation that effects window size
|
||||
uint16_t animation_is_tag;
|
||||
|
||||
// Client window related members
|
||||
/// ID of the top-level client window of the window.
|
||||
|
||||
Reference in New Issue
Block a user