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>.
|
||||
----------------------------------------------------------------------
|
||||
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);
|
||||
REQUIRE_RVAL(action->param.string != NULL, 0);
|
||||
#ifdef ESCREEN
|
||||
if(TermWin.screen_mode&&TermWin.screen) /* translate escapes */
|
||||
ns_screen_command(TermWin.screen,action->param.string);
|
||||
if (TermWin.screen_mode && TermWin.screen) /* translate escapes */
|
||||
ns_screen_command(TermWin.screen, action->param.string);
|
||||
else
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
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:
|
||||
if (!press) {
|
||||
#ifdef ESCREEN
|
||||
if(TermWin.screen_mode&&TermWin.screen) { /* translate escapes */
|
||||
if(prvs!=1) {
|
||||
button_t *b=bbar->buttons;
|
||||
_ns_disp *d2=TermWin.screen->dsps;
|
||||
int n=(button->action.string)[1]-'0';
|
||||
if (TermWin.screen_mode && TermWin.screen) { /* translate escapes */
|
||||
if (prvs != 1) {
|
||||
button_t *b = bbar->buttons;
|
||||
_ns_disp *d2 = TermWin.screen->dsps;
|
||||
int n = (button->action.string)[1] - '0';
|
||||
|
||||
while(b&&!(b->flags&NS_SCREAM_CURR)) /* find active disp */
|
||||
b=b->next; /* when trying to change name of non- */
|
||||
if(b&&b!=button) { /* active display, make that disp active */
|
||||
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 (b && !(b->flags & NS_SCREAM_CURR)) /* find active disp */
|
||||
b = b->next; /* when trying to change name of non- */
|
||||
if (b && b != button) { /* active display, make that disp active */
|
||||
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)
|
||||
d2 = d2->next;
|
||||
if(d2)
|
||||
TermWin.screen->curr=d2; /* pre-adjust curr ptr */
|
||||
else
|
||||
fprintf(stderr,NS_PREFIX "button_check_action: no display %d in this session : (\n",n);
|
||||
(void)ns_screen_command(TermWin.screen,button->action.string); }
|
||||
while (d2 && d2->index != n)
|
||||
d2 = d2->next;
|
||||
if (d2)
|
||||
TermWin.screen->curr = d2; /* pre-adjust curr ptr */
|
||||
else
|
||||
fprintf(stderr, NS_PREFIX "button_check_action: no display %d in this session : (\n", n);
|
||||
(void) ns_screen_command(TermWin.screen, button->action.string);
|
||||
}
|
||||
|
||||
if(prvs==2) /* middle button -- kill */
|
||||
(void)ns_parse_screen_key(TermWin.screen,NS_SCREEN_KILL);
|
||||
else /* right button -- rename */
|
||||
(void)ns_parse_screen_key(TermWin.screen,NS_SCREEN_RENAME); }
|
||||
else /* left button -- select */
|
||||
(void)ns_screen_command(TermWin.screen,button->action.string); }
|
||||
else /* not in screen-mode, use normal facilities */
|
||||
if (prvs == 2) /* middle button -- kill */
|
||||
(void) ns_parse_screen_key(TermWin.screen, NS_SCREEN_KILL);
|
||||
else /* right button -- rename */
|
||||
(void) ns_parse_screen_key(TermWin.screen, NS_SCREEN_RENAME);
|
||||
} else /* left button -- select */
|
||||
(void) ns_screen_command(TermWin.screen, button->action.string);
|
||||
} else /* not in screen-mode, use normal facilities */
|
||||
#endif
|
||||
tt_write((unsigned char *) button->action.string, strlen(button->action.string));
|
||||
tt_write((unsigned char *) button->action.string, strlen(button->action.string));
|
||||
}
|
||||
break;
|
||||
case ACTION_SCRIPT:
|
||||
|
@ -827,7 +830,7 @@ button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Ti
|
|||
default:
|
||||
break;
|
||||
}
|
||||
prvs=press;
|
||||
prvs = press;
|
||||
}
|
||||
|
||||
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.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);
|
||||
XFreeGC(Xdisplay, gc);
|
||||
} else
|
||||
|
@ -1073,8 +1076,7 @@ bbar_redraw(buttonbar_t *bbar)
|
|||
addright add to rbuttons instead of buttons
|
||||
<- NULL, or the bar */
|
||||
|
||||
buttonbar_t *
|
||||
bbar_insert_button(buttonbar_t *bbar, button_t *button, int after, int addright)
|
||||
buttonbar_t *bbar_insert_button(buttonbar_t *bbar, button_t *button, int after, int addright)
|
||||
{
|
||||
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");
|
||||
return NULL;
|
||||
} 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_docked(bbar, BBAR_DOCKED_TOP);
|
||||
}
|
||||
state = 0;
|
||||
}
|
||||
|
||||
if(addright) { /* add to rbuttons */
|
||||
if (!bbar->rbuttons) { /* first button */
|
||||
button->next = NULL;
|
||||
bbar->rbuttons = button;
|
||||
} else {
|
||||
int c=0;
|
||||
button_t *b = bbar->rbuttons;
|
||||
do {
|
||||
c++;
|
||||
} while((b=b->next));
|
||||
if(after>=(c-1)) {
|
||||
button->next=bbar->rbuttons;
|
||||
bbar->rbuttons=button; }
|
||||
else {
|
||||
b = bbar->rbuttons;
|
||||
after=c-after-2;
|
||||
while (after-- > 0 && b->next)
|
||||
b = b->next;
|
||||
button->next = b->next;
|
||||
b->next = button; }
|
||||
}
|
||||
}
|
||||
else { /* add to buttons */
|
||||
if (!bbar->buttons || after < 0) { /* first button */
|
||||
button->next = bbar->buttons;
|
||||
bbar->buttons = button;
|
||||
} else {
|
||||
button_t *b = bbar->buttons;
|
||||
while (after-- > 0 && b->next)
|
||||
b = b->next;
|
||||
button->next = b->next;
|
||||
b->next = button;
|
||||
}
|
||||
if (addright) { /* add to rbuttons */
|
||||
if (!bbar->rbuttons) { /* first button */
|
||||
button->next = NULL;
|
||||
bbar->rbuttons = button;
|
||||
} else {
|
||||
int c = 0;
|
||||
button_t *b = bbar->rbuttons;
|
||||
do {
|
||||
c++;
|
||||
} while ((b = b->next));
|
||||
if (after >= (c - 1)) {
|
||||
button->next = bbar->rbuttons;
|
||||
bbar->rbuttons = button;
|
||||
} else {
|
||||
b = bbar->rbuttons;
|
||||
after = c - after - 2;
|
||||
while (after-- > 0 && b->next)
|
||||
b = b->next;
|
||||
button->next = b->next;
|
||||
b->next = button;
|
||||
}
|
||||
}
|
||||
} else { /* add to buttons */
|
||||
if (!bbar->buttons || after < 0) { /* first button */
|
||||
button->next = bbar->buttons;
|
||||
bbar->buttons = button;
|
||||
} else {
|
||||
button_t *b = bbar->buttons;
|
||||
while (after-- > 0 && b->next)
|
||||
b = b->next;
|
||||
button->next = b->next;
|
||||
b->next = 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 */
|
||||
|
||||
if (!state) {
|
||||
if(buttonbar) {
|
||||
buttonbar_t *bar=buttonbar;
|
||||
while(bar->next)
|
||||
bar=bar->next;
|
||||
bar->next=bbar;
|
||||
}
|
||||
else
|
||||
buttonbar=bbar;
|
||||
if (buttonbar) {
|
||||
buttonbar_t *bar = buttonbar;
|
||||
while (bar->next)
|
||||
bar = bar->next;
|
||||
bar->next = bbar;
|
||||
} else
|
||||
buttonbar = bbar;
|
||||
|
||||
bbar_init(bbar, TermWin.width);
|
||||
bbar_add(bbar);
|
||||
bbar_init(bbar, TermWin.width);
|
||||
bbar_add(bbar);
|
||||
}
|
||||
|
||||
bbar_redraw(bbar);
|
||||
|
|
161
src/command.c
161
src/command.c
|
@ -1131,8 +1131,7 @@ clean_exit(void)
|
|||
font_cache_clear();
|
||||
eterm_font_list_clear();
|
||||
# ifdef PIXMAP_SUPPORT
|
||||
FOREACH_IMAGE(free_eterm_image(&(images[idx]));
|
||||
);
|
||||
FOREACH_IMAGE(free_eterm_image(&(images[idx])););
|
||||
# endif
|
||||
for (i = 0; i < NRS_COLORS; i++) {
|
||||
if (rs_color[i]) {
|
||||
|
@ -2107,7 +2106,7 @@ run_command(char **argv)
|
|||
char **a = argv;
|
||||
if (a) {
|
||||
while (*a) {
|
||||
fprintf(stderr, NS_PREFIX "run_command: %s\n",*a);
|
||||
fprintf(stderr, NS_PREFIX "run_command: %s\n", *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 *b;
|
||||
char p[3];
|
||||
button_t *screen_button_create(char *text, char code)
|
||||
{
|
||||
button_t *b;
|
||||
char p[3];
|
||||
|
||||
if(!text||!*text||!(b=button_create(text)))
|
||||
return NULL;
|
||||
if (!text || !*text || !(b = button_create(text)))
|
||||
return NULL;
|
||||
|
||||
p[0]=NS_SCREEN_ESCAPE;
|
||||
p[1]=code;
|
||||
p[2]='\0';
|
||||
p[0] = NS_SCREEN_ESCAPE;
|
||||
p[1] = code;
|
||||
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;
|
||||
button_t *button;
|
||||
|
||||
if(!xd||!name||!*name)
|
||||
return NS_FAIL;
|
||||
if (!xd || !name || !*name)
|
||||
return NS_FAIL;
|
||||
bbar = *((buttonbar_t **) xd);
|
||||
|
||||
if(!(button=screen_button_create(name,'0' + after + 1)))
|
||||
return NS_FAIL;
|
||||
if (!(button = screen_button_create(name, '0' + after + 1)))
|
||||
return NS_FAIL;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
fprintf(stderr, NS_PREFIX "ins_disp: %s after %d...\n", name, after);
|
||||
#endif
|
||||
|
||||
if((bbar=bbar_insert_button(bbar,button,after,FALSE))) {
|
||||
*((buttonbar_t **) xd) = bbar;
|
||||
return NS_SUCC; }
|
||||
if ((bbar = bbar_insert_button(bbar, button, after, FALSE))) {
|
||||
*((buttonbar_t **) xd) = bbar;
|
||||
return NS_SUCC;
|
||||
}
|
||||
|
||||
button_free(button);
|
||||
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,
|
||||
otherwise, we'll create one. */
|
||||
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;
|
||||
button_t *button;
|
||||
|
||||
if(!xd||!name||!*name)
|
||||
return NS_FAIL;
|
||||
if (!xd || !name || !*name)
|
||||
return NS_FAIL;
|
||||
bbar = *xd;
|
||||
|
||||
if(!(button=screen_button_create(name,key)))
|
||||
return NS_FAIL;
|
||||
if (!(button = screen_button_create(name, key)))
|
||||
return NS_FAIL;
|
||||
|
||||
if((bbar=bbar_insert_button(bbar,button,-1,TRUE))) {
|
||||
*xd = bbar;
|
||||
return NS_SUCC; }
|
||||
if ((bbar = bbar_insert_button(bbar, button, -1, TRUE))) {
|
||||
*xd = bbar;
|
||||
return NS_SUCC;
|
||||
}
|
||||
|
||||
button_free(button);
|
||||
return NS_FAIL;
|
||||
|
@ -2504,8 +2507,8 @@ upd_disp(void *xd, int n, int flags, char *name)
|
|||
int
|
||||
err_msg(void *xd, int err, char *msg)
|
||||
{
|
||||
if(strlen(msg))
|
||||
menu_dial(NULL,msg,0,NULL,NULL);
|
||||
if (strlen(msg))
|
||||
menu_dial(NULL, msg, 0, NULL, NULL);
|
||||
return NS_SUCC;
|
||||
}
|
||||
|
||||
|
@ -2523,16 +2526,17 @@ inp_text(void *xd, int id, char *txt)
|
|||
|
||||
/* open a dialog */
|
||||
int
|
||||
inp_dial(void *xd, char *prompt, int maxlen, char **retstr,
|
||||
int (*inp_tab)(void *,char *,size_t,size_t))
|
||||
inp_dial(void *xd, char *prompt, int maxlen, char **retstr, int (*inp_tab) (void *, char *, size_t, size_t))
|
||||
{
|
||||
switch(menu_dial(xd, prompt, maxlen, retstr,inp_tab)) {
|
||||
case 0:
|
||||
return NS_SUCC;
|
||||
case -2:
|
||||
return NS_USER_CXL;
|
||||
default:
|
||||
return NS_FAIL; }}
|
||||
switch (menu_dial(xd, prompt, maxlen, retstr, inp_tab)) {
|
||||
case 0:
|
||||
return NS_SUCC;
|
||||
case -2:
|
||||
return NS_USER_CXL;
|
||||
default:
|
||||
return NS_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -2606,56 +2610,65 @@ init_command(char **argv)
|
|||
if (!TermWin.screen_mode)
|
||||
cmd_fd = run_command(argv);
|
||||
else if ((TermWin.screen = ns_attach_by_URL(rs_url, rs_hop, &efuns, &ns_err, (void *) &buttonbar))) {
|
||||
button_t *button;
|
||||
menu_t *m;
|
||||
button_t *button;
|
||||
menu_t *m;
|
||||
menuitem_t *i;
|
||||
if((m=menu_create(NS_MENU_TITLE))) {
|
||||
char *sc[]={ "New", "\x01\x03", "Close", "\x01k" };
|
||||
int n,nsc=sizeof(sc)/sizeof(char *);
|
||||
if ((m = menu_create(NS_MENU_TITLE))) {
|
||||
char *sc[] = { "New", "\x01\x03", "Close", "\x01k" };
|
||||
int n, nsc = sizeof(sc) / sizeof(char *);
|
||||
|
||||
if(menu_list) {
|
||||
for(n=0;n<menu_list->nummenus;n++) { /* blend in w/ l&f */
|
||||
if (menu_list) {
|
||||
for (n = 0; n < menu_list->nummenus; n++) { /* blend in w/ l&f */
|
||||
#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
|
||||
if(menu_list->menus[n]->font) {
|
||||
m->font =menu_list->menus[n]->font;
|
||||
m->fwidth =menu_list->menus[n]->fwidth;
|
||||
m->fheight=menu_list->menus[n]->fheight;
|
||||
if (menu_list->menus[n]->font) {
|
||||
m->font = menu_list->menus[n]->font;
|
||||
m->fwidth = menu_list->menus[n]->fwidth;
|
||||
m->fheight = menu_list->menus[n]->fheight;
|
||||
#ifdef MULTI_CHARSET
|
||||
m->fontset=menu_list->menus[n]->fontset;
|
||||
m->fontset = menu_list->menus[n]->fontset;
|
||||
#endif
|
||||
break; }}}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(n=0;n<(nsc-1);n+=2) {
|
||||
if((i=menuitem_create(sc[n]))) {
|
||||
for (n = 0; n < (nsc - 1); n += 2) {
|
||||
if ((i = menuitem_create(sc[n]))) {
|
||||
# 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
|
||||
menuitem_set_action(i,MENUITEM_ECHO,sc[n+1]);
|
||||
menu_add_item(m,i); }}
|
||||
menuitem_set_action(i, MENUITEM_ECHO, sc[n + 1]);
|
||||
menu_add_item(m, i);
|
||||
}
|
||||
}
|
||||
|
||||
if((i=menuitem_create("About..."))) {
|
||||
menuitem_set_action(i,MENUITEM_ALERT,"Screen compatibility layer by Azundris <scream@azundris.com>");
|
||||
menu_add_item(m,i); }
|
||||
if ((i = menuitem_create("About..."))) {
|
||||
menuitem_set_action(i, MENUITEM_ALERT, "Screen compatibility layer by Azundris <scream@azundris.com>");
|
||||
menu_add_item(m, i);
|
||||
}
|
||||
|
||||
if((button=button_create(NS_MENU_TITLE))) {
|
||||
if(!(buttonbar=bbar_insert_button(buttonbar,button,-1,TRUE))) {
|
||||
m->font=NULL;
|
||||
if ((button = button_create(NS_MENU_TITLE))) {
|
||||
if (!(buttonbar = bbar_insert_button(buttonbar, button, -1, TRUE))) {
|
||||
m->font = NULL;
|
||||
#ifdef MULTI_CHARSET
|
||||
m->fontset=NULL;
|
||||
m->fontset = NULL;
|
||||
#endif
|
||||
menu_delete(m);
|
||||
button_set_action(button,ACTION_STRING,NS_MENU_TITLE);
|
||||
button_free(button); }
|
||||
else {
|
||||
int j,k=menu_list?menu_list->nummenus:0;
|
||||
menu_list=menulist_add_menu(menu_list,m);
|
||||
for (j=k;j<menu_list->nummenus;j++)
|
||||
event_data_add_mywin(&menu_event_data,menu_list->menus[j]->win);
|
||||
if(!k)
|
||||
button_set_action(button, ACTION_STRING, NS_MENU_TITLE);
|
||||
button_free(button);
|
||||
} else {
|
||||
int j, k = menu_list ? menu_list->nummenus : 0;
|
||||
menu_list = menulist_add_menu(menu_list, m);
|
||||
for (j = k; j < menu_list->nummenus; j++)
|
||||
event_data_add_mywin(&menu_event_data, menu_list->menus[j]->win);
|
||||
if (!k)
|
||||
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'); */
|
||||
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;
|
||||
case MENUITEM_ECHO:
|
||||
#ifdef ESCREEN
|
||||
if(TermWin.screen_mode&&TermWin.screen) { /* translate escapes */
|
||||
if (TermWin.screen_mode && TermWin.screen) { /* translate escapes */
|
||||
# ifdef NS_DEBUG
|
||||
{
|
||||
char *p=item->action.string;
|
||||
fprintf(stderr,NS_PREFIX "::menu_action: ");
|
||||
while(*p) {
|
||||
if(*p<' ')
|
||||
fprintf(stderr,"^%c",*p-1+'A');
|
||||
else
|
||||
fprintf(stderr,"%c",*p);
|
||||
p++;
|
||||
}
|
||||
fputs("\n",stderr);
|
||||
}
|
||||
{
|
||||
char *p = item->action.string;
|
||||
fprintf(stderr, NS_PREFIX "::menu_action: ");
|
||||
while (*p) {
|
||||
if (*p < ' ')
|
||||
fprintf(stderr, "^%c", *p - 1 + 'A');
|
||||
else
|
||||
fprintf(stderr, "%c", *p);
|
||||
p++;
|
||||
}
|
||||
fputs("\n", stderr);
|
||||
}
|
||||
# endif
|
||||
(void)ns_screen_command(TermWin.screen,item->action.string); }
|
||||
else
|
||||
(void) ns_screen_command(TermWin.screen, item->action.string);
|
||||
} else
|
||||
#endif
|
||||
tt_write((unsigned char *) item->action.string, strlen(item->action.string));
|
||||
tt_write((unsigned char *) item->action.string, strlen(item->action.string));
|
||||
break;
|
||||
case MENUITEM_SCRIPT:
|
||||
script_parse((char *) item->action.script);
|
||||
break;
|
||||
case MENUITEM_ALERT:
|
||||
menu_dial(NULL,item->action.alert,0,NULL,NULL);
|
||||
menu_dial(NULL, item->action.alert, 0, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
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 */
|
||||
|
||||
int
|
||||
menu_tab(void *xd,char *sc[],int nsc,char *b,size_t l,size_t m) {
|
||||
int n,n2=0;
|
||||
menu_tab(void *xd, char *sc[], int nsc, char *b, size_t l, size_t m)
|
||||
{
|
||||
int n, n2 = 0;
|
||||
|
||||
for(n=0;n<nsc;n++) { /* second tab? cycle. */
|
||||
if((!strcasecmp(b,sc[n]))&&(n<nsc-1)&&!strncasecmp(b,sc[n+1],l)) {
|
||||
n2=n+1;
|
||||
break; }}
|
||||
for (n = 0; n < nsc; n++) { /* second tab? cycle. */
|
||||
if ((!strcasecmp(b, sc[n])) && (n < nsc - 1) && !strncasecmp(b, sc[n + 1], l)) {
|
||||
n2 = n + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(n=n2;n<nsc;n++) {
|
||||
if(!strncasecmp(b,sc[n],l)) {
|
||||
if(strcmp(b,sc[n])) {
|
||||
if(strlen(sc[n])>=m) /* buffer would overflow => fail */
|
||||
return -1;
|
||||
strcpy(b,sc[n]);
|
||||
return 0; }}}
|
||||
for (n = n2; n < nsc; n++) {
|
||||
if (!strncasecmp(b, sc[n], l)) {
|
||||
if (strcmp(b, sc[n])) {
|
||||
if (strlen(sc[n]) >= m) /* buffer would overflow => fail */
|
||||
return -1;
|
||||
strcpy(b, sc[n]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1; }
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* open a dialog. this is a bit of a hack and should really resize otf.
|
||||
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
|
||||
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];
|
||||
unsigned char *kbuf = short_buf;
|
||||
menu_t *m;
|
||||
menuitem_t *i;
|
||||
register int ch;
|
||||
int f=0,len,ret=-1,tab=0;
|
||||
XEvent ev;
|
||||
KeySym keysym;
|
||||
char *b,*old;
|
||||
size_t l;
|
||||
menu_t *m;
|
||||
menuitem_t *i;
|
||||
register int ch;
|
||||
int f = 0, len, ret = -1, tab = 0;
|
||||
XEvent ev;
|
||||
KeySym keysym;
|
||||
char *b, *old;
|
||||
size_t l;
|
||||
|
||||
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))
|
||||
if (!prompt || !*prompt)
|
||||
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;
|
||||
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;
|
||||
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
|
||||
m->fontset=menu_list->menus[l]->fontset;
|
||||
m->fontset = menu_list->menus[l]->fontset;
|
||||
#endif
|
||||
break; }}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((i=menuitem_create("..."))) {
|
||||
int h;
|
||||
old=i->text;
|
||||
i->text=b;
|
||||
i->len =strlen(b);
|
||||
if ((i = menuitem_create("..."))) {
|
||||
int h;
|
||||
old = i->text;
|
||||
i->text = b;
|
||||
i->len = strlen(b);
|
||||
|
||||
if(m->font) { /* pre-calc width so we can center the dialog */
|
||||
l=strlen(prompt);
|
||||
if(i->len>l)
|
||||
l=XTextWidth(m->font,i->text,i->len);
|
||||
else
|
||||
l=XTextWidth(m->font,prompt,l); }
|
||||
else
|
||||
l=200;
|
||||
if (m->font) { /* pre-calc width so we can center the dialog */
|
||||
l = strlen(prompt);
|
||||
if (i->len > l)
|
||||
l = XTextWidth(m->font, i->text, i->len);
|
||||
else
|
||||
l = XTextWidth(m->font, prompt, l);
|
||||
} else
|
||||
l = 200;
|
||||
|
||||
menuitem_set_action(i,MENUITEM_STRING,"error");
|
||||
menu_add_item(m,i);
|
||||
menu_invoke((int)((TermWin_TotalWidth()-l)/2),(int)(TermWin_TotalHeight()/2)-20,TermWin.parent,m,CurrentTime);
|
||||
menuitem_set_action(i, MENUITEM_STRING, "error");
|
||||
menu_add_item(m, i);
|
||||
menu_invoke((int) ((TermWin_TotalWidth() - l) / 2), (int) (TermWin_TotalHeight() / 2) - 20, TermWin.parent, m, CurrentTime);
|
||||
|
||||
do {
|
||||
do {
|
||||
while(!XPending(Xdisplay))
|
||||
;
|
||||
XNextEvent(Xdisplay,&ev);
|
||||
} while(ev.type!=KeyPress);
|
||||
do {
|
||||
do {
|
||||
while (!XPending(Xdisplay));
|
||||
XNextEvent(Xdisplay, &ev);
|
||||
} while (ev.type != KeyPress);
|
||||
|
||||
len=XLookupString(&ev.xkey,(char *)kbuf,sizeof(short_buf),&keysym,NULL);
|
||||
ch=kbuf[0];
|
||||
l=strlen(b);
|
||||
len = XLookupString(&ev.xkey, (char *) kbuf, sizeof(short_buf), &keysym, NULL);
|
||||
ch = kbuf[0];
|
||||
l = strlen(b);
|
||||
|
||||
if(ch!='\t')
|
||||
tab=0;
|
||||
if (ch != '\t')
|
||||
tab = 0;
|
||||
|
||||
if(ch>=' ') {
|
||||
if(l<maxlen) {
|
||||
b[l+1]='\0';
|
||||
b[l] =ch; }}
|
||||
else if((ch=='\n')||(ch=='\r'))
|
||||
f=1;
|
||||
else if(ch=='\x08') {
|
||||
if(maxlen&&l)
|
||||
b[--l]='\0'; }
|
||||
else if((ch=='\t')&&inp_tab) {
|
||||
if(!tab)
|
||||
tab=l;
|
||||
inp_tab(xd,b,tab,maxlen); }
|
||||
else if(ch=='\x1b')
|
||||
f=2;
|
||||
i->len=strlen(b);
|
||||
menu_draw(m);
|
||||
} while(!f);
|
||||
if (ch >= ' ') {
|
||||
if (l < maxlen) {
|
||||
b[l + 1] = '\0';
|
||||
b[l] = ch;
|
||||
}
|
||||
} else if ((ch == '\n') || (ch == '\r'))
|
||||
f = 1;
|
||||
else if (ch == '\x08') {
|
||||
if (maxlen && l)
|
||||
b[--l] = '\0';
|
||||
} else if ((ch == '\t') && inp_tab) {
|
||||
if (!tab)
|
||||
tab = l;
|
||||
inp_tab(xd, b, tab, maxlen);
|
||||
} else if (ch == '\x1b')
|
||||
f = 2;
|
||||
i->len = strlen(b);
|
||||
menu_draw(m);
|
||||
} while (!f);
|
||||
|
||||
i->text=old;
|
||||
i->len =strlen(old);
|
||||
i->text = old;
|
||||
i->len = strlen(old);
|
||||
|
||||
/* we could just return b, but it might be longer than we need */
|
||||
if(retstr)
|
||||
*retstr=(!maxlen||(f==2))?NULL:strdup(b);
|
||||
ret=(f==2)?-2:0;
|
||||
}
|
||||
m->font=NULL;
|
||||
/* we could just return b, but it might be longer than we need */
|
||||
if (retstr)
|
||||
*retstr = (!maxlen || (f == 2)) ? NULL : strdup(b);
|
||||
ret = (f == 2) ? -2 : 0;
|
||||
}
|
||||
m->font = NULL;
|
||||
#ifdef MULTI_CHARSET
|
||||
m->fontset=NULL;
|
||||
m->fontset = NULL;
|
||||
#endif
|
||||
menu_delete(m);
|
||||
menu_delete(m);
|
||||
}
|
||||
free(b);
|
||||
return ret;
|
||||
|
|
|
@ -1566,12 +1566,10 @@ parse_toggles(char *buff, void *state)
|
|||
|
||||
} else if (!BEG_STRCASECMP(buff, "buttonbar")) {
|
||||
if (bool_val) {
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1);
|
||||
);
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1););
|
||||
rs_buttonbars = 1; /* Reset for future use. */
|
||||
} else {
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0);
|
||||
);
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0););
|
||||
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). */
|
||||
if (rs_buttonbars != 1) {
|
||||
if (rs_buttonbars) {
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1);
|
||||
);
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1););
|
||||
} else {
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0);
|
||||
);
|
||||
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0););
|
||||
}
|
||||
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);
|
||||
image_mode_fallback(i);
|
||||
} 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* */
|
||||
FOREACH_IMAGE(
|
||||
if (image_mode_is(idx, MODE_AUTO)) {
|
||||
|
@ -629,6 +629,7 @@ check_image_ipc(unsigned char reset)
|
|||
}
|
||||
);
|
||||
/* *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);
|
||||
checked = 2;
|
||||
return 0;
|
||||
|
|
55
src/term.c
55
src/term.c
|
@ -262,18 +262,17 @@ lookup_key(XEvent * ev)
|
|||
#endif /* USE_XIM */
|
||||
|
||||
#ifdef ESCREEN
|
||||
if (escreen_escape) {
|
||||
if(kbuf[0]) {
|
||||
escreen_escape=0;
|
||||
if(kbuf[0]<128)
|
||||
(void)ns_parse_screen_key(TermWin.screen,kbuf[0]);
|
||||
LK_RET();
|
||||
}
|
||||
}
|
||||
else if (TermWin.screen&&TermWin.screen->escape==kbuf[0]) {
|
||||
escreen_escape=1;
|
||||
LK_RET();
|
||||
}
|
||||
if (escreen_escape) {
|
||||
if (kbuf[0]) {
|
||||
escreen_escape = 0;
|
||||
if (kbuf[0] < 128)
|
||||
(void) ns_parse_screen_key(TermWin.screen, kbuf[0]);
|
||||
LK_RET();
|
||||
}
|
||||
} else if (TermWin.screen && TermWin.screen->escape == kbuf[0]) {
|
||||
escreen_escape = 1;
|
||||
LK_RET();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_XIM
|
||||
|
@ -1857,11 +1856,11 @@ xterm_seq(int op, const char *str)
|
|||
*/
|
||||
switch (eterm_seq_op) {
|
||||
#ifdef PIXMAP_SUPPORT
|
||||
case 0:
|
||||
nstr = (char *) strsep(&tnstr, ";");
|
||||
if (nstr) {
|
||||
if (BOOL_OPT_ISTRUE(nstr)) {
|
||||
D_CMD((" Request to enable transparency.\n"));
|
||||
case 0:
|
||||
nstr = (char *) strsep(&tnstr, ";");
|
||||
if (nstr) {
|
||||
if (BOOL_OPT_ISTRUE(nstr)) {
|
||||
D_CMD((" Request to enable transparency.\n"));
|
||||
/* *INDENT-OFF* */
|
||||
FOREACH_IMAGE(
|
||||
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* */
|
||||
} else if (BOOL_OPT_ISFALSE(nstr)) {
|
||||
D_CMD((" Request to disable transparency.\n"));
|
||||
} else if (BOOL_OPT_ISFALSE(nstr)) {
|
||||
D_CMD((" Request to disable transparency.\n"));
|
||||
/* *INDENT-OFF* */
|
||||
FOREACH_IMAGE(
|
||||
if (image_mode_is(idx, MODE_TRANS)) {
|
||||
|
@ -1886,12 +1885,12 @@ xterm_seq(int op, const char *str)
|
|||
}
|
||||
);
|
||||
/* *INDENT-ON* */
|
||||
} else {
|
||||
D_CMD((" Bad boolean value in transparency request.\n"));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
D_CMD((" Request to toggle transparency.\n"));
|
||||
} else {
|
||||
D_CMD((" Bad boolean value in transparency request.\n"));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
D_CMD((" Request to toggle transparency.\n"));
|
||||
/* *INDENT-OFF* */
|
||||
FOREACH_IMAGE(
|
||||
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* */
|
||||
}
|
||||
redraw_all_images();
|
||||
break;
|
||||
}
|
||||
redraw_all_images();
|
||||
break;
|
||||
case 1:
|
||||
changed = 0;
|
||||
for (; 1;) {
|
||||
|
|
Loading…
Reference in New Issue