diff options
author | pommicket <pommicket@gmail.com> | 2023-08-06 14:07:53 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-06 14:07:53 -0400 |
commit | 52da64686fb506372fa09ab562915f895cd88cb9 (patch) | |
tree | 24c2ca40227ddc0ad92adced2432930d4beed729 /ide-autocomplete.c | |
parent | b4e2b3d2407cbad54169da707f72595246e4794a (diff) |
util cleanup
Diffstat (limited to 'ide-autocomplete.c')
-rw-r--r-- | ide-autocomplete.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/ide-autocomplete.c b/ide-autocomplete.c index ec6c83f..42183ff 100644 --- a/ide-autocomplete.c +++ b/ide-autocomplete.c @@ -610,7 +610,7 @@ void autocomplete_frame(Ted *ted) { else start_y += char_height; // put menu below cursor { - Rect menu_rect = rect(Vec2(x, start_y), Vec2(menu_width, menu_height)); + Rect menu_rect = rect_xywh(x, start_y, menu_width, menu_height); gl_geometry_rect(menu_rect, colors[COLOR_AUTOCOMPLETE_BG]); gl_geometry_rect_border(menu_rect, 1, colors[COLOR_AUTOCOMPLETE_BORDER]); ac->rect = menu_rect; @@ -622,7 +622,7 @@ void autocomplete_frame(Ted *ted) { if (ncompletions) { assert(ac->cursor >= 0 && ac->cursor < (i32)ncompletions); // highlight cursor entry - Rect r = rect(Vec2(x, start_y + (float)(ac->cursor - scroll) * char_height), Vec2(menu_width, char_height)); + Rect r = rect_xywh(x, start_y + (float)(ac->cursor - scroll) * char_height, menu_width, char_height); if (rect_contains_point(ac->rect, rect_center(r))) { gl_geometry_rect(r, colors[COLOR_AUTOCOMPLETE_HL]); document = &ac->completions[ac->suggested[ac->cursor]]; @@ -631,7 +631,7 @@ void autocomplete_frame(Ted *ted) { if (mouse_entry >= 0 && mouse_entry < (i32)ncompletions && rect_contains_point(ac->rect, ted->mouse_pos)) { // highlight moused over entry - Rect r = rect(Vec2(x, start_y + (float)(mouse_entry - scroll) * char_height), Vec2(menu_width, char_height)); + Rect r = rect_xywh(x, start_y + (float)(mouse_entry - scroll) * char_height, menu_width, char_height); gl_geometry_rect(r, colors[COLOR_AUTOCOMPLETE_HL]); ted->cursor = ted->cursor_hand; document = &ac->completions[ac->suggested[mouse_entry]]; @@ -656,7 +656,7 @@ void autocomplete_frame(Ted *ted) { float doc_x = open_left ? ac->rect.pos.x - doc_width - padding : ac->rect.pos.x + ac->rect.size.x + padding; float doc_y = ac->rect.pos.y; - Rect r = rect(Vec2(doc_x, doc_y), Vec2(doc_width, doc_height)); + Rect r = rect_xywh(doc_x, doc_y, doc_width, doc_height); gl_geometry_rect(r, colors[COLOR_AUTOCOMPLETE_BG]); gl_geometry_rect_border(r, border_thickness, colors[COLOR_AUTOCOMPLETE_BORDER]); @@ -699,8 +699,8 @@ void autocomplete_frame(Ted *ted) { state.x = x; state.y = y; if (i != ncompletions_visible-1) { - gl_geometry_rect(rect(Vec2(x, y + char_height), - Vec2(menu_width, border_thickness)), + gl_geometry_rect(rect_xywh(x, y + char_height, + menu_width, border_thickness), colors[COLOR_AUTOCOMPLETE_BORDER]); } @@ -715,7 +715,7 @@ void autocomplete_frame(Ted *ted) { state.x += padding; text_utf8_with_state(font, &state, icon_text); state.x += padding; - gl_geometry_rect(rect(Vec2((float)state.x, (float)state.y), Vec2(border_thickness, char_height)), + gl_geometry_rect(rect_xywh((float)state.x, (float)state.y, border_thickness, char_height), colors[COLOR_AUTOCOMPLETE_BORDER]); state.x += padding; @@ -753,9 +753,13 @@ void autocomplete_frame(Ted *ted) { } if (completion->deprecated) { - gl_geometry_rect(rect(Vec2(label_x, y + (char_height - border_thickness) * 0.5f), - Vec2((float)state.x - label_x, 1)), - colors[label_color]); + gl_geometry_rect( + rect_xywh( + label_x, y + (char_height - border_thickness) * 0.5f, + (float)state.x - label_x, 1 + ), + colors[label_color] + ); } y += char_height; |