initial fade-in work
This commit is contained in:
parent
d89c365106
commit
b5410a123c
4 changed files with 25 additions and 6 deletions
|
@ -119,10 +119,13 @@ struct sway_container {
|
|||
|
||||
float saturation;
|
||||
|
||||
// TODO: move current_alpha to state?
|
||||
float current_alpha;
|
||||
// TODO: rename me to something like max_alpha?
|
||||
float alpha;
|
||||
|
||||
int corner_radius;
|
||||
|
||||
|
||||
float dim;
|
||||
|
||||
struct wlr_texture *title_focused;
|
||||
|
|
|
@ -521,6 +521,18 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
|
|||
return wlr_output_commit(wlr_output);
|
||||
}
|
||||
|
||||
static void containers_tick_alpha(list_t *containers, struct sway_output *output) {
|
||||
// TODO: config for alpha_step
|
||||
float alpha_step = 0.01;
|
||||
for (int i = 0; i < containers->length; ++i) {
|
||||
struct sway_container *con = containers->items[i];
|
||||
if (con->current_alpha < con->alpha) {
|
||||
output_damage_whole_container(output, con);
|
||||
con->current_alpha += alpha_step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int output_repaint_timer_handler(void *data) {
|
||||
struct sway_output *output = data;
|
||||
if (output->wlr_output == NULL) {
|
||||
|
@ -570,6 +582,9 @@ static int output_repaint_timer_handler(void *data) {
|
|||
|
||||
pixman_region32_t damage;
|
||||
pixman_region32_init(&damage);
|
||||
|
||||
containers_tick_alpha(workspace->current.tiling, output);
|
||||
|
||||
wlr_damage_ring_get_buffer_damage(&output->damage_ring, buffer_age, &damage);
|
||||
if (!output->wlr_output->needs_frame &&
|
||||
!pixman_region32_not_empty(&output->damage_ring.current)) {
|
||||
|
|
|
@ -1430,7 +1430,7 @@ static void render_containers_linear(struct sway_output *output,
|
|||
bool has_titlebar = state->border == B_NORMAL;
|
||||
|
||||
struct decoration_data deco_data = {
|
||||
.alpha = child->alpha,
|
||||
.alpha = child->current_alpha,
|
||||
.dim_color = view_is_urgent(view)
|
||||
? config->dim_inactive_colors.urgent
|
||||
: config->dim_inactive_colors.unfocused,
|
||||
|
@ -1481,7 +1481,7 @@ static void render_containers_tabbed(struct sway_output *output,
|
|||
int tab_width = parent->box.width / parent->children->length;
|
||||
|
||||
struct decoration_data deco_data = {
|
||||
.alpha = current->alpha,
|
||||
.alpha = current->current_alpha,
|
||||
.dim_color = current->view && view_is_urgent(current->view)
|
||||
? config->dim_inactive_colors.urgent
|
||||
: config->dim_inactive_colors.unfocused,
|
||||
|
@ -1579,7 +1579,7 @@ static void render_containers_stacked(struct sway_output *output,
|
|||
size_t titlebar_height = container_titlebar_height();
|
||||
|
||||
struct decoration_data deco_data = {
|
||||
.alpha = current->alpha,
|
||||
.alpha = current->current_alpha,
|
||||
.dim_color = current->view && view_is_urgent(current->view)
|
||||
? config->dim_inactive_colors.urgent
|
||||
: config->dim_inactive_colors.unfocused,
|
||||
|
@ -1730,7 +1730,7 @@ static void render_floating_container(struct sway_output *soutput,
|
|||
|
||||
bool has_titlebar = state->border == B_NORMAL;
|
||||
struct decoration_data deco_data = {
|
||||
.alpha = con->alpha,
|
||||
.alpha = con->current_alpha,
|
||||
.dim_color = view_is_urgent(view)
|
||||
? config->dim_inactive_colors.urgent
|
||||
: config->dim_inactive_colors.unfocused,
|
||||
|
@ -1988,7 +1988,7 @@ void output_render(struct sway_output *output, struct timespec *when,
|
|||
struct sway_container *focus = seat_get_focused_container(seat);
|
||||
if (focus && focus->view) {
|
||||
struct decoration_data deco_data = {
|
||||
.alpha = focus->alpha,
|
||||
.alpha = focus->current_alpha,
|
||||
.dim_color = view_is_urgent(focus->view)
|
||||
? config->dim_inactive_colors.urgent
|
||||
: config->dim_inactive_colors.unfocused,
|
||||
|
|
|
@ -39,6 +39,7 @@ struct sway_container *container_create(struct sway_view *view) {
|
|||
node_init(&c->node, N_CONTAINER, c);
|
||||
c->pending.layout = L_NONE;
|
||||
c->view = view;
|
||||
c->current_alpha = 0.0f;
|
||||
c->alpha = 1.0f;
|
||||
c->saturation = 1.0f;
|
||||
c->dim = config->default_dim_inactive;
|
||||
|
|
Loading…
Add table
Reference in a new issue