changeset 493:fce3b3c4b496

ui: label -> mlk_label
author David Demelier <markand@malikania.fr>
date Tue, 28 Feb 2023 13:26:53 +0100
parents c7b18475f640
children 35cc5d51bcb2
files examples/example-action/example-action.c examples/example-animation/example-animation.c examples/example-audio/example-audio.c examples/example-battle/example-battle.c examples/example-cursor/example-cursor.c examples/example-drawable/example-drawable.c examples/example-label/example-label.c examples/example-notify/example-notify.c examples/example-sprite/example-sprite.c examples/example-ui/example-ui.c libmlk-example/mlk/example/trace-hud.c libmlk-rpg/mlk/rpg/battle-bar-default.c libmlk-rpg/mlk/rpg/battle-entity.c libmlk-rpg/mlk/rpg/battle-entity.h libmlk-rpg/mlk/rpg/battle-message.c libmlk-rpg/mlk/rpg/battle-state-selection.c libmlk-rpg/mlk/rpg/battle.c libmlk-rpg/mlk/rpg/message.c libmlk-ui/mlk/ui/button.c libmlk-ui/mlk/ui/gridmenu.c libmlk-ui/mlk/ui/label.c libmlk-ui/mlk/ui/label.h libmlk-ui/mlk/ui/notify.c libmlk-ui/mlk/ui/theme.c
diffstat 24 files changed, 124 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/examples/example-action/example-action.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-action/example-action.c	Tue Feb 28 13:26:53 2023 +0100
@@ -69,8 +69,8 @@
 /*
  * Just a label to explain to the user what to do.
  */
