version 1.18, 2017/11/03 14:23:44 |
version 1.19, 2017/11/03 17:02:33 |
|
|
} |
} |
} |
} |
|
|
static void |
|
mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag) |
|
{ |
|
u_int i; |
|
|
|
for (i = 0; i < mtd->line_size; i++) { |
|
if (mtd->line_list[i].item->tag == tag) |
|
break; |
|
} |
|
if (i != mtd->line_size) { |
|
mtd->current = i; |
|
if (mtd->current > mtd->height - 1) |
|
mtd->offset = mtd->current - mtd->height + 1; |
|
else |
|
mtd->offset = 0; |
|
} else { |
|
mtd->current = 0; |
|
mtd->offset = 0; |
|
} |
|
} |
|
|
|
void |
void |
mode_tree_up(struct mode_tree_data *mtd, int wrap) |
mode_tree_up(struct mode_tree_data *mtd, int wrap) |
{ |
{ |
|
|
return (mtd->line_list[mtd->current].item->itemdata); |
return (mtd->line_list[mtd->current].item->itemdata); |
} |
} |
|
|
|
void |
|
mode_tree_expand_current(struct mode_tree_data *mtd) |
|
{ |
|
if (!mtd->line_list[mtd->current].item->expanded) { |
|
mtd->line_list[mtd->current].item->expanded = 1; |
|
mode_tree_build(mtd); |
|
} |
|
} |
|
|
|
void |
|
mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag) |
|
{ |
|
u_int i; |
|
|
|
for (i = 0; i < mtd->line_size; i++) { |
|
if (mtd->line_list[i].item->tag == tag) |
|
break; |
|
} |
|
if (i != mtd->line_size) { |
|
mtd->current = i; |
|
if (mtd->current > mtd->height - 1) |
|
mtd->offset = mtd->current - mtd->height + 1; |
|
else |
|
mtd->offset = 0; |
|
} else { |
|
mtd->current = 0; |
|
mtd->offset = 0; |
|
} |
|
} |
|
|
u_int |
u_int |
mode_tree_count_tagged(struct mode_tree_data *mtd) |
mode_tree_count_tagged(struct mode_tree_data *mtd) |
{ |
{ |
|
|
|
|
int |
int |
mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key, |
mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key, |
struct mouse_event *m) |
struct mouse_event *m, u_int *xp, u_int *yp) |
{ |
{ |
struct mode_tree_line *line; |
struct mode_tree_line *line; |
struct mode_tree_item *current, *parent; |
struct mode_tree_item *current, *parent; |
|
|
*key = KEYC_NONE; |
*key = KEYC_NONE; |
return (0); |
return (0); |
} |
} |
|
if (xp != NULL) |
|
*xp = x; |
|
if (yp != NULL) |
|
*yp = y; |
if (x > mtd->width || y > mtd->height) { |
if (x > mtd->width || y > mtd->height) { |
*key = KEYC_NONE; |
if (!mtd->preview || y < mtd->height) |
|
*key = KEYC_NONE; |
return (0); |
return (0); |
} |
} |
if (mtd->offset + y < mtd->line_size) { |
if (mtd->offset + y < mtd->line_size) { |