Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Face under mouse highlighted when scrolling Property Browser window #417

Closed
nabijaczleweli opened this issue May 20, 2019 · 5 comments
Closed
Milestone

Comments

@nabijaczleweli
Copy link
Contributor

nabijaczleweli commented May 20, 2019

System information

SolveSpace version: 3.0~be0dc7e2

Operating system: Windows 10

Expected behavior

A face that's hidden under the Property Browser window doesn't get highlighted.

Actual behavior

Faces (and other elements, like workplanes, but faces are the easiest to see) covered by the Property Browser window get highlighted if the mouse is over them while scrolling that window.

Additional information

Video

@whitequark
Copy link
Contributor

So what I think is happening here is that events are forwarded to the property browser window correctly (AFAICT its window in your video is not in focus), but then are also handled by the main window as well. This is handled here:

case WM_MOUSEWHEEL:
// Make the mousewheel work according to which window the mouse is
// over, not according to which window is active.
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
HWND hWindowUnderMouse;
sscheck(hWindowUnderMouse = WindowFromPoint(pt));
if(hWindowUnderMouse && hWindowUnderMouse != h) {
SendMessageW(hWindowUnderMouse, msg, wParam, lParam);
break;
}
event.type = MouseEvent::Type::SCROLL_VERT;
event.scrollDelta = GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? 1 : -1;
break;

@nabijaczleweli
Copy link
Contributor Author

Can confirm, this doesn't happen if the Property Browser window is focused.

@whitequark
Copy link
Contributor

What if you apply this?

diff --git a/src/platform/guiwin.cpp b/src/platform/guiwin.cpp
index 0366880..a39e351 100644
--- a/src/platform/guiwin.cpp
+++ b/src/platform/guiwin.cpp
@@ -822,6 +822,7 @@ public:
                 event.shiftDown   = (wParam & MK_SHIFT) != 0;
                 event.controlDown = (wParam & MK_CONTROL) != 0;
 
+                bool consumed = false;
                 switch(msg) {
                     case WM_LBUTTONDOWN:
                         event.button = MouseEvent::Button::LEFT;
@@ -872,6 +873,7 @@ public:
                         sscheck(hWindowUnderMouse = WindowFromPoint(pt));
                         if(hWindowUnderMouse && hWindowUnderMouse != h) {
                             SendMessageW(hWindowUnderMouse, msg, wParam, lParam);
+                            consumed = true;
                             break;
                         }
 
@@ -903,7 +905,7 @@ public:
                     }
                 }
 
-                if(window->onMouseEvent) {
+                if(!consumed && window->onMouseEvent) {
                     window->onMouseEvent(event);
                 }
                 break;

@nabijaczleweli
Copy link
Contributor Author

That did it!

@whitequark
Copy link
Contributor

Fixed in 7f75148.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants