Commit Graph

59 Commits

Author SHA1 Message Date
Markus Teich
827f3de2e7 clean ffread and rename to ffload
- also remove unneeded memmove in load()
2016-06-30 16:42:34 +02:00
Hiltjo Posthuma
fd303ee9c1 load slide image on-demand
On Sat, Jun 04, 2016 at 05:28:31PM +0200, Markus Teich wrote:
> Hiltjo Posthuma wrote:
> > previously an image file would be opened but only ffread when advancing to
> > the slide, but when the slide was not used it gave an error:
> >
> > 	/usr/local/bin/2ff: failed to convert image/png
>
> Heyho Hiltjo,
>
> thanks for the patch. Unfortunately it does not work if the first slide contains
> an image (ffopen is only called in advance). I think it would be good to merge
> ffopen and ffread instead into a single function ffload. This makes the `LOADED`
> state clearer and also enforces that the fd is closed in the same function where
> it is opened. This ffload function should then be called in advance() replacing
> the ffread() calls if the image is not loaded yet and once in load() for the
> first slide if it is an image.
>

Ah yes, sorry for the oversight.

> If you want to take this new approach, go for it, otherwise I'll look into it
> myself.
>

I have attached a patch that does this, I hope you'll like it.

Also I'm not sure if we need the below code in advance(), I have removed it in
the patch:

        if (slidecount > idx + 1 && slides[idx + 1].img)
                ffread(slides[idx + 1].img);
        if (0 < idx && slides[idx - 1].img)
                ffread(slides[idx - 1].img);

That seems to preload the next and previous slide image right? A minor issue I
notice also is that images seem to flicker, it uses XPutImage directly to
xw.win. Maybe it can be replaced with a backbuffer then XCopyArea? What do you
think?

In advance() it should also not always be needed to rescale the image.

--
Kind regards,
Hiltjo

From 97bebdcab4003f9acdfdd4bdf424449299ffd61d Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 4 Jun 2016 21:34:25 +0200
Subject: [PATCH] merge ffread and ffopen into one function
2016-06-06 17:26:50 +02:00
Hiltjo Posthuma
44a50ad948 load slide image on-demand
previously an image file would be opened but only ffread when advancing to
the slide, but when the slide was not used it gave an error:

	/usr/local/bin/2ff: failed to convert image/png

this changes it to load the image on-demand once and "cache" it.
2016-06-04 17:26:50 +02:00
Markus Teich
27a904c1dd import new drw and util from libsl. 2016-05-24 19:28:44 +02:00
Markus Teich
b954ed4b9f Fix cmdline argument check
There was a segfault when sent was called without arguments. Now we use stdin
when there's no argument or - is used. Thanks to izabera for the report.
2016-03-06 20:49:18 +01:00
Markus Teich
616aafdcb9 no need to reimplement cat here 2016-02-06 14:12:47 +01:00
Markus Teich
3019229279 improve error handling
- errors are now fatal
- no need to clean up when dying
- no need for status return codes => ffread and ffprepare now return void
2016-02-06 14:08:43 +01:00
Markus Teich
77809fae79 style: move function return types to own line 2016-02-05 16:17:43 +01:00
FRIGN
68ac6486b1 Fix alpha blending
- "/ 257", because 255 * 257 = UINT16_MAX
- "/ 255", because that's the maximum possible RGB value
2016-02-05 15:35:59 +01:00
David Phillips
022ae48360 Change an eprintf to a die to stop child from running its own slideshow
The child thread was created because execlp will not return if successful.
The eprintf was placed after the call to execlp to catch any error, but the
child continued to return a (closed) fds[0], resulting in a second slideshow
being run by the child.

This commit fixes the issue by killing the child.
2015-12-24 01:57:50 +01:00
Grant Mathews
54daf38b08 filter via shell pipeline
Instead of requiring an executable, allow building arbitrary shell
pipelines to filter filetypes through.
2015-12-24 01:51:29 +01:00
Markus Teich
11f2c648eb unbreak the build 2015-12-09 00:52:39 +01:00
Markus Teich
008ff1b88b fix 2 uninitialized variables and bin == NULL check 2015-12-09 00:50:05 +01:00
Markus Teich
edb4630564 check for bin == NULL 2015-12-08 22:34:48 +01:00
Markus Teich
24762d0172 minor syntax, style and README fixes 2015-12-08 22:09:26 +01:00
Markus Teich
0798e82d23 support transparent images 2015-12-08 21:46:18 +01:00
sin
b516f468fa Support farbfeld as an intermediate format
Sent now uses farbfeld[0] as an intermediate format.  A series of
filters is specified in config.h that matches file extensions to
filter programs.  The programs will convert between formats such as
png to farbfeld.  Internally in sent we do not need to worry on how
to parse png or any other format.

