#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
+#include "atom/common/mouse_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "brightray/browser/inspectable_web_contents.h"
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/base/l10n/l10n_util.h"
-#include "mw/cursor/cursor_event_filter.h"
#include "atom/common/node_includes.h"
-#include <iostream>
-
namespace {
struct PrintSettings {
}
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
- Emit("cursor-changed", CursorChangeEvent::toString(cursor));
+ Emit("cursor-changed", CursorTypeToString(cursor));
}
void WebContents::SetSize(const SetSizeParams& params) {
return ++request_id_;
}
+ // Called when we receive a CursorChange message from chromium.
void OnCursorChange(const content::WebCursor& cursor);
// Called when received a message from renderer.
#include <string>
#include <vector>
-#include "atom/common/keyboad_util.h"
+#include "atom/common/keyboard_util.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
// found in the LICENSE file.
#include <string>
-#include "atom/common/keyboad_util.h"
+#include "atom/common/keyboard_util.h"
namespace atom {
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
-#ifndef ATOM_COMMON_KEYBOAD_UTIL_H_
-#define ATOM_COMMON_KEYBOAD_UTIL_H_
+#ifndef ATOM_COMMON_KEYBOARD_UTIL_H_
+#define ATOM_COMMON_KEYBOARD_UTIL_H_
#include <string>
#include "ui/events/keycodes/keyboard_codes.h"
} // namespace atom
-#endif // ATOM_COMMON_KEYBOAD_UTIL_H_
+#endif // ATOM_COMMON_KEYBOARD_UTIL_H_
--- /dev/null
+// Copyright (c) 2015 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include <string>
+#include "atom/common/mouse_util.h"
+
+using Cursor = blink::WebCursorInfo::Type;
+
+namespace atom {
+
+std::string CursorTypeToString(const content::WebCursor& cursor) {
+ content::WebCursor::CursorInfo* info = new content::WebCursor::CursorInfo();
+ cursor.GetCursorInfo(info);
+
+ switch (info->type) {
+ case Cursor::TypePointer: return "pointer";
+ case Cursor::TypeCross: return "cross";
+ case Cursor::TypeHand: return "hand";
+ case Cursor::TypeIBeam: return "i-beam";
+ case Cursor::TypeWait: return "wait";
+ case Cursor::TypeHelp: return "help";
+ case Cursor::TypeEastResize: return "east-resize";
+ case Cursor::TypeNorthResize: return "north-resize";
+ case Cursor::TypeNorthEastResize: return "north-east-resize";
+ case Cursor::TypeNorthWestResize: return "north-west-resize";
+ case Cursor::TypeSouthResize: return "south-resize";
+ case Cursor::TypeSouthEastResize: return "south-east-resize";
+ case Cursor::TypeSouthWestResize: return "south-west-resize";
+ case Cursor::TypeWestResize: return "west-resize";
+ case Cursor::TypeNorthSouthResize: return "north-south-resize";
+ case Cursor::TypeEastWestResize: return "east-west-resize";
+ case Cursor::TypeNorthEastSouthWestResize:
+ return "north-east-south-west-resize";
+ case Cursor::TypeNorthWestSouthEastResize:
+ return "north-west-south-east-resize";
+ case Cursor::TypeColumnResize: return "column-resize";
+ case Cursor::TypeRowResize: return "row-resize";
+ case Cursor::TypeMiddlePanning: return "middle-panning";
+ case Cursor::TypeEastPanning: return "east-panning";
+ case Cursor::TypeNorthPanning: return "north-panning";
+ case Cursor::TypeNorthEastPanning: return "north-east-panning";
+ case Cursor::TypeNorthWestPanning: return "north-west-panning";
+ case Cursor::TypeSouthPanning: return "south-panning";
+ case Cursor::TypeSouthEastPanning: return "south-east-panning";
+ case Cursor::TypeSouthWestPanning: return "south-west-panning";
+ case Cursor::TypeWestPanning: return "west-panning";
+ case Cursor::TypeMove: return "move";
+ case Cursor::TypeVerticalText: return "vertical-text";
+ case Cursor::TypeCell: return "cell";
+ case Cursor::TypeContextMenu: return "context-menu";
+ case Cursor::TypeAlias: return "alias";
+ case Cursor::TypeProgress: return "progress";
+ case Cursor::TypeNoDrop: return "nodrop";
+ case Cursor::TypeCopy: return "copy";
+ case Cursor::TypeNone: return "none";
+ case Cursor::TypeNotAllowed: return "not-allowed";
+ case Cursor::TypeZoomIn: return "zoom-in";
+ case Cursor::TypeZoomOut: return "zoom-out";
+ case Cursor::TypeGrab: return "grab";
+ case Cursor::TypeGrabbing: return "grabbing";
+ case Cursor::TypeCustom: return "custom";
+ default: return "pointer";
+ }
+}
+
+} // namespace atom
--- /dev/null
+// Copyright (c) 2015 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_COMMON_MOUSE_UTIL_H_
+#define ATOM_COMMON_MOUSE_UTIL_H_
+
+#include <string>
+#include "content/common/cursors/webcursor.h"
+#include "ipc/ipc_message_macros.h"
+
+// IPC macros similar to the already existing ones in the chromium source.
+// We need these to listen to the cursor change IPC message while still
+// letting chromium handle the actual cursor change by setting handled = false.
+#define IPC_MESSAGE_HANDLER_CODE(msg_class, member_func, code) \
+ IPC_MESSAGE_FORWARD_CODE(msg_class, this, \
+ _IpcMessageHandlerClass::member_func, code)
+
+#define IPC_MESSAGE_FORWARD_CODE(msg_class, obj, member_func, code) \
+ case msg_class::ID: { \
+ TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \
+ if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \
+ &member_func)) \
+ ipc_message__.set_dispatch_error(); \
+ code; \
+ } \
+ break;
+
+namespace atom {
+
+// Returns the cursor's type as a string.
+std::string CursorTypeToString(const content::WebCursor& cursor);
+
+} // namespace atom
+
+#endif // ATOM_COMMON_MOUSE_UTIL_H_
#include <string>
#include <vector>
-#include "atom/common/keyboad_util.h"
+#include "atom/common/keyboard_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/native_web_keyboard_event.h"
<meta name='theme-color' content='#ff0000'>
```
+### Event: 'cursor-changed'
+
+Returns:
+
+* `event` Event
+* `type` String
+
+Emitted when the cursor's type changes. The `type` parameter can be `pointer`,
+`cross`, `hand`, `i-beam`, `wait`, `help`, `east-resize`, `north-resize`,
+`north-east-resize`, `north-west-resize`, `south-resize`, `south-east-resize`,
+`south-west-resize`, `west-resize`, `north-south-resize`, `east-west-resize`,
+`north-east-south-west-resize`, `north-west-south-east-resize`, `column-resize`,
+`row-resize`, `middle-panning`, `east-panning`, `north-panning`,
+`north-east-panning`, `north-west-panning`, `south-panning`,
+`south-east-panning`, `south-west-panning`, `west-panning`, `move`,
+`vertical-text`, `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`,
+`none`, `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing`, `custom`.
+
## Instance Methods
The `webContents` object has the following instance methods:
'atom/common/google_api_key.h',
'atom/common/id_weak_map.cc',
'atom/common/id_weak_map.h',
- 'atom/common/keyboad_util.cc',
- 'atom/common/keyboad_util.h',
+ 'atom/common/keyboard_util.cc',
+ 'atom/common/keyboard_util.h',
+ 'atom/common/mouse_util.cc',
+ 'atom/common/mouse_util.h',
'atom/common/linux/application_info.cc',
'atom/common/native_mate_converters/accelerator_converter.cc',
'atom/common/native_mate_converters/accelerator_converter.h',
'atom/renderer/node_array_buffer_bridge.h',
'atom/utility/atom_content_utility_client.cc',
'atom/utility/atom_content_utility_client.h',
- 'mw/cursor/cursor_event_filter.cc',
- 'mw/cursor/cursor_event_filter.h',
'chromium_src/chrome/browser/browser_process.cc',
'chromium_src/chrome/browser/browser_process.h',
'chromium_src/chrome/browser/chrome_process_finder_win.cc',
+++ /dev/null
-#include "mw/cursor/cursor_event_filter.h"
-#include "content/common/view_messages.h"
-
-namespace atom {
-
-std::string CursorChangeEvent::toString(
- const content::WebCursor& cursor) {
- content::WebCursor::CursorInfo* info = new content::WebCursor::CursorInfo();
- cursor.GetCursorInfo(info);
-
- switch(info->type){
- case blink::WebCursorInfo::Type::TypePointer:
- return "Pointer";
- break;
- case blink::WebCursorInfo::Type::TypeCross:
- return "Cross";
- break;
- case blink::WebCursorInfo::Type::TypeHand:
- return "Hand";
- break;
- case blink::WebCursorInfo::Type::TypeIBeam:
- return "IBeam";
- break;
- case blink::WebCursorInfo::Type::TypeWait:
- return "Wait";
- break;
- case blink::WebCursorInfo::Type::TypeHelp:
- return "Help";
- break;
- case blink::WebCursorInfo::Type::TypeEastResize:
- return "EastResize";
- break;
- case blink::WebCursorInfo::Type::TypeNorthResize:
- return "NorthResize";
- break;
- case blink::WebCursorInfo::Type::TypeNorthEastResize:
- return "NorthEastResize";
- break;
- case blink::WebCursorInfo::Type::TypeNorthWestResize:
- return "NorthWestResize";
- break;
- case blink::WebCursorInfo::Type::TypeSouthResize:
- return "SouthResize";
- break;
- case blink::WebCursorInfo::Type::TypeSouthEastResize:
- return "SouthEastResize";
- break;
- case blink::WebCursorInfo::Type::TypeSouthWestResize:
- return "SouthWestResize";
- break;
- case blink::WebCursorInfo::Type::TypeWestResize:
- return "WestResize";
- break;
- case blink::WebCursorInfo::Type::TypeNorthSouthResize:
- return "NorthSouthResize";
- break;
- case blink::WebCursorInfo::Type::TypeEastWestResize:
- return "EastWestResize";
- break;
- case blink::WebCursorInfo::Type::TypeNorthEastSouthWestResize:
- return "NorthEastSouthWestResize";
- break;
- case blink::WebCursorInfo::Type::TypeNorthWestSouthEastResize:
- return "NorthWestSouthEastResize";
- break;
- case blink::WebCursorInfo::Type::TypeColumnResize:
- return "ColumnResize";
- break;
- case blink::WebCursorInfo::Type::TypeRowResize:
- return "RowResize";
- break;
- case blink::WebCursorInfo::Type::TypeMiddlePanning:
- return "MiddlePanning";
- break;
- case blink::WebCursorInfo::Type::TypeEastPanning:
- return "EastPanning";
- break;
- case blink::WebCursorInfo::Type::TypeNorthPanning:
- return "NorthPanning";
- break;
- case blink::WebCursorInfo::Type::TypeNorthEastPanning:
- return "NorthEastPanning";
- break;
- case blink::WebCursorInfo::Type::TypeNorthWestPanning:
- return "NorthWestPanning";
- break;
- case blink::WebCursorInfo::Type::TypeSouthPanning:
- return "SouthPanning";
- break;
- case blink::WebCursorInfo::Type::TypeSouthEastPanning:
- return "SouthEastPanning";
- break;
- case blink::WebCursorInfo::Type::TypeSouthWestPanning:
- return "SouthWestPanning";
- break;
- case blink::WebCursorInfo::Type::TypeWestPanning:
- return "WestPanning";
- break;
- case blink::WebCursorInfo::Type::TypeMove:
- return "Move";
- break;
- case blink::WebCursorInfo::Type::TypeVerticalText:
- return "VerticalText";
- break;
- case blink::WebCursorInfo::Type::TypeCell:
- return "Cell";
- break;
- case blink::WebCursorInfo::Type::TypeContextMenu:
- return "ContextMenu";
- break;
- case blink::WebCursorInfo::Type::TypeAlias:
- return "Alias";
- break;
- case blink::WebCursorInfo::Type::TypeProgress:
- return "Progress";
- break;
- case blink::WebCursorInfo::Type::TypeNoDrop:
- return "NoDrop";
- break;
- case blink::WebCursorInfo::Type::TypeCopy:
- return "Copy";
- break;
- case blink::WebCursorInfo::Type::TypeNone:
- return "None";
- break;
- case blink::WebCursorInfo::Type::TypeNotAllowed:
- return "NotAllowed";
- break;
- case blink::WebCursorInfo::Type::TypeZoomIn:
- return "ZoomIn";
- break;
- case blink::WebCursorInfo::Type::TypeZoomOut:
- return "ZoomOut";
- break;
- case blink::WebCursorInfo::Type::TypeGrab:
- return "Grab";
- break;
- case blink::WebCursorInfo::Type::TypeGrabbing:
- return "Grabbing";
- break;
- case blink::WebCursorInfo::Type::TypeCustom:
- return "Custom";
- break;
- default:
- return "Pointer";
- break;
- }
-}
-
-}
+++ /dev/null
-#ifndef MW_CURSOR_EVENT_H_
-#define MW_CURSOR_EVENT_H_
-
-#include "content/common/cursors/webcursor.h"
-#include "ipc/ipc_message_macros.h"
-
-#define IPC_MESSAGE_HANDLER_CODE(msg_class, member_func, code) \
- IPC_MESSAGE_FORWARD_CODE(msg_class, this, \
- _IpcMessageHandlerClass::member_func, code)
-
-#define IPC_MESSAGE_FORWARD_CODE(msg_class, obj, member_func, code) \
- case msg_class::ID: { \
- TRACK_RUN_IN_THIS_SCOPED_REGION(member_func); \
- if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \
- &member_func)) \
- ipc_message__.set_dispatch_error(); \
- code; \
- } \
- break;
-
-namespace atom {
-
-class CursorChangeEvent {
- public:
- static std::string toString(const content::WebCursor& cursor);
-};
-
-}
-
-#endif // MW_CURSOR_EVENT_H_