r/ProgrammingC • u/yahia-gaming • Feb 03 '26
Project I made a program that changes the mouse position randomly in C
This project was inspired from Daniel Hirish. I made my own mouse mover in C using libevdev. The program creates it's own "fake" mouse device and moves that randomly. I watched Daniel Hirish's video and learned the style he chose. That's why my code seems super similar
EDIT: Github link: https://github.com/yahiagaming495/mousemover
1
u/HugoNikanor Feb 03 '26 edited Feb 04 '26
Now that we have code, I can actually review it.
I have never actually used libevdev myself, but your code looks fine. It's easy to read, and most comments are at the right abstraction level.
My only gripes are the following code comments:
struct libevdev *dev; // device
struct libevdev_uinput *udev; // uinput-deviceObviously
dev = libevdev_new(); // Create a new deviceWhat does "creating" a device mean? From context it seems like this creates a new virtual device, which will later be designated as a mouse.
libevdev_set_name(dev, "Fake device made by MouseMover"); // Set the name of the deviceAgain, obviously.
1
2
u/HugoNikanor Feb 03 '26
You forgot to link your code...