mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Add search_print_text(), a default callback for mi->print in menu_filter(). While
here, normalize the remaining search_print_* argument paramters.
This commit is contained in:
parent
89e4e7fb14
commit
a7f2ab7497
1
calmwm.h
1
calmwm.h
@ -449,6 +449,7 @@ void search_match_text(struct menu_q *, struct menu_q *,
|
|||||||
void search_print_client(struct menu *, int);
|
void search_print_client(struct menu *, int);
|
||||||
void search_print_cmd(struct menu *, int);
|
void search_print_cmd(struct menu *, int);
|
||||||
void search_print_group(struct menu *, int);
|
void search_print_group(struct menu *, int);
|
||||||
|
void search_print_text(struct menu *, int);
|
||||||
|
|
||||||
struct region_ctx *region_find(struct screen_ctx *, int, int);
|
struct region_ctx *region_find(struct screen_ctx *, int, int);
|
||||||
struct geom screen_apply_gap(struct screen_ctx *, struct geom);
|
struct geom screen_apply_gap(struct screen_ctx *, struct geom);
|
||||||
|
6
kbfunc.c
6
kbfunc.c
@ -451,7 +451,7 @@ kbfunc_menu_exec(void *ctx, union arg *arg, enum xev xev)
|
|||||||
|
|
||||||
if ((mi = menu_filter(sc, &menuq, label, NULL,
|
if ((mi = menu_filter(sc, &menuq, label, NULL,
|
||||||
(CWM_MENU_DUMMY | CWM_MENU_FILE),
|
(CWM_MENU_DUMMY | CWM_MENU_FILE),
|
||||||
search_match_exec, NULL)) != NULL) {
|
search_match_exec, search_print_text)) != NULL) {
|
||||||
if (mi->text[0] == '\0')
|
if (mi->text[0] == '\0')
|
||||||
goto out;
|
goto out;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
@ -526,7 +526,7 @@ kbfunc_menu_ssh(void *ctx, union arg *arg, enum xev xev)
|
|||||||
(void)fclose(fp);
|
(void)fclose(fp);
|
||||||
menu:
|
menu:
|
||||||
if ((mi = menu_filter(sc, &menuq, "ssh", NULL, (CWM_MENU_DUMMY),
|
if ((mi = menu_filter(sc, &menuq, "ssh", NULL, (CWM_MENU_DUMMY),
|
||||||
search_match_text, NULL)) != NULL) {
|
search_match_text, search_print_text)) != NULL) {
|
||||||
if (mi->text[0] == '\0')
|
if (mi->text[0] == '\0')
|
||||||
goto out;
|
goto out;
|
||||||
l = snprintf(path, sizeof(path), "%s -T '[ssh] %s' -e ssh %s",
|
l = snprintf(path, sizeof(path), "%s -T '[ssh] %s' -e ssh %s",
|
||||||
@ -552,7 +552,7 @@ kbfunc_menu_client_label(void *ctx, union arg *arg, enum xev xev)
|
|||||||
|
|
||||||
/* dummy is set, so this will always return */
|
/* dummy is set, so this will always return */
|
||||||
mi = menu_filter(cc->sc, &menuq, "label", cc->label, (CWM_MENU_DUMMY),
|
mi = menu_filter(cc->sc, &menuq, "label", cc->label, (CWM_MENU_DUMMY),
|
||||||
search_match_text, NULL);
|
search_match_text, search_print_text);
|
||||||
|
|
||||||
if (!mi->abort) {
|
if (!mi->abort) {
|
||||||
free(cc->label);
|
free(cc->label);
|
||||||
|
8
menu.c
8
menu.c
@ -196,7 +196,7 @@ menu_complete_path(struct menu_ctx *mc)
|
|||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
if ((mi = menu_filter(sc, &menuq, mc->searchstr, NULL,
|
if ((mi = menu_filter(sc, &menuq, mc->searchstr, NULL,
|
||||||
(CWM_MENU_DUMMY), search_match_path, NULL)) != NULL) {
|
(CWM_MENU_DUMMY), search_match_path, search_print_text)) != NULL) {
|
||||||
mr->abort = mi->abort;
|
mr->abort = mi->abort;
|
||||||
mr->dummy = mi->dummy;
|
mr->dummy = mi->dummy;
|
||||||
if (mi->text[0] != '\0')
|
if (mi->text[0] != '\0')
|
||||||
@ -366,11 +366,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(mi, resultq, resultentry) {
|
TAILQ_FOREACH(mi, resultq, resultentry) {
|
||||||
if (mc->print != NULL)
|
(*mc->print)(mi, mc->listing);
|
||||||
(*mc->print)(mi, mc->listing);
|
|
||||||
else
|
|
||||||
(void)snprintf(mi->print, sizeof(mi->print),
|
|
||||||
"%s", mi->text);
|
|
||||||
|
|
||||||
XftTextExtentsUtf8(X_Dpy, sc->xftfont,
|
XftTextExtentsUtf8(X_Dpy, sc->xftfont,
|
||||||
(const FcChar8*)mi->print,
|
(const FcChar8*)mi->print,
|
||||||
|
12
search.c
12
search.c
@ -105,7 +105,13 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
search_print_cmd(struct menu *mi, int i)
|
search_print_text(struct menu *mi, int listing)
|
||||||
|
{
|
||||||
|
(void)snprintf(mi->print, sizeof(mi->print), "%s", mi->text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
search_print_cmd(struct menu *mi, int listing)
|
||||||
{
|
{
|
||||||
struct cmd_ctx *cmd = (struct cmd_ctx *)mi->ctx;
|
struct cmd_ctx *cmd = (struct cmd_ctx *)mi->ctx;
|
||||||
|
|
||||||
@ -113,7 +119,7 @@ search_print_cmd(struct menu *mi, int i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
search_print_group(struct menu *mi, int i)
|
search_print_group(struct menu *mi, int listing)
|
||||||
{
|
{
|
||||||
struct group_ctx *gc = (struct group_ctx *)mi->ctx;
|
struct group_ctx *gc = (struct group_ctx *)mi->ctx;
|
||||||
|
|
||||||
@ -123,7 +129,7 @@ search_print_group(struct menu *mi, int i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
search_print_client(struct menu *mi, int list)
|
search_print_client(struct menu *mi, int listing)
|
||||||
{
|
{
|
||||||
struct client_ctx *cc = (struct client_ctx *)mi->ctx;
|
struct client_ctx *cc = (struct client_ctx *)mi->ctx;
|
||||||
char flag = ' ';
|
char flag = ' ';
|
||||||
|
Loading…
Reference in New Issue
Block a user