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

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=516b55b7ea53e2de2b096e85ba0eb83f2a2693f3$
// $hash=fa230168d79d0644b518d042bf3f9370e6eccf8c$
//
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
@@ -621,39 +621,6 @@ browser_host_get_navigation_entries(struct _cef_browser_host_t* self,
current_only ? true : false);
}
void CEF_CALLBACK
browser_host_set_mouse_cursor_change_disabled(struct _cef_browser_host_t* self,
int disabled) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefBrowserHostCppToC::Get(self)->SetMouseCursorChangeDisabled(
disabled ? true : false);
}
int CEF_CALLBACK
browser_host_is_mouse_cursor_change_disabled(struct _cef_browser_host_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefBrowserHostCppToC::Get(self)->IsMouseCursorChangeDisabled();
// Return type: bool
return _retval;
}
void CEF_CALLBACK
browser_host_replace_misspelling(struct _cef_browser_host_t* self,
const cef_string_t* word) {
@@ -1367,10 +1334,6 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->add_dev_tools_message_observer =
browser_host_add_dev_tools_message_observer;
GetStruct()->get_navigation_entries = browser_host_get_navigation_entries;
GetStruct()->set_mouse_cursor_change_disabled =
browser_host_set_mouse_cursor_change_disabled;
GetStruct()->is_mouse_cursor_change_disabled =
browser_host_is_mouse_cursor_change_disabled;
GetStruct()->replace_misspelling = browser_host_replace_misspelling;
GetStruct()->add_word_to_dictionary = browser_host_add_word_to_dictionary;
GetStruct()->is_window_rendering_disabled =

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=1e329026cfad131337e794e5501367604f62fdb6$
// $hash=a6a81143ea8792ba5643643389f4dc2a8815174a$
//
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
@@ -252,6 +252,41 @@ display_handler_on_loading_progress_change(struct _cef_display_handler_t* self,
CefBrowserCToCpp::Wrap(browser), progress);
}
int CEF_CALLBACK display_handler_on_cursor_change(
struct _cef_display_handler_t* self,
cef_browser_t* browser,
cef_cursor_handle_t cursor,
cef_cursor_type_t type,
const struct _cef_cursor_info_t* custom_cursor_info) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: custom_cursor_info; type: struct_byref_const
DCHECK(custom_cursor_info);
if (!custom_cursor_info)
return 0;
// Translate param: custom_cursor_info; type: struct_byref_const
CefCursorInfo custom_cursor_infoObj;
if (custom_cursor_info)
custom_cursor_infoObj.Set(*custom_cursor_info, false);
// Execute
bool _retval = CefDisplayHandlerCppToC::Get(self)->OnCursorChange(
CefBrowserCToCpp::Wrap(browser), cursor, type, custom_cursor_infoObj);
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@@ -268,6 +303,7 @@ CefDisplayHandlerCppToC::CefDisplayHandlerCppToC() {
GetStruct()->on_auto_resize = display_handler_on_auto_resize;
GetStruct()->on_loading_progress_change =
display_handler_on_loading_progress_change;
GetStruct()->on_cursor_change = display_handler_on_cursor_change;
}
// DESTRUCTOR - Do not edit by hand.

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=2e22f210ff06337ac41e71a00b9dc6edce08e6d8$
// $hash=22da80871c4a9dfc9989f577456b7e3d987e805d$
//
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
@@ -324,38 +324,6 @@ render_handler_on_accelerated_paint(struct _cef_render_handler_t* self,
CefBrowserCToCpp::Wrap(browser), type, dirtyRectsList, shared_handle);
}
void CEF_CALLBACK render_handler_on_cursor_change(
struct _cef_render_handler_t* self,
cef_browser_t* browser,
cef_cursor_handle_t cursor,
cef_cursor_type_t type,
const struct _cef_cursor_info_t* custom_cursor_info) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Verify param: custom_cursor_info; type: struct_byref_const
DCHECK(custom_cursor_info);
if (!custom_cursor_info)
return;
// Translate param: custom_cursor_info; type: struct_byref_const
CefCursorInfo custom_cursor_infoObj;
if (custom_cursor_info)
custom_cursor_infoObj.Set(*custom_cursor_info, false);
// Execute
CefRenderHandlerCppToC::Get(self)->OnCursorChange(
CefBrowserCToCpp::Wrap(browser), cursor, type, custom_cursor_infoObj);
}
int CEF_CALLBACK
render_handler_start_dragging(struct _cef_render_handler_t* self,
cef_browser_t* browser,
@@ -536,7 +504,6 @@ CefRenderHandlerCppToC::CefRenderHandlerCppToC() {
GetStruct()->on_popup_size = render_handler_on_popup_size;
GetStruct()->on_paint = render_handler_on_paint;
GetStruct()->on_accelerated_paint = render_handler_on_accelerated_paint;
GetStruct()->on_cursor_change = render_handler_on_cursor_change;
GetStruct()->start_dragging = render_handler_start_dragging;
GetStruct()->update_drag_cursor = render_handler_update_drag_cursor;
GetStruct()->on_scroll_offset_changed =