mouse_util.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_COMMON_MOUSE_UTIL_H_
  5. #define ATOM_COMMON_MOUSE_UTIL_H_
  6. #include <string>
  7. #include "content/common/cursors/webcursor.h"
  8. #include "ipc/ipc_message_macros.h"
  9. // IPC macros similar to the already existing ones in the chromium source.
  10. // We need these to listen to the cursor change IPC message while still
  11. // letting chromium handle the actual cursor change by setting handled = false.
  12. #define IPC_MESSAGE_HANDLER_CODE(msg_class, member_func, code) \
  13. IPC_MESSAGE_FORWARD_CODE(msg_class, this, \
  14. _IpcMessageHandlerClass::member_func, code)
  15. #define IPC_MESSAGE_FORWARD_CODE(msg_class, obj, member_func, code) \
  16. case msg_class::ID: { \
  17. if (!msg_class::Dispatch(&ipc_message__, obj, this, param__, \
  18. &member_func)) \
  19. ipc_message__.set_dispatch_error(); \
  20. code; \
  21. } break;
  22. namespace atom {
  23. // Returns the cursor's type as a string.
  24. std::string CursorTypeToString(const content::CursorInfo& info);
  25. } // namespace atom
  26. #endif // ATOM_COMMON_MOUSE_UTIL_H_