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

Viewports: Fix window dragging stopping when window leaves main viewport #2757

Closed

Conversation

rokups
Copy link
Contributor

@rokups rokups commented Aug 26, 2019

GLFW will incorrectly report mouse button as released when new window is created even if mouse button is kept pressed. Added a workaround that ignores mouse-release events for held-down buttons during window creation. This only happens on linux (tested windows and MacOS as well).

Video

Note that we can no longer use glfwGetMouseButton(g_Window, i) != 0 because this call also reports mouse button as released even though it is being held down.

… is created even if mouse button is kept pressed. Added a workaround that ignores mouse-release events for held-down buttons during window creation. This only happens on linux.
@ocornut ocornut changed the title [Docking] Fix window dragging stopping when window leaves main viewport Viewports: Fix window dragging stopping when window leaves main viewport Aug 27, 2019
@ocornut
Copy link
Owner

ocornut commented Sep 17, 2019

For later reference, linking this to the issue submitted on GLFW's repo: #1562

(Not super confident about the current workaround which possibly have more side-effects, but I'll need to review it more thoroughly!)

@kudaba
Copy link
Contributor

kudaba commented Sep 17, 2019

I think this is the same issue I ran into when implementing #2696. Basically once the drag starts on a viewport it allows the mouse to fall through to the window behind it. The window won't be hovered and won't report being under the mouse position.

I'm not sure why glfw is using events and polling for handling the mouse input, but that's probably part of the problem as well. The win32 code will call ::SetCapture when mouse is down on a window which may help prevent it from receiving a mouse up event when going transparent, I'm not sure though.

@ocornut
Copy link
Owner

ocornut commented Sep 18, 2019

It's a little bit of a different issue than #2696, here the issue is that the mouse button gets reported as released.

It is probable that we should attempt to rewrite the back-end to use events instead of polling to solve the other issue, but I don't think this issue would be fixed by this.

@rokups rokups closed this Jun 5, 2020
@rokups rokups deleted the docking-glfw-unfocus-workaround branch June 5, 2020 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants