mirror of
https://github.com/tmux/tmux.git
synced 2024-12-14 02:48:47 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
6e8c93afdd
@ -47,11 +47,13 @@ const struct window_mode window_client_mode = {
|
|||||||
|
|
||||||
enum window_client_sort_type {
|
enum window_client_sort_type {
|
||||||
WINDOW_CLIENT_BY_NAME,
|
WINDOW_CLIENT_BY_NAME,
|
||||||
|
WINDOW_CLIENT_BY_SIZE,
|
||||||
WINDOW_CLIENT_BY_CREATION_TIME,
|
WINDOW_CLIENT_BY_CREATION_TIME,
|
||||||
WINDOW_CLIENT_BY_ACTIVITY_TIME,
|
WINDOW_CLIENT_BY_ACTIVITY_TIME,
|
||||||
};
|
};
|
||||||
static const char *window_client_sort_list[] = {
|
static const char *window_client_sort_list[] = {
|
||||||
"name",
|
"name",
|
||||||
|
"size",
|
||||||
"creation time",
|
"creation time",
|
||||||
"activity time"
|
"activity time"
|
||||||
};
|
};
|
||||||
@ -95,6 +97,23 @@ window_client_cmp_name(const void *a0, const void *b0)
|
|||||||
return (strcmp((*a)->c->name, (*b)->c->name));
|
return (strcmp((*a)->c->name, (*b)->c->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
window_client_cmp_size(const void *a0, const void *b0)
|
||||||
|
{
|
||||||
|
const struct window_client_itemdata *const *a = a0;
|
||||||
|
const struct window_client_itemdata *const *b = b0;
|
||||||
|
|
||||||
|
if ((*a)->c->tty.sx < (*b)->c->tty.sx)
|
||||||
|
return (-1);
|
||||||
|
if ((*a)->c->tty.sx > (*b)->c->tty.sx)
|
||||||
|
return (1);
|
||||||
|
if ((*a)->c->tty.sy < (*b)->c->tty.sy)
|
||||||
|
return (-1);
|
||||||
|
if ((*a)->c->tty.sy > (*b)->c->tty.sy)
|
||||||
|
return (1);
|
||||||
|
return (strcmp((*a)->c->name, (*b)->c->name));
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
window_client_cmp_creation_time(const void *a0, const void *b0)
|
window_client_cmp_creation_time(const void *a0, const void *b0)
|
||||||
{
|
{
|
||||||
@ -105,7 +124,7 @@ window_client_cmp_creation_time(const void *a0, const void *b0)
|
|||||||
return (-1);
|
return (-1);
|
||||||
if (timercmp(&(*a)->c->creation_time, &(*b)->c->creation_time, <))
|
if (timercmp(&(*a)->c->creation_time, &(*b)->c->creation_time, <))
|
||||||
return (1);
|
return (1);
|
||||||
return (0);
|
return (strcmp((*a)->c->name, (*b)->c->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -118,7 +137,7 @@ window_client_cmp_activity_time(const void *a0, const void *b0)
|
|||||||
return (-1);
|
return (-1);
|
||||||
if (timercmp(&(*a)->c->activity_time, &(*b)->c->activity_time, <))
|
if (timercmp(&(*a)->c->activity_time, &(*b)->c->activity_time, <))
|
||||||
return (1);
|
return (1);
|
||||||
return (0);
|
return (strcmp((*a)->c->name, (*b)->c->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -152,6 +171,10 @@ window_client_build(void *modedata, u_int sort_type, __unused uint64_t *tag)
|
|||||||
qsort(data->item_list, data->item_size, sizeof *data->item_list,
|
qsort(data->item_list, data->item_size, sizeof *data->item_list,
|
||||||
window_client_cmp_name);
|
window_client_cmp_name);
|
||||||
break;
|
break;
|
||||||
|
case WINDOW_CLIENT_BY_SIZE:
|
||||||
|
qsort(data->item_list, data->item_size, sizeof *data->item_list,
|
||||||
|
window_client_cmp_size);
|
||||||
|
break;
|
||||||
case WINDOW_CLIENT_BY_CREATION_TIME:
|
case WINDOW_CLIENT_BY_CREATION_TIME:
|
||||||
qsort(data->item_list, data->item_size, sizeof *data->item_list,
|
qsort(data->item_list, data->item_size, sizeof *data->item_list,
|
||||||
window_client_cmp_creation_time);
|
window_client_cmp_creation_time);
|
||||||
@ -169,7 +192,8 @@ window_client_build(void *modedata, u_int sort_type, __unused uint64_t *tag)
|
|||||||
tim = ctime(&c->activity_time.tv_sec);
|
tim = ctime(&c->activity_time.tv_sec);
|
||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
|
|
||||||
xasprintf(&text, "session %s (%s)", c->session->name, tim);
|
xasprintf(&text, "session %s (%ux%u, %s)", c->session->name,
|
||||||
|
c->tty.sx, c->tty.sy, tim);
|
||||||
mode_tree_add(data->data, NULL, item, (uint64_t)c, c->name,
|
mode_tree_add(data->data, NULL, item, (uint64_t)c, c->name,
|
||||||
text, -1);
|
text, -1);
|
||||||
free(text);
|
free(text);
|
||||||
|
Loading…
Reference in New Issue
Block a user