Mon May 13 19:18:46 2002 Michael Jennings (mej)
Fixed indentation. SVN revision: 6252
This commit is contained in:
parent
0bdd7edc63
commit
b173e4053d
|
@ -4647,3 +4647,7 @@ Mon May 13 18:46:06 2002 Michael Jennings (mej)
|
||||||
|
|
||||||
Latest Escreen patch from Azundris <hacks@azundris.com>.
|
Latest Escreen patch from Azundris <hacks@azundris.com>.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
Mon May 13 19:18:46 2002 Michael Jennings (mej)
|
||||||
|
|
||||||
|
Fixed indentation.
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
|
@ -60,11 +60,11 @@ action_handle_echo(event_t *ev, action_t *action)
|
||||||
USE_VAR(ev);
|
USE_VAR(ev);
|
||||||
REQUIRE_RVAL(action->param.string != NULL, 0);
|
REQUIRE_RVAL(action->param.string != NULL, 0);
|
||||||
#ifdef ESCREEN
|
#ifdef ESCREEN
|
||||||
if(TermWin.screen_mode&&TermWin.screen) /* translate escapes */
|
if (TermWin.screen_mode && TermWin.screen) /* translate escapes */
|
||||||
ns_screen_command(TermWin.screen,action->param.string);
|
ns_screen_command(TermWin.screen, action->param.string);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
tt_write((unsigned char *) action->param.string, strlen(action->param.string));
|
tt_write((unsigned char *) action->param.string, strlen(action->param.string));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
149
src/buttons.c
149
src/buttons.c
|
@ -787,36 +787,39 @@ button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Ti
|
||||||
case ACTION_ECHO:
|
case ACTION_ECHO:
|
||||||
if (!press) {
|
if (!press) {
|
||||||
#ifdef ESCREEN
|
#ifdef ESCREEN
|
||||||
if(TermWin.screen_mode&&TermWin.screen) { /* translate escapes */
|
if (TermWin.screen_mode && TermWin.screen) { /* translate escapes */
|
||||||
if(prvs!=1) {
|
if (prvs != 1) {
|
||||||
button_t *b=bbar->buttons;
|
button_t *b = bbar->buttons;
|
||||||
_ns_disp *d2=TermWin.screen->dsps;
|
_ns_disp *d2 = TermWin.screen->dsps;
|
||||||
int n=(button->action.string)[1]-'0';
|
int n = (button->action.string)[1] - '0';
|
||||||
|
|
||||||
while(b&&!(b->flags&NS_SCREAM_CURR)) /* find active disp */
|
while (b && !(b->flags & NS_SCREAM_CURR)) /* find active disp */
|
||||||
b=b->next; /* when trying to change name of non- */
|
b = b->next; /* when trying to change name of non- */
|
||||||
if(b&&b!=button) { /* active display, make that disp active */
|
if (b && b != button) { /* active display, make that disp active */
|
||||||
button->flags|=NS_SCREAM_CURR; b->flags&=~NS_SCREAM_CURR;
|
button->flags |= NS_SCREAM_CURR;
|
||||||
bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK);
|
b->flags &= ~NS_SCREAM_CURR;
|
||||||
button->flags&=~NS_SCREAM_CURR; b->flags|=NS_SCREAM_CURR;
|
bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK);
|
||||||
|
button->flags &= ~NS_SCREAM_CURR;
|
||||||
|
b->flags |= NS_SCREAM_CURR;
|
||||||
|
|
||||||
while(d2 && d2->index != n)
|
while (d2 && d2->index != n)
|
||||||
d2 = d2->next;
|
d2 = d2->next;
|
||||||
if(d2)
|
if (d2)
|
||||||
TermWin.screen->curr=d2; /* pre-adjust curr ptr */
|
TermWin.screen->curr = d2; /* pre-adjust curr ptr */
|
||||||
else
|
else
|
||||||
fprintf(stderr,NS_PREFIX "button_check_action: no display %d in this session : (\n",n);
|
fprintf(stderr, NS_PREFIX "button_check_action: no display %d in this session : (\n", n);
|
||||||
(void)ns_screen_command(TermWin.screen,button->action.string); }
|
(void) ns_screen_command(TermWin.screen, button->action.string);
|
||||||
|
}
|
||||||
|
|
||||||
if(prvs==2) /* middle button -- kill */
|
if (prvs == 2) /* middle button -- kill */
|
||||||
(void)ns_parse_screen_key(TermWin.screen,NS_SCREEN_KILL);
|
(void) ns_parse_screen_key(TermWin.screen, NS_SCREEN_KILL);
|
||||||
else /* right button -- rename */
|
else /* right button -- rename */
|
||||||
(void)ns_parse_screen_key(TermWin.screen,NS_SCREEN_RENAME); }
|
(void) ns_parse_screen_key(TermWin.screen, NS_SCREEN_RENAME);
|
||||||
else /* left button -- select */
|
} else /* left button -- select */
|
||||||
(void)ns_screen_command(TermWin.screen,button->action.string); }
|
(void) ns_screen_command(TermWin.screen, button->action.string);
|
||||||
else /* not in screen-mode, use normal facilities */
|
} else /* not in screen-mode, use normal facilities */
|
||||||
#endif
|
#endif
|
||||||
tt_write((unsigned char *) button->action.string, strlen(button->action.string));
|
tt_write((unsigned char *) button->action.string, strlen(button->action.string));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_SCRIPT:
|
case ACTION_SCRIPT:
|
||||||
|
@ -827,7 +830,7 @@ button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Ti
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prvs=press;
|
prvs = press;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char
|
unsigned char
|
||||||
|
@ -942,7 +945,7 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode
|
||||||
gcvalue.foreground = PixColors[button->flags + 2];
|
gcvalue.foreground = PixColors[button->flags + 2];
|
||||||
gcvalue.font = bbar->font->fid;
|
gcvalue.font = bbar->font->fid;
|
||||||
|
|
||||||
if(button->flags&&(gc=LIBAST_X_CREATE_GC(GCForeground | GCFont, &gcvalue))) {
|
if (button->flags && (gc = LIBAST_X_CREATE_GC(GCForeground | GCFont, &gcvalue))) {
|
||||||
draw_string(bbar, bbar->bg, gc, button->text_x, button->text_y, button->text, button->len);
|
draw_string(bbar, bbar->bg, gc, button->text_x, button->text_y, button->text, button->len);
|
||||||
XFreeGC(Xdisplay, gc);
|
XFreeGC(Xdisplay, gc);
|
||||||
} else
|
} else
|
||||||
|
@ -1073,8 +1076,7 @@ bbar_redraw(buttonbar_t *bbar)
|
||||||
addright add to rbuttons instead of buttons
|
addright add to rbuttons instead of buttons
|
||||||
<- NULL, or the bar */
|
<- NULL, or the bar */
|
||||||
|
|
||||||
buttonbar_t *
|
buttonbar_t *bbar_insert_button(buttonbar_t *bbar, button_t *button, int after, int addright)
|
||||||
bbar_insert_button(buttonbar_t *bbar, button_t *button, int after, int addright)
|
|
||||||
{
|
{
|
||||||
int state = 1;
|
int state = 1;
|
||||||
|
|
||||||
|
@ -1083,46 +1085,46 @@ bbar_insert_button(buttonbar_t *bbar, button_t *button, int after, int addright)
|
||||||
fprintf(stderr, "ins_disp: failed to create button-bar...\n");
|
fprintf(stderr, "ins_disp: failed to create button-bar...\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
bbar->next=NULL;
|
bbar->next = NULL;
|
||||||
bbar_set_font(bbar, "-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1");
|
bbar_set_font(bbar, "-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1");
|
||||||
bbar_set_docked(bbar, BBAR_DOCKED_TOP);
|
bbar_set_docked(bbar, BBAR_DOCKED_TOP);
|
||||||
}
|
}
|
||||||
state = 0;
|
state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addright) { /* add to rbuttons */
|
if (addright) { /* add to rbuttons */
|
||||||
if (!bbar->rbuttons) { /* first button */
|
if (!bbar->rbuttons) { /* first button */
|
||||||
button->next = NULL;
|
button->next = NULL;
|
||||||
bbar->rbuttons = button;
|
bbar->rbuttons = button;
|
||||||
} else {
|
} else {
|
||||||
int c=0;
|
int c = 0;
|
||||||
button_t *b = bbar->rbuttons;
|
button_t *b = bbar->rbuttons;
|
||||||
do {
|
do {
|
||||||
c++;
|
c++;
|
||||||
} while((b=b->next));
|
} while ((b = b->next));
|
||||||
if(after>=(c-1)) {
|
if (after >= (c - 1)) {
|
||||||
button->next=bbar->rbuttons;
|
button->next = bbar->rbuttons;
|
||||||
bbar->rbuttons=button; }
|
bbar->rbuttons = button;
|
||||||
else {
|
} else {
|
||||||
b = bbar->rbuttons;
|
b = bbar->rbuttons;
|
||||||
after=c-after-2;
|
after = c - after - 2;
|
||||||
while (after-- > 0 && b->next)
|
while (after-- > 0 && b->next)
|
||||||
b = b->next;
|
b = b->next;
|
||||||
button->next = b->next;
|
button->next = b->next;
|
||||||
b->next = button; }
|
b->next = button;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* add to buttons */
|
} else { /* add to buttons */
|
||||||
if (!bbar->buttons || after < 0) { /* first button */
|
if (!bbar->buttons || after < 0) { /* first button */
|
||||||
button->next = bbar->buttons;
|
button->next = bbar->buttons;
|
||||||
bbar->buttons = button;
|
bbar->buttons = button;
|
||||||
} else {
|
} else {
|
||||||
button_t *b = bbar->buttons;
|
button_t *b = bbar->buttons;
|
||||||
while (after-- > 0 && b->next)
|
while (after-- > 0 && b->next)
|
||||||
b = b->next;
|
b = b->next;
|
||||||
button->next = b->next;
|
button->next = b->next;
|
||||||
b->next = button;
|
b->next = button;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bbar->current = button;
|
bbar->current = button;
|
||||||
|
@ -1130,17 +1132,16 @@ bbar_insert_button(buttonbar_t *bbar, button_t *button, int after, int addright)
|
||||||
/* add to list of bbars so bbar_event_init_dispatcher() won't break */
|
/* add to list of bbars so bbar_event_init_dispatcher() won't break */
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
if(buttonbar) {
|
if (buttonbar) {
|
||||||
buttonbar_t *bar=buttonbar;
|
buttonbar_t *bar = buttonbar;
|
||||||
while(bar->next)
|
while (bar->next)
|
||||||
bar=bar->next;
|
bar = bar->next;
|
||||||
bar->next=bbar;
|
bar->next = bbar;
|
||||||
}
|
} else
|
||||||
else
|
buttonbar = bbar;
|
||||||
buttonbar=bbar;
|
|
||||||
|
|
||||||
bbar_init(bbar, TermWin.width);
|
bbar_init(bbar, TermWin.width);
|
||||||
bbar_add(bbar);
|
bbar_add(bbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
bbar_redraw(bbar);
|
bbar_redraw(bbar);
|
||||||
|
|
161
src/command.c
161
src/command.c
|
@ -1131,8 +1131,7 @@ clean_exit(void)
|
||||||
font_cache_clear();
|
font_cache_clear();
|
||||||
eterm_font_list_clear();
|
eterm_font_list_clear();
|
||||||
# ifdef PIXMAP_SUPPORT
|
# ifdef PIXMAP_SUPPORT
|
||||||
FOREACH_IMAGE(free_eterm_image(&(images[idx]));
|
FOREACH_IMAGE(free_eterm_image(&(images[idx])););
|
||||||
);
|
|
||||||
# endif
|
# endif
|
||||||
for (i = 0; i < NRS_COLORS; i++) {
|
for (i = 0; i < NRS_COLORS; i++) {
|
||||||
if (rs_color[i]) {
|
if (rs_color[i]) {
|
||||||
|
@ -2107,7 +2106,7 @@ run_command(char **argv)
|
||||||
char **a = argv;
|
char **a = argv;
|
||||||
if (a) {
|
if (a) {
|
||||||
while (*a) {
|
while (*a) {
|
||||||
fprintf(stderr, NS_PREFIX "run_command: %s\n",*a);
|
fprintf(stderr, NS_PREFIX "run_command: %s\n", *a);
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2335,20 +2334,22 @@ redraw_xywh(void *xd, int x, int y, int w, int h)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
button_t *screen_button_create(char *text,char code) {
|
button_t *screen_button_create(char *text, char code)
|
||||||
button_t *b;
|
{
|
||||||
char p[3];
|
button_t *b;
|
||||||
|
char p[3];
|
||||||
|
|
||||||
if(!text||!*text||!(b=button_create(text)))
|
if (!text || !*text || !(b = button_create(text)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p[0]=NS_SCREEN_ESCAPE;
|
p[0] = NS_SCREEN_ESCAPE;
|
||||||
p[1]=code;
|
p[1] = code;
|
||||||
p[2]='\0';
|
p[2] = '\0';
|
||||||
|
|
||||||
button_set_action(b, ACTION_ECHO, p);
|
button_set_action(b, ACTION_ECHO, p);
|
||||||
|
|
||||||
return b; }
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2361,20 +2362,21 @@ ins_disp(void *xd, int after, char *name)
|
||||||
buttonbar_t *bbar;
|
buttonbar_t *bbar;
|
||||||
button_t *button;
|
button_t *button;
|
||||||
|
|
||||||
if(!xd||!name||!*name)
|
if (!xd || !name || !*name)
|
||||||
return NS_FAIL;
|
return NS_FAIL;
|
||||||
bbar = *((buttonbar_t **) xd);
|
bbar = *((buttonbar_t **) xd);
|
||||||
|
|
||||||
if(!(button=screen_button_create(name,'0' + after + 1)))
|
if (!(button = screen_button_create(name, '0' + after + 1)))
|
||||||
return NS_FAIL;
|
return NS_FAIL;
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
fprintf(stderr, NS_PREFIX "ins_disp: %s after %d...\n", name, after);
|
fprintf(stderr, NS_PREFIX "ins_disp: %s after %d...\n", name, after);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if((bbar=bbar_insert_button(bbar,button,after,FALSE))) {
|
if ((bbar = bbar_insert_button(bbar, button, after, FALSE))) {
|
||||||
*((buttonbar_t **) xd) = bbar;
|
*((buttonbar_t **) xd) = bbar;
|
||||||
return NS_SUCC; }
|
return NS_SUCC;
|
||||||
|
}
|
||||||
|
|
||||||
button_free(button);
|
button_free(button);
|
||||||
return NS_FAIL;
|
return NS_FAIL;
|
||||||
|
@ -2387,21 +2389,22 @@ ins_disp(void *xd, int after, char *name)
|
||||||
if our user's configured a bbar, we'll add to that,
|
if our user's configured a bbar, we'll add to that,
|
||||||
otherwise, we'll create one. */
|
otherwise, we'll create one. */
|
||||||
int
|
int
|
||||||
add_screen_ctl_button(buttonbar_t **xd,char *name,char key)
|
add_screen_ctl_button(buttonbar_t **xd, char *name, char key)
|
||||||
{
|
{
|
||||||
buttonbar_t *bbar;
|
buttonbar_t *bbar;
|
||||||
button_t *button;
|
button_t *button;
|
||||||
|
|
||||||
if(!xd||!name||!*name)
|
if (!xd || !name || !*name)
|
||||||
return NS_FAIL;
|
return NS_FAIL;
|
||||||
bbar = *xd;
|
bbar = *xd;
|
||||||
|
|
||||||
if(!(button=screen_button_create(name,key)))
|
if (!(button = screen_button_create(name, key)))
|
||||||
return NS_FAIL;
|
return NS_FAIL;
|
||||||
|
|
||||||
if((bbar=bbar_insert_button(bbar,button,-1,TRUE))) {
|
if ((bbar = bbar_insert_button(bbar, button, -1, TRUE))) {
|
||||||
*xd = bbar;
|
*xd = bbar;
|
||||||
return NS_SUCC; }
|
return NS_SUCC;
|
||||||
|
}
|
||||||
|
|
||||||
button_free(button);
|
button_free(button);
|
||||||
return NS_FAIL;
|
return NS_FAIL;
|
||||||
|
@ -2504,8 +2507,8 @@ upd_disp(void *xd, int n, int flags, char *name)
|
||||||
int
|
int
|
||||||
err_msg(void *xd, int err, char *msg)
|
err_msg(void *xd, int err, char *msg)
|
||||||
{
|
{
|
||||||
if(strlen(msg))
|
if (strlen(msg))
|
||||||
menu_dial(NULL,msg,0,NULL,NULL);
|
menu_dial(NULL, msg, 0, NULL, NULL);
|
||||||
return NS_SUCC;
|
return NS_SUCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2523,16 +2526,17 @@ inp_text(void *xd, int id, char *txt)
|
||||||
|
|
||||||
/* open a dialog */
|
/* open a dialog */
|
||||||
int
|
int
|
||||||
inp_dial(void *xd, char *prompt, int maxlen, char **retstr,
|
inp_dial(void *xd, char *prompt, int maxlen, char **retstr, int (*inp_tab) (void *, char *, size_t, size_t))
|
||||||
int (*inp_tab)(void *,char *,size_t,size_t))
|
|
||||||
{
|
{
|
||||||
switch(menu_dial(xd, prompt, maxlen, retstr,inp_tab)) {
|
switch (menu_dial(xd, prompt, maxlen, retstr, inp_tab)) {
|
||||||
case 0:
|
case 0:
|
||||||
return NS_SUCC;
|
return NS_SUCC;
|
||||||
case -2:
|
case -2:
|
||||||
return NS_USER_CXL;
|
return NS_USER_CXL;
|
||||||
default:
|
default:
|
||||||
return NS_FAIL; }}
|
return NS_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2606,56 +2610,65 @@ init_command(char **argv)
|
||||||
if (!TermWin.screen_mode)
|
if (!TermWin.screen_mode)
|
||||||
cmd_fd = run_command(argv);
|
cmd_fd = run_command(argv);
|
||||||
else if ((TermWin.screen = ns_attach_by_URL(rs_url, rs_hop, &efuns, &ns_err, (void *) &buttonbar))) {
|
else if ((TermWin.screen = ns_attach_by_URL(rs_url, rs_hop, &efuns, &ns_err, (void *) &buttonbar))) {
|
||||||
button_t *button;
|
button_t *button;
|
||||||
menu_t *m;
|
menu_t *m;
|
||||||
menuitem_t *i;
|
menuitem_t *i;
|
||||||
if((m=menu_create(NS_MENU_TITLE))) {
|
if ((m = menu_create(NS_MENU_TITLE))) {
|
||||||
char *sc[]={ "New", "\x01\x03", "Close", "\x01k" };
|
char *sc[] = { "New", "\x01\x03", "Close", "\x01k" };
|
||||||
int n,nsc=sizeof(sc)/sizeof(char *);
|
int n, nsc = sizeof(sc) / sizeof(char *);
|
||||||
|
|
||||||
if(menu_list) {
|
if (menu_list) {
|
||||||
for(n=0;n<menu_list->nummenus;n++) { /* blend in w/ l&f */
|
for (n = 0; n < menu_list->nummenus; n++) { /* blend in w/ l&f */
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
fprintf(stderr,NS_PREFIX "font: %d: %p\n",n,menu_list->menus[n]->font);
|
fprintf(stderr, NS_PREFIX "font: %d: %p\n", n, menu_list->menus[n]->font);
|
||||||
#endif
|
#endif
|
||||||
if(menu_list->menus[n]->font) {
|
if (menu_list->menus[n]->font) {
|
||||||
m->font =menu_list->menus[n]->font;
|
m->font = menu_list->menus[n]->font;
|
||||||
m->fwidth =menu_list->menus[n]->fwidth;
|
m->fwidth = menu_list->menus[n]->fwidth;
|
||||||
m->fheight=menu_list->menus[n]->fheight;
|
m->fheight = menu_list->menus[n]->fheight;
|
||||||
#ifdef MULTI_CHARSET
|
#ifdef MULTI_CHARSET
|
||||||
m->fontset=menu_list->menus[n]->fontset;
|
m->fontset = menu_list->menus[n]->fontset;
|
||||||
#endif
|
#endif
|
||||||
break; }}}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(n=0;n<(nsc-1);n+=2) {
|
for (n = 0; n < (nsc - 1); n += 2) {
|
||||||
if((i=menuitem_create(sc[n]))) {
|
if ((i = menuitem_create(sc[n]))) {
|
||||||
# ifdef NS_DEBUG
|
# ifdef NS_DEBUG
|
||||||
fprintf(stderr, NS_PREFIX "register %s (%d)\n",&sc[n+1][1],*sc[n+1]);
|
fprintf(stderr, NS_PREFIX "register %s (%d)\n", &sc[n + 1][1], *sc[n + 1]);
|
||||||
# endif
|
# endif
|
||||||
menuitem_set_action(i,MENUITEM_ECHO,sc[n+1]);
|
menuitem_set_action(i, MENUITEM_ECHO, sc[n + 1]);
|
||||||
menu_add_item(m,i); }}
|
menu_add_item(m, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if((i=menuitem_create("About..."))) {
|
if ((i = menuitem_create("About..."))) {
|
||||||
menuitem_set_action(i,MENUITEM_ALERT,"Screen compatibility layer by Azundris <scream@azundris.com>");
|
menuitem_set_action(i, MENUITEM_ALERT, "Screen compatibility layer by Azundris <scream@azundris.com>");
|
||||||
menu_add_item(m,i); }
|
menu_add_item(m, i);
|
||||||
|
}
|
||||||
|
|
||||||
if((button=button_create(NS_MENU_TITLE))) {
|
if ((button = button_create(NS_MENU_TITLE))) {
|
||||||
if(!(buttonbar=bbar_insert_button(buttonbar,button,-1,TRUE))) {
|
if (!(buttonbar = bbar_insert_button(buttonbar, button, -1, TRUE))) {
|
||||||
m->font=NULL;
|
m->font = NULL;
|
||||||
#ifdef MULTI_CHARSET
|
#ifdef MULTI_CHARSET
|
||||||
m->fontset=NULL;
|
m->fontset = NULL;
|
||||||
#endif
|
#endif
|
||||||
menu_delete(m);
|
menu_delete(m);
|
||||||
button_set_action(button,ACTION_STRING,NS_MENU_TITLE);
|
button_set_action(button, ACTION_STRING, NS_MENU_TITLE);
|
||||||
button_free(button); }
|
button_free(button);
|
||||||
else {
|
} else {
|
||||||
int j,k=menu_list?menu_list->nummenus:0;
|
int j, k = menu_list ? menu_list->nummenus : 0;
|
||||||
menu_list=menulist_add_menu(menu_list,m);
|
menu_list = menulist_add_menu(menu_list, m);
|
||||||
for (j=k;j<menu_list->nummenus;j++)
|
for (j = k; j < menu_list->nummenus; j++)
|
||||||
event_data_add_mywin(&menu_event_data,menu_list->menus[j]->win);
|
event_data_add_mywin(&menu_event_data, menu_list->menus[j]->win);
|
||||||
if(!k)
|
if (!k)
|
||||||
menu_init();
|
menu_init();
|
||||||
button_set_action(button,ACTION_MENU,NS_MENU_TITLE); }}}
|
button_set_action(button, ACTION_MENU, NS_MENU_TITLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/* add_screen_ctl_button(&buttonbar,"New",'c'); */
|
/* add_screen_ctl_button(&buttonbar,"New",'c'); */
|
||||||
cmd_fd = TermWin.screen->fd;
|
cmd_fd = TermWin.screen->fd;
|
||||||
}
|
}
|
||||||
|
|
1109
src/libscream.c
1109
src/libscream.c
File diff suppressed because it is too large
Load Diff
248
src/menus.c
248
src/menus.c
|
@ -1218,31 +1218,31 @@ menu_action(menuitem_t *item)
|
||||||
break;
|
break;
|
||||||
case MENUITEM_ECHO:
|
case MENUITEM_ECHO:
|
||||||
#ifdef ESCREEN
|
#ifdef ESCREEN
|
||||||
if(TermWin.screen_mode&&TermWin.screen) { /* translate escapes */
|
if (TermWin.screen_mode && TermWin.screen) { /* translate escapes */
|
||||||
# ifdef NS_DEBUG
|
# ifdef NS_DEBUG
|
||||||
{
|
{
|
||||||
char *p=item->action.string;
|
char *p = item->action.string;
|
||||||
fprintf(stderr,NS_PREFIX "::menu_action: ");
|
fprintf(stderr, NS_PREFIX "::menu_action: ");
|
||||||
while(*p) {
|
while (*p) {
|
||||||
if(*p<' ')
|
if (*p < ' ')
|
||||||
fprintf(stderr,"^%c",*p-1+'A');
|
fprintf(stderr, "^%c", *p - 1 + 'A');
|
||||||
else
|
else
|
||||||
fprintf(stderr,"%c",*p);
|
fprintf(stderr, "%c", *p);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
fputs("\n",stderr);
|
fputs("\n", stderr);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
(void)ns_screen_command(TermWin.screen,item->action.string); }
|
(void) ns_screen_command(TermWin.screen, item->action.string);
|
||||||
else
|
} else
|
||||||
#endif
|
#endif
|
||||||
tt_write((unsigned char *) item->action.string, strlen(item->action.string));
|
tt_write((unsigned char *) item->action.string, strlen(item->action.string));
|
||||||
break;
|
break;
|
||||||
case MENUITEM_SCRIPT:
|
case MENUITEM_SCRIPT:
|
||||||
script_parse((char *) item->action.script);
|
script_parse((char *) item->action.script);
|
||||||
break;
|
break;
|
||||||
case MENUITEM_ALERT:
|
case MENUITEM_ALERT:
|
||||||
menu_dial(NULL,item->action.alert,0,NULL,NULL);
|
menu_dial(NULL, item->action.alert, 0, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type);
|
fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type);
|
||||||
|
@ -1294,23 +1294,30 @@ menu_invoke_by_title(int x, int y, Window win, char *title, Time timestamp)
|
||||||
<- error code */
|
<- error code */
|
||||||
|
|
||||||
int
|
int
|
||||||
menu_tab(void *xd,char *sc[],int nsc,char *b,size_t l,size_t m) {
|
menu_tab(void *xd, char *sc[], int nsc, char *b, size_t l, size_t m)
|
||||||
int n,n2=0;
|
{
|
||||||
|
int n, n2 = 0;
|
||||||
|
|
||||||
for(n=0;n<nsc;n++) { /* second tab? cycle. */
|
for (n = 0; n < nsc; n++) { /* second tab? cycle. */
|
||||||
if((!strcasecmp(b,sc[n]))&&(n<nsc-1)&&!strncasecmp(b,sc[n+1],l)) {
|
if ((!strcasecmp(b, sc[n])) && (n < nsc - 1) && !strncasecmp(b, sc[n + 1], l)) {
|
||||||
n2=n+1;
|
n2 = n + 1;
|
||||||
break; }}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(n=n2;n<nsc;n++) {
|
for (n = n2; n < nsc; n++) {
|
||||||
if(!strncasecmp(b,sc[n],l)) {
|
if (!strncasecmp(b, sc[n], l)) {
|
||||||
if(strcmp(b,sc[n])) {
|
if (strcmp(b, sc[n])) {
|
||||||
if(strlen(sc[n])>=m) /* buffer would overflow => fail */
|
if (strlen(sc[n]) >= m) /* buffer would overflow => fail */
|
||||||
return -1;
|
return -1;
|
||||||
strcpy(b,sc[n]);
|
strcpy(b, sc[n]);
|
||||||
return 0; }}}
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -1; }
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* open a dialog. this is a bit of a hack and should really resize otf.
|
/* open a dialog. this is a bit of a hack and should really resize otf.
|
||||||
xd extra-data (userdef) for inp_tab
|
xd extra-data (userdef) for inp_tab
|
||||||
|
@ -1325,113 +1332,116 @@ menu_tab(void *xd,char *sc[],int nsc,char *b,size_t l,size_t m) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
menu_dial(void *xd, char *prompt, int maxlen, char **retstr,int (*inp_tab)(void *,char *,size_t,size_t))
|
menu_dial(void *xd, char *prompt, int maxlen, char **retstr, int (*inp_tab) (void *, char *, size_t, size_t))
|
||||||
{
|
{
|
||||||
static unsigned char short_buf[256];
|
static unsigned char short_buf[256];
|
||||||
unsigned char *kbuf = short_buf;
|
unsigned char *kbuf = short_buf;
|
||||||
menu_t *m;
|
menu_t *m;
|
||||||
menuitem_t *i;
|
menuitem_t *i;
|
||||||
register int ch;
|
register int ch;
|
||||||
int f=0,len,ret=-1,tab=0;
|
int f = 0, len, ret = -1, tab = 0;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
char *b,*old;
|
char *b, *old;
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
if(!prompt||!*prompt)
|
if (!prompt || !*prompt)
|
||||||
return ret;
|
|
||||||
|
|
||||||
if(!maxlen||!retstr) {
|
|
||||||
inp_tab=NULL;
|
|
||||||
maxlen=0;
|
|
||||||
retstr=NULL;
|
|
||||||
if((b=strdup("Press \"Return\" to continue..."))==NULL)
|
|
||||||
return ret; }
|
|
||||||
else {
|
|
||||||
if(((b=malloc(maxlen+1))==NULL))
|
|
||||||
return ret;
|
return ret;
|
||||||
if(*retstr) {
|
|
||||||
strncpy(b,*retstr,maxlen);
|
|
||||||
b[maxlen]='\0'; }
|
|
||||||
else
|
|
||||||
b[0]='\0'; }
|
|
||||||
|
|
||||||
if((m=menu_create(prompt))) {
|
if (!maxlen || !retstr) {
|
||||||
for(l=0;l<menu_list->nummenus;l++) { /* copycat font entry to */
|
inp_tab = NULL;
|
||||||
if(menu_list->menus[l]->font) { /* blend in with l&f */
|
maxlen = 0;
|
||||||
m->font =menu_list->menus[l]->font;
|
retstr = NULL;
|
||||||
m->fwidth =menu_list->menus[l]->fwidth;
|
if ((b = strdup("Press \"Return\" to continue...")) == NULL)
|
||||||
m->fheight=menu_list->menus[l]->fheight;
|
return ret;
|
||||||
|
} else {
|
||||||
|
if (((b = malloc(maxlen + 1)) == NULL))
|
||||||
|
return ret;
|
||||||
|
if (*retstr) {
|
||||||
|
strncpy(b, *retstr, maxlen);
|
||||||
|
b[maxlen] = '\0';
|
||||||
|
} else
|
||||||
|
b[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m = menu_create(prompt))) {
|
||||||
|
for (l = 0; l < menu_list->nummenus; l++) { /* copycat font entry to */
|
||||||
|
if (menu_list->menus[l]->font) { /* blend in with l&f */
|
||||||
|
m->font = menu_list->menus[l]->font;
|
||||||
|
m->fwidth = menu_list->menus[l]->fwidth;
|
||||||
|
m->fheight = menu_list->menus[l]->fheight;
|
||||||
#ifdef MULTI_CHARSET
|
#ifdef MULTI_CHARSET
|
||||||
m->fontset=menu_list->menus[l]->fontset;
|
m->fontset = menu_list->menus[l]->fontset;
|
||||||
#endif
|
#endif
|
||||||
break; }}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if((i=menuitem_create("..."))) {
|
if ((i = menuitem_create("..."))) {
|
||||||
int h;
|
int h;
|
||||||
old=i->text;
|
old = i->text;
|
||||||
i->text=b;
|
i->text = b;
|
||||||
i->len =strlen(b);
|
i->len = strlen(b);
|
||||||
|
|
||||||
if(m->font) { /* pre-calc width so we can center the dialog */
|
if (m->font) { /* pre-calc width so we can center the dialog */
|
||||||
l=strlen(prompt);
|
l = strlen(prompt);
|
||||||
if(i->len>l)
|
if (i->len > l)
|
||||||
l=XTextWidth(m->font,i->text,i->len);
|
l = XTextWidth(m->font, i->text, i->len);
|
||||||
else
|
else
|
||||||
l=XTextWidth(m->font,prompt,l); }
|
l = XTextWidth(m->font, prompt, l);
|
||||||
else
|
} else
|
||||||
l=200;
|
l = 200;
|
||||||
|
|
||||||
menuitem_set_action(i,MENUITEM_STRING,"error");
|
menuitem_set_action(i, MENUITEM_STRING, "error");
|
||||||
menu_add_item(m,i);
|
menu_add_item(m, i);
|
||||||
menu_invoke((int)((TermWin_TotalWidth()-l)/2),(int)(TermWin_TotalHeight()/2)-20,TermWin.parent,m,CurrentTime);
|
menu_invoke((int) ((TermWin_TotalWidth() - l) / 2), (int) (TermWin_TotalHeight() / 2) - 20, TermWin.parent, m, CurrentTime);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
do {
|
do {
|
||||||
while(!XPending(Xdisplay))
|
while (!XPending(Xdisplay));
|
||||||
;
|
XNextEvent(Xdisplay, &ev);
|
||||||
XNextEvent(Xdisplay,&ev);
|
} while (ev.type != KeyPress);
|
||||||
} while(ev.type!=KeyPress);
|
|
||||||
|
|
||||||
len=XLookupString(&ev.xkey,(char *)kbuf,sizeof(short_buf),&keysym,NULL);
|
len = XLookupString(&ev.xkey, (char *) kbuf, sizeof(short_buf), &keysym, NULL);
|
||||||
ch=kbuf[0];
|
ch = kbuf[0];
|
||||||
l=strlen(b);
|
l = strlen(b);
|
||||||
|
|
||||||
if(ch!='\t')
|
if (ch != '\t')
|
||||||
tab=0;
|
tab = 0;
|
||||||
|
|
||||||
if(ch>=' ') {
|
if (ch >= ' ') {
|
||||||
if(l<maxlen) {
|
if (l < maxlen) {
|
||||||
b[l+1]='\0';
|
b[l + 1] = '\0';
|
||||||
b[l] =ch; }}
|
b[l] = ch;
|
||||||
else if((ch=='\n')||(ch=='\r'))
|
}
|
||||||
f=1;
|
} else if ((ch == '\n') || (ch == '\r'))
|
||||||
else if(ch=='\x08') {
|
f = 1;
|
||||||
if(maxlen&&l)
|
else if (ch == '\x08') {
|
||||||
b[--l]='\0'; }
|
if (maxlen && l)
|
||||||
else if((ch=='\t')&&inp_tab) {
|
b[--l] = '\0';
|
||||||
if(!tab)
|
} else if ((ch == '\t') && inp_tab) {
|
||||||
tab=l;
|
if (!tab)
|
||||||
inp_tab(xd,b,tab,maxlen); }
|
tab = l;
|
||||||
else if(ch=='\x1b')
|
inp_tab(xd, b, tab, maxlen);
|
||||||
f=2;
|
} else if (ch == '\x1b')
|
||||||
i->len=strlen(b);
|
f = 2;
|
||||||
menu_draw(m);
|
i->len = strlen(b);
|
||||||
} while(!f);
|
menu_draw(m);
|
||||||
|
} while (!f);
|
||||||
|
|
||||||
i->text=old;
|
i->text = old;
|
||||||
i->len =strlen(old);
|
i->len = strlen(old);
|
||||||
|
|
||||||
/* we could just return b, but it might be longer than we need */
|
/* we could just return b, but it might be longer than we need */
|
||||||
if(retstr)
|
if (retstr)
|
||||||
*retstr=(!maxlen||(f==2))?NULL:strdup(b);
|
*retstr = (!maxlen || (f == 2)) ? NULL : strdup(b);
|
||||||
ret=(f==2)?-2:0;
|
ret = (f == 2) ? -2 : 0;
|
||||||
}
|
}
|
||||||
m->font=NULL;
|
m->font = NULL;
|
||||||
#ifdef MULTI_CHARSET
|
#ifdef MULTI_CHARSET
|
||||||
m->fontset=NULL;
|
m->fontset = NULL;
|
||||||
#endif
|
#endif
|
||||||
menu_delete(m);
|
menu_delete(m);
|
||||||
}
|
}
|
||||||
free(b);
|
free(b);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1566,12 +1566,10 @@ parse_toggles(char *buff, void *state)
|
||||||
|
|
||||||
} else if (!BEG_STRCASECMP(buff, "buttonbar")) {
|
} else if (!BEG_STRCASECMP(buff, "buttonbar")) {
|
||||||
if (bool_val) {
|
if (bool_val) {
|
||||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1);
|
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1););
|
||||||
);
|
|
||||||
rs_buttonbars = 1; /* Reset for future use. */
|
rs_buttonbars = 1; /* Reset for future use. */
|
||||||
} else {
|
} else {
|
||||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0);
|
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0););
|
||||||
);
|
|
||||||
rs_buttonbars = 1; /* Reset for future use. */
|
rs_buttonbars = 1; /* Reset for future use. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3057,11 +3055,9 @@ post_parse(void)
|
||||||
specified. If specified, it will either become 3 (on) or 0 (off). */
|
specified. If specified, it will either become 3 (on) or 0 (off). */
|
||||||
if (rs_buttonbars != 1) {
|
if (rs_buttonbars != 1) {
|
||||||
if (rs_buttonbars) {
|
if (rs_buttonbars) {
|
||||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1);
|
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1););
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0);
|
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0););
|
||||||
);
|
|
||||||
}
|
}
|
||||||
rs_buttonbars = 1; /* Reset for future use. */
|
rs_buttonbars = 1; /* Reset for future use. */
|
||||||
}
|
}
|
||||||
|
|
|
@ -614,7 +614,7 @@ check_image_ipc(unsigned char reset)
|
||||||
print_error("ImageClass \"%s\" is not defined in Enlightenment. Disallowing \"auto\" mode for this image.\n", iclass);
|
print_error("ImageClass \"%s\" is not defined in Enlightenment. Disallowing \"auto\" mode for this image.\n", iclass);
|
||||||
image_mode_fallback(i);
|
image_mode_fallback(i);
|
||||||
} else if (strstr(reply, "Error")) {
|
} else if (strstr(reply, "Error")) {
|
||||||
print_error("Looks like this version of Enlightenment doesn't support the IPC commands I need. Disallowing \"auto\" mode for all images.\n");
|
print_error
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
FOREACH_IMAGE(
|
FOREACH_IMAGE(
|
||||||
if (image_mode_is(idx, MODE_AUTO)) {
|
if (image_mode_is(idx, MODE_AUTO)) {
|
||||||
|
@ -629,6 +629,7 @@ check_image_ipc(unsigned char reset)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
("Looks like this version of Enlightenment doesn't support the IPC commands I need. Disallowing \"auto\" mode for all images.\n");
|
||||||
FREE(reply);
|
FREE(reply);
|
||||||
checked = 2;
|
checked = 2;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
55
src/term.c
55
src/term.c
|
@ -262,18 +262,17 @@ lookup_key(XEvent * ev)
|
||||||
#endif /* USE_XIM */
|
#endif /* USE_XIM */
|
||||||
|
|
||||||
#ifdef ESCREEN
|
#ifdef ESCREEN
|
||||||
if (escreen_escape) {
|
if (escreen_escape) {
|
||||||
if(kbuf[0]) {
|
if (kbuf[0]) {
|
||||||
escreen_escape=0;
|
escreen_escape = 0;
|
||||||
if(kbuf[0]<128)
|
if (kbuf[0] < 128)
|
||||||
(void)ns_parse_screen_key(TermWin.screen,kbuf[0]);
|
(void) ns_parse_screen_key(TermWin.screen, kbuf[0]);
|
||||||
LK_RET();
|
LK_RET();
|
||||||
}
|
}
|
||||||
}
|
} else if (TermWin.screen && TermWin.screen->escape == kbuf[0]) {
|
||||||
else if (TermWin.screen&&TermWin.screen->escape==kbuf[0]) {
|
escreen_escape = 1;
|
||||||
escreen_escape=1;
|
LK_RET();
|
||||||
LK_RET();
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_XIM
|
#ifdef USE_XIM
|
||||||
|
@ -1857,11 +1856,11 @@ xterm_seq(int op, const char *str)
|
||||||
*/
|
*/
|
||||||
switch (eterm_seq_op) {
|
switch (eterm_seq_op) {
|
||||||
#ifdef PIXMAP_SUPPORT
|
#ifdef PIXMAP_SUPPORT
|
||||||
case 0:
|
case 0:
|
||||||
nstr = (char *) strsep(&tnstr, ";");
|
nstr = (char *) strsep(&tnstr, ";");
|
||||||
if (nstr) {
|
if (nstr) {
|
||||||
if (BOOL_OPT_ISTRUE(nstr)) {
|
if (BOOL_OPT_ISTRUE(nstr)) {
|
||||||
D_CMD((" Request to enable transparency.\n"));
|
D_CMD((" Request to enable transparency.\n"));
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
FOREACH_IMAGE(
|
FOREACH_IMAGE(
|
||||||
if (!image_mode_is(idx, MODE_TRANS) && image_mode_is(idx, ALLOW_TRANS)) {
|
if (!image_mode_is(idx, MODE_TRANS) && image_mode_is(idx, ALLOW_TRANS)) {
|
||||||
|
@ -1873,8 +1872,8 @@ xterm_seq(int op, const char *str)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
} else if (BOOL_OPT_ISFALSE(nstr)) {
|
} else if (BOOL_OPT_ISFALSE(nstr)) {
|
||||||
D_CMD((" Request to disable transparency.\n"));
|
D_CMD((" Request to disable transparency.\n"));
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
FOREACH_IMAGE(
|
FOREACH_IMAGE(
|
||||||
if (image_mode_is(idx, MODE_TRANS)) {
|
if (image_mode_is(idx, MODE_TRANS)) {
|
||||||
|
@ -1886,12 +1885,12 @@ xterm_seq(int op, const char *str)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
} else {
|
} else {
|
||||||
D_CMD((" Bad boolean value in transparency request.\n"));
|
D_CMD((" Bad boolean value in transparency request.\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
D_CMD((" Request to toggle transparency.\n"));
|
D_CMD((" Request to toggle transparency.\n"));
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
FOREACH_IMAGE(
|
FOREACH_IMAGE(
|
||||||
if (!image_mode_is(idx, MODE_TRANS) && image_mode_is(idx, ALLOW_TRANS)) {
|
if (!image_mode_is(idx, MODE_TRANS) && image_mode_is(idx, ALLOW_TRANS)) {
|
||||||
|
@ -1909,9 +1908,9 @@ xterm_seq(int op, const char *str)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
}
|
}
|
||||||
redraw_all_images();
|
redraw_all_images();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
changed = 0;
|
changed = 0;
|
||||||
for (; 1;) {
|
for (; 1;) {
|
||||||
|
|
Loading…
Reference in New Issue