Move OnCursorChange from CefRenderHandler to CefDisplayHandler

The cursor change can now be handled by the client with both windowed and
off-screen rendering.

Returning true from OnCursorChange will disable the default cursor change
behavior. This is functionally equivalent to the
CefBrowserHost::SetMouseCursorChangeDisabled method, so that method has been
removed.
This commit is contained in:
Marshall Greenblatt
2020-10-28 12:30:54 -04:00
parent 4e6c558bf2
commit 023d218104
38 changed files with 282 additions and 354 deletions

View File

@@ -17,6 +17,7 @@
#include "libcef/browser/context.h"
#include "libcef/browser/devtools/devtools_manager.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/native/cursor_util.h"
#include "libcef/browser/osr/osr_util.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/thread_util.h"
@@ -102,10 +103,11 @@ class CefWidgetHostInterceptor
// WidgetHostInterceptorForTesting method:
void SetCursor(const ui::Cursor& cursor) override {
if (browser_->IsMouseCursorChangeDisabled()) {
if (cursor_util::OnCursorChange(browser_, cursor)) {
// Don't change the cursor.
return;
}
GetForwardingInterface()->SetCursor(cursor);
}
@@ -643,18 +645,6 @@ bool AlloyBrowserHostImpl::IsBackgroundHost() {
return is_background_host_;
}
void AlloyBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
base::AutoLock lock_scope(state_lock_);
if (mouse_cursor_change_disabled_ == disabled)
return;
mouse_cursor_change_disabled_ = disabled;
}
bool AlloyBrowserHostImpl::IsMouseCursorChangeDisabled() {
base::AutoLock lock_scope(state_lock_);
return mouse_cursor_change_disabled_;
}
bool AlloyBrowserHostImpl::IsWindowRenderingDisabled() {
return IsWindowless();
}