CefSharp icon indicating copy to clipboard operation
CefSharp copied to clipboard

WPF - Mouse wheel in PDF viewer doesn't work after scrolling with touch screen

Open klotzoliver opened this issue 3 years ago • 10 comments

After using touch display in PDF viewer to scroll (document and thumbnail area) scrolling using mouse wheel doesn’t work anymore.

OS: Windows 10 (19044.1645)

Using Google Chrome 101.0.4951.54 and CEF sample app version 101.0.18.0 feature works as expected.

Tested with CEFSharp WPF sample app

klotzoliver avatar May 16 '22 15:05 klotzoliver

What version of CefSharp did you test with?

CEF sample app version 101.0.18.0 feature

Did you test with the command line args for WPF as listed in the bug report template?

This sounds like an upstream bug.

amaitland avatar May 16 '22 19:05 amaitland

Please confirm you've tested using the following

 cefclient.exe --multi-threaded-message-loop --no-sandbox --off-screen-rendering-enabled --enable-gpu

amaitland avatar May 16 '22 21:05 amaitland

I've tested the cefclient without any parameter and by calling cefclient.exe --multi-threaded-message-loop --no-sandbox --off-screen-rendering-enabled --enable-gpu cefclient without any parameter works as expected. Using parameter above only mouse wheel works. Scrolling using touch screen doesn't work.

Everything was tested with Cef/CefSharp version 101.0.180

klotzoliver avatar May 16 '22 21:05 klotzoliver

Based on additional feedback the CEF OSR implementation which WPF uses needs fixes to support the new PDF viewer implementation. Looks like you already raised https://github.com/chromiumembedded/cef/issues/3331 report your findings there.

As an alternative you should be able to use https://github.com/cefsharp/CefSharp.Wpf.HwndHost which is the equivalent of hosting the WinForms version in WPF. It uses windowed rendering as opposed to OSR.

Making as upstream as issue needs to be fixed in CEF.

amaitland avatar May 16 '22 22:05 amaitland

There are multiple potentially related issues with the OSR implementation currently

  • https://bitbucket.org/chromiumembedded/cef/issues/3325/osr-mouse-wheel-events-are-not-always
  • https://bitbucket.org/chromiumembedded/cef/issues/3271/osr-scrolling-impossible-when-auto-scroll
  • https://bitbucket.org/chromiumembedded/cef/issues/2949/osr-windows-mouse-wheel-scrolling-doesnt

amaitland avatar May 16 '22 22:05 amaitland

Does the cef log provide any relevant information? (By default there should be a debug.log file in your bin directory)

Any errors in the log?

Any further issues I'd ask that you please use the Bug Report Template.

amaitland avatar May 16 '22 22:05 amaitland

I can make sure there is a bug for CefSharp.Wpf. I cannot tell how to reproduce the bug, since I have not found the rule, but it's very easy to reproduce. Basically, I can reproduce the problem within 1 minute by clicking here and there for several times.

the way I am using to reproduce with the CefSharp source code:

  1. set CefShart.Wpf.Example as startup project.
  2. change Reload command to be able to switch between two pdf file, see the code below. if (browser.Address.EndsWith("1.PDF")) browser.LoadUrl(@"C:\Folder\2.PDF"); else browser.LoadUrl(@"C:\Folder\1.PDF");
  3. run the app
  4. change properties from toolbar and hit RELOAD button to switch pdf files. You can find the scroll issue very quickly in this way.

I am sure, the problem must be in the handler of SendMouseWheelEvent(see the last line of the following code of WebBrowserExtensions.cs), I cannot go inside the method. `public static void SendMouseWheelEvent(this IBrowser browser, int x, int y, int deltaX, int deltaY, CefEventFlags modifiers) { browser.ThrowExceptionIfBrowserNull();

  var host = browser.GetHost();
  ThrowExceptionIfBrowserHostNull(host);

  **host.SendMouseWheelEvent(new MouseEvent(x, y, modifiers), deltaX, deltaY);**

}`

If you want any other materials or the screen capture video, please reach me out via skype: xjtu_ok

Really hope the bug can be fixed ASAP. Thanks! Yes, I am using the latest source code of 101 branch.

zhaozehong avatar Jun 15 '22 12:06 zhaozehong

@zhaozehong See https://github.com/cefsharp/CefSharp/issues/4106#issuecomment-1128209352

This needs to be fixed in CEF. It's not something that can be fixed in CefSharp directly.

amaitland avatar Jun 15 '22 19:06 amaitland

@zhaozehong See #4106 (comment)

This needs to be fixed in CEF. It's not something that can be fixed in CefSharp directly.

Right. Thanks for your reply. Any plan to fix that in CEF? Cos it really leads to a bad user experience.

zhaozehong avatar Jun 16 '22 07:06 zhaozehong

Any plan to fix that in CEF? Cos it really leads to a bad user experience.

You'll need to ask the CEF maintainers.

amaitland avatar Jun 16 '22 08:06 amaitland