Leonardo Taccari writes: > [...] > The attached patch fixes negative values passed to scrollh() and > scrollv() by adding an extra sign character (`-' or `+') to the > msg. > [...]
Quentin kindly commented that off-list and here an updated and simpler version to just cast the passed `char' to `signed char' (possible mistakes are mine though!).
From fc2fa635183835db6db4cdded4bfba356395dbdc Mon Sep 17 00:00:00 2001 From: Leonardo Taccari <[email protected]> Date: Mon, 17 Jun 2019 17:30:43 +0200 Subject: [PATCH] Fix negative values in readpipe() --- libsurf-webext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsurf-webext.c b/libsurf-webext.c index ec9a235..be8d4ee 100644 --- a/libsurf-webext.c +++ b/libsurf-webext.c @@ -91,14 +91,14 @@ readpipe(GIOChannel *s, GIOCondition c, gpointer unused) return TRUE; ww = webkit_dom_dom_window_get_inner_width(view); webkit_dom_dom_window_scroll_by(view, - (ww / 100) * msg[3], 0); + (ww / 100) * (signed char)msg[3], 0); break; case 'v': if (msgsz != 4) return TRUE; wh = webkit_dom_dom_window_get_inner_height(view); webkit_dom_dom_window_scroll_by(view, - 0, (wh / 100) * msg[3]); + 0, (wh / 100) * (signed char)msg[3]); break; } -- 2.22.0
