mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-02-04 10:35:35 +00:00
fix(macos/input): Fix handling of mouse wheel scroll events (#4592)
This commit is contained in:
@ -449,19 +449,19 @@ const KeyCodeMap kKeyCodesMap[] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void scroll(input_t &input, const int high_res_distance) {
|
void scroll(input_t &input, const int high_res_distance) {
|
||||||
CGEventRef upEvent = CGEventCreateScrollWheelEvent(
|
int wheelY = high_res_distance / 120;
|
||||||
nullptr,
|
int wheelX = 0;
|
||||||
kCGScrollEventUnitLine,
|
CGEventRef upEvent = CGEventCreateScrollWheelEvent(nullptr, kCGScrollEventUnitLine, 2, wheelY, wheelX);
|
||||||
2,
|
|
||||||
high_res_distance > 0 ? 1 : -1,
|
|
||||||
high_res_distance
|
|
||||||
);
|
|
||||||
CGEventPost(kCGHIDEventTap, upEvent);
|
CGEventPost(kCGHIDEventTap, upEvent);
|
||||||
CFRelease(upEvent);
|
CFRelease(upEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hscroll(input_t &input, int high_res_distance) {
|
void hscroll(input_t &input, int high_res_distance) {
|
||||||
// Unimplemented
|
int wheelY = 0;
|
||||||
|
int wheelX = high_res_distance / 120;
|
||||||
|
CGEventRef upEvent = CGEventCreateScrollWheelEvent(nullptr, kCGScrollEventUnitLine, 2, wheelY, wheelX);
|
||||||
|
CGEventPost(kCGHIDEventTap, upEvent);
|
||||||
|
CFRelease(upEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -532,9 +532,10 @@ const KeyCodeMap kKeyCodesMap[] = {
|
|||||||
auto output_name = display_device::map_output_name(config::video.output_name);
|
auto output_name = display_device::map_output_name(config::video.output_name);
|
||||||
// If output_name is set, try to find the display with that display id
|
// If output_name is set, try to find the display with that display id
|
||||||
if (!output_name.empty()) {
|
if (!output_name.empty()) {
|
||||||
uint32_t max_display = 32;
|
const int MAX_DISPLAYS = 32;
|
||||||
|
uint32_t max_display = MAX_DISPLAYS;
|
||||||
uint32_t display_count;
|
uint32_t display_count;
|
||||||
CGDirectDisplayID displays[max_display];
|
CGDirectDisplayID displays[MAX_DISPLAYS];
|
||||||
if (CGGetActiveDisplayList(max_display, displays, &display_count) != kCGErrorSuccess) {
|
if (CGGetActiveDisplayList(max_display, displays, &display_count) != kCGErrorSuccess) {
|
||||||
BOOST_LOG(error) << "Unable to get active display list , error: "sv << std::endl;
|
BOOST_LOG(error) << "Unable to get active display list , error: "sv << std::endl;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user