-static struct label label = {
-	.flags = LABEL_FLAGS_SHADOW,
+static struct mlk_label label = {
+	.flags = MLK_LABEL_FLAGS_SHADOW,
 	.text = "Select your destiny."
 };
 
@@ -267,7 +267,7 @@
 {
 	unsigned int lw, lh;
 
-	label_query(&label, &lw, &lh);
+	mlk_label_query(&label, &lw, &lh);
 	mlk_align(MLK_ALIGN_CENTER, &label.x, &label.y, lw, lh,
 	    0, 0, MLK_EXAMPLE_W, MLK_EXAMPLE_H / 2);
 }
@@ -324,7 +324,7 @@
 
 	mlk_painter_set_color(0x4f8fbaff);
 	mlk_painter_clear();
-	label_draw(&label);
+	mlk_label_draw(&label);
 	mlk_action_stack_draw(&chests_stack);
 
 	/*
--- a/examples/example-animation/example-animation.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-animation/example-animation.c	Tue Feb 28 13:26:53 2023 +0100
@@ -36,11 +36,11 @@
 #include <mlk/example/example.h>
 #include <mlk/example/registry.h>
 
-static struct label label = {
+static struct mlk_label label = {
 	.text = "Keys: <Space> start or reset the animation.",
 	.x = 10,
 	.y = 10,
-	.flags = LABEL_FLAGS_SHADOW
+	.flags = MLK_LABEL_FLAGS_SHADOW
 };
 
 static struct mlk_state *states[1];
@@ -101,7 +101,7 @@
 
 	mlk_painter_set_color(0x4f8fbaff);
 	mlk_painter_clear();
-	label_draw(&label);
+	mlk_label_draw(&label);
 
 	if (!completed)
 		mlk_animation_draw(&animation, (mlk_window.w - cellw) / 2, (mlk_window.h - cellh) / 2);
--- a/examples/example-audio/example-audio.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-audio/example-audio.c	Tue Feb 28 13:26:53 2023 +0100
@@ -39,18 +39,18 @@
 static struct mlk_music *music;
 static struct mlk_sound *sound;
 
-static struct label label_music = {
+static struct mlk_label label_music = {
 	.text = "Music: <Space> play, <p> pause, <r> resume, <q> stop, <l> loop.",
 	.x = 10,
 	.y = 10,
-	.flags = LABEL_FLAGS_SHADOW
+	.flags = MLK_LABEL_FLAGS_SHADOW
 };
 
-static struct label label_sound = {
+static struct mlk_label label_sound = {
 	.text = "Sound: click anywhere to pop a sound.",
 	.x = 10,
 	.y = 30,
-	.flags = LABEL_FLAGS_SHADOW
+	.flags = MLK_LABEL_FLAGS_SHADOW
 };
 
 static void
@@ -121,8 +121,8 @@
 
 	mlk_painter_set_color(0x006554ff);
 	mlk_painter_clear();
-	label_draw(&label_music);
-	label_draw(&label_sound);
+	mlk_label_draw(&label_music);
+	mlk_label_draw(&label_sound);
 	mlk_painter_present();
 }
 
--- a/examples/example-battle/example-battle.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-battle/example-battle.c	Tue Feb 28 13:26:53 2023 +0100
@@ -250,16 +250,16 @@
 {
 	(void)st;
 
-	static const struct label info = {
+	static const struct mlk_label info = {
 		.text = "Press <Space> to start a battle.",
 		.x = 10,
 		.y = 10,
-		.flags = LABEL_FLAGS_SHADOW
+		.flags = MLK_LABEL_FLAGS_SHADOW
 	};
 
 	mlk_painter_set_color(0x4f8fbaff);
 	mlk_painter_clear();
-	label_draw(&info);
+	mlk_label_draw(&info);
 	mlk_painter_present();
 }
 
--- a/examples/example-cursor/example-cursor.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-cursor/example-cursor.c	Tue Feb 28 13:26:53 2023 +0100
@@ -39,11 +39,11 @@
 static char help_text[128];
 static enum mlk_window_cursor cursor = MLK_WINDOW_CURSOR_ARROW;
 
-static struct label help = {
+static struct mlk_label help = {
 	.x = 10,
 	.y = 10,
 	.text = help_text,
-	.flags = LABEL_FLAGS_SHADOW
+	.flags = MLK_LABEL_FLAGS_SHADOW
 };
 
 static void
@@ -108,7 +108,7 @@
 
 	mlk_painter_set_color(0xebede9ff);
 	mlk_painter_clear();
-	label_draw(&help);
+	mlk_label_draw(&help);
 	mlk_painter_present();
 }
 
--- a/examples/example-drawable/example-drawable.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-drawable/example-drawable.c	Tue Feb 28 13:26:53 2023 +0100
@@ -44,11 +44,11 @@
 #include <mlk/example/example.h>
 #include <mlk/example/registry.h>
 
-static struct label help = {
+static struct mlk_label help = {
 	.x = 10,
 	.y = 10,
 	.text = "Keys: <Esc> to reset. Click anywhere to spawn a drawable.",
-	.flags = LABEL_FLAGS_SHADOW
+	.flags = MLK_LABEL_FLAGS_SHADOW
 };
 
 static struct mlk_state *states[1];
@@ -161,7 +161,7 @@
 
 	mlk_painter_set_color(0xebede9ff);
 	mlk_painter_clear();
-	label_draw(&help);
+	mlk_label_draw(&help);
 	mlk_drawable_stack_draw(&stack);
 	mlk_painter_present();
 }
--- a/examples/example-label/example-label.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-label/example-label.c	Tue Feb 28 13:26:53 2023 +0100
@@ -38,7 +38,7 @@
 
 struct {
 	enum mlk_align align;
-	struct label label;
+	struct mlk_label label;
 } table[] = {
 	{
 		.align = MLK_ALIGN_TOP_LEFT,
@@ -92,12 +92,12 @@
 		.align = MLK_ALIGN_CENTER,
 		.label = {
 			.text = "The world is Malikania.",
-			.flags = LABEL_FLAGS_SHADOW
+			.flags = MLK_LABEL_FLAGS_SHADOW
 		}
 	}
 };
 
-static struct label mlabel = {
+static struct mlk_label mlabel = {
 	.text = "This one follows your mouse and is not aligned."
 };
 
@@ -106,16 +106,17 @@
 static void
 init(void)
 {
+	unsigned int w, h;
 	int err;
+	struct mlk_label *l;
 
 	if ((err = mlk_example_init("example-label")) < 0)
 		mlk_panicf("mlk_example_init: %s", mlk_err_string(err));
 
 	for (size_t i = 0; i < MLK_UTIL_SIZE(table); ++i) {
-		struct label *l = &table[i].label;
-		unsigned int w, h;
+		l = &table[i].label;
 
-		label_query(l, &w, &h);
+		mlk_label_query(l, &w, &h);
 		mlk_align(table[i].align, &l->x, &l->y, w, h, 0, 0, mlk_window.w, mlk_window.h);
 	}
 }
@@ -155,9 +156,9 @@
 	mlk_painter_clear();
 
 	for (size_t i = 0; i < MLK_UTIL_SIZE(table); ++i)
-		label_draw(&table[i].label);
+		mlk_label_draw(&table[i].label);
 
-	label_draw(&mlabel);
+	mlk_label_draw(&mlabel);
 	mlk_painter_present();
 }
 
--- a/examples/example-notify/example-notify.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-notify/example-notify.c	Tue Feb 28 13:26:53 2023 +0100
@@ -36,11 +36,11 @@
 #include <mlk/example/example.h>
 #include <mlk/example/registry.h>
 
-static struct label help = {
+static struct mlk_label help = {
 	.text = "Keys: <Space> to generate a notification.",
 	.x = 10,
 	.y = 10,
-	.flags = LABEL_FLAGS_SHADOW
+	.flags = MLK_LABEL_FLAGS_SHADOW
 };
 static struct mlk_texture *icon;
 static struct mlk_state *states[1];
@@ -89,7 +89,7 @@
 
 	mlk_painter_set_color(0xffffffff);
 	mlk_painter_clear();
-	label_draw(&help);
+	mlk_label_draw(&help);
 	notify_draw();
 	mlk_painter_present();
 }
--- a/examples/example-sprite/example-sprite.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-sprite/example-sprite.c	Tue Feb 28 13:26:53 2023 +0100
@@ -48,11 +48,11 @@
 static unsigned int row, column;
 static struct mlk_state *states[1];
 
-static struct label help = {
+static struct mlk_label help = {
 	.x = 10,
 	.y = 10,
 	.text = msg,
-	.flags = LABEL_FLAGS_SHADOW
+	.flags = MLK_LABEL_FLAGS_SHADOW
 };
 
 static void
@@ -121,7 +121,7 @@
 	mlk_painter_clear();
 	mlk_align(MLK_ALIGN_CENTER, &x, &y, sprite->cellw, sprite->cellh, 0, 0, mlk_window.w, mlk_window.h);
 	mlk_sprite_draw(sprite, row, column, x, y);
-	label_draw(&help);
+	mlk_label_draw(&help);
 	mlk_painter_present();
 }
 
--- a/examples/example-ui/example-ui.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/examples/example-ui/example-ui.c	Tue Feb 28 13:26:53 2023 +0100
@@ -72,12 +72,12 @@
 	} panel;
 
 	struct {
-		struct label label;
+		struct mlk_label label;
 	} header;
 
 	struct {
 		struct mlk_checkbox cb;
-		struct label label;
+		struct mlk_label label;
 	} autosave;
 
 	struct {
@@ -97,7 +97,7 @@
 			.text = "Preferences",
 			.x = FRAME_ORIGIN_X,
 			.y = FRAME_ORIGIN_Y,
-			.flags = LABEL_FLAGS_SHADOW,
+			.flags = MLK_LABEL_FLAGS_SHADOW,
 		}
 	},
 	.autosave = {
@@ -107,7 +107,7 @@
 		},
 		.label = {
 			.text = "Auto save game",
-			.flags = LABEL_FLAGS_SHADOW,
+			.flags = MLK_LABEL_FLAGS_SHADOW,
 		}
 	},
 	.quit = {
@@ -133,11 +133,11 @@
 resize_header(void)
 {
 	struct mlk_frame *f = &ui.panel.frame;
-	struct label *l = &ui.header.label;
+	struct mlk_label *l = &ui.header.label;
 	unsigned int w, h;
 
 	/* Header. */
-	label_query(l, &w, &h);
+	mlk_label_query(l, &w, &h);
 	mlk_align(MLK_ALIGN_LEFT, &l->x, &l->y, w, h, f->x, f->y, f->w, HEADER_HEIGHT);
 
 	l->x += theme_default()->padding;
@@ -149,7 +149,7 @@
 	unsigned int padding = theme_default()->padding;
 	struct mlk_frame *f = &ui.panel.frame;
 	struct mlk_checkbox *c = &ui.autosave.cb;
-	struct label *l = &ui.autosave.label;
+	struct mlk_label *l = &ui.autosave.label;
 
 	c->x = f->x + padding;
 	c->y = f->y + HEADER_HEIGHT + padding;
@@ -244,9 +244,9 @@
 	mlk_painter_set_color(0xffffffff);
 	mlk_painter_clear();
 	mlk_frame_draw(&ui.panel.frame);
-	label_draw(&ui.header.label);
+	mlk_label_draw(&ui.header.label);
 	mlk_checkbox_draw(&ui.autosave.cb);
-	label_draw(&ui.autosave.label);
+	mlk_label_draw(&ui.autosave.label);
 	mlk_button_draw(&ui.quit.button);
 	mlk_painter_present();
 }
