aboutsummaryrefslogtreecommitdiff
path: root/windows.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2022-11-07 21:42:38 +0000
committerBen Harris <bjh21@bjh21.me.uk>2022-11-08 00:57:36 +0000
commite45cd43aaab7af014607b2578ec68a5bbec1b609 (patch)
treefa7c2f2eea3ca96dcaa06ef7b949b0e28ffe7be6 /windows.c
parentfba22f04d684dfb14d1f74c12ba71dd0b2f7be32 (diff)
downloadpuzzles-e45cd43aaab7af014607b2578ec68a5bbec1b609.zip
puzzles-e45cd43aaab7af014607b2578ec68a5bbec1b609.tar.gz
puzzles-e45cd43aaab7af014607b2578ec68a5bbec1b609.tar.bz2
puzzles-e45cd43aaab7af014607b2578ec68a5bbec1b609.tar.xz
Teach the mid-end about device pixel ratios
The device pixel ratio indicates how many physical pixels there are in the platonic ideal of a pixel, at least approximately. In Web browsers, the device pixel ratio is used to represent "retina" displays with particularly high pixel densities, and also to reflect user-driven zooming of the page to different text sizes. The mid-end uses the device pixel ratio to adjust the tile size at startup, and can also respond to changes in device pixel ratio by adjusting the time size later. This is accomplished through a new argument to midend_size() which can simply be passed as 1.0 in any front end that doesn't care about this.
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/windows.c b/windows.c
index aa95b62..e58a150 100644
--- a/windows.c
+++ b/windows.c
@@ -1285,7 +1285,7 @@ static bool check_window_resize(frontend *fe, int cx, int cy,
* See if we actually got the window size we wanted, and adjust
* the puzzle size if not.
*/
- midend_size(fe->me, &x, &y, true);
+ midend_size(fe->me, &x, &y, true, 1.0);
if (x != cx || y != cy) {
/*
* Resize the window, now we know what size we _really_
@@ -1611,7 +1611,7 @@ static int fe_set_midend(frontend *fe, midend *me)
fe->statusbar = NULL;
get_max_puzzle_size(fe, &x, &y);
- midend_size(fe->me, &x, &y, false);
+ midend_size(fe->me, &x, &y, false, 1.0);
r.left = r.top = 0;
r.right = x;
@@ -2374,12 +2374,12 @@ static void new_game_size(frontend *fe, float scale)
int x, y;
get_max_puzzle_size(fe, &x, &y);
- midend_size(fe->me, &x, &y, false);
+ midend_size(fe->me, &x, &y, false, 1.0);
if (scale != 1.0) {
x = (int)((float)x * fe->puzz_scale);
y = (int)((float)y * fe->puzz_scale);
- midend_size(fe->me, &x, &y, true);
+ midend_size(fe->me, &x, &y, true, 1.0);
}
fe->ymin = (fe->xmin * y) / x;