From c2ed3b258fdb3ef307e3b142c38cb0b518bb0c71 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 May 2015 17:06:31 -0400 Subject: [PATCH] implement pointer type matching for cef window cursor setting I think this is right? --- ports/cef/window.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/ports/cef/window.rs b/ports/cef/window.rs index 2c8cf2a71c6..1cc8051697d 100644 --- a/ports/cef/window.rs +++ b/ports/cef/window.rs @@ -87,6 +87,33 @@ impl Window { WindowEvent::Idle } + fn cursor_type_for_cursor(&self, cursor: Cursor) -> cef_cursor_type_t { + match cursor { + Cursor::NoCursor => return cef_cursor_type_t::CT_NONE, + Cursor::ContextMenuCursor => return cef_cursor_type_t::CT_CONTEXTMENU, + Cursor::GrabbingCursor => return cef_cursor_type_t::CT_GRABBING, + Cursor::CrosshairCursor => return cef_cursor_type_t::CT_CROSS, + Cursor::CopyCursor => return cef_cursor_type_t::CT_COPY, + Cursor::AliasCursor => return cef_cursor_type_t::CT_ALIAS, + Cursor::TextCursor => return cef_cursor_type_t::CT_IBEAM, + Cursor::GrabCursor | Cursor::AllScrollCursor => + return cef_cursor_type_t::CT_GRAB, + Cursor::NoDropCursor => return cef_cursor_type_t::CT_NODROP, + Cursor::NotAllowedCursor => return cef_cursor_type_t::CT_NOTALLOWED, + Cursor::PointerCursor => return cef_cursor_type_t::CT_POINTER, + Cursor::SResizeCursor => return cef_cursor_type_t::CT_SOUTHRESIZE, + Cursor::WResizeCursor => return cef_cursor_type_t::CT_WESTRESIZE, + Cursor::EwResizeCursor => return cef_cursor_type_t::CT_EASTWESTRESIZE, + Cursor::ColResizeCursor => return cef_cursor_type_t::CT_COLUMNRESIZE, + Cursor::EResizeCursor => return cef_cursor_type_t::CT_EASTRESIZE, + Cursor::NResizeCursor => return cef_cursor_type_t::CT_NORTHRESIZE, + Cursor::NsResizeCursor => return cef_cursor_type_t::CT_NORTHSOUTHRESIZE, + Cursor::RowResizeCursor => return cef_cursor_type_t::CT_ROWRESIZE, + Cursor::VerticalTextCursor => return cef_cursor_type_t::CT_VERTICALTEXT, + _ => return cef_cursor_type_t::CT_POINTER, + } + } + /// Returns the Cocoa cursor for a CSS cursor. These match Firefox, except where Firefox /// bundles custom resources (which we don't yet do). #[cfg(target_os="macos")] @@ -318,7 +345,7 @@ impl WindowMethods for Window { .get_client() .get_render_handler() .on_cursor_change(browser.clone(), cursor_handle, - CT_POINTER, &info) + self.cursor_type_for_cursor(cursor), &info) } } }