Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Pannoniae
Copy link

Fixes #2684, now without all the commented out debug code. Hope it doesn't break anything.

@Pannoniae Pannoniae requested a review from elmindreda as a code owner July 30, 2025 18:12
@dougbinks dougbinks changed the title clean application of the patch for #2684 Win32: Buffered approach to raw mouse motion, PR fix for #2684 Aug 9, 2025
@dougbinks
Copy link
Contributor

It looks like the MinGW builds fail because RI_MOUSE_HWHEEL is not defined, so we may need:

#ifndef RI_MOUSE_HWHEEL
// MinGW may not have the define for RI_MOUSE_HWHEEL
#define RI_MOUSE_HWHEEL 0x0800
#endif

@Pannoniae
Copy link
Author

It looks like the MinGW builds fail because RI_MOUSE_HWHEEL is not defined, so we may need:

#ifndef RI_MOUSE_HWHEEL
// MinGW may not have the define for RI_MOUSE_HWHEEL
#define RI_MOUSE_HWHEEL 0x0800
#endif

ask and ye shall find!

MSG msg;
HWND handle;
_GLFWwindow* window;
_GLFWwindow* window = _glfw.windowListHead;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line does nothing, and should be reverted to:

    _GLFWwindow* window;

@dougbinks
Copy link
Contributor

I've done an initial testing of the code, along with a brief review (one note added above). Given this affects all raw mouse input I'd like a bit more time testing and checking the code. Meanwhile do take a look at the guide on contributing a bug fix and feature. This is somewhat more like a bug fix as the optimization does not add new functionality, simply improves an existing one.

https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md#contributing-a-bug-fix

So in addition to the code we need:

  • Change log entry in README.md, describing the incorrect behavior
  • Credits entries in CONTRIBUTORS.md for all authors of the bug fix

I can do these if you don't have the time. You can search previous commits for examples.

@dougbinks dougbinks self-assigned this Aug 10, 2025
@dougbinks dougbinks added Windows Win32 specific (not Cygwin or WSL) input Keyboard, joystick or mouse enhancement Feature suggestions and PRs labels Aug 10, 2025
@dougbinks
Copy link
Contributor

@Pannoniae Could you remove your tag GLFW "3.5.0"?

Sadly due to an error I made (see #2758) the tag got added to GLFW until I found out and deleted it. In order to reduce any confusion could you delete the tag (but keep the source code branch)?

@Pannoniae
Copy link
Author

yeah, I will do it in an hour or two (sorry about that, I've been busy the past week!)

@dougbinks
Copy link
Contributor

Do you have time to update the PR with changes related to the comments I've made, in particular the bug I mention in the first review comment?

If not I can look into making the required changes myself when merging.

@Pannoniae
Copy link
Author

sadly no, some things have come up...

@dougbinks
Copy link
Contributor

OK - then if I get time I'll look into making the required changes.

@Pannoniae
Copy link
Author

much appreciated!

@IzumiiKonata
Copy link

IzumiiKonata commented Oct 27, 2025

Thanks for working on this!

I tested this PR and found that when pressing three mouse buttons simultaneously (e.g., left, right, and a side button) and releasing them at the same time, there is a high probability that some buttons will remain stuck in the pressed state. (This issue only occurs when GLFW_RAW_MOUSE_MOTION is set to GLFW_TRUE.)

Let me know if you need any more details on the reproduction steps.

@dougbinks
Copy link
Contributor

Thanks @IzumiiKonata that's a great bug report - I can indeed now see in the code that though a set of flags for each button pressed/released is processed, it's done assuming only one key event happens at a time.
https://github.com/glfw/glfw/pull/2750/files#diff-475ae98b1c5241adc1365b9672ee3c565946a3618c8d6f2e409500eb9dba0395R2139-R2192

I can see how to alter this to fix the issue but won't have time for a bit.

@dougbinks
Copy link
Contributor

I have pushed several fixes and updates to a branch on my fork:

https://github.com/dougbinks/glfw/tree/pr-2750-win32-buf-raw-m

This should fix the issue @IzumiiKonata raised along with the multi-window bug I mentioned and most of the review comments I made. The one remaining issue is bounding the raw buffer memory allocation to something sensible, and add a loop to cope with larger input buffers.

@dougbinks
Copy link
Contributor

I've now added a bounded raw input buffer with looping read, plus fixed a potential crash after an error.

I think the PR is now functionally complete (if testing shows no further issues), but needs some other changes as per the contributing guide except documentation since this feature does not change the API:

  1. Change log entry in README.md, listing all new symbols
  2. News page entry in docs/news.md, briefly describing the feature
  3. Credits entries in CONTRIBUTORS.md for all authors of the feature

@dougbinks
Copy link
Contributor

I have updated both the README.md and docs/news.md, so all that remains to be complete is for @Pannoniae to let me know how they want to be credited in the CONTRIBUTORS.md file.

I've done quite a bit of testing, but if @Pannoniae and @IzumiiKonata could test my branch below that would be very helpful:
https://github.com/dougbinks/glfw/tree/pr-2750-win32-buf-raw-m

@Pannoniae
Copy link
Author

Just my name as it is on GitHub is fine, thank you! I'll try to see whether any more bugs come up.

@dougbinks
Copy link
Contributor

@Pannoniae I've updated the contributors. If you want to merge my branch into yours then I can merge the PR from the Github UI but that's not required.

@Pannoniae
Copy link
Author

I don't know how to merge it in :\

@dougbinks
Copy link
Contributor

No problem, I'll merge the PR from my branch keeping your authorship!

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

Labels

enhancement Feature suggestions and PRs input Keyboard, joystick or mouse Windows Win32 specific (not Cygwin or WSL)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

glfwPollEvents very low performance when using high polling rate mouse

3 participants