mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Merge branch '2.6.x' into feature/back-merge
This commit is contained in:
commit
cb675b2bbc
2
.gitignore
vendored
2
.gitignore
vendored
@ -37,4 +37,4 @@ build/
|
|||||||
# Cache/IDE folders
|
# Cache/IDE folders
|
||||||
.cache/
|
.cache/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <linux/joystick.h>
|
#include <linux/joystick.h>
|
||||||
#include <libudev.h>
|
#include <libudev.h>
|
||||||
|
#include <poll.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -254,13 +255,9 @@ namespace
|
|||||||
// This will not fail since we make sure udevMonitor is valid
|
// This will not fail since we make sure udevMonitor is valid
|
||||||
int monitorFd = udev_monitor_get_fd(udevMonitor);
|
int monitorFd = udev_monitor_get_fd(udevMonitor);
|
||||||
|
|
||||||
fd_set descriptorSet;
|
pollfd fds{ monitorFd, POLLIN, 0 };
|
||||||
FD_ZERO(&descriptorSet);
|
|
||||||
FD_SET(monitorFd, &descriptorSet);
|
|
||||||
timeval timeout = {0, 0};
|
|
||||||
|
|
||||||
return (select(monitorFd + 1, &descriptorSet, nullptr, nullptr, &timeout) > 0) &&
|
return (poll(&fds, 1, 0) > 0) && ((fds.revents & POLLIN) != 0);
|
||||||
FD_ISSET(monitorFd, &descriptorSet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a property value from a udev device
|
// Get a property value from a udev device
|
||||||
|
Loading…
Reference in New Issue
Block a user