Disable smart zoom on macOS

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Disable smart zoom on macOS

Postby dtarkows » Thu Jan 05, 2017 9:25 am

On macOS, if the user double taps with two fingers, it initiates a zoom which seems to be context dependent on the element that was clicked on.

Is there a way to disable this from within CEF?
dtarkows
Techie
 
Posts: 10
Joined: Mon Jul 13, 2015 1:34 pm

Re: Disable smart zoom on macOS

Postby magreenblatt » Mon Jan 09, 2017 2:35 pm

Can it be disabled in Google Chrome?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Disable smart zoom on macOS

Postby dtarkows » Wed Jan 18, 2017 5:08 pm

I can't find a way to explicitly disable it in Chrome or Chromium.

Upon further investigation, I've determined that the Cocoa event that causes this behavior is "smartMagnify". It looks like Chromium maps this to the GestureDoubleTap event with a tap count of 1. The GestureDoubleTap event is what handles the (single finger) double tap on Android. I can't determine if there is any way to enable or disable specific gesture events.
dtarkows
Techie
 
Posts: 10
Joined: Mon Jul 13, 2015 1:34 pm

Re: Disable smart zoom on macOS

Postby Czarek » Sat Nov 24, 2018 12:42 pm

This can be disabled in Chromium in Browser::PreHandleGestureEvent:
https://cs.chromium.org/chromium/src/ch ... bad3bf8ef9

With such code:
Code: Select all
if (event.GetType() == blink::WebInputEvent::kGestureDoubleTap) {
    return true;
}


Is it possible to expose such callback in CEF?

Does anyone know if it is possible to intercept and block the NSEventTypeSmartMagnify / smartMagnifyWithEvent events, so that they are not forwarded to Chromium?

Ref:
1. Old code that disabled double tap in PDF viewer: https://chromium-review.googlesource.co ... /+/614084/
2. Double tap disabled in Extensions: https://cs.chromium.org/chromium/src/ex ... bad3bf8ef9
3. NSEventTypeSmartMagnify event handled in Chromium: https://cs.chromium.org/chromium/src/co ... bad3bf8ef9
4. smartMagnifyWithEvent event handled in Chromium: https://cs.chromium.org/chromium/src/co ... bad3bf8ef9
5. Double tap to zoom enabled in Chromium via this issue: https://bugs.chromium.org/p/chromium/is ... ?id=452592
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Disable smart zoom on macOS

Postby Czarek » Sat Nov 24, 2018 12:53 pm

In Electron smart zoom can be disabled by calling WebFrame::SetVisualZoomLevelLimits. There is no such equivalent in CEF API.

Ref:
1. https://electronjs.org/docs/api/web-fra ... ximumlevel
2. https://github.com/MarshallOfSound/Goog ... 2793/files
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 96 guests

cron