This also works with jpg and gif and others.  The 2ff wrapper will
use imagemagick conversion tools.  This is temporary as jpg2ff and
gif2ff will also be implemented.

To make this work, you will have to clone[0] and put png2ff and 2ff
in your PATH.

[0] http://git.2f30.org/farbfeld/
2015-12-08 20:01:36 +01:00
Markus Teich
7e558105e6 add 'sent: ' prefix to errors 2015-12-03 23:02:14 +01:00
Alexis
91aeb01dce Refactor die() to use eprintf() 2015-12-03 23:00:44 +01:00
Alexis
824dae147e Use consistent wording for error messages 2015-12-03 23:00:28 +01:00
Quentin Rameau
a1dcdad14f Bail out before allocating slides if file is empty
In load() we allocated slides before checking if we actually read
anything from the FILE fp and then continue with an allocated but
“empty” space wich would lead to errors.
2015-11-18 23:26:33 +01:00
Markus Teich
eac14478e9 fix dying on empty slidefile 2015-11-18 23:24:53 +01:00
Markus Teich
cc57a28eba die if no font could be loaded 2015-11-18 00:41:38 +01:00
Markus Teich
4a828c2d6c prevent flickering when changing slides
When the window background is left at WhitePixel (from initialization) and the
user has set a dark background color in config.h, the window shortly displays
the white default background when clearing after advancing to another slide.
This was very disturbing and is fixed now by setting the default window
background color to the bgcol chosen in config.h.
2015-11-17 01:04:04 +01:00
Markus Teich
b1cb3bbc20 fix another index overflow issue 2015-11-17 00:23:51 +01:00
Markus Teich
84734c73e8 fix several number overflow issues 2015-11-17 00:19:39 +01:00
Markus Teich
22a0a7f255 add multiline support 2015-11-11 23:46:24 +01:00
Markus Teich
d7eac23083 fix more memory leaks 2015-11-11 19:09:13 +01:00
Markus Teich
b23121b4aa free all fonts correctly 2015-11-11 19:00:54 +01:00
Markus Teich
d302f2efe1 free temporary fontstr arrays 2015-11-11 18:53:54 +01:00
Markus Teich
f6455efd52 simplify png cleanup 2015-11-11 18:50:46 +01:00
Tony Lainson
8b52c85dd1 don't assume we get a ConfigureNotify event
If the window manager maps our window at the requested size, we may not get a
ConfigureNotify event.  This happens e.g. under ratpoison.

The result is that xw.uw and xw.uh are never set, so text is too small and
pngscale() tries to divide by 0.
2015-11-10 16:56:37 +01:00
Szabolcs Nagy
4ca44387e6 initialize .img
without the attached patch ./sent example segfaults here
2015-11-10 16:55:22 +01:00
Markus Teich
3ce84e7170 don't use EXIT_… cpp defines 2015-11-07 23:52:35 +01:00
Markus Teich
9ab88b5935 make colors configurable 2015-11-04 01:43:13 +01:00
Markus Teich
fc82374b03 update license year 2015-11-04 01:40:50 +01:00
Markus Teich
345b48fe03 remove unused font configuration, update license year 2015-10-31 18:10:47 +01:00
Markus Teich
a9ca2473fd fix font width calculations 2015-10-31 18:07:07 +01:00
Markus Teich
4a114392bb remove unused type qualifiers 2015-10-31 16:25:02 +01:00
Markus Teich
6b002c44b8 fonts are automatically cleaned up 2015-08-29 02:24:42 +02:00
Markus Teich
d06622336b drw_resize should be called on mapping as well 2015-05-03 22:08:30 +02:00
Markus Teich
8215db707c remove debug statement 2015-05-02 13:29:03 +02:00
Markus Teich
96e1607e78 typedef image struct 2015-05-01 21:34:52 +02:00
Markus Teich
036d77fffe minor style adaptions 2015-04-30 22:00:14 +02:00
Markus Teich
8606d72ced fonts cleanup 2015-04-28 00:27:43 +02:00
Markus Teich
e9261114fe remove unused dc/gc variables 2015-04-27 23:26:03 +02:00
Markus Teich
4166516862 remove old stuff and fix warnings 2015-04-25 20:18:43 +02:00
Markus Teich
75081d228e blank screen before drawing text 2015-04-22 11:57:08 +02:00
Markus Teich
5394f7f539 fix calculation of correct font size to use 2015-04-22 11:56:41 +02:00
Markus Teich
85d25716b0 use new font system from drw 2015-04-20 22:20:16 +02:00