Skip to content

Commit

Permalink
Fix variable shadowing (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
PMheart authored Aug 1, 2022
1 parent 67cfa83 commit fdb8be5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions VoodooPS2Controller/VoodooPS2Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,22 +654,22 @@ bool ApplePS2Controller::start(IOService * provider)

propertyMatch = propertyMatching(_deliverNotification, kOSBooleanTrue);
if (propertyMatch != NULL) {
IOServiceMatchingNotificationHandler notificationHandlerPublish = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandlerPublish);
IOServiceMatchingNotificationHandler publishHandler = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandlerPublish);

//
// Register notifications for availability of any IOService objects wanting to consume our message events
//
_publishNotify = addMatchingNotification(gIOFirstPublishNotification,
propertyMatch,
notificationHandlerPublish,
publishHandler,
this,
0, 10000);

IOServiceMatchingNotificationHandler notificationHandlerTerminate = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandlerTerminate);
IOServiceMatchingNotificationHandler terminateHandler = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandlerTerminate);

_terminateNotify = addMatchingNotification(gIOTerminatedNotification,
propertyMatch,
notificationHandlerTerminate,
terminateHandler,
this,
0, 10000);

Expand Down Expand Up @@ -2001,8 +2001,8 @@ void ApplePS2Controller::dispatchMessageGated(int* message, void* data)
break;
default:

int dispatchMessage = kPS2M_notifyKeyTime;
dispatchMessageGated(&dispatchMessage, &(pInfo->time));
int dispatchMsg = kPS2M_notifyKeyTime;
dispatchMessageGated(&dispatchMsg, &(pInfo->time));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions VoodooPS2Keyboard/VoodooPS2Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1516,12 +1516,12 @@ bool ApplePS2Keyboard::dispatchKeyboardEventWithPacket(const UInt8* packet)
// Fn+F2 generates e0 ab and so does Fn+F3 (we will null those out in ps2 map)
static unsigned keys[] = { 0x2a, 0x1d };
// if Option key is down don't pull up on the Shift keys
int start = checkModifierState(kMaskLeftWindows) ? 1 : 0;
for (int i = start; i < countof(keys); i++)
int state = checkModifierState(kMaskLeftWindows) ? 1 : 0;
for (int i = state; i < countof(keys); i++)
if (KBV_IS_KEYDOWN(keys[i]))
dispatchKeyboardEventX(_PS2ToADBMap[keys[i]], false, now_abs);
dispatchKeyboardEventX(keyCode == 0x4e ? 0x90 : 0x91, goingDown, now_abs);
for (int i = start; i < countof(keys); i++)
for (int i = state; i < countof(keys); i++)
if (KBV_IS_KEYDOWN(keys[i]))
dispatchKeyboardEventX(_PS2ToADBMap[keys[i]], true, now_abs);
keyCode = 0;
Expand Down
30 changes: 15 additions & 15 deletions VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,22 +964,22 @@ void ApplePS2SynapticsTouchPad::synaptics_parse_hw_state(const UInt8 buf[])



UInt32 buttonsraw = buf[0] & 0x03; // mask for just R L
UInt32 buttons = buttonsraw;
UInt32 btnsraw = buf[0] & 0x03; // mask for just R L
UInt32 btn = btnsraw;


UInt32 passbuttons = buf[1] & 0x7; // mask for just M R L
UInt32 passbtns = buf[1] & 0x7; // mask for just M R L
// if there are buttons set in the last pass through packet, then be sure
// they are set in any trackpad dispatches.
// otherwise, you might see double clicks that aren't there
buttons |= passbuttons;
lastbuttons = buttons;
btn |= passbtns;
lastbuttons = btn;

// New Lenovo clickpads do not have buttons, so LR in packet byte 1 is zero and thus
// passbuttons is 0. Instead we need to check the trackpad buttons in byte 0 and byte 3
// However for clickpads that would miss right clicks, so use the last clickbuttons that
// were saved.
UInt32 combinedButtons = buttons | ((buf[0] & 0x3) | (buf[3] & 0x3)) | _clickbuttons | thinkpadButtonState;
UInt32 combinedButtons = btn | ((buf[0] & 0x3) | (buf[3] & 0x3)) | _clickbuttons | thinkpadButtonState;

SInt32 dx = ((buf[1] & 0x10) ? 0xffffff00 : 0 ) | buf[4];
SInt32 dy = ((buf[1] & 0x20) ? 0xffffff00 : 0 ) | buf[5];
Expand Down Expand Up @@ -1228,14 +1228,14 @@ bool ApplePS2SynapticsTouchPad::renumberFingers() {
else if (clampedFingerCount == 3) {
const auto &f0v = virtualFingerStates[f0.virtualFingerIndex];
const auto &f1v = virtualFingerStates[f1.virtualFingerIndex];
auto &f2 = fingerStates[2];
f2.x += ((f0.x - f0v.x_avg.newest()) + (f1.x - f1v.x_avg.newest())) / 2;
f2.y += ((f0.y - f0v.y_avg.newest()) + (f1.y - f1v.y_avg.newest())) / 2;
f2.z = (f0.z + f1.z) / 2;
f2.w = (f0.w + f1.w) / 2;

clip_no_update_limits(f2.x, logical_min_x, logical_max_x, margin_size_x);
clip_no_update_limits(f2.y, logical_min_y, logical_max_y, margin_size_y);
auto &fs2 = fingerStates[2];
fs2.x += ((f0.x - f0v.x_avg.newest()) + (f1.x - f1v.x_avg.newest())) / 2;
fs2.y += ((f0.y - f0v.y_avg.newest()) + (f1.y - f1v.y_avg.newest())) / 2;
fs2.z = (f0.z + f1.z) / 2;
fs2.w = (f0.w + f1.w) / 2;

clip_no_update_limits(fs2.x, logical_min_x, logical_max_x, margin_size_x);
clip_no_update_limits(fs2.y, logical_min_y, logical_max_y, margin_size_y);
}
}
else
Expand Down Expand Up @@ -1630,7 +1630,7 @@ void ApplePS2SynapticsTouchPad::sendTouchData() {
} else {
double base = ((double) (state.pressure - _forceTouchCustomUpThreshold)) / ((double) (_forceTouchCustomDownThreshold - _forceTouchCustomUpThreshold));
value = 1;
for (int i = 0; i < _forceTouchCustomPower; ++i) {
for (int j = 0; j < _forceTouchCustomPower; ++j) {
value *= base;
}
}
Expand Down

0 comments on commit fdb8be5

Please sign in to comment.