mirror of https://github.com/encounter/SDL.git
Fixed bug 1965 - Mac: dead code for supporting OS 10.4
Alex Szpakowski The new patch removes all the truly obsolete code I could find. I tested on OS 10.8 and OS 10.5.
This commit is contained in:
parent
5821466c05
commit
b30e396ba1
|
@ -32,12 +32,7 @@
|
||||||
#include <mach/mach_error.h>
|
#include <mach/mach_error.h>
|
||||||
#include <IOKit/IOKitLib.h>
|
#include <IOKit/IOKitLib.h>
|
||||||
#include <IOKit/IOCFPlugIn.h>
|
#include <IOKit/IOCFPlugIn.h>
|
||||||
#ifdef MACOS_10_0_4
|
|
||||||
#include <IOKit/hidsystem/IOHIDUsageTables.h>
|
|
||||||
#else
|
|
||||||
/* The header was moved here in Mac OS X 10.1 */
|
|
||||||
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
|
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
|
||||||
#endif
|
|
||||||
#include <IOKit/hid/IOHIDLib.h>
|
#include <IOKit/hid/IOHIDLib.h>
|
||||||
#include <IOKit/hid/IOHIDKeys.h>
|
#include <IOKit/hid/IOHIDKeys.h>
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
|
@ -198,45 +198,6 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/* This is the original behavior, before support was added for
|
|
||||||
* differentiating between left and right versions of the keys.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
DoUnsidedModifiers(unsigned short scancode,
|
|
||||||
unsigned int oldMods, unsigned int newMods)
|
|
||||||
{
|
|
||||||
const int mapping[] = {
|
|
||||||
SDL_SCANCODE_CAPSLOCK,
|
|
||||||
SDL_SCANCODE_LSHIFT,
|
|
||||||
SDL_SCANCODE_LCTRL,
|
|
||||||
SDL_SCANCODE_LALT,
|
|
||||||
SDL_SCANCODE_LGUI
|
|
||||||
};
|
|
||||||
unsigned int i, bit;
|
|
||||||
|
|
||||||
/* Iterate through the bits, testing each against the current modifiers */
|
|
||||||
for (i = 0, bit = NSAlphaShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) {
|
|
||||||
unsigned int oldMask, newMask;
|
|
||||||
|
|
||||||
oldMask = oldMods & bit;
|
|
||||||
newMask = newMods & bit;
|
|
||||||
|
|
||||||
if (oldMask && oldMask != newMask) { /* modifier up event */
|
|
||||||
/* If this was Caps Lock, we need some additional voodoo to make SDL happy */
|
|
||||||
if (bit == NSAlphaShiftKeyMask) {
|
|
||||||
SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]);
|
|
||||||
}
|
|
||||||
SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]);
|
|
||||||
} else if (newMask && oldMask != newMask) { /* modifier down event */
|
|
||||||
SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]);
|
|
||||||
/* If this was Caps Lock, we need some additional voodoo to make SDL happy */
|
|
||||||
if (bit == NSAlphaShiftKeyMask) {
|
|
||||||
SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is a helper function for HandleModifierSide. This
|
/* This is a helper function for HandleModifierSide. This
|
||||||
* function reverts back to behavior before the distinction between
|
* function reverts back to behavior before the distinction between
|
||||||
* sides was made.
|
* sides was made.
|
||||||
|
@ -458,15 +419,7 @@ HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
DoSidedModifiers(scancode, data->modifierFlags, modifierFlags);
|
||||||
* Starting with Panther (10.3.0), the ability to distinguish between
|
|
||||||
* left side and right side modifiers is available.
|
|
||||||
*/
|
|
||||||
if (data->osversion >= 0x1030) {
|
|
||||||
DoSidedModifiers(scancode, data->modifierFlags, modifierFlags);
|
|
||||||
} else {
|
|
||||||
DoUnsidedModifiers(scancode, data->modifierFlags, modifierFlags);
|
|
||||||
}
|
|
||||||
data->modifierFlags = modifierFlags;
|
data->modifierFlags = modifierFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue