diff options
author | Phil Jones <philj56@gmail.com> | 2023-03-03 00:28:53 +0000 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2023-03-03 00:28:53 +0000 |
commit | 828744849d0b41d0b65db4f0bcb9be7e8698fdd0 (patch) | |
tree | 07e5046a244baf6efd10548bd8200bae09db1234 /src/config.c | |
parent | 570ea4ab9e7f8e3cb71dba199cb8fb46e1f58cdb (diff) |
Convert to using wp_viewporter.
This is the next step in supporting fractional scaling, as
wl_surface_set_buffer_scale only supports integer scale factors.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c index 23dbc7f..31db79d 100644 --- a/src/config.c +++ b/src/config.c @@ -775,14 +775,6 @@ void config_fixup_values(struct tofi *tofi) base_height /= scale; } - tofi->window.width = fixup_percentage( - tofi->window.width, - base_width, - tofi->window.width_is_percent); - tofi->window.height = fixup_percentage( - tofi->window.height, - base_height, - tofi->window.height_is_percent); tofi->window.margin_top = fixup_percentage( tofi->window.margin_top, base_height, @@ -816,6 +808,27 @@ void config_fixup_values(struct tofi *tofi) base_width, tofi->window.entry.padding_right_is_percent); + /* + * Window width and height are a little special. We're only going to be + * using them to specify sizes to Wayland, which always wants scaled + * pixels, so always scale them here (unless we've directly specified a + * scaled size). + */ + tofi->window.width = fixup_percentage( + tofi->window.width, + tofi->output_width, + tofi->window.width_is_percent); + tofi->window.height = fixup_percentage( + tofi->window.height, + tofi->output_height, + tofi->window.height_is_percent); + if (tofi->window.width_is_percent || !tofi->use_scale) { + tofi->window.width /= scale; + } + if (tofi->window.height_is_percent || !tofi->use_scale) { + tofi->window.height /= scale; + } + /* Don't attempt percentage handling if exclusive_zone is set to -1. */ if (tofi->window.exclusive_zone > 0) { /* Exclusive zone base depends on anchor. */ |