Re: xwallpaper: a pledged wallpaper utility

2017-04-02 Thread Tobias Stoeckmann
Hi Juan,

On Sun, Apr 02, 2017 at 02:48:20AM +0200, Juan Francisco Cantero Hurtado wrote:
> > and/or into code reviewing: Please do so! And if you have a big endian
> > machine, it would be great if you can see if it works there as well.
> 
> The program works fine on macppc with a png image.

that's great news to hear. I was uncertain about it because it does some
byte to int conversions, but it seems that this is generally okay on
such systems at well. Looked around at other projects, but why would I
trust them without first- or at least second-hand experience? ;)

> Are you going to create a port for xwallpaper?

If all goes well and no show stoppers, major bugs, flaws in the design
etc. show up, I'll propose it to ports@ next weekend.


Thanks for testing (including everyone who did),

Tobias



Re: xwallpaper: a pledged wallpaper utility

2017-04-01 Thread Juan Francisco Cantero Hurtado
On Sat, Apr 01, 2017 at 11:43:04AM +0200, Tobias Stoeckmann wrote:
> Hi misc@,
> 
> during the last weeks, I have reviewed quite some image tools out there
> because I needed one to set a wallpaper on my X server. I am not using
> a sophisticated desktop environment, so there was a need for a
> standalone tool. Let's keep it short: I have found and reported many
> bugs, and had to stop eventually after accepting that these libraries
> are either legacy/unmaintained or beyond repair (calling printf and free
> in signal handlers, anyone?).
> 
> To overcome this issue, I decided to write a simple utility, with the
> common OpenBSD focuses: Simplicity, security, doing exactly one thing.
> 
> The tool supports three file formats:
> 
> - JPEG; virtually everyone uses it
> - PNG; most popular lossless format
> - XPM; well, it's the most common agreement on X installations out there
> 
> I still want to be able to zoom into my pictures, so these modes of
> operations are supported:
> 
> - tile; tiles the image next to each other until screen/output is filled
> - center; centers the image
> - maximize; maximizes the image without cutting things off
> - stretch; destroys aspect ratio and fills the whole screen/output
> - zoom; maximizes the image and cuts things off, screen/output is filled
> 
> To get nice results, xwallpaper directly uses pixman for pixel
> operations. In case you don't know pixman: It is the direct foundation
> for the xorg-server to do pixel operations. No further dependencies!
> 
> Next to this, it avoids using the old (deprecated) X11 libraries. Found
> bugs in them as well and also got repeatedly told that they are not
> supposed to be used anymore either. So I decided to go with XCB.
> 
> Multi monitor setups are too regular by today to completely ignore them
> or using Xinerama with its weird numbering. Instead, it uses RandR if
> available, which makes it pretty nice to use. It even supports different
> modes (tiling, centering etc.) on different outputs! And if you are used
> to run xrandr, the syntax will be very familiar.
> 
> Last but not least, the tool is tightly pledged. We all know that file
> formats suck and they contain lots of bugs. For increased security, I
> have included pledge support right from the start. Before even one
> instruction of one of these image libraries is called, pledge is already
> down to "stdio". That's really tight! :)
> 
> All in all, it can be compiled with 0 dependencies with xenocara. Keep
> in mind that you just have XPM support then, though.
> 
> It's not in ports (yet?). It would be really great if you can give it a
> try, experiment a bit, and give me feedback. If you are an XCB expert
> and/or into code reviewing: Please do so! And if you have a big endian
> machine, it would be great if you can see if it works there as well.

The program works fine on macppc with a png image.

> 
> The project as well as its release files can be found on GitHub:
> https://github.com/stoeckmann/xwallpaper
> 
> 
> Hope someone finds this tool useful, too.

Are you going to create a port for xwallpaper?


-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: xwallpaper: a pledged wallpaper utility

