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:
33
libcef/browser/native/cursor_util_linux.cc
Normal file
33
libcef/browser/native/cursor_util_linux.cc
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/native/cursor_util.h"
|
||||
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include "ui/base/x/x11_cursor.h"
|
||||
#endif
|
||||
|
||||
namespace cursor_util {
|
||||
|
||||
cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type) {
|
||||
auto cursor = ui::CursorFactory::GetInstance()->GetDefaultCursor(type);
|
||||
if (cursor) {
|
||||
return ToCursorHandle(*cursor);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
cef_cursor_handle_t ToCursorHandle(ui::PlatformCursor cursor) {
|
||||
#if defined(USE_X11)
|
||||
// See https://crbug.com/1029142 for background.
|
||||
return static_cast<cef_cursor_handle_t>(
|
||||
static_cast<ui::X11Cursor*>(cursor)->xcursor());
|
||||
#else
|
||||
return cursor;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace cursor_util
|
Reference in New Issue
Block a user