chiark / gitweb /
GTK 3: handle nontrivial window scale factors.
authorSimon Tatham <anakin@pobox.com>
Tue, 7 Apr 2020 05:50:20 +0000 (06:50 +0100)
committerSimon Tatham <anakin@pobox.com>
Tue, 7 Apr 2020 07:59:46 +0000 (08:59 +0100)
commit97a0dc0fee0b9e7d1cd488309e03a19e942d1a57
treeaf52e6a95d201b578d44bfdeb3d5da5bd87b1c20
parentd71ac73d8a4397c35b21ec08388a1c6f94691b64
GTK 3: handle nontrivial window scale factors.

A user pointed out that if you run a GTK 3 puzzles with "GDK_SCALE=2"
in the environment, the main game drawing area is blurred. That's
because we're choosing the size of our backing Cairo surface based on
the number of _logical_ pixels in the window size, not taking into
account the fact that the non-unit scale factor means the number of
physical pixels is larger. Everything 'works' in the basis - Cairo
happily expands the smaller backing surface into the larger window -
but resolution is lost in the process.

Now we detect the window's scale factor, construct the backing surface
appropriately, and compensate for that scaling when drawing to the
surface and when blitting the surface to the window.
gtk.c