From d1febf5a40c0f7138be4b5558ed13a9dd5466d07 Mon Sep 17 00:00:00 2001 From: Xanfre Date: Tue, 7 May 2019 20:16:45 -0500 Subject: [PATCH 1/3] Optimize scrolling for high-resolution mouse wheels and trackpads --- AngelLoader/CustomControls/RichTextBoxCustom.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/AngelLoader/CustomControls/RichTextBoxCustom.cs b/AngelLoader/CustomControls/RichTextBoxCustom.cs index 98878473c..1b7c1e7c5 100644 --- a/AngelLoader/CustomControls/RichTextBoxCustom.cs +++ b/AngelLoader/CustomControls/RichTextBoxCustom.cs @@ -382,17 +382,17 @@ private static void RepositionScroll(IntPtr handle, SCROLLINFO si) // Intercept mousewheel and make RichTextBox scroll using the above method private void InterceptMousewheel(ref Message m) { - int delta = (int)m.WParam >> 16 & 0xFF; + int delta = (int)m.WParam; if (((ModifierKeys & Keys.Control) != 0) || !VerticalScrollBarVisible(this)) { base.WndProc(ref m); return; } - if ((delta >> 7) == 1) + if (delta < 0) { BetterScroll(m.HWnd, 50); } - if ((delta >> 7) == 0) + else { BetterScroll(m.HWnd, -50); } @@ -441,6 +441,10 @@ protected override void WndProc(ref Message m) case InteropMisc.WM_MOUSEWHEEL: InterceptMousewheel(ref m); break; + case InteropMisc.WM_MBUTTONDOWN: + break; + case InteropMisc.WM_MBUTTONDBLCLK: + break; // The below DefWndProc() call essentially "calls" this section, and this section "returns" whether // the cursor was over a link (via LinkCursor) case InteropMisc.WM_REFLECT + InteropMisc.WM_NOTIFY: From 60fa0f0eae4f229a5048825d04254dfdd63b9533 Mon Sep 17 00:00:00 2001 From: Xanfre Date: Wed, 8 May 2019 17:58:53 -0500 Subject: [PATCH 2/3] Cleanup --- AngelLoader/CustomControls/RichTextBoxCustom.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/AngelLoader/CustomControls/RichTextBoxCustom.cs b/AngelLoader/CustomControls/RichTextBoxCustom.cs index 1b7c1e7c5..45a4fcb32 100644 --- a/AngelLoader/CustomControls/RichTextBoxCustom.cs +++ b/AngelLoader/CustomControls/RichTextBoxCustom.cs @@ -382,17 +382,16 @@ private static void RepositionScroll(IntPtr handle, SCROLLINFO si) // Intercept mousewheel and make RichTextBox scroll using the above method private void InterceptMousewheel(ref Message m) { - int delta = (int)m.WParam; if (((ModifierKeys & Keys.Control) != 0) || !VerticalScrollBarVisible(this)) { base.WndProc(ref m); return; } - if (delta < 0) + if ((int)m.WParam < 0) { BetterScroll(m.HWnd, 50); } - else + if ((int)m.WParam > 0) { BetterScroll(m.HWnd, -50); } From 815793bbaedc2cc8ddba0af96fba06ae9171ca95 Mon Sep 17 00:00:00 2001 From: Xanfre Date: Wed, 8 May 2019 22:42:54 -0500 Subject: [PATCH 3/3] Re-enable autoscroll --- AngelLoader/CustomControls/RichTextBoxCustom.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/AngelLoader/CustomControls/RichTextBoxCustom.cs b/AngelLoader/CustomControls/RichTextBoxCustom.cs index 45a4fcb32..e17a63046 100644 --- a/AngelLoader/CustomControls/RichTextBoxCustom.cs +++ b/AngelLoader/CustomControls/RichTextBoxCustom.cs @@ -440,10 +440,6 @@ protected override void WndProc(ref Message m) case InteropMisc.WM_MOUSEWHEEL: InterceptMousewheel(ref m); break; - case InteropMisc.WM_MBUTTONDOWN: - break; - case InteropMisc.WM_MBUTTONDBLCLK: - break; // The below DefWndProc() call essentially "calls" this section, and this section "returns" whether // the cursor was over a link (via LinkCursor) case InteropMisc.WM_REFLECT + InteropMisc.WM_NOTIFY: