version 1.38, 2021/10/14 13:19:01 |
version 1.39, 2021/10/20 09:50:40 |
|
|
struct cmdq_item *item; |
struct cmdq_item *item; |
int flags; |
int flags; |
enum box_lines lines; |
enum box_lines lines; |
|
char *title; |
|
|
struct screen s; |
struct screen s; |
struct colour_palette palette; |
struct colour_palette palette; |
|
|
screen_write_cursormove(&ctx, 0, 0, 0); |
screen_write_cursormove(&ctx, 0, 0, 0); |
screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx, pd->sy); |
screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx, pd->sy); |
} else if (pd->sx > 2 && pd->sy > 2) { |
} else if (pd->sx > 2 && pd->sy > 2) { |
screen_write_box(&ctx, pd->sx, pd->sy, pd->lines, &bgc); |
screen_write_box(&ctx, pd->sx, pd->sy, pd->lines, &bgc, |
|
pd->title); |
screen_write_cursormove(&ctx, 1, 1, 0); |
screen_write_cursormove(&ctx, 1, 1, 0); |
screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx - 2, |
screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx - 2, |
pd->sy - 2); |
pd->sy - 2); |
|
|
screen_free(&pd->s); |
screen_free(&pd->s); |
colour_palette_free(&pd->palette); |
colour_palette_free(&pd->palette); |
|
|
|
free(pd->title); |
free(pd); |
free(pd); |
} |
} |
|
|
|
|
int |
int |
popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px, |
popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px, |
u_int py, u_int sx, u_int sy, struct environ *env, const char *shellcmd, |
u_int py, u_int sx, u_int sy, struct environ *env, const char *shellcmd, |
int argc, char **argv, const char *cwd, struct client *c, struct session *s, |
int argc, char **argv, const char *cwd, const char *title, struct client *c, |
popup_close_cb cb, void *arg) |
struct session *s, popup_close_cb cb, void *arg) |
{ |
{ |
struct popup_data *pd; |
struct popup_data *pd; |
u_int jx, jy; |
u_int jx, jy; |
|
|
pd->item = item; |
pd->item = item; |
pd->flags = flags; |
pd->flags = flags; |
pd->lines = lines; |
pd->lines = lines; |
|
pd->title = xstrdup(title); |
|
|
pd->c = c; |
pd->c = c; |
pd->c->references++; |
pd->c->references++; |
|
|
|
|
xasprintf(&cmd, "%s %s", editor, path); |
xasprintf(&cmd, "%s %s", editor, path); |
if (popup_display(POPUP_INTERNAL|POPUP_CLOSEEXIT, BOX_LINES_DEFAULT, |
if (popup_display(POPUP_INTERNAL|POPUP_CLOSEEXIT, BOX_LINES_DEFAULT, |
NULL, px, py, sx, sy, NULL, cmd, 0, NULL, _PATH_TMP, c, NULL, |
// TODO: Helpful to use path as a title? |
|
NULL, px, py, sx, sy, NULL, cmd, 0, NULL, _PATH_TMP, NULL, c, NULL, |
popup_editor_close_cb, pe) != 0) { |
popup_editor_close_cb, pe) != 0) { |
popup_editor_free(pe); |
popup_editor_free(pe); |
free(cmd); |
free(cmd); |