2017-04-01 Thread Bryan Steele
On Sat, Apr 01, 2017 at 11:43:04AM +0200, Tobias Stoeckmann wrote:
> Hi misc@,
> 
> during the last weeks, I have reviewed quite some image tools out there
> because I needed one to set a wallpaper on my X server. I am not using
> a sophisticated desktop environment, so there was a need for a
> standalone tool. Let's keep it short: I have found and reported many
> bugs, and had to stop eventually after accepting that these libraries
> are either legacy/unmaintained or beyond repair (calling printf and free
> in signal handlers, anyone?).
> 
> To overcome this issue, I decided to write a simple utility, with the
> common OpenBSD focuses: Simplicity, security, doing exactly one thing.
> 
> The tool supports three file formats:
> 
> - JPEG; virtually everyone uses it
> - PNG; most popular lossless format
> - XPM; well, it's the most common agreement on X installations out there
> 
> I still want to be able to zoom into my pictures, so these modes of
> operations are supported:
> 
> - tile; tiles the image next to each other until screen/output is filled
> - center; centers the image
> - maximize; maximizes the image without cutting things off
> - stretch; destroys aspect ratio and fills the whole screen/output
> - zoom; maximizes the image and cuts things off, screen/output is filled
> 
> To get nice results, xwallpaper directly uses pixman for pixel
> operations. In case you don't know pixman: It is the direct foundation
> for the xorg-server to do pixel operations. No further dependencies!
> 
> Next to this, it avoids using the old (deprecated) X11 libraries. Found
> bugs in them as well and also got repeatedly told that they are not
> supposed to be used anymore either. So I decided to go with XCB.
> 
> Multi monitor setups are too regular by today to completely ignore them
> or using Xinerama with its weird numbering. Instead, it uses RandR if
> available, which makes it pretty nice to use. It even supports different
> modes (tiling, centering etc.) on different outputs! And if you are used
> to run xrandr, the syntax will be very familiar.
> 
> Last but not least, the tool is tightly pledged. We all know that file
> formats suck and they contain lots of bugs. For increased security, I
> have included pledge support right from the start. Before even one
> instruction of one of these image libraries is called, pledge is already
> down to "stdio". That's really tight! :)
> 
> All in all, it can be compiled with 0 dependencies with xenocara. Keep
> in mind that you just have XPM support then, though.
> 
> It's not in ports (yet?). It would be really great if you can give it a
> try, experiment a bit, and give me feedback. If you are an XCB expert
> and/or into code reviewing: Please do so! And if you have a big endian
> machine, it would be great if you can see if it works there as well.
> 
> The project as well as its release files can be found on GitHub:
> https://github.com/stoeckmann/xwallpaper
> 
> 
> Hope someone finds this tool useful, too.

It does what it says on the tin, really handy. Thanks for sharing.

> Tobias
>

-Bryan.



xwallpaper: a pledged wallpaper utility

2017-04-01 Thread Tobias Stoeckmann
Hi misc@,

during the last weeks, I have reviewed quite some image tools out there
because I needed one to set a wallpaper on my X server. I am not using
a sophisticated desktop environment, so there was a need for a
standalone tool. Let's keep it short: I have found and reported many
bugs, and had to stop eventually after accepting that these libraries
are either legacy/unmaintained or beyond repair (calling printf and free
in signal handlers, anyone?).

To overcome this issue, I decided to write a simple utility, with the
common OpenBSD focuses: Simplicity, security, doing exactly one thing.

The tool supports three file formats:

- JPEG; virtually everyone uses it
- PNG; most popular lossless format
- XPM; well, it's the most common agreement on X installations out there

I still want to be able to zoom into my pictures, so these modes of
operations are supported:

- tile; tiles the image next to each other until screen/output is filled
- center; centers the image
- maximize; maximizes the image without cutting things off
- stretch; destroys aspect ratio and fills the whole screen/output
- zoom; maximizes the image and cuts things off, screen/output is filled

To get nice results, xwallpaper directly uses pixman for pixel
operations. In case you don't know pixman: It is the direct foundation
for the xorg-server to do pixel operations. No further dependencies!

Next to this, it avoids using the old (deprecated) X11 libraries. Found
bugs in them as well and also got repeatedly told that they are not
supposed to be used anymore either. So I decided to go with XCB.

Multi monitor setups are too regular by today to completely ignore them
or using Xinerama with its weird numbering. Instead, it uses RandR if
available, which makes it pretty nice to use. It even supports different
modes (tiling, centering etc.) on different outputs! And if you are used
to run xrandr, the syntax will be very familiar.

Last but not least, the tool is tightly pledged. We all know that file
formats suck and they contain lots of bugs. For increased security, I
have included pledge support right from the start. Before even one
instruction of one of these image libraries is called, pledge is already
down to "stdio". That's really tight! :)

All in all, it can be compiled with 0 dependencies with xenocara. Keep
in mind that you just have XPM support then, though.

It's not in ports (yet?). It would be really great if you can give it a
try, experiment a bit, and give me feedback. If you are an XCB expert
and/or into code reviewing: Please do so! And if you have a big endian
machine, it would be great if you can see if it works there as well.

The project as well as its release files can be found on GitHub:
https://github.com/stoeckmann/xwallpaper


Hope someone finds this tool useful, too.

Tobias