]> khamidou — GitHub mirrors - electron.git/commitdiff
Use uint64_t instead of LPARAM
authorCheng Zhao <zcbenz@gmail.com>
Wed, 28 Oct 2015 11:51:24 +0000 (19:51 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 28 Oct 2015 11:51:24 +0000 (19:51 +0800)
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.

atom/browser/api/atom_api_window.cc
atom/browser/api/atom_api_window.h
atom/browser/native_window.cc
atom/browser/native_window_observer.h

index 5d0a501629f87d5de8762f331d3fd05b763a7a85..077dffe0bc5c0daf4ec77986374b24231b6fc249 100644 (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);
   }
index 870f8e134216733d9a0731007056a43287be1c1a..f4bc4cdba01ab98dc3332adba7c881a5d6a7be2e 100644 (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_;
 
index e3abed473e7d5b27f52a7f1ad47b29f1a9d33f2f..6e38f40287457ef356b57654e46c612126c6a456 100644 (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
 
index 54004a300d9468e29803159e93f0e48056bbc719..240a7277fa097105bd30ddded0c24789c7f48655 100644 (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.