--- a/libmlk-example/mlk/example/trace-hud.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-example/mlk/example/trace-hud.c	Tue Feb 28 13:26:53 2023 +0100
@@ -96,12 +96,12 @@
 	y = th->padding;
 
 	for (int i = 0; i < LINES_MAX && data.lines[i][0]; ++i) {
-		label_draw(&(struct label) {
+		mlk_label_draw(&(struct mlk_label) {
 			.x = x,
 			.y = y,
 			.text = data.lines[i],
 			.theme = th,
-			.flags = LABEL_FLAGS_SHADOW
+			.flags = MLK_LABEL_FLAGS_SHADOW
 		});
 
 		y += mlk_font_height(th->fonts[THEME_FONT_INTERFACE]);
--- a/libmlk-rpg/mlk/rpg/battle-bar-default.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-bar-default.c	Tue Feb 28 13:26:53 2023 +0100
@@ -180,15 +180,15 @@
 static void
 draw_help(const struct battle_bar_default *bar, const char *what)
 {
-	struct label label = {0};
+	struct mlk_label label = {0};
 	unsigned int lw = 0, lh = 0;
 
-	label.flags = LABEL_FLAGS_SHADOW;
+	label.flags = MLK_LABEL_FLAGS_SHADOW;
 	label.text = what;
-	label_query(&label, &lw, &lh);
+	mlk_label_query(&label, &lw, &lh);
 	label.x = bar->grid.x + (bar->grid.w / 2) - (lw / 2);
 	label.y = bar->grid.y - lh - THEME(bar)->padding;
-	label_draw(&label);
+	mlk_label_draw(&label);
 }
 
 static void
@@ -229,7 +229,7 @@
                             unsigned int h)
 {
 	const struct theme *theme = THEME(bar);
-	struct label label;
+	struct mlk_label label;
 	unsigned int spacing, lw, lh;
 	char line[64];
 
@@ -240,28 +240,28 @@
 	/* Reuse the same label. */
 	label.theme = theme;
 	label.text = line;
-	label.flags = LABEL_FLAGS_SHADOW;
+	label.flags = MLK_LABEL_FLAGS_SHADOW;
 
 	/* Name. */
 	snprintf(line, sizeof (line), "%s", ch->name);
-	label_query(&label, &lw, &lh);
+	mlk_label_query(&label, &lw, &lh);
 	label.x = x + theme->padding;
 	label.y = y + spacing;
-	label_draw(&label);
+	mlk_label_draw(&label);
 
 	/* HP. */
 	snprintf(line, sizeof (line), "%d/%u", ch->hp, ch->hpmax);
-	label_query(&label, &lw, &lh);
+	mlk_label_query(&label, &lw, &lh);
 	label.x = x + theme->padding;
 	label.y = label.y + lh + spacing;
-	label_draw(&label);
+	mlk_label_draw(&label);
 
 	/* MP. */
 	snprintf(line, sizeof (line), "%d/%u", ch->mp, ch->mpmax);
-	label_query(&label, &lw, &lh);
+	mlk_label_query(&label, &lw, &lh);
 	label.x = x + theme->padding;
 	label.y = label.y + lh + spacing;
-	label_draw(&label);
+	mlk_label_draw(&label);
 
 	/* Status. */
 	/* TODO: list all status. */
@@ -321,34 +321,34 @@
 	struct {
 		unsigned int w, h;
 		enum mlk_align align;
-		struct label label;
+		struct mlk_label label;
 	} buttons[] = {
 		{
 			.align = MLK_ALIGN_TOP,
 			.label = {
 				.text = "Attack",
-				.flags = LABEL_FLAGS_SHADOW
+				.flags = MLK_LABEL_FLAGS_SHADOW
 			}
 		},
 		{
 			.align = MLK_ALIGN_RIGHT,
 			.label = {
 				.text = "Magic",
-				.flags = LABEL_FLAGS_SHADOW
+				.flags = MLK_LABEL_FLAGS_SHADOW
 			}
 		},
 		{
 			.align = MLK_ALIGN_BOTTOM,
 			.label = {
 				.text = "Objects",
-				.flags = LABEL_FLAGS_SHADOW
+				.flags = MLK_LABEL_FLAGS_SHADOW
 			}
 		},
 		{
 			.align = MLK_ALIGN_LEFT,
 			.label = {
 				.text = "Special",
-				.flags = LABEL_FLAGS_SHADOW
+				.flags = MLK_LABEL_FLAGS_SHADOW
 			}
 		}
 	};
@@ -374,18 +374,18 @@
 	for (size_t i = 0; i < MLK_UTIL_SIZE(buttons); ++i) {
 		buttons[i].label.theme = theme;
 
-		label_query(&buttons[i].label, &buttons[i].w, &buttons[i].h);
+		mlk_label_query(&buttons[i].label, &buttons[i].w, &buttons[i].h);
 
 		/* Change theme if it's selected. */
 		if ((size_t)bar->menu == i)
-			buttons[i].label.flags |=  LABEL_FLAGS_SELECTED;
+			buttons[i].label.flags |=  MLK_LABEL_FLAGS_SELECTED;
 		else
-			buttons[i].label.flags &= ~LABEL_FLAGS_SELECTED;
+			buttons[i].label.flags &= ~MLK_LABEL_FLAGS_SELECTED;
 
 		mlk_align(buttons[i].align,
 		    &buttons[i].label.x, &buttons[i].label.y, buttons[i].w, buttons[i].h,
 		    bx, by, bw, bh);
-		label_draw(&buttons[i].label);
+		mlk_label_draw(&buttons[i].label);
 	}
 }
 
--- a/libmlk-rpg/mlk/rpg/battle-entity.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-entity.c	Tue Feb 28 13:26:53 2023 +0100
@@ -32,16 +32,16 @@
 static void
 draw_name(const struct battle_entity *et, const struct battle *bt)
 {
-	struct label label = et->name;
+	struct mlk_label label = et->name;
 
 	label.theme = BATTLE_THEME(bt);
 
 	if (et == battle_current(bt))
-		label.flags |=  LABEL_FLAGS_SELECTED;
+		label.flags |=  MLK_LABEL_FLAGS_SELECTED;
 	else
-		label.flags &= ~LABEL_FLAGS_SELECTED;
+		label.flags &= ~MLK_LABEL_FLAGS_SELECTED;
 
-	label_draw(&label);
+	mlk_label_draw(&label);
 }
 
 void
--- a/libmlk-rpg/mlk/rpg/battle-entity.h	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-entity.h	Tue Feb 28 13:26:53 2023 +0100
@@ -31,7 +31,7 @@
 	struct character *ch;
 	int x;
 	int y;
-	struct label name;
+	struct mlk_label name;
 	struct battle_entity_state *state;
 };
 
--- a/libmlk-rpg/mlk/rpg/battle-message.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-message.c	Tue Feb 28 13:26:53 2023 +0100
@@ -44,7 +44,7 @@
 	assert(msg);
 
 	struct mlk_frame f = {0};
-	struct label l = {0};
+	struct mlk_label l = {0};
 	unsigned int lw = 0, lh = 0;
 
 	/* Prepare message frame. */
@@ -57,13 +57,13 @@
 
 	/* Prepare message label box. */
 	l.text = msg->text;
-	l.flags = LABEL_FLAGS_SHADOW;
+	l.flags = MLK_LABEL_FLAGS_SHADOW;
 	l.theme = msg->theme;
-	label_query(&l, &lw, &lh);
+	mlk_label_query(&l, &lw, &lh);
 
 	/* Align the text in the box. */
 	mlk_align(MLK_ALIGN_CENTER, &l.x, &l.y, lw, lh, f.x, f.y, f.w, f.h);
 
 	mlk_frame_draw(&f);
-	label_draw(&l);
+	mlk_label_draw(&l);
 }
