aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2023-12-07 16:09:20 +0100
committerFederico Angelilli <code@fedang.net>2023-12-07 16:09:20 +0100
commit4b83ba02939ad7692ebd7e71161d37eabe4b73e3 (patch)
tree254478db8fd094ea4ae914605e418a8f94c8ea09 /src
parent7da583328758e3e8e3ace381aab9e98313f76767 (diff)
Tweak some buttons
Diffstat (limited to 'src')
-rw-r--r--src/comet.c12
-rw-r--r--src/state.c3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/comet.c b/src/comet.c
index d6fc0d1..4945bb2 100644
--- a/src/comet.c
+++ b/src/comet.c
@@ -121,7 +121,7 @@ static gboolean cpu_update(gpointer data)
state_redraw(btn->action_data, len1 != len2);
}
- log_debug("Updated cpu percentage");
+ log_debug("%s cpu percentage", perc != NULL ? "Updated" : "Unchanged");
return G_SOURCE_CONTINUE;
}
@@ -234,7 +234,7 @@ static void register_buttons(State *state, Color color, Color line_color, Color
// Cpu usage button
Button *cpu_btn = button_simple_create(PANGO_ALIGN_RIGHT, color, line_color);
- button_simple_set_text(cpu_btn, g_strdup(" ?%"), text_color);
+ button_simple_set_text(cpu_btn, g_strdup(" 0%"), text_color);
button_simple_set_action(cpu_btn, show_action, state);
state_add_button(state, cpu_btn);
@@ -297,7 +297,7 @@ int main(int argc, char **argv)
Color color = { 0.4, 0.4, 0.4, 1 };
Color line_color = { 0.8, 0.8, 0.8, 1 };
- Color text_color = { 0.8, 0.8, 0.8, 1 };
+ Color text_color = { 0.9, 0.9, 0.9, 1 };
register_buttons(state, color, line_color, text_color);
// Buttons with special handling
@@ -327,9 +327,9 @@ int main(int argc, char **argv)
button_simple_set_action(q_btn, quit_action, mainloop);
state_add_button(state, q_btn);
- // Test button group
- Color orange = { 1, 0.647, 0, 1 };
- Button *group = button_group_create(PANGO_ALIGN_LEFT, orange, line_color);
+ // Menu button(s)
+ Color grey = { 0.5, 0.5, 0.5, 1 };
+ Button *group = button_group_create(PANGO_ALIGN_LEFT, grey, line_color);
Button *child1 = button_simple_create(PANGO_ALIGN_CENTER, color, line_color);
button_set_padding(child1, 1);
diff --git a/src/state.c b/src/state.c
index 893976a..0054076 100644
--- a/src/state.c
+++ b/src/state.c
@@ -35,6 +35,9 @@ static gboolean redraw(gpointer data)
return G_SOURCE_REMOVE;
}
+// Sometimes we schedule multiple redraws in a row without actually checking if there are
+// others already scheduled...
+// This could probably be fixed by implementing a redraw source...
void state_redraw(State *state, bool changed_layout)
{
g_idle_add_full(G_PRIORITY_HIGH_IDLE, changed_layout ? redraw_and_layout : redraw, state, NULL);