mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-29 06:40:27 +00:00
remove unused field from event
This commit is contained in:
parent
5f978a75e3
commit
ef14e353fd
12 changed files with 27 additions and 39 deletions
|
@ -2,7 +2,7 @@
|
|||
#include "event.h"
|
||||
|
||||
static ANIMATOR_CALLBACK(animator_handler) {
|
||||
struct event event = { NULL, 0, ANIMATOR_REFRESH };
|
||||
struct event event = { NULL, ANIMATOR_REFRESH };
|
||||
event_post(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
extern void forced_front_app_event();
|
||||
|
||||
static CLOCK_CALLBACK(clock_handler) {
|
||||
struct event event = { NULL, 0, SHELL_REFRESH };
|
||||
struct event event = { NULL, SHELL_REFRESH };
|
||||
event_post(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,29 +12,29 @@ static void brightness_handler(void* notification_center, uint32_t did, void* na
|
|||
DisplayServicesGetBrightness(did, brightness);
|
||||
if (g_last_brightness < *brightness - 1e-2 || g_last_brightness > *brightness + 1e-2) {
|
||||
g_last_brightness = *brightness;
|
||||
struct event event = { (void*) brightness, 0, BRIGHTNESS_CHANGED };
|
||||
struct event event = { (void*) brightness, BRIGHTNESS_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
||||
static DISPLAY_EVENT_HANDLER(display_handler) {
|
||||
if (flags & kCGDisplayAddFlag) {
|
||||
struct event event = { (void *)(intptr_t) did, 0, DISPLAY_ADDED };
|
||||
struct event event = { (void *)(intptr_t) did, DISPLAY_ADDED };
|
||||
event_post(&event);
|
||||
|
||||
if (g_brightness_events && DisplayServicesCanChangeBrightness(did))
|
||||
DisplayServicesRegisterForBrightnessChangeNotifications(did, did, (void*)brightness_handler);
|
||||
} else if (flags & kCGDisplayRemoveFlag) {
|
||||
struct event event = { (void *)(intptr_t) did, 0, DISPLAY_REMOVED };
|
||||
struct event event = { (void *)(intptr_t) did, DISPLAY_REMOVED };
|
||||
event_post(&event);
|
||||
|
||||
if (g_brightness_events && DisplayServicesCanChangeBrightness(did))
|
||||
DisplayServicesUnregisterForBrightnessChangeNotifications(did, did);
|
||||
} else if (flags & kCGDisplayMovedFlag) {
|
||||
struct event event = { (void *)(intptr_t) did, 0, DISPLAY_MOVED };
|
||||
struct event event = { (void *)(intptr_t) did, DISPLAY_MOVED };
|
||||
event_post(&event);
|
||||
} else if (flags & kCGDisplayDesktopShapeChangedFlag) {
|
||||
struct event event = { (void *)(intptr_t) did, 0, DISPLAY_RESIZED };
|
||||
struct event event = { (void *)(intptr_t) did, DISPLAY_RESIZED };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ enum event_type {
|
|||
|
||||
struct event {
|
||||
void* context;
|
||||
volatile uint32_t* info;
|
||||
enum event_type type;
|
||||
};
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ static void handler(ConstFSEventStreamRef stream,
|
|||
const FSEventStreamEventFlags* flags,
|
||||
const FSEventStreamEventId* ids) {
|
||||
if (g_hotload && count > 0) {
|
||||
struct event event = { NULL, 0, HOTLOAD };
|
||||
struct event event = { NULL, HOTLOAD };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ bool g_media_events = false;
|
|||
char payload_info[info_len];
|
||||
memcpy(payload_info, info, info_len);
|
||||
|
||||
struct event event = { payload_info, 0, MEDIA_CHANGED };
|
||||
struct event event = { payload_info, MEDIA_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -713,7 +713,7 @@ void handle_message_mach(struct mach_buffer* buffer) {
|
|||
free(rbr_msg);
|
||||
|
||||
if (reload) {
|
||||
struct event event = { NULL, 0, HOTLOAD };
|
||||
struct event event = { NULL, HOTLOAD };
|
||||
event_post(&event);
|
||||
}
|
||||
} else {
|
||||
|
@ -744,6 +744,6 @@ void handle_message_mach(struct mach_buffer* buffer) {
|
|||
}
|
||||
|
||||
MACH_HANDLER(mach_message_handler) {
|
||||
struct event event = { message, 0, MACH_MESSAGE };
|
||||
struct event event = { message, MACH_MESSAGE };
|
||||
event_post(&event);
|
||||
}
|
||||
|
|
20
src/mouse.c
20
src/mouse.c
|
@ -15,9 +15,7 @@ static pascal OSStatus mouse_handler(EventHandlerCallRef next, EventRef e, void
|
|||
switch (GetEventKind(e)) {
|
||||
case kEventMouseUp: {
|
||||
CGEventRef cg_event = CopyEventCGEvent(e);
|
||||
struct event event = { (void *) cg_event,
|
||||
0,
|
||||
MOUSE_UP };
|
||||
struct event event = { (void *) cg_event, MOUSE_UP };
|
||||
|
||||
event_post(&event);
|
||||
CFRelease(cg_event);
|
||||
|
@ -25,9 +23,7 @@ static pascal OSStatus mouse_handler(EventHandlerCallRef next, EventRef e, void
|
|||
}
|
||||
case kEventMouseDragged: {
|
||||
CGEventRef cg_event = CopyEventCGEvent(e);
|
||||
struct event event = { (void *) cg_event,
|
||||
0,
|
||||
MOUSE_DRAGGED };
|
||||
struct event event = { (void *) cg_event, MOUSE_DRAGGED };
|
||||
|
||||
event_post(&event);
|
||||
CFRelease(cg_event);
|
||||
|
@ -35,9 +31,7 @@ static pascal OSStatus mouse_handler(EventHandlerCallRef next, EventRef e, void
|
|||
}
|
||||
case kEventMouseEntered: {
|
||||
CGEventRef cg_event = CopyEventCGEvent(e);
|
||||
struct event event = { (void *) cg_event,
|
||||
0,
|
||||
MOUSE_ENTERED };
|
||||
struct event event = { (void *) cg_event, MOUSE_ENTERED };
|
||||
|
||||
event_post(&event);
|
||||
CFRelease(cg_event);
|
||||
|
@ -45,9 +39,7 @@ static pascal OSStatus mouse_handler(EventHandlerCallRef next, EventRef e, void
|
|||
}
|
||||
case kEventMouseExited: {
|
||||
CGEventRef cg_event = CopyEventCGEvent(e);
|
||||
struct event event = { (void *) cg_event,
|
||||
0,
|
||||
MOUSE_EXITED };
|
||||
struct event event = { (void *) cg_event, MOUSE_EXITED };
|
||||
|
||||
event_post(&event);
|
||||
CFRelease(cg_event);
|
||||
|
@ -55,9 +47,7 @@ static pascal OSStatus mouse_handler(EventHandlerCallRef next, EventRef e, void
|
|||
}
|
||||
case kEventMouseWheelMoved: {
|
||||
CGEventRef cg_event = CopyEventCGEvent(e);
|
||||
struct event event = { (void *) cg_event,
|
||||
0,
|
||||
MOUSE_SCROLLED };
|
||||
struct event event = { (void *) cg_event, MOUSE_SCROLLED };
|
||||
|
||||
event_post(&event);
|
||||
CFRelease(cg_event);
|
||||
|
|
|
@ -12,7 +12,7 @@ void power_handler(void* context) {
|
|||
g_power_source = POWER_AC;
|
||||
char source[8];
|
||||
snprintf(source, 8, "AC");
|
||||
struct event event = { (void*) source, 0, POWER_SOURCE_CHANGED };
|
||||
struct event event = { (void*) source, POWER_SOURCE_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
} else if (CFStringCompare(type, POWER_BATTERY_KEY, 0) == 0) {
|
||||
|
@ -21,7 +21,7 @@ void power_handler(void* context) {
|
|||
char source[8];
|
||||
snprintf(source, 8, "BATTERY");
|
||||
|
||||
struct event event = { (void*) source, 0, POWER_SOURCE_CHANGED };
|
||||
struct event event = { (void*) source, POWER_SOURCE_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ static OSStatus handler(AudioObjectID id, uint32_t address_count, const AudioObj
|
|||
|
||||
if (*volume > g_last_volume + 1e-2 || *volume < g_last_volume - 1e-2) {
|
||||
g_last_volume = *volume;
|
||||
struct event event = { (void*) volume, 0, VOLUME_CHANGED };
|
||||
struct event event = { (void*) volume, VOLUME_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
return KERN_SUCCESS;
|
||||
|
|
|
@ -15,7 +15,7 @@ void update_ssid(SCDynamicStoreRef store, CFArrayRef keys, void* info) {
|
|||
if (g_current_ssid) free(g_current_ssid);
|
||||
g_current_ssid = string_copy(ssid);
|
||||
|
||||
struct event event = { (void*) ssid, 0, WIFI_CHANGED };
|
||||
struct event event = { (void*) ssid, WIFI_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ void forced_front_app_event() {
|
|||
const char* front_app = [name cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
struct event event = { string_copy((char*)front_app),
|
||||
0,
|
||||
APPLICATION_FRONT_SWITCHED };
|
||||
event_post(&event);
|
||||
}
|
||||
|
@ -130,18 +129,18 @@ CGImageRef workspace_icon_for_app(char* app) {
|
|||
}
|
||||
}
|
||||
|
||||
struct event event = { notification, 0, DISTRIBUTED_NOTIFICATION };
|
||||
struct event event = { notification, DISTRIBUTED_NOTIFICATION };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)willSleep:(NSNotification *)notification {
|
||||
struct event event = { NULL, 0, SYSTEM_WILL_SLEEP };
|
||||
struct event event = { NULL, SYSTEM_WILL_SLEEP };
|
||||
event_post(&event);
|
||||
}
|
||||
|
||||
- (void)didWake:(NSNotification *)notification {
|
||||
struct event event = { NULL, 0, SYSTEM_WOKE };
|
||||
struct event event = { NULL, SYSTEM_WOKE };
|
||||
event_post(&event);
|
||||
}
|
||||
|
||||
|
@ -152,23 +151,23 @@ CGImageRef workspace_icon_for_app(char* app) {
|
|||
NSRunningApplication* app = [notification.userInfo objectForKey:NSWorkspaceApplicationKey];
|
||||
if (app) name = string_copy((char*)[[app localizedName] UTF8String]);
|
||||
}
|
||||
struct event event = { name, 0, APPLICATION_FRONT_SWITCHED };
|
||||
struct event event = { name, APPLICATION_FRONT_SWITCHED };
|
||||
event_post(&event);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didChangeMenuBarHiding:(NSNotification *)notification {
|
||||
struct event event = { NULL, 0, MENU_BAR_HIDDEN_CHANGED };
|
||||
struct event event = { NULL, MENU_BAR_HIDDEN_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
|
||||
- (void)activeDisplayDidChange:(NSNotification *)notification {
|
||||
struct event event = { NULL, 0, DISPLAY_CHANGED };
|
||||
struct event event = { NULL, DISPLAY_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
|
||||
- (void)activeSpaceDidChange:(NSNotification *)notification {
|
||||
struct event event = { NULL, 0, SPACE_CHANGED };
|
||||
struct event event = { NULL, SPACE_CHANGED };
|
||||
event_post(&event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue