I noticed that GLFW doesn’t currently support trackpad (ex: windows precision trackpad) “pinch-to-zoom”. By zoom, I mean the one-to-one zoom effect something like below.
I want to try out implementing custom win32 event handling for my app. Is there a way I can achieve this without rewriting the internal event loop?
For win32 I believe you can do this either by using SetWindowsHookEx to add your own window callback function or using PeekMessage with the filter parameters set to receive only the messages you need, though the later case might miss some messages which GLFW processes in _glfwPlatformPollEvents which you still need to call.
That should work, except occasionally it will miss some messages as if they happen between you calling PeekMessage and glfwPollEvents the GLFW message loop will ‘swallow’ them.
SetWindowsHookEx would be a more guaranteed solution to ensure you get all messages, though it’s slightly more complex to use so you could try the PeekMessage approach first.
An alternative is to modify the GLFW message function and maintain a fork, which might be easier.
The difference between GetMessage and PeekMessage is that PeekMessage does not wait until a message is posted, and it has an extra parameter wRemoveMsg which controls whether a message is removed from the queue or not.
_glfwPlatformPollEvents uses PM_REMOVE which removes messages - it has to otherwise the queue would not drain and only the first message would be read.
Hello, I noticed that WM_GESTURE isn’t what I’m really looking for. This is off-topic, but wanted to ask if you knew how I can capture trackpad (not touch screen) events.
I’m not receiving any WM_GESTURE events when I try to zoom or rotate. I assume it’s the legacy gesture handling, and not the new “precision drivers” events
Note that copying text is more useful than an image as I can’t copy text from an image
You’ve put your code in the if (!window) section, which as per the comment is for the hidden helper window and for a regular window during its initial creation. You should put your changes in the second switch (uMsg) section after this, namely lines 548-1214 of the original code where WM_MOUSEMOVE and other input is processed.
I don’t know enough about touch/gesture input to help you further, so I would just advise to read the documentation and perhaps look for samples and try those.