mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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:
@@ -333,7 +333,7 @@ void ClientHandler::OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
|
||||
model->AddSeparator();
|
||||
model->AddItem(CLIENT_ID_CURSOR_CHANGE_DISABLED, "Cursor change disabled");
|
||||
if (browser->GetHost()->IsMouseCursorChangeDisabled())
|
||||
if (mouse_cursor_change_disabled_)
|
||||
model->SetChecked(CLIENT_ID_CURSOR_CHANGE_DISABLED, true);
|
||||
|
||||
model->AddSeparator();
|
||||
@@ -370,8 +370,7 @@ bool ClientHandler::OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
||||
ShowSSLInformation(browser);
|
||||
return true;
|
||||
case CLIENT_ID_CURSOR_CHANGE_DISABLED:
|
||||
browser->GetHost()->SetMouseCursorChangeDisabled(
|
||||
!browser->GetHost()->IsMouseCursorChangeDisabled());
|
||||
mouse_cursor_change_disabled_ = !mouse_cursor_change_disabled_;
|
||||
return true;
|
||||
case CLIENT_ID_OFFLINE:
|
||||
offline_ = !offline_;
|
||||
@@ -469,6 +468,16 @@ bool ClientHandler::OnAutoResize(CefRefPtr<CefBrowser> browser,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ClientHandler::OnCursorChange(CefRefPtr<CefBrowser> browser,
|
||||
CefCursorHandle cursor,
|
||||
cef_cursor_type_t type,
|
||||
const CefCursorInfo& custom_cursor_info) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
// Return true to disable default handling of cursor changes.
|
||||
return mouse_cursor_change_disabled_;
|
||||
}
|
||||
|
||||
void ClientHandler::OnBeforeDownload(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
@@ -595,10 +604,6 @@ void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||
message_router_->AddHandler(*(it), false);
|
||||
}
|
||||
|
||||
// Disable mouse cursor change if requested via the command-line flag.
|
||||
if (mouse_cursor_change_disabled_)
|
||||
browser->GetHost()->SetMouseCursorChangeDisabled(true);
|
||||
|
||||
// Set offline mode if requested via the command-line flag.
|
||||
if (offline_)
|
||||
SetOfflineState(browser, true);
|
||||
|
Reference in New Issue
Block a user