mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-23 03:43:02 +00:00
preparing item grouping
This commit is contained in:
parent
fcf5db0c07
commit
e0697d9879
6 changed files with 42 additions and 2 deletions
3
makefile
3
makefile
|
@ -22,6 +22,9 @@ install: clean $(UNIVERSAL_BINS)
|
||||||
uninstall: clean
|
uninstall: clean
|
||||||
rm /usr/local/bin/sketchybar
|
rm /usr/local/bin/sketchybar
|
||||||
|
|
||||||
|
profile: BUILD_FLAGS=-std=c99 -Wall -DDEBUG -g -Ofast -fvisibility=hidden
|
||||||
|
profile: clean $(x86_BINS)
|
||||||
|
|
||||||
debug: BUILD_FLAGS=-std=c99 -Wall -DDEBUG -fsanitize=address -fsanitize=undefined -g -O0 -fvisibility=hidden
|
debug: BUILD_FLAGS=-std=c99 -Wall -DDEBUG -fsanitize=address -fsanitize=undefined -g -O0 -fvisibility=hidden
|
||||||
debug: clean $(x86_BINS)
|
debug: clean $(x86_BINS)
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ void bar_item_init(struct bar_item* bar_item, struct bar_item* default_item) {
|
||||||
bar_item->y_offset = 0;
|
bar_item->y_offset = 0;
|
||||||
bar_item->num_rects = 0;
|
bar_item->num_rects = 0;
|
||||||
bar_item->bounding_rects = NULL;
|
bar_item->bounding_rects = NULL;
|
||||||
|
bar_item->group = NULL;
|
||||||
|
|
||||||
bar_item->has_alias = false;
|
bar_item->has_alias = false;
|
||||||
bar_item->has_graph = false;
|
bar_item->has_graph = false;
|
||||||
|
|
|
@ -65,6 +65,9 @@ struct bar_item {
|
||||||
bool has_alias;
|
bool has_alias;
|
||||||
struct alias alias;
|
struct alias alias;
|
||||||
|
|
||||||
|
// Group Properties
|
||||||
|
struct group* group;
|
||||||
|
|
||||||
// Update Events
|
// Update Events
|
||||||
uint32_t update_mask;
|
uint32_t update_mask;
|
||||||
|
|
||||||
|
|
25
src/group.c
Normal file
25
src/group.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include "group.h"
|
||||||
|
#include "background.h"
|
||||||
|
#include <malloc/_malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
struct group* group_create() {
|
||||||
|
struct group* group = malloc(sizeof(struct group));
|
||||||
|
memset(group, 0, sizeof(struct group));
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
void group_init(struct group* group) {
|
||||||
|
group->name = string_copy("");
|
||||||
|
background_init(&group->background);
|
||||||
|
}
|
||||||
|
|
||||||
|
void group_set_name(struct group* group, char* _name) {
|
||||||
|
if (group->name && group->name != _name) free(group->name);
|
||||||
|
group->name = _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void group_destroy(struct group* group) {
|
||||||
|
if (group->name) free(group->name);
|
||||||
|
free(group);
|
||||||
|
}
|
10
src/group.h
10
src/group.h
|
@ -1,11 +1,17 @@
|
||||||
#ifndef GROUP_H_
|
#ifndef GROUP_H_
|
||||||
#define GROUP_H_
|
#define GROUP_H_
|
||||||
|
|
||||||
|
#include <_types/_uint32_t.h>
|
||||||
|
|
||||||
struct group {
|
struct group {
|
||||||
char* name;
|
char* name;
|
||||||
|
|
||||||
// Background
|
struct background background;
|
||||||
struct rgba_color background_color;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct group* group_create();
|
||||||
|
void group_init(struct group* group);
|
||||||
|
void group_set_name(struct group* group, char* _name);
|
||||||
|
void group_destroy(struct group* group);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "alias.h"
|
#include "alias.h"
|
||||||
|
#include "group.h"
|
||||||
#include "bar_item.h"
|
#include "bar_item.h"
|
||||||
#include "custom_events.h"
|
#include "custom_events.h"
|
||||||
#include "bar_manager.h"
|
#include "bar_manager.h"
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
#include "text.c"
|
#include "text.c"
|
||||||
#include "graph.c"
|
#include "graph.c"
|
||||||
#include "alias.c"
|
#include "alias.c"
|
||||||
|
#include "group.c"
|
||||||
#include "bar_item.c"
|
#include "bar_item.c"
|
||||||
#include "custom_events.c"
|
#include "custom_events.c"
|
||||||
#include "bar_manager.c"
|
#include "bar_manager.c"
|
||||||
|
|
Loading…
Reference in a new issue