minor syntax, style and README fixes
This commit is contained in:
parent
0798e82d23
commit
24762d0172
12
README.md
12
README.md
@ -1,14 +1,19 @@
|
|||||||
sent is a simple plaintext presentation tool.
|
sent is a simple plaintext presentation tool.
|
||||||
|
|
||||||
sent does not need latex, libreoffice or any other fancy file format, it uses
|
sent does not need latex, libreoffice or any other fancy file format, it uses
|
||||||
plaintext files and png images. Every paragraph represents a slide in the
|
plaintext files to describe the slides and can include images via farbfeld.
|
||||||
presentation.
|
Every paragraph represents a slide in the presentation.
|
||||||
|
|
||||||
The presentation is displayed in a simple X11 window. The content of each slide
|
The presentation is displayed in a simple X11 window. The content of each slide
|
||||||
is automatically scaled to fit the window and centered so you also don't have to
|
is automatically scaled to fit the window and centered so you also don't have to
|
||||||
worry about alignment. Instead you can really concentrate on the content.
|
worry about alignment. Instead you can really concentrate on the content.
|
||||||
|
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
|
||||||
|
You need Xlib to build sent and the farbfeld[0] tools installed to use images in
|
||||||
|
your presentations.
|
||||||
|
|
||||||
Demo
|
Demo
|
||||||
|
|
||||||
To get a little demo, just type
|
To get a little demo, just type
|
||||||
@ -47,3 +52,6 @@ presentation file could look like this:
|
|||||||
Development
|
Development
|
||||||
|
|
||||||
sent is developed at http://tools.suckless.org/sent
|
sent is developed at http://tools.suckless.org/sent
|
||||||
|
|
||||||
|
|
||||||
|
0: http://git.2f30.org/farbfeld/about/
|
||||||
|
1
example
1
example
@ -20,6 +20,7 @@ easy to use
|
|||||||
|
|
||||||
depends on
|
depends on
|
||||||
♽ Xlib
|
♽ Xlib
|
||||||
|
☃ farbfeld
|
||||||
|
|
||||||
~1000 lines of code
|
~1000 lines of code
|
||||||
|
|
||||||
|
23
sent.c
23
sent.c
@ -186,7 +186,7 @@ Image *ffopen(char *filename)
|
|||||||
tmpfd = fd;
|
tmpfd = fd;
|
||||||
fd = filter(fd, bin);
|
fd = filter(fd, bin);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
eprintf("could not filter %s:", filename);
|
eprintf("Unable to filter %s:", filename);
|
||||||
close(tmpfd);
|
close(tmpfd);
|
||||||
|
|
||||||
if (read(fd, hdr, 16) != 16)
|
if (read(fd, hdr, 16) != 16)
|
||||||
@ -218,7 +218,7 @@ int ffread(Image *img)
|
|||||||
uint8_t opac;
|
uint8_t opac;
|
||||||
uint8_t fg_r, fg_g, fg_b, bg_r, bg_g, bg_b;
|
uint8_t fg_r, fg_g, fg_b, bg_r, bg_g, bg_b;
|
||||||
size_t rowlen, off, nbytes;
|
size_t rowlen, off, nbytes;
|
||||||
ssize_t r;
|
ssize_t count;
|
||||||
|
|
||||||
if (!img)
|
if (!img)
|
||||||
return 0;
|
return 0;
|
||||||
@ -249,10 +249,10 @@ int ffread(Image *img)
|
|||||||
for (off = 0, y = 0; y < img->bufheight; y++) {
|
for (off = 0, y = 0; y < img->bufheight; y++) {
|
||||||
nbytes = 0;
|
nbytes = 0;
|
||||||
while (nbytes < rowlen) {
|
while (nbytes < rowlen) {
|
||||||
r = read(img->fd, (char *)row + nbytes, rowlen - nbytes);
|
count = read(img->fd, (char *)row + nbytes, rowlen - nbytes);
|
||||||
if (r < 0)
|
if (count < 0)
|
||||||
eprintf("read:");
|
eprintf("Unable to read from pipe:");
|
||||||
nbytes += r;
|
nbytes += count;
|
||||||
}
|
}
|
||||||
for (x = 0; x < rowlen / 2; x += 4) {
|
for (x = 0; x < rowlen / 2; x += 4) {
|
||||||
fg_r = ntohs(row[x + 0]) / 256;
|
fg_r = ntohs(row[x + 0]) / 256;
|
||||||
@ -346,7 +346,7 @@ void ffdraw(Image *img)
|
|||||||
int xoffset = (xw.w - img->ximg->width) / 2;
|
int xoffset = (xw.w - img->ximg->width) / 2;
|
||||||
int yoffset = (xw.h - img->ximg->height) / 2;
|
int yoffset = (xw.h - img->ximg->height) / 2;
|
||||||
XPutImage(xw.dpy, xw.win, d->gc, img->ximg, 0, 0,
|
XPutImage(xw.dpy, xw.win, d->gc, img->ximg, 0, 0,
|
||||||
xoffset, yoffset, img->ximg->width, img->ximg->height);
|
xoffset, yoffset, img->ximg->width, img->ximg->height);
|
||||||
XFlush(xw.dpy);
|
XFlush(xw.dpy);
|
||||||
img->state |= DRAWN;
|
img->state |= DRAWN;
|
||||||
}
|
}
|
||||||
@ -604,12 +604,13 @@ void xinit()
|
|||||||
resize(DisplayWidth(xw.dpy, xw.scr), DisplayHeight(xw.dpy, xw.scr));
|
resize(DisplayWidth(xw.dpy, xw.scr), DisplayHeight(xw.dpy, xw.scr));
|
||||||
|
|
||||||
xw.attrs.bit_gravity = CenterGravity;
|
xw.attrs.bit_gravity = CenterGravity;
|
||||||
xw.attrs.event_mask = KeyPressMask | ExposureMask | StructureNotifyMask
|
xw.attrs.event_mask = KeyPressMask | ExposureMask | StructureNotifyMask |
|
||||||
| ButtonMotionMask | ButtonPressMask;
|
ButtonMotionMask | ButtonPressMask;
|
||||||
|
|
||||||
xw.win = XCreateWindow(xw.dpy, XRootWindow(xw.dpy, xw.scr), 0, 0,
|
xw.win = XCreateWindow(xw.dpy, XRootWindow(xw.dpy, xw.scr), 0, 0,
|
||||||
xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, xw.vis,
|
xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr),
|
||||||
CWBitGravity | CWEventMask, &xw.attrs);
|
InputOutput, xw.vis, CWBitGravity | CWEventMask,
|
||||||
|
&xw.attrs);
|
||||||
|
|
||||||
xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
|
xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
|
||||||
xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False);
|
xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False);
|
||||||
|
Loading…
Reference in New Issue
Block a user