Skip to content

Commit

Permalink
commented out the whole display stuff to see if test moves
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazer committed May 22, 2024
1 parent 07059fe commit 28fceb9
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions src/platform/macos/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,35 +541,35 @@ const KeyCodeMap kKeyCodesMap[] = {
const auto macos_input = static_cast<macos_input_t *>(result.get());

// Default to main display
macos_input->display = CGMainDisplayID();

auto output_name = config::video.output_name;
// If output_name is set, try to find the display with that display id
if (!output_name.empty()) {
uint32_t max_display = 32;
uint32_t display_count;
CGDirectDisplayID displays[max_display];
if (CGGetActiveDisplayList(max_display, displays, &display_count) != kCGErrorSuccess) {
BOOST_LOG(error) << "Unable to get active display list , error: "sv << std::endl;
}
else {
for (int i = 0; i < display_count; i++) {
CGDirectDisplayID display_id = displays[i];
if (display_id == std::atoi(output_name.c_str())) {
macos_input->display = display_id;
}
}
}
}

if (macos_input->display != nullptr) {
// Input coordinates are based on the virtual resolution not the physical, so we need the scaling factor
const CGDisplayModeRef mode = CGDisplayCopyDisplayMode(macos_input->display);
macos_input->displayScaling = ((CGFloat) CGDisplayPixelsWide(macos_input->display)) / ((CGFloat) CGDisplayModeGetPixelWidth(mode));
CFRelease(mode);
} else {
macos_input->displayScaling = 1.0;
}
// macos_input->display = CGMainDisplayID();

// auto output_name = config::video.output_name;
// // If output_name is set, try to find the display with that display id
// if (!output_name.empty()) {
// uint32_t max_display = 32;
// uint32_t display_count;
// CGDirectDisplayID displays[max_display];
// if (CGGetActiveDisplayList(max_display, displays, &display_count) != kCGErrorSuccess) {
// BOOST_LOG(error) << "Unable to get active display list , error: "sv << std::endl;
// }
// else {
// for (int i = 0; i < display_count; i++) {
// CGDirectDisplayID display_id = displays[i];
// if (display_id == std::atoi(output_name.c_str())) {
// macos_input->display = display_id;
// }
// }
// }
// }
//
// if (macos_input->display != nullptr) {
// // Input coordinates are based on the virtual resolution not the physical, so we need the scaling factor
// const CGDisplayModeRef mode = CGDisplayCopyDisplayMode(macos_input->display);
// macos_input->displayScaling = ((CGFloat) CGDisplayPixelsWide(macos_input->display)) / ((CGFloat) CGDisplayModeGetPixelWidth(mode));
// CFRelease(mode);
// } else {
// macos_input->displayScaling = 1.0;
// }

macos_input->source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);

Expand Down

0 comments on commit 28fceb9

Please sign in to comment.