GLUTMOTIONFUNC(3)
π GLUTMOTIONFUNC(3) π
okay so bestie, pull up a chair, we're reading the GLUTMOTIONFUNC(3) page together and honestly? it's a bop. it's short, it's sweet, it's giving "small function, big main character energy." π¦
β¨ NAME β¨
glutMotionFunc β reports mouse-motion while a button is held. that's it. that's the whole vibe. π
π LIBRARY π
OpenGLUT β input. yes, that OpenGLUT. the input corner of the library, where all the mouse gossip lives. π
πΈ SYNOPSIS πΈ
#include <openglut.h>
void
glutMotionFunc(void( *callback )( int x, int y ));
look at her. one include, one function, no drama. iconic. β¨
π PARAMETERS π
callbackβ your client hook for dragging the mouse. this is your little function that OpenGLUT is gonna call every time the mouse moves while a button is held down. you write it, you own it, you're the main character of it. π«Ά
π DESCRIPTION π
so, what does this actually do? simple: this function reports the mouse position when the mouse is dragged starting from within your window. that's the whole thing, bestie.
and okay, let's define "dragging" because it's doing a lot of work in that sentence: "dragging" happens when you press one or more mouse buttons in one of your OpenGLUT windows, and then move the mouse around. button down + mouse moves = dragging. no button down = that's a different function's whole personality (see SEE ALSO, we'll get there π).
also super important: this callback is bound to the current window. the current window. not all the windows, not some random window, the one that's current. so if you're switching windows around, keep that in mind. no cap. π₯
π CAVEATS π
okay now the part where we all sit up straight, because these are the "read the fine print or perish" bits:
- events are reported until the mouse button is released, even if the mouse leaves the window. yes, really. your window doesn't get to say "not my problem anymore" β the callback keeps firing until that button comes back up. the mouse can wander off into the void and you'll still be getting coordinates about it. π
- windows created via
glutCreateMenuWindow()always cascade keyboard and mouse events to their parent. so menu windows don't hoard their events, they pass them up to mom. that's just how they're built, no exceptions. periodt. π
π SEE ALSO π
go read these, they're the friend group:
glutMouseFunc(3)glutPassiveMotion(3)
glutPassiveMotion(3) is literally the no-button-held cousin of this one, iykyk. π¦
and that's the page!! mwah. go forth and drag things around. πβ¨
this little love letter to mouse dragging came to you from the OpenGLUT library, dated UNDATED, and it's filed under the extremely mysterious title UNTITLED() β yeah, they didn't name it, we're not gonna ask, we're just gonna accept it and slay. ππΈπ«Ά
π¦ where this page comes from
- centos-stream 10: freeglut-devel 3.4.0-9.el10 Β· MIT
- centos-stream 9: freeglut-devel 3.2.1-10.el9 Β· MIT
- centos-stream 9: freeglut-devel 3.2.1-10.el9 Β· MIT
- fedora 43: freeglut-devel 3.6.0-6.fc43 Β· MIT
- fedora 43: freeglut-devel 3.6.0-6.fc43 Β· MIT
- fedora 43: freeglut-devel 3.8.0-1.fc43 Β· MIT
- fedora 43: freeglut-devel 3.8.0-1.fc43 Β· MIT
- fedora 44: freeglut-devel 3.8.0-2.fc44 Β· MIT
- fedora 44: freeglut-devel 3.8.0-2.fc44 Β· MIT
- opensuse-leap 16.0: freeglut-devel 3.2.2-160000.2.2 Β· MIT
- opensuse-leap 16.0: freeglut-devel 3.2.2-160000.2.2 Β· MIT
- opensuse-leap 16.0: freeglut-devel 3.2.2-160000.2.2 Β· MIT
- opensuse-leap 16.0: freeglut-devel 3.2.2-160000.2.2 Β· MIT
- Copyright 2004, the OpenGLUT contributors
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms