Commit f33b58d0 by Corentin Wallez

Win32Window: Implement Event::EVENT_MOUSE_ENTERED

BUG=angleproject:1000 Change-Id: I9b61564fa086318c3ffa9a6b85bb100c52cfad54 Reviewed-on: https://chromium-review.googlesource.com/316590Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 6beb0bfd
...@@ -228,7 +228,7 @@ Key VirtualKeyCodeToKey(WPARAM key, LPARAM flags) ...@@ -228,7 +228,7 @@ Key VirtualKeyCodeToKey(WPARAM key, LPARAM flags)
return Key(0); return Key(0);
} }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) switch (message)
{ {
...@@ -444,6 +444,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -444,6 +444,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
{ {
if (!window->mIsMouseInWindow)
{
window->mIsMouseInWindow = true;
Event event;
event.Type = Event::EVENT_MOUSE_ENTERED;
window->pushEvent(event);
}
int mouseX = static_cast<short>(LOWORD(lParam)); int mouseX = static_cast<short>(LOWORD(lParam));
int mouseY = static_cast<short>(HIWORD(lParam)); int mouseY = static_cast<short>(HIWORD(lParam));
...@@ -460,6 +468,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -460,6 +468,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Event event; Event event;
event.Type = Event::EVENT_MOUSE_LEFT; event.Type = Event::EVENT_MOUSE_LEFT;
window->pushEvent(event); window->pushEvent(event);
window->mIsMouseInWindow = false;
break; break;
} }
...@@ -478,6 +487,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -478,6 +487,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Win32Window::Win32Window() Win32Window::Win32Window()
: mIsVisible(false), : mIsVisible(false),
mSetVisibleTimer(CreateTimer()), mSetVisibleTimer(CreateTimer()),
mIsMouseInWindow(false),
mNativeWindow(0), mNativeWindow(0),
mParentWindow(0), mParentWindow(0),
mNativeDisplay(0) mNativeDisplay(0)
......
...@@ -41,12 +41,16 @@ class Win32Window : public OSWindow ...@@ -41,12 +41,16 @@ class Win32Window : public OSWindow
void signalTestEvent() override; void signalTestEvent() override;
private: private:
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
std::string mParentClassName; std::string mParentClassName;
std::string mChildClassName; std::string mChildClassName;
bool mIsVisible; bool mIsVisible;
Timer *mSetVisibleTimer; Timer *mSetVisibleTimer;
bool mIsMouseInWindow;
EGLNativeWindowType mNativeWindow; EGLNativeWindowType mNativeWindow;
EGLNativeWindowType mParentWindow; EGLNativeWindowType mParentWindow;
EGLNativeDisplayType mNativeDisplay; EGLNativeDisplayType mNativeDisplay;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment