Use uint64_t instead of LPARAM

LPARAM is defined to differnt types on differnt machines with different
SDKs, so there is no way to represent it on all platforms safely, using
uint64_t seems to be the only safe choice.
This commit is contained in:
Cheng Zhao 2015-10-28 19:51:24 +08:00
parent 5fd310c75f
commit b86267aa3b
4 changed files with 7 additions and 15 deletions

View file

@ -42,14 +42,6 @@ struct Converter<atom::TaskbarHost::ThumbarButton> {
}
};
template<>
struct Converter<LPARAM> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
LPARAM val) {
return ConvertToV8(isolate, static_cast<int64_t>(val));
}
};
} // namespace mate
#endif
@ -198,7 +190,7 @@ void Window::OnExecuteWindowsCommand(const std::string& command_name) {
}
#if defined(OS_WIN)
void Window::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {
void Window::OnWindowMessage(UINT message, WPARAM w_param, uint64_t l_param) {
if (IsWindowMessageHooked(message)) {
messages_callback_map_[message].Run(w_param, l_param);
}

View file

@ -77,8 +77,7 @@ class Window : public mate::TrackableObject<Window>,
void OnExecuteWindowsCommand(const std::string& command_name) override;
#if defined(OS_WIN)
void OnWindowMessage(UINT message, WPARAM w_param,
LPARAM l_param) override;
void OnWindowMessage(UINT message, WPARAM w_param, uint64_t l_param) override;
#endif
// mate::Wrappable:
@ -150,7 +149,7 @@ class Window : public mate::TrackableObject<Window>,
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
#if defined(OS_WIN)
typedef base::Callback<void(WPARAM, LPARAM)> MessageCallback;
typedef base::Callback<void(WPARAM, uint64_t)> MessageCallback;
typedef std::map<UINT, MessageCallback> MessageCallbackMap;
MessageCallbackMap messages_callback_map_;

View file

@ -467,8 +467,9 @@ void NativeWindow::NotifyWindowExecuteWindowsCommand(
#if defined(OS_WIN)
void NativeWindow::NotifyWindowMessage(UINT message, WPARAM w_param,
LPARAM l_param) {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
OnWindowMessage(message, w_param, l_param));
FOR_EACH_OBSERVER(
NativeWindowObserver, observers_,
OnWindowMessage(message, w_param, static_cast<uint64_t>(l_param)));
}
#endif

View file

@ -61,7 +61,7 @@ class NativeWindowObserver {
// Called when window message received
#if defined(OS_WIN)
virtual void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) {}
virtual void OnWindowMessage(UINT message, WPARAM wparam, uint64_t lparam) {}
#endif
// Called when renderer is hung.