diff -r -N -u alevt-1.5.0.orig/Makefile alevt-1.5.0/Makefile --- alevt-1.5.0.orig/Makefile Fri Oct 8 23:49:26 1999 +++ alevt-1.5.0/Makefile Fri Oct 15 09:50:25 1999 @@ -2,10 +2,19 @@ OPT=-O2 -s DEFS=-DWITH_PNG +# to disable XAWTV_HACKS comment out the line below +XAWTV_HACKS=. + +ifdef XAWTV_HACKS +DEFS+= -DXAWTV_HACKS +HACKOBJS= xawtv-remote.o +HACKLIBS += -lXmu +endif + CFLAGS=$(OPT) -DVERSION=\"$(VER)\" $(DEFS) -I/usr/X11R6/include -W EXPOBJS=export.o exp-txt.o exp-html.o exp-gfx.o font.o -OBJS=main.o ui.o xio.o fdset.o vbi.o cache.o help.o edline.o search.o edit.o misc.o hamm.o lang.o $(EXPOBJS) +OBJS=main.o ui.o xio.o fdset.o vbi.o cache.o help.o edline.o search.o edit.o misc.o hamm.o lang.o $(EXPOBJS) $(HACKOBJS) TOBJS=alevt-date.o vbi.o fdset.o misc.o hamm.o lang.o COBJS=alevt-cap.o vbi.o fdset.o misc.o hamm.o lang.o $(EXPOBJS) @@ -17,7 +26,7 @@ sync alevt: $(OBJS) - $(CC) $(OPT) $(OBJS) -o alevt -L/usr/X11R6/lib -lX11 $(EXPLIBS) + $(CC) $(OPT) $(OBJS) -o alevt -L/usr/X11R6/lib -lX11 $(EXPLIBS) $(HACKLIBS) alevt-date: $(TOBJS) $(CC) $(OPT) $(TOBJS) -o alevt-date @@ -65,6 +74,7 @@ # anything below this line is just for me! install: all + strip alevt alevt-date alevt-cap -R .note -R .comment cp alevt /usr/local/bin cp alevt-date /usr/local/bin cp alevt-cap /usr/local/bin @@ -123,3 +133,6 @@ ui.o: search.h export.h ui.h vbi.o: vt.h misc.h vbi.h dllist.h cache.h lang.h fdset.h hamm.h xio.o: vt.h misc.h dllist.h xio.h fdset.h lang.h icon.xbm font.h +ifdef XAWTV_HACKS +ui.o : xawtv-remote.h +endif \ No newline at end of file diff -r -N -u alevt-1.5.0.orig/export.c alevt-1.5.0/export.c --- alevt-1.5.0.orig/export.c Fri Oct 8 01:52:41 1999 +++ alevt-1.5.0/export.c Fri Oct 15 09:11:20 1999 @@ -240,120 +240,220 @@ return p; } - static void fmt_page(struct export *e, struct fmt_page *pg, struct vt_page *vtp) { char buf[16]; int x, y; u8 c, *p = vtp->data[0]; - pg->dbl = 0; - - sprintf(buf, "\2%x.%02x\7", vtp->pgno, vtp->subno & 0xff); - + sprintf(buf, "\2%3x.%02x\7", vtp->pgno, vtp->subno & 0xff); + strncpy(p,buf,8); for (y = 0; y < H; y++) { - struct fmt_char c; - int last_ch = ' '; - int dbl = 0, hold = 0; - - c.fg = 7; - c.bg = 0; - c.attr = 0; + /* two variables for each attribute + * new_attr -- information got from the latest char + * here_attr -- value of the attribute for this xy position + * So, if the attribute char is "Set-At" + * then + * { + * here_attr=new_attr=attribute(latest_char); + * ... processing ... (use here_attr !!!) + * here_attr=new_attr; // <-- unneeded, + * // but doesn't break the code + * } + * else // Set-After + * { + * new_attr=attribute(latest_char); + * ... processing ... (use here_attr !!!) + * here_attr=new_attr; + * } + * Attributes persist until changed by another attribute + * or end of row + */ + u8 held_mosaic_char=' '; + u8 dbl=0; /* set to 1 for double height page + * (is used at the end of row processing) */ + + u8 new_gfx=0, here_gfx=0; // Start-of-row default condition + u8 new_bg=0, here_bg=0; // Start-of-row default condition + u8 new_fg=7, here_fg=7; // Start-of-row default condition + u8 new_bln=0, here_bln=0; // Start-of-row default condition + u8 new_dbl=0, here_dbl=0; // Start-of-row default condition + u8 new_con=0, here_con=0; // Start-of-row default condition + u8 here_sep=0; /* Start-of-row default condition + * set/reset by 0x19,0x1a chars + * Both (0x19,0x1a) are Set-At + * so anyway (here_sep==new_sep) all the time + */ + u8 new_hld=0, here_hld=0; + + //hold attribute: + u8 held_sep=0; - for (x = 0; x < W; ++x) + for (x = 0; x < W; ++x) { - c.ch = *p++; - if (y == 0 && x < 8) - c.ch = buf[x]; - switch (c.ch) + pg->data[y][x].ch=' '; // case 0x00 ... 0x1f + switch (c=*p++) { - case 0x00 ... 0x07: /* alpha + fg color */ - c.fg = c.ch & 7; - c.attr &= ~(EA_GRAPHIC | EA_SEPARATED | EA_CONCEALED); - goto ctrl; - case 0x08: /* flash */ - c.attr |= EA_BLINK; - goto ctrl; - case 0x09: /* steady */ - c.attr &= ~EA_BLINK; - goto ctrl; - case 0x0a: /* end box */ - case 0x0b: /* start box */ - goto ctrl; - case 0x0c: /* normal height */ - c.attr &= EA_DOUBLE; - goto ctrl; - case 0x0d: /* double height */ - c.attr |= EA_DOUBLE; - dbl = 1; - goto ctrl; - case 0x10 ... 0x17: /* gfx + fg color */ - c.fg = c.ch & 7; - c.attr |= EA_GRAPHIC; - c.attr &= ~EA_CONCEALED; - goto ctrl; - case 0x18: /* conceal */ - c.attr |= EA_CONCEALED; - goto ctrl; - case 0x19: /* contiguous gfx */ - c.attr &= ~EA_SEPARATED; - goto ctrl; - case 0x1a: /* separate gfx */ - c.attr |= EA_SEPARATED; - goto ctrl; - case 0x1c: /* black bf */ - c.bg = 0; - goto ctrl; - case 0x1d: /* new bg */ - c.bg = c.fg; - goto ctrl; - case 0x1e: /* hold gfx */ - hold = 1; - goto ctrl; - case 0x1f: /* release gfx */ - hold = 0; - goto ctrl; - - case 0x0e: /* SO */ - case 0x0f: /* SI */ - case 0x1b: /* ESC */ - c.ch = ' '; - break; - - ctrl: - c.ch = ' '; - if (hold && (c.attr & EA_GRAPHIC)) - c.ch = last_ch; - break; - } - if (c.attr & EA_GRAPHIC) - if ((c.ch & 0xa0) == 0x20) + case 0x00 ... 0x07: + //Alpha Colour Codes (foreground) + //Set-After + new_gfx=0; + new_fg=c; // in this case (c == (c & 0x07)) + new_con=0; + break; + case 0x08: + //Flash + //Set-After + new_bln=EA_BLINK; + break; + case 0x09: + //Steady + //Set-At + new_bln=here_bln=0; + break; + case 0x0a: + //End Box + //Set-After + //!!! not processed + break; + case 0x0b: + //Start Box (used with End Box to mark visible + // part of page on transparent ones + // eg. newsflash or subtitle ) + //Set-After + //!!! not processed + break; + case 0x0c: + //Normal Size + //Set-At + new_dbl=here_dbl=0; + break; + case 0x0d: + //Double Height + //Set-After + dbl=1; + new_dbl=EA_DOUBLE; + break; + case 0x0e: + //Double Width (for Presentation Level 2.5 and 3.5) + //Set-After + //!!! not processed + break; + case 0x0f: + //Double Size (for Presentation Level 2.5 and 3.5) + //Set-After + //!!! not processed + break; + case 0x10 ... 0x17: + //Mosaic Colour Codes + //Set-After + new_gfx=EA_GRAPHIC; + new_fg= c & 0x07; + new_con=0; + break; + case 0x18: + //Conceal + //Set-At + here_con=new_con=EA_CONCEALED; + break; + case 0x19: + //Contiguous Mosaic Graphics + //Set-At + here_sep=0; + break; + case 0x1a: + //Separated Mosaic Graphics + //Set-At + here_sep=EA_SEPARATED; + break; + case 0x1b: + //ESC (or Switch) + //Set-After + //!!! not processed + break; + case 0x1c: + //Black Background + //Set-At + here_bg=new_bg=0; + break; + case 0x1d: + //New Background + //Set-At + here_bg=new_bg=here_fg; + break; + case 0x1e: + //Hold Mosaics + //Set-At + here_hld=new_hld=1; + break; + case 0x1f: + //Release Mosaics + //Set-After + new_hld=0; + break; + + // start of "... processing ..." + + default: //noncontrol characters + pg->data[y][x].ch=c; + /* **************************** */ + /* special treating of sep + * when in Hold-Mosaics mode + * see the specs for details... + */ + if (c & (1<<5)) //why "6" bit set is (1<<5) ???????? { - last_ch = c.ch; - c.ch += (c.ch & 0x40) ? 32 : -32; + held_mosaic_char=c; + held_sep=here_sep; } - if (c.attr & EA_CONCEALED) - if (not e->reveal) - c.ch = ' '; - pg->data[y][x] = c; - } - if (dbl) - { - pg->dbl |= 1 << y; - for (x = 0; x < W; ++x) - { - if (~pg->data[y][x].attr & EA_DOUBLE) - pg->data[y][x].attr |= EA_HDOUBLE; - pg->data[y+1][x] = pg->data[y][x]; - pg->data[y+1][x].ch = ' '; - } - y++; - p += W; + if (here_hld) //when in "hold" set 'here_sep' here: + pg->data[y][x].attr|=here_sep; + /* **************************** */ + } //end of switch + + if (here_hld) c=held_mosaic_char; + + if ((here_gfx) && ((c & 0xa0) == 0x20)) + pg->data[y][x].ch= c + ((c & 0x40) ? 32 : -32); + + if ((here_con) && (not e->reveal)) + pg->data[y][x].ch=' '; + + pg->data[y][x].fg=here_fg; + pg->data[y][x].bg=here_bg; + + if (here_hld) // special treating again... + pg->data[y][x].attr=(here_dbl|here_gfx| + here_bln|here_con); + else // when not in "hold" set 'here_sep' here + pg->data[y][x].attr=(here_dbl|here_gfx| + here_bln|here_con|here_sep); + + // end of "... processing ..." + here_gfx=new_gfx; + here_fg=new_fg; + here_bg=new_bg; + here_bln=new_bln; + here_dbl=new_dbl; + here_con=new_con; + here_hld=new_hld; } + if (dbl) + { + pg->dbl |= 1 << y; + for (x = 0; x < W; ++x) + { + if (~pg->data[y][x].attr & EA_DOUBLE) + pg->data[y][x].attr |= EA_HDOUBLE; + pg->data[y+1][x] = pg->data[y][x]; + pg->data[y+1][x].ch = ' '; + } + y++;p+=40; + } } - pg->hid = pg->dbl << 1; + } int diff -r -N -u alevt-1.5.0.orig/ui.c alevt-1.5.0/ui.c --- alevt-1.5.0.orig/ui.c Fri Oct 8 02:03:11 1999 +++ alevt-1.5.0/ui.c Fri Oct 15 09:40:34 1999 @@ -17,6 +17,10 @@ #include "export.h" #include "ui.h" +#ifdef XAWTV_HACKS +#include "xawtv-remote.h" +#endif /*XAWTV_HACKS*/ + int enab_editor = 0; static char save_format[EDLEN] = "ascii"; // just to remember prev format @@ -678,6 +682,43 @@ else msg(w, "Finetune auto adjusting."); break; +#ifdef XAWTV_HACKS + case '+': + { + char * commands[]={"volume","inc"}; + if (xawtv_remote(2,commands)) + msg(w, "No xawtv running."); + } + break; + case '-': + { + char * commands[]={"volume","dec"}; + if (xawtv_remote(2,commands)) + msg(w, "No xawtv running."); + } + break; + case '\r': + { + char * commands[]={"volume","mute"}; + if (xawtv_remote(2,commands)) + msg(w, "No xawtv running."); + } + break; + case KEY_PUP: + { + char * commands[]={"setstation","next"}; + if (xawtv_remote(2,commands)) + msg(w, "No xawtv running."); + } + break; + case KEY_PDOWN: + { + char * commands[]={"setstation","prev"}; + if (xawtv_remote(2,commands)) + msg(w, "No xawtv running."); + } + break; +#endif /*XAWTV_HACKS*/ default: err(w, "Unused key."); break; diff -r -N -u alevt-1.5.0.orig/xawtv-remote.c alevt-1.5.0/xawtv-remote.c --- alevt-1.5.0.orig/xawtv-remote.c Thu Jan 1 01:00:00 1970 +++ alevt-1.5.0/xawtv-remote.c Fri Oct 15 09:40:34 1999 @@ -0,0 +1,100 @@ +/* see xawtv-remote.h for comments */ +/* Orig by Gerd Knorr */ +/* Modifications by Paul Ortyl */ + + +/* shameless stolen from netscape :-) */ + +#include +#include +#include +#include + +#include +#include +#include /* for XmuClientWindow() */ + +static Window +xawtv_find_window(Display * dpy, Atom atom) +{ + int i; + Window root = RootWindowOfScreen(DefaultScreenOfDisplay(dpy)); + Window root2, parent, *kids; + unsigned int nkids; + Window result = 0; + + if (!XQueryTree(dpy, root, &root2, &parent, &kids, &nkids)) + return(0); + + if (!(kids && nkids)) + return(0); + + for (i = nkids - 1; i >= 0; i--) { + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char *args = NULL; + + Window w = XmuClientWindow(dpy, kids[i]); + + XGetWindowProperty(dpy, w, atom, + 0, (65536 / sizeof(long)), + False, XA_STRING, + &type, &format, &nitems, &bytesafter, + &args); + + if (!args) + continue; + for (i = 0; (unsigned int) i < nitems; i += strlen(args + i) + 1); + XFree(args); + + result = w; + break; + } + return result; +} + +void +xawtv_pass_cmd(Display *dpy, Atom atom, Window win, int argc, char **argv) +{ + int i, len; + char *pass; + + for (len = 0, i = 0; i < argc; i++) { + len += strlen(argv[i]) + 1; + } + + pass = malloc(len); + pass[0] = 0; + for (len = 0, i = 0; i < argc; i++) + strcpy(pass + len, argv[i]), + len += strlen(argv[i]) + 1; + XChangeProperty(dpy, win, + atom, XA_STRING, + 8, PropModeReplace, + pass, len); + free(pass); +} + +int +xawtv_remote(int argcount, char *argval[]) +{ + Display *dpy; + char *dpyname = NULL; + Window win; + Atom station,remote; + int c; + + if (NULL == (dpy = XOpenDisplay(dpyname))) return(1); + + station = XInternAtom(dpy, "_XAWTV_STATION", False); + remote = XInternAtom(dpy, "_XAWTV_REMOTE", False); + + if (0 == (win = xawtv_find_window(dpy,station))) return(1); + + xawtv_pass_cmd(dpy, remote, win, argcount, argval); + + XCloseDisplay(dpy); + return(0); +} + diff -r -N -u alevt-1.5.0.orig/xawtv-remote.h alevt-1.5.0/xawtv-remote.h --- alevt-1.5.0.orig/xawtv-remote.h Thu Jan 1 01:00:00 1970 +++ alevt-1.5.0/xawtv-remote.h Fri Oct 15 09:40:34 1999 @@ -0,0 +1,29 @@ +/* passing commands to xawtv + the code is an adapted xawtv-remote.c by Paul Ortyl + (from xawtv-2.44 by Gerd Knorr ) + !!! no syntax errror checking !!! +available commands: + setstation | | next | prev + Tune in some station from $HOME/.xawtv. Takes either name or the + number (0 = first entry) of the config file entry as argument. + setchannel | next | prev + Tune in some channel. Takes the channel number as argument + capture on | off + Turn on/off video + volume mute | dec | inc | + number (range 0 - 65536) sets the volume, the other arguments + (un)mute sound or increase/decrease volume + grab [ [ [ ]]] + capture a single image + format ppm | jpeg ppm is default + size full | win | x full is default + filename default is snap*.jpeg (the same xawtv uses + if you press the G or J key to capture an image) + You should use absolute paths here... + msg text + display "text" in the window title (onscreen display if in + fullscreen mode + +*/ +/* on error returns 1, on success returns 0*/ +int xawtv_remote(int argcount, char *argval[]); diff -r -N -u alevt-1.5.0.orig/xio.c alevt-1.5.0/xio.c --- alevt-1.5.0.orig/xio.c Fri Oct 8 00:24:38 1999 +++ alevt-1.5.0/xio.c Fri Oct 15 09:37:52 1999 @@ -556,6 +556,7 @@ { int fg = 7, bg = 0, _fg, _bg; int dbl = 0, blk = 0, con = 0, gfx = 0, sep = 0, hld = 0; + int last_bg=0, last_fg=7, last_gfx=0; int last_ch = ' '; for (x = 0; x < W; ++x) @@ -596,11 +597,11 @@ case 0x1a: /* separate graphics */ sep = 1; goto ctrl; - case 0x1c: /* black background */ - bg = 0; + case 0x1c: /* black background, set-at*/ + last_bg=bg = 0; goto ctrl; - case 0x1d: /* new background */ - bg = fg; + case 0x1d: /* new background, set-at */ + last_bg=bg = fg; goto ctrl; case 0x1e: /* hold graphics */ hld = 1; @@ -617,7 +618,7 @@ ctrl: c = ' '; - if (hld && gfx) + if (hld && last_gfx) c = last_ch; break; @@ -629,14 +630,14 @@ break; } - if (gfx && (c & 0xa0) == 0x20) + if (last_gfx && (c & 0xa0) == 0x20) { last_ch = c; c += (c & 0x40) ? 32 : -32; } - _fg = fg; - _bg = bg; + _fg = last_fg; + _bg = last_bg; if (blk) _fg |= 8; if (y >= xw->sel_y1 && y < xw->sel_y2 && @@ -651,8 +652,13 @@ draw_cursor(xw, xw->curs_x, xw->curs_y, dbl); if (xw->sel_pixmap && (_bg & 8)) - draw_char(xw, xw->sel_pixmap, con ? bg : fg, bg, c, dbl, - x - xw->sel_x1, y - xw->sel_y1, y); + draw_char(xw, xw->sel_pixmap, con ? last_bg : last_fg, + last_bg, c, dbl, + x - xw->sel_x1, y - xw->sel_y1, y); + last_fg=fg; + last_bg=bg; + last_gfx=gfx; + } } else