-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Possible #612 fix #669
base: dev
Are you sure you want to change the base?
Possible #612 fix #669
Conversation
My concern with removing that condition is about performance: wheel events occur frequently, at least once per frame, so it is disadvantegeous to offer them to widgets that we already know shouldn't handle them. My educated guess is that the actual problem is that the wheel event does not know the current cursor position, or the coordinates are unexpectedly affected by the secondary monitor. I have no way to test a dual monitor Wayland setup myself, but if anyone can print out those wheel event coordinates and see if they make sense, it could enlighten us here. |
Super hacky: if (ev->type == SDL_MOUSEWHEEL)
{
printf("Scroll on %ld %lu\n", i, (unsigned long)time(NULL));
} Shows that when scrolling in a window with a split view, there appears to only be one event, but the first scroll in a different split widget has two events which is fun and weird.
You're probably right that the fix shouldn't be in the I'll have a look and get back! Edit: |
I'm not going to open a new PR just yet, but it looks like for a real fix swapping: // original
if (ev->type == SDL_MOUSEWHEEL && !contains_Rect(rect_Root(root),
coord_MouseWheelEvent(&ev->wheel))) for // updated
if (ev->type == SDL_MOUSEWHEEL && !contains_Rect(rect_Root(root),
coord_Window(d, ev->wheel.mouseX, ev->wheel.mouseY))) works From printing the various variables in Just for fun, I tried messing with [...]
SDL_GetGlobalMouseState(&mousePos.x, &mousePos.y);
mousePos.x += 1920;
SDL_GetWindowPosition(win->win, &winPos.x, &winPos.y);
[...] and screen 2 starts working under the original/current |
I tried this last patch and it works. Thank you. |
Apply the fix suggested by @shurizzle in #669, requiring SDL 2.26+. This does not apply on macOS because the wheel events are dispatched by custom event handling code (due to trackpad swipe handling) and therefore don't have the mouse coordinates included. IssueID #612 IssueID #669
If using |
@skyjake I believe the commit message for 83d29c1 is incorrect. I only confirmed that it works on Linux; the solution was written by @probablySophie, who has nothing to do with me. |
@shurizzle Ah, right you are, sorry for the confusion. |
Issue #612 is about scrolling not working on secondary monitors when running under Wayland.
@tuomovee says that removing the check for the
mousewheel
event indispatchEvent_Window()
appears to resolve the issue, but is unaware of any potential consequences.This does fix the issue on Wayland, with seemingly no consequences, split views appear to behave fine.
I haven't tested this on X11, but I can.
So barring anyone coming in and saying this is the worst idea ever, it looks like a fix?