Try this:
diff --git a/src/window.c b/src/window.c
index 8cdad27b66..b23ae41aba 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5475,7 +5475,9 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool
whole, bool noerror)
wset_redisplay (XWINDOW (window));
- if (whole && Vfast_but_imprecise_scrolling)
+ if (Vfast_but_imprecise_scrolling
+ && (whole
+ || EQ (Vthis_command, Qmwheel_scroll)))
specbind (Qfontification_functions, Qnil);
/* On GUI frames, use the pixel-based version which is much slower
@@ -8173,6 +8175,7 @@ syms_of_window (void)
DEFSYM (Qmode_line_format, "mode-line-format");
DEFSYM (Qheader_line_format, "header-line-format");
DEFSYM (Qtab_line_format, "tab-line-format");
+ DEFSYM (Qmwheel_scroll, "mwheel-scroll");