feat: expose drive labels to userspace, render in Files

This commit is contained in:
2026-04-22 07:45:33 +02:00
parent 38b1f8a7ef
commit 7fa2b6c54b
20 changed files with 261 additions and 38 deletions
@@ -117,11 +117,10 @@ void filemanager_on_mouse(Window* win, MouseEvent& ev) {
if (local_y >= list_y && local_x < cw - FM_SCROLLBAR_W) {
int cols = (cw - FM_SCROLLBAR_W) / FM_GRID_CELL_W;
if (cols < 1) cols = 1;
int col = local_x / FM_GRID_CELL_W;
int row = (local_y - list_y + fm->scrollbar.scroll_offset) / FM_GRID_CELL_H;
int clicked_idx = row * cols + col;
int rel_y = local_y - list_y + fm->scrollbar.scroll_offset;
int clicked_idx = filemanager_grid_index_at(fm, cols, local_x, rel_y);
if (clicked_idx >= 0 && clicked_idx < fm->entry_count && col < cols) {
if (clicked_idx >= 0 && clicked_idx < fm->entry_count) {
uint64_t now = montauk::get_milliseconds();
if (fm->last_click_item == clicked_idx &&
@@ -179,10 +178,9 @@ void filemanager_on_mouse(Window* win, MouseEvent& ev) {
if (local_x < cw - FM_SCROLLBAR_W) {
int cols = (cw - FM_SCROLLBAR_W) / FM_GRID_CELL_W;
if (cols < 1) cols = 1;
int col = local_x / FM_GRID_CELL_W;
int row = (local_y - list_y + fm->scrollbar.scroll_offset) / FM_GRID_CELL_H;
int idx = row * cols + col;
if (idx >= 0 && idx < fm->entry_count && col < cols) {
int rel_y = local_y - list_y + fm->scrollbar.scroll_offset;
int idx = filemanager_grid_index_at(fm, cols, local_x, rel_y);
if (idx >= 0 && idx < fm->entry_count) {
target_idx = idx;
fm->selected = idx;
}