aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-09-26 16:39:49 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-09-26 16:39:49 +0000
commit2d6369482e231e8d2cdfbf567e4b651a4c71f763 (patch)
treef68e923a58041654c5276234e091fde5e29e9890 /input.c
parentPKGBUILD: explicitly set --term=xterm (diff)
main: initialize scale to '1'
This ensures we always have a valid (but possibly incorrect) scaling value. This allows us to simplify code that uses the scale - it doesn't have to verify the scale if valid. Furthermore, since render_resize() is the function that actually updates term->scale, make sure to call it *before* updating the cursor (otherwise, the cursor will use the old scaling value).
Diffstat (limited to 'input.c')
-rw-r--r--input.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/input.c b/input.c
index d2c85ea3..77856a9e 100644
--- a/input.c
+++ b/input.c
@@ -404,9 +404,8 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
{
struct terminal *term = data;
- const int scale = term->scale >= 1 ? term->scale : 1;
- int x = wl_fixed_to_int(surface_x) * scale;
- int y = wl_fixed_to_int(surface_y) * scale;
+ int x = wl_fixed_to_int(surface_x) * term->scale;
+ int y = wl_fixed_to_int(surface_y) * term->scale;
int col = (x - term->x_margin) / term->cell_width;
int row = (y - term->y_margin) / term->cell_height;