diff --git a/src/event.c b/src/event.c index 0b2bdb92..7d47b234 100644 --- a/src/event.c +++ b/src/event.c @@ -34,10 +34,10 @@ static void window_did_receive_focus(struct window_manager *wm, struct mouse_sta if (node->window_count <= 1) return; for (int i = 0; i < node->window_count; ++i) { - if (node->window_id[i] != window->id) continue; + if (node->window_list[i] != window->id) continue; - memmove(node->window_id + 1, node->window_id, sizeof(uint32_t) * i); - node->window_id[0] = window->id; + memmove(node->window_list + 1, node->window_list, sizeof(uint32_t) * i); + node->window_list[0] = window->id; break; } @@ -731,16 +731,16 @@ static EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP) dst_view->insertion_point = g_mouse_state.window->id; } - uint32_t tmp_window_id[64]; + uint32_t tmp_window_list[64]; uint32_t tmp_window_count; - memcpy(tmp_window_id, a_node->window_id, sizeof(uint32_t) * a_node->window_count); + memcpy(tmp_window_list, a_node->window_list, sizeof(uint32_t) * a_node->window_count); tmp_window_count = a_node->window_count; - memcpy(a_node->window_id, b_node->window_id, sizeof(uint32_t) * b_node->window_count); + memcpy(a_node->window_list, b_node->window_list, sizeof(uint32_t) * b_node->window_count); a_node->window_count = b_node->window_count; - memcpy(b_node->window_id, tmp_window_id, sizeof(uint32_t) * tmp_window_count); + memcpy(b_node->window_list, tmp_window_list, sizeof(uint32_t) * tmp_window_count); b_node->window_count = tmp_window_count; a_node->zoom = NULL; @@ -748,13 +748,13 @@ static EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP) if (src_view->sid != dst_view->sid) { for (int i = 0; i < a_node->window_count; ++i) { - window_manager_remove_managed_window(&g_window_manager, a_node->window_id[i]); - window_manager_add_managed_window(&g_window_manager, window_manager_find_window(&g_window_manager, a_node->window_id[i]), src_view); + window_manager_remove_managed_window(&g_window_manager, a_node->window_list[i]); + window_manager_add_managed_window(&g_window_manager, window_manager_find_window(&g_window_manager, a_node->window_list[i]), src_view); } for (int i = 0; i < b_node->window_count; ++i) { - window_manager_remove_managed_window(&g_window_manager, b_node->window_id[i]); - window_manager_add_managed_window(&g_window_manager, window_manager_find_window(&g_window_manager, b_node->window_id[i]), dst_view); + window_manager_remove_managed_window(&g_window_manager, b_node->window_list[i]); + window_manager_add_managed_window(&g_window_manager, window_manager_find_window(&g_window_manager, b_node->window_list[i]), dst_view); } } diff --git a/src/view.c b/src/view.c index 620cc119..c6f65166 100644 --- a/src/view.c +++ b/src/view.c @@ -81,14 +81,14 @@ void insert_feedback_show(struct window_node *node) CGPathAddLineToPoint(outline, NULL, x4, y4); SLSDisableUpdate(g_connection); - SLSOrderWindow(g_connection, node->feedback_window.id, 0, node->window_id[0]); + SLSOrderWindow(g_connection, node->feedback_window.id, 0, node->window_list[0]); SLSSetWindowShape(g_connection, node->feedback_window.id, 0.0f, 0.0f, frame_region); CGContextClearRect(node->feedback_window.context, frame); CGContextFillRect(node->feedback_window.context, fill); CGContextAddPath(node->feedback_window.context, outline); CGContextStrokePath(node->feedback_window.context); CGContextFlush(node->feedback_window.context); - SLSOrderWindow(g_connection, node->feedback_window.id, 1, node->window_id[0]); + SLSOrderWindow(g_connection, node->feedback_window.id, 1, node->window_list[0]); SLSReenableUpdate(g_connection); CGPathRelease(outline); CFRelease(frame_region); @@ -246,14 +246,14 @@ static void window_node_split(struct view *view, struct window_node *node, struc memset(right, 0, sizeof(struct window_node)); if (window_node_get_child(node) == CHILD_SECOND) { - memcpy(left->window_id, node->window_id, sizeof(uint32_t) * node->window_count); + memcpy(left->window_list, node->window_list, sizeof(uint32_t) * node->window_count); left->window_count = node->window_count; - right->window_id[0] = window->id; + right->window_list[0] = window->id; right->window_count = 1; } else { - memcpy(right->window_id, node->window_id, sizeof(uint32_t) * node->window_count); + memcpy(right->window_list, node->window_list, sizeof(uint32_t) * node->window_count); right->window_count = node->window_count; - left->window_id[0] = window->id; + left->window_list[0] = window->id; left->window_count = 1; } @@ -288,7 +288,7 @@ static void window_node_destroy(struct window_node *node) if (node->right) window_node_destroy(node->right); for (int i = 0; i < node->window_count; ++i) { - window_manager_remove_managed_window(&g_window_manager, node->window_id[i]); + window_manager_remove_managed_window(&g_window_manager, node->window_list[i]); } insert_feedback_destroy(node); @@ -309,7 +309,7 @@ void window_node_flush(struct window_node *node) { if (window_node_is_occupied(node)) { for (int i = 0; i < node->window_count; ++i) { - struct window *window = window_manager_find_window(&g_window_manager, node->window_id[i]); + struct window *window = window_manager_find_window(&g_window_manager, node->window_list[i]); if (window) { if (node->zoom) { window_manager_set_window_frame(window, node->zoom->area.x, node->zoom->area.y, node->zoom->area.w, node->zoom->area.h); @@ -329,7 +329,7 @@ void window_node_flush(struct window_node *node) bool window_node_contains_window(struct window_node *node, uint32_t window_id) { for (int i = 0; i < node->window_count; ++i) { - if (node->window_id[i] == window_id) return true; + if (node->window_list[i] == window_id) return true; } return false; @@ -522,9 +522,9 @@ void view_remove_window_node(struct view *view, struct window *window) if (node->window_count > 1) { for (int i = 0; i < node->window_count; ++i) { - if (node->window_id[i] != window->id) continue; + if (node->window_list[i] != window->id) continue; - memmove(node->window_id + i, node->window_id + i + 1, sizeof(uint32_t) * (node->window_count - i - 1)); + memmove(node->window_list + i, node->window_list + i + 1, sizeof(uint32_t) * (node->window_count - i - 1)); --node->window_count; break; @@ -549,7 +549,7 @@ void view_remove_window_node(struct view *view, struct window *window) : parent->right; - memcpy(parent->window_id, child->window_id, sizeof(uint32_t) * child->window_count); + memcpy(parent->window_list, child->window_list, sizeof(uint32_t) * child->window_count); parent->window_count = child->window_count; parent->left = NULL; @@ -596,14 +596,14 @@ void view_stack_window_node(struct view *view, struct window_node *node, struct window_manager_set_window_frame(window, node->area.x, node->area.y, node->area.w, node->area.h); } - node->window_id[node->window_count++] = window->id; + node->window_list[node->window_count++] = window->id; } void view_add_window_node(struct view *view, struct window *window) { if (!window_node_is_occupied(view->root) && window_node_is_leaf(view->root)) { - view->root->window_id[0] = window->id; + view->root->window_list[0] = window->id; view->root->window_count = 1; } else { struct window_node *leaf = NULL; @@ -644,7 +644,7 @@ uint32_t *view_find_window_list(struct view *view) struct window_node *node = window_node_find_first_leaf(view->root); while (node) { for (int i = 0; i < node->window_count; ++i) { - buf_push(window_list, node->window_id[i]); + buf_push(window_list, node->window_list[i]); } node = window_node_find_next_leaf(node); } @@ -728,8 +728,8 @@ void view_serialize(FILE *rsp, struct view *view) space_is_visible(view->sid), view->sid == g_space_manager.current_space_id, space_is_fullscreen(view->sid), - first_leaf ? first_leaf->window_id[0] : 0, - last_leaf ? last_leaf->window_id[0] : 0); + first_leaf ? first_leaf->window_list[0] : 0, + last_leaf ? last_leaf->window_list[0] : 0); } void view_update(struct view *view) @@ -785,7 +785,7 @@ void view_clear(struct view *view) if (view->root->right) window_node_destroy(view->root->right); for (int i = 0; i < view->root->window_count; ++i) { - window_manager_remove_managed_window(&g_window_manager, view->root->window_id[i]); + window_manager_remove_managed_window(&g_window_manager, view->root->window_list[i]); } insert_feedback_destroy(view->root); diff --git a/src/view.h b/src/view.h index e7985575..c4177ec4 100644 --- a/src/view.h +++ b/src/view.h @@ -58,7 +58,7 @@ struct window_node struct window_node *left; struct window_node *right; struct window_node *zoom; - uint32_t window_id[64]; + uint32_t window_list[64]; uint32_t window_count; float ratio; enum window_node_split split; diff --git a/src/window_manager.c b/src/window_manager.c index 087e115c..d6ce04f4 100644 --- a/src/window_manager.c +++ b/src/window_manager.c @@ -638,7 +638,7 @@ struct window *window_manager_find_closest_managed_window_in_direction(struct wi struct window_node *closest = view_find_window_node_in_direction(view, node, direction); if (!closest) return NULL; - return window_manager_find_window(wm, closest->window_id[0]); + return window_manager_find_window(wm, closest->window_list[0]); } struct window *window_manager_find_prev_managed_window(struct space_manager *sm, struct window_manager *wm, struct window *window) @@ -652,7 +652,7 @@ struct window *window_manager_find_prev_managed_window(struct space_manager *sm, struct window_node *prev = window_node_find_prev_leaf(node); if (!prev) return NULL; - return window_manager_find_window(wm, prev->window_id[0]); + return window_manager_find_window(wm, prev->window_list[0]); } struct window *window_manager_find_next_managed_window(struct space_manager *sm, struct window_manager *wm, struct window *window) @@ -666,7 +666,7 @@ struct window *window_manager_find_next_managed_window(struct space_manager *sm, struct window_node *next = window_node_find_next_leaf(node); if (!next) return NULL; - return window_manager_find_window(wm, next->window_id[0]); + return window_manager_find_window(wm, next->window_list[0]); } struct window *window_manager_find_first_managed_window(struct space_manager *sm, struct window_manager *wm) @@ -677,7 +677,7 @@ struct window *window_manager_find_first_managed_window(struct space_manager *sm struct window_node *first = window_node_find_first_leaf(view->root); if (!first) return NULL; - return window_manager_find_window(wm, first->window_id[0]); + return window_manager_find_window(wm, first->window_list[0]); } struct window *window_manager_find_last_managed_window(struct space_manager *sm, struct window_manager *wm) @@ -688,7 +688,7 @@ struct window *window_manager_find_last_managed_window(struct space_manager *sm, struct window_node *last = window_node_find_last_leaf(view->root); if (!last) return NULL; - return window_manager_find_window(wm, last->window_id[0]); + return window_manager_find_window(wm, last->window_list[0]); } struct window *window_manager_find_recent_managed_window(struct space_manager *sm, struct window_manager *wm) @@ -713,7 +713,7 @@ struct window *window_manager_find_largest_managed_window(struct space_manager * for (struct window_node *node = window_node_find_first_leaf(view->root); node != NULL; node = window_node_find_next_leaf(node)) { uint32_t area = node->area.w * node->area.h; if (area > best_area) { - best_id = node->window_id[0]; + best_id = node->window_list[0]; best_area = area; } } @@ -732,7 +732,7 @@ struct window *window_manager_find_smallest_managed_window(struct space_manager for (struct window_node *node = window_node_find_first_leaf(view->root); node != NULL; node = window_node_find_next_leaf(node)) { uint32_t area = node->area.w * node->area.h; if (area <= best_area) { - best_id = node->window_id[0]; + best_id = node->window_list[0]; best_area = area; } } @@ -1038,7 +1038,7 @@ enum window_op_error window_manager_set_window_insertion(struct space_manager *s } node->insert_dir = direction; - view->insertion_point = node->window_id[0]; + view->insertion_point = node->window_list[0]; insert_feedback_show(node); return WINDOW_OP_ERROR_SUCCESS; @@ -1102,16 +1102,16 @@ enum window_op_error window_manager_warp_window(struct space_manager *sm, struct a_view->insertion_point = b->id; } - uint32_t tmp_window_id[64]; + uint32_t tmp_window_list[64]; uint32_t tmp_window_count; - memcpy(tmp_window_id, a_node->window_id, sizeof(uint32_t) * a_node->window_count); + memcpy(tmp_window_list, a_node->window_list, sizeof(uint32_t) * a_node->window_count); tmp_window_count = a_node->window_count; - memcpy(a_node->window_id, b_node->window_id, sizeof(uint32_t) * b_node->window_count); + memcpy(a_node->window_list, b_node->window_list, sizeof(uint32_t) * b_node->window_count); a_node->window_count = b_node->window_count; - memcpy(b_node->window_id, tmp_window_id, sizeof(uint32_t) * tmp_window_count); + memcpy(b_node->window_list, tmp_window_list, sizeof(uint32_t) * tmp_window_count); b_node->window_count = tmp_window_count; a_node->zoom = NULL; @@ -1169,16 +1169,16 @@ enum window_op_error window_manager_swap_window(struct space_manager *sm, struct b_view->insertion_point = a->id; } - uint32_t tmp_window_id[64]; + uint32_t tmp_window_list[64]; uint32_t tmp_window_count; - memcpy(tmp_window_id, a_node->window_id, sizeof(uint32_t) * a_node->window_count); + memcpy(tmp_window_list, a_node->window_list, sizeof(uint32_t) * a_node->window_count); tmp_window_count = a_node->window_count; - memcpy(a_node->window_id, b_node->window_id, sizeof(uint32_t) * b_node->window_count); + memcpy(a_node->window_list, b_node->window_list, sizeof(uint32_t) * b_node->window_count); a_node->window_count = b_node->window_count; - memcpy(b_node->window_id, tmp_window_id, sizeof(uint32_t) * tmp_window_count); + memcpy(b_node->window_list, tmp_window_list, sizeof(uint32_t) * tmp_window_count); b_node->window_count = tmp_window_count; a_node->zoom = NULL; @@ -1186,15 +1186,15 @@ enum window_op_error window_manager_swap_window(struct space_manager *sm, struct if (a_view->sid != b_view->sid) { for (int i = 0; i < a_node->window_count; ++i) { - struct window *window = window_manager_find_window(wm, a_node->window_id[i]); - window_manager_remove_managed_window(wm, a_node->window_id[i]); + struct window *window = window_manager_find_window(wm, a_node->window_list[i]); + window_manager_remove_managed_window(wm, a_node->window_list[i]); window_manager_add_managed_window(wm, window, a_view); space_manager_move_window_to_space(a_view->sid, window); } for (int i = 0; i < b_node->window_count; ++i) { - struct window *window = window_manager_find_window(wm, b_node->window_id[i]); - window_manager_remove_managed_window(wm, b_node->window_id[i]); + struct window *window = window_manager_find_window(wm, b_node->window_list[i]); + window_manager_remove_managed_window(wm, b_node->window_list[i]); window_manager_add_managed_window(wm, window, b_view); space_manager_move_window_to_space(b_view->sid, window); }