64 events possible

This commit is contained in:
FelixKratz 2021-11-03 20:51:12 +01:00
parent 54fbc9faa5
commit 8b7c82f4ed
5 changed files with 15 additions and 15 deletions

View file

@ -374,7 +374,7 @@ void bar_item_serialize(struct bar_item* bar_item, FILE* rsp) {
"\t\t\"associated_bar_mask\": %u,\n"
"\t\t\"associated_display_mask\": %u,\n"
"\t\t\"associated_space_mask\": %u,\n"
"\t\t\"update_mask\": %u\n"
"\t\t\"update_mask\": %llu\n"
"\t},\n"
"\t\"bounding_rects\": {\n",
bar_item->name,

View file

@ -60,7 +60,7 @@ struct bar_item {
struct group* group;
// Update Events
uint32_t update_mask;
uint64_t update_mask;
// Bounding Boxes for click events and background drawing (individual per display)
uint32_t num_rects;

View file

@ -345,7 +345,7 @@ struct bar_item* bar_manager_get_item_by_point(struct bar_manager* bar_manager,
}
void bar_manager_custom_events_trigger(struct bar_manager* bar_manager, char* name) {
uint32_t flag = custom_events_get_flag_for_name(&bar_manager->custom_events, name);
uint64_t flag = custom_events_get_flag_for_name(&bar_manager->custom_events, name);
for (int i = 0; i < bar_manager->bar_item_count; i++) {
struct bar_item* bar_item = bar_manager->bar_items[i];

View file

@ -31,10 +31,10 @@ void custom_events_append(struct custom_events* custom_events, char* name, char*
workspace_create_custom_observer(&g_workspace_context, notification);
}
uint32_t custom_events_get_flag_for_name(struct custom_events* custom_events, char* name) {
uint64_t custom_events_get_flag_for_name(struct custom_events* custom_events, char* name) {
for (int i = 0; i < custom_events->count; i++) {
if (strcmp(name, custom_events->events[i]->name) == 0) {
return 1 << i;
return 1ULL << i;
}
}
return 0;
@ -54,10 +54,10 @@ void custom_events_serialize(struct custom_events* custom_events, FILE* rsp) {
fprintf(rsp, "{\n");
for (int i = 0; i < custom_events->count; i++) {
fprintf(rsp, "\t\"%s\": {\n"
"\t\t\"bit\": %d,\n"
"\t\t\"bit\": %llu,\n"
"\t\t\"notification\": \"%s\"\n",
custom_events->events[i]->name,
1 << i,
1ULL << i,
custom_events->events[i]->notification);
if (i < custom_events->count - 1) fprintf(rsp, "\t},\n");
}

View file

@ -1,13 +1,13 @@
#ifndef CUSTOM_EVENT_H
#define CUSTOM_EVENT_H
#define UPDATE_FRONT_APP_SWITCHED 1
#define UPDATE_SPACE_CHANGE 1 << 1
#define UPDATE_DISPLAY_CHANGE 1 << 2
#define UPDATE_SYSTEM_WOKE 1 << 3
#define UPDATE_MOUSE_ENTERED 1 << 4
#define UPDATE_MOUSE_EXITED 1 << 5
#define UPDATE_MOUSE_CLICKED 1 << 6
#define UPDATE_FRONT_APP_SWITCHED 1ULL
#define UPDATE_SPACE_CHANGE 1ULL << 1
#define UPDATE_DISPLAY_CHANGE 1ULL << 2
#define UPDATE_SYSTEM_WOKE 1ULL << 3
#define UPDATE_MOUSE_ENTERED 1ULL << 4
#define UPDATE_MOUSE_EXITED 1ULL << 5
#define UPDATE_MOUSE_CLICKED 1ULL << 6
extern void* g_workspace_context;
@ -25,7 +25,7 @@ struct custom_events {
void custom_event_init(struct custom_event* custom_event, char* name, char* notification);
void custom_events_init(struct custom_events* custom_events);
void custom_events_append(struct custom_events* custom_events, char* name, char* notification);
uint32_t custom_events_get_flag_for_name(struct custom_events* custom_events, char* name);
uint64_t custom_events_get_flag_for_name(struct custom_events* custom_events, char* name);
char* custom_events_get_name_for_notification(struct custom_events* custom_events, char* notification);
void custom_events_serialize(struct custom_events* custom_events, FILE* rsp);
#endif