mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Don't initialise GTK in --screenshot mode.
I had this idea today and immediately wondered why I'd never had it before! To generate the puzzle screenshots used on the website and as program icons, we run the GTK front end with the --screenshot option, which sets up GTK, insists on connecting to an X server (or other display), draws the state of a puzzle on a Cairo surface, writes that surface out to a .png file, and exits. But there's no reason we actually need the GTK setup during that process, especially because the surface we do the drawing on is our _own_ surface, not even one provided to us by GTK. We could just set up a Cairo surface by itself, draw on it, and save it to a file. Calling gtk_init is not only pointless, but actively inconvenient, because it means the build script depends on having an X server available for the sole purpose of making gtk_init not complain. So now I've simplified things, by adding a 'headless' flag in new_window and the frontend structure, which suppresses all uses of actual GTK, leaving only the Cairo surface setup and enough supporting stuff (like colours) to generate the puzzle image. One awkward build dependency removed. This means that --screenshot no longer works in GTK 2, which I don't care about, because it only needs to run on _one_ platform.
This commit is contained in:
2
Buildscr
2
Buildscr
@ -34,7 +34,7 @@ ifneq "$(NOICONS)" yes then
|
||||
in puzzles do make -j$(nproc)
|
||||
|
||||
# Now build the screenshots and icons.
|
||||
in puzzles/icons do xvfb-run -s "-screen 0 1024x768x24" make web winicons gtkicons -j$(nproc)
|
||||
in puzzles/icons do make web winicons gtkicons -j$(nproc)
|
||||
|
||||
# Destroy the local binaries and autoconf detritus, mostly to avoid
|
||||
# wasting network bandwidth by transferring them to the delegate
|
||||
|
Reference in New Issue
Block a user