--- a/libmlk-rpg/mlk/rpg/battle-state-selection.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-state-selection.c	Tue Feb 28 13:26:53 2023 +0100
@@ -123,7 +123,7 @@
 	if (!cursor)
 		return;
 
-	label_query(&et->name, NULL, &lh);
+	mlk_label_query(&et->name, NULL, &lh);
 
 	x = et->name.x - cursor->cellw - theme->padding;
 	y = et->name.y + (((int)(lh) - (int)(cursor->cellh)) / 2);
--- a/libmlk-rpg/mlk/rpg/battle.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle.c	Tue Feb 28 13:26:53 2023 +0100
@@ -139,8 +139,8 @@
 	sprite = et->ch->sprites[CHARACTER_SPRITE_NORMAL];
 
 	et->name.text = et->ch->name;
-	et->name.flags = LABEL_FLAGS_SHADOW;
-	label_query(&et->name, &lw, NULL);
+	et->name.flags = MLK_LABEL_FLAGS_SHADOW;
+	mlk_label_query(&et->name, &lw, NULL);
 	et->name.y = et->y + sprite->cellh + BATTLE_THEME(bt)->padding;
 	et->name.x = et->x + (sprite->cellw / 2) - (lw / 2);
 }
--- a/libmlk-rpg/mlk/rpg/message.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/message.c	Tue Feb 28 13:26:53 2023 +0100
@@ -87,7 +87,7 @@
 draw_lines(const struct message *msg)
 {
 	const struct theme *theme = THEME(msg);
-	struct label label;
+	struct mlk_label label;
 	unsigned int lw, lh;
 	int err;
 
@@ -101,7 +101,7 @@
 		label.x = theme->padding;
 		label.y = theme->padding + (i * (lh + msg->spacing));
 		label.text = msg->lines[i];
-		label.flags = LABEL_FLAGS_SHADOW;
+		label.flags = MLK_LABEL_FLAGS_SHADOW;
 
 		if (label.x + lw > msg->w)
 			mlk_tracef("message width too small: %u < %u", msg->w, min_width(msg));
@@ -113,12 +113,12 @@
 		 * text and THEME_COLOR_SHADOW so if we have selected a line
 		 * we need to cheat the normal color.
 		 */
-		if (msg->flags & MESSAGE_FLAGS_QUESTION && msg->index == (unsigned int)i)
-			label.flags |= LABEL_FLAGS_SELECTED;
+		if ((msg->flags & MESSAGE_FLAGS_QUESTION) && msg->index == (unsigned int)i)
+			label.flags |= MLK_LABEL_FLAGS_SELECTED;
 		else
-			label.flags &= ~(LABEL_FLAGS_SELECTED);
+			label.flags &= ~(MLK_LABEL_FLAGS_SELECTED);
 
-		label_draw(&label);
+		mlk_label_draw(&label);
 	}
 }
 
