aboutsummaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-05-14 10:54:47 +0200
committerFederico Angelilli <code@fedang.net>2024-05-14 10:54:47 +0200
commit247a74810374894a74ca63af4eb86d9614cf6c74 (patch)
tree52f85875ab4aa0ca64112d86a151ba0cc44a4d5b /src/state.c
parent3768820fb27ff394114a17f6612417bcc78689a0 (diff)
Implement multiple windows
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/state.c b/src/state.c
index 7748e58..c8fe0df 100644
--- a/src/state.c
+++ b/src/state.c
@@ -3,10 +3,11 @@
#include "state.h"
#include "log.h"
-State *state_create(Window *win, Drawer *draw)
+State *state_create(const char *label, Window *win, Drawer *draw)
{
State *state = g_malloc0(sizeof(State));
g_assert_nonnull(state);
+ state->label = label ? label : "comet";
state->win = win;
state->draw = draw;
return state;
@@ -39,7 +40,7 @@ void state_order_button(State *state)
static gboolean redraw_handler(State *state)
{
- log_debug("Redrawing once [relayout=%d]", state->relayout);
+ log_debug("Redrawing once [relayout=%d, state=\"%s\"]", state->relayout, state->label);
if (state->relayout) {
draw_compute_layout(state->draw, state->win, state->btns);
@@ -78,8 +79,8 @@ static bool anim_check_more(State *state, GList *btns)
// Remove animation if all functions finished
if (!layout && !before && !after) {
- log_debug("Removing animation [type=%d, end=%ld, button=%p]",
- btn->anim->type, btn->anim->start + btn->anim->duration, btn);
+ log_debug("Removing animation [type=%d, end=%ld, button=%p, state=\"%s\"]",
+ btn->anim->type, btn->anim->start + btn->anim->duration, btn, state->label);
g_clear_pointer(&btn->anim, animation_destroy);
} else {
@@ -97,7 +98,8 @@ static bool anim_check_more(State *state, GList *btns)
static gboolean anim_handler(State *state)
{
bool more = anim_check_more(state, state->btns);
- log_debug("Redrawing animation [relayout=%d, more=%d]", state->relayout, more);
+ log_debug("Redrawing animation [relayout=%d, more=%d, state=\"%s\"]",
+ state->relayout, more, state->label);
if (state->relayout) {
draw_compute_layout(state->draw, state->win, state->btns);
@@ -129,7 +131,6 @@ void state_request_animation(State *state)
void state_destroy(State *state)
{
- g_list_free_full(state->btns, (GDestroyNotify)button_destroy);
g_free(state);
}