Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Feb 19, 2025
1 parent f105d88 commit 883dc0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions src/mission_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@ extern enum mission_control_mode g_mission_control_mode;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
__attribute__((no_sanitize("undefined")))
static CONNECTION_CALLBACK(connection_handler)
{
//
// NOTE(koekeishiya): Disable undefined sanitizer for this particular function.
// It will sometimes report load of misaligned address when reading from the
// data buffer, but there is nothing for us to do here because said memory is
// allocated and managed by macOS.
//

if (type == 1204) {
event_loop_post(&g_event_loop, MISSION_CONTROL_ENTER, NULL, 0);
} else if (type == 1327) {
event_loop_post(&g_event_loop, SLS_SPACE_CREATED, (void *) (intptr_t) (* (uint64_t *) data), 0);
uint64_t sid; memcpy(&sid, data, sizeof(uint64_t));
event_loop_post(&g_event_loop, SLS_SPACE_CREATED, (void *) (intptr_t) sid , 0);
} else if (type == 1328) {
event_loop_post(&g_event_loop, SLS_SPACE_DESTROYED, (void *) (intptr_t) (* (uint64_t *) data), 0);
uint64_t sid; memcpy(&sid, data, sizeof(uint64_t));
event_loop_post(&g_event_loop, SLS_SPACE_DESTROYED, (void *) (intptr_t) sid, 0);
} else if (type == 808) {
event_loop_post(&g_event_loop, SLS_WINDOW_ORDERED, (void *) (intptr_t) (* (uint32_t *) data), 0);
uint32_t wid; memcpy(&wid, data, sizeof(uint32_t));
event_loop_post(&g_event_loop, SLS_WINDOW_ORDERED, (void *) (intptr_t) wid, 0);
} else if (type == 804) {
event_loop_post(&g_event_loop, SLS_WINDOW_DESTROYED, (void *) (intptr_t) (* (uint32_t *) data), 0);
uint32_t wid; memcpy(&wid, data, sizeof(uint32_t));
event_loop_post(&g_event_loop, SLS_WINDOW_DESTROYED, (void *) (intptr_t) wid, 0);
}
}
#pragma clang diagnostic pop
Expand Down
2 changes: 1 addition & 1 deletion src/window_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ bool window_manager_add_existing_application_windows(struct space_manager *sm, s
// NOTE(koekeishiya): Only the element_id changes between iterations.
//

*(uint64_t *) (data + 0xc) = element_id;
memcpy(data+0xc, &element_id, sizeof(uint64_t));
AXUIElementRef element_ref = _AXUIElementCreateWithRemoteToken(data_ref);
uint32_t element_wid = ax_window_id(element_ref);
bool matched = false;
Expand Down

0 comments on commit 883dc0a

Please sign in to comment.