--- a/libmlk-ui/mlk/ui/button.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-ui/mlk/ui/button.c	Tue Feb 28 13:26:53 2023 +0100
@@ -48,12 +48,12 @@
 
 	(void)t;
 
-	struct label label = {
+	struct mlk_label label = {
 		.text = button->text,
 	};
 	unsigned int lw, lh;
 
-	label_query(&label, &lw, &lh);
+	mlk_label_query(&label, &lw, &lh);
 
 	if (lw > button->w)
 		mlk_tracef("button width is too small for text: %u < %u", button->w, lw);
@@ -66,7 +66,7 @@
 	mlk_painter_set_color(0x577277ff);
 	mlk_painter_draw_rectangle(button->x, button->y, button->w, button->h);
 
-	label_draw(&label);
+	mlk_label_draw(&label);
 }
 
 int
--- a/libmlk-ui/mlk/ui/gridmenu.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-ui/mlk/ui/gridmenu.c	Tue Feb 28 13:26:53 2023 +0100
@@ -52,9 +52,9 @@
 geometry(struct mlk_gridmenu *menu)
 {
 	const struct theme *theme = THEME(menu);
-	struct label label = {
+	struct mlk_label label = {
 		.theme = theme,
-		.flags = LABEL_FLAGS_SHADOW
+		.flags = MLK_LABEL_FLAGS_SHADOW
 	};
 	unsigned int reqw = 0, reqh = 0, lw, lh;
 
@@ -67,7 +67,7 @@
 			continue;
 
 
-		label_query(&label, &lw, &lh);
+		mlk_label_query(&label, &lw, &lh);
 
 		menu->eltw = fmax(menu->eltw, lw);
 		menu->elth = fmax(menu->elth, lh);
@@ -116,11 +116,11 @@
 draw_labels(const struct mlk_gridmenu *menu)
 {
 	size_t pagesz, pagenr, item, c = 0, r = 0;
-	struct label label = {0};
+	struct mlk_label label = {0};
 	const struct theme *theme = THEME(menu);
 
 	label.theme = theme;
-	label.flags = LABEL_FLAGS_SHADOW;
+	label.flags = MLK_LABEL_FLAGS_SHADOW;
 
 	/*
 	 * Select the first top-left column based on the current selection and
@@ -140,11 +140,11 @@
 		label.y = menu->y + theme->padding + (r * menu->elth) + (r * menu->spaceh);
 
 		if (i == menu->selected % pagesz)
-			label.flags |= LABEL_FLAGS_SELECTED;
+			label.flags |= MLK_LABEL_FLAGS_SELECTED;
 		else
-			label.flags &= ~(LABEL_FLAGS_SELECTED);
+			label.flags &= ~(MLK_LABEL_FLAGS_SELECTED);
 
-		label_draw(&label);
+		mlk_label_draw(&label);
 
 		if (++c >= menu->ncols) {
 			++r;
--- a/libmlk-ui/mlk/ui/label.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-ui/mlk/ui/label.c	Tue Feb 28 13:26:53 2023 +0100
@@ -27,7 +27,7 @@
 #include "theme.h"
 
 void
-label_draw_default(const struct theme *t, const struct label *label)
+mlk_label_draw_default(const struct theme *t, const struct mlk_label *label)
 {
 	assert(t);
 	assert(label);
@@ -37,15 +37,15 @@
 	unsigned long color;
 	int err;
 
-	font = label->flags & LABEL_FLAGS_IMPORTANT
+	font = label->flags & MLK_LABEL_FLAGS_IMPORTANT
 		? t->fonts[THEME_FONT_IMPORTANT]
 		: t->fonts[THEME_FONT_INTERFACE];
-	color = label->flags & LABEL_FLAGS_SELECTED
+	color = label->flags & MLK_LABEL_FLAGS_SELECTED
 		? t->colors[THEME_COLOR_SELECTED]
 	        : t->colors[THEME_COLOR_NORMAL];
 
 	/* Shadow text, only if enabled. */
-	if (label->flags & LABEL_FLAGS_SHADOW) {
+	if (label->flags & MLK_LABEL_FLAGS_SHADOW) {
 		if ((err = mlk_font_render(font, &tex, label->text, t->colors[THEME_COLOR_SHADOW])) < 0)
 			mlk_panic(err);
 
@@ -62,19 +62,19 @@
 }
 
 int
-label_ok(const struct label *label)
+mlk_label_ok(const struct mlk_label *label)
 {
 	return label && label->text && strlen(label->text) > 0;
 }
 
 void
-label_query(const struct label *label, unsigned int *w, unsigned int *h)
+mlk_label_query(const struct mlk_label *label, unsigned int *w, unsigned int *h)
 {
 	assert(label);
 	assert(label->text);
 
 	const struct theme *t = label->theme ? label->theme : theme_default();
-	const struct mlk_font *f = label->flags & LABEL_FLAGS_IMPORTANT
+	const struct mlk_font *f = label->flags & MLK_LABEL_FLAGS_IMPORTANT
 		? t->fonts[THEME_FONT_IMPORTANT]
 		: t->fonts[THEME_FONT_INTERFACE];
 	int err;
@@ -84,7 +84,7 @@
 }
 
 void
-label_draw(const struct label *label)
+mlk_label_draw(const struct mlk_label *label)
 {
 	assert(label);
 	assert(label->text);
--- a/libmlk-ui/mlk/ui/label.h	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-ui/mlk/ui/label.h	Tue Feb 28 13:26:53 2023 +0100
@@ -23,34 +23,34 @@
 
 struct theme;
 
-enum label_flags {
-	LABEL_FLAGS_NONE,
-	LABEL_FLAGS_SHADOW      = (1 << 0),
-	LABEL_FLAGS_IMPORTANT   = (1 << 1),
-	LABEL_FLAGS_SELECTED    = (1 << 2)
+enum mlk_label_flags {
+	MLK_LABEL_FLAGS_NONE,
+	MLK_LABEL_FLAGS_SHADOW          = (1 << 0),
+	MLK_LABEL_FLAGS_IMPORTANT       = (1 << 1),
+	MLK_LABEL_FLAGS_SELECTED        = (1 << 2)
 };
 
-struct label {
+struct mlk_label {
 	int x;
 	int y;
 	const char *text;
-	enum label_flags flags;
+	enum mlk_label_flags flags;
 	const struct theme *theme;
 };
 
 MLK_CORE_BEGIN_DECLS
 
 void
-label_draw_default(const struct theme *, const struct label *);
+mlk_label_draw_default(const struct theme *, const struct mlk_label *);
 
 int
-label_ok(const struct label *);
+mlk_label_ok(const struct mlk_label *);
 
 void
-label_query(const struct label *, unsigned int *, unsigned int *);
+mlk_label_query(const struct mlk_label *, unsigned int *, unsigned int *);
 
 void
-label_draw(const struct label *);
+mlk_label_draw(const struct mlk_label *);
 
 MLK_CORE_END_DECLS
 
--- a/libmlk-ui/mlk/ui/notify.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-ui/mlk/ui/notify.c	Tue Feb 28 13:26:53 2023 +0100
@@ -123,27 +123,27 @@
 static void
 draw_title(const struct geo *geo, const struct notify *n)
 {
-	const struct label l = {
+	const struct mlk_label l = {
 		.x = geo->title_x,
 		.y = geo->title_y,
 		.text = n->title,
-		.flags = LABEL_FLAGS_SHADOW | LABEL_FLAGS_IMPORTANT
+		.flags = MLK_LABEL_FLAGS_SHADOW | MLK_LABEL_FLAGS_IMPORTANT
 	};
 
-	label_draw(&l);
+	mlk_label_draw(&l);
 }
 
 static void
 draw_body(const struct geo *geo, const struct notify *n)
 {
-	const struct label l = {
+	const struct mlk_label l = {
 		.x = geo->body_x,
 		.y = geo->body_y,
 		.text = n->body,
-		.flags = LABEL_FLAGS_SHADOW
+		.flags = MLK_LABEL_FLAGS_SHADOW
 	};
 
-	label_draw(&l);
+	mlk_label_draw(&l);
 }
 
 static void
--- a/libmlk-ui/mlk/ui/theme.c	Tue Feb 28 13:18:23 2023 +0100
+++ b/libmlk-ui/mlk/ui/theme.c	Tue Feb 28 13:26:53 2023 +0100
@@ -54,7 +54,7 @@
 	},
 	.padding = 10,
 	.draw_frame = mlk_frame_draw_default,
-	.draw_label = label_draw_default,
+	.draw_label = mlk_label_draw_default,
 	.draw_button = mlk_button_draw_default,
 	.draw_checkbox = mlk_checkbox_draw_default
 };