Internals of native OS X backend event processing are no longer exposed

This commit is contained in:
alexey.lysiuk 2014-12-29 12:16:17 +02:00
parent 21d557ee11
commit 1c102ef9c9
3 changed files with 56 additions and 55 deletions

View file

@ -45,12 +45,7 @@ inline bool I_IsHiDPISupported()
return NSAppKitVersionNumber >= 1138; return NSAppKitVersionNumber >= 1138;
} }
void I_ProcessKeyboardEvent(NSEvent* event); void I_ProcessEvent(NSEvent* event);
void I_ProcessKeyboardFlagsEvent(NSEvent* event);
void I_ProcessMouseMoveEvent(NSEvent* event);
void I_ProcessMouseButtonEvent(NSEvent* event);
void I_ProcessMouseWheelEvent(NSEvent* event);
void I_StartupJoysticks(); void I_StartupJoysticks();
void I_ShutdownJoysticks(); void I_ShutdownJoysticks();

View file

@ -535,10 +535,8 @@ void ProcessMouseMoveInGame(NSEvent* theEvent)
} }
} }
} // unnamed namespace
void ProcessKeyboardEvent(NSEvent* theEvent)
void I_ProcessKeyboardEvent(NSEvent* theEvent)
{ {
const unsigned short keyCode = [theEvent keyCode]; const unsigned short keyCode = [theEvent keyCode];
if (keyCode >= KEY_COUNT) if (keyCode >= KEY_COUNT)
@ -567,7 +565,7 @@ void I_ProcessKeyboardEvent(NSEvent* theEvent)
} }
} }
void I_ProcessKeyboardFlagsEvent(NSEvent* theEvent) void ProcessKeyboardFlagsEvent(NSEvent* theEvent)
{ {
static const uint32_t FLAGS_MASK = static const uint32_t FLAGS_MASK =
NSDeviceIndependentModifierFlagsMask & ~NSNumericPadKeyMask; NSDeviceIndependentModifierFlagsMask & ~NSNumericPadKeyMask;
@ -606,7 +604,7 @@ void I_ProcessKeyboardFlagsEvent(NSEvent* theEvent)
} }
void I_ProcessMouseMoveEvent(NSEvent* theEvent) void ProcessMouseMoveEvent(NSEvent* theEvent)
{ {
if (GUICapture) if (GUICapture)
{ {
@ -618,7 +616,7 @@ void I_ProcessMouseMoveEvent(NSEvent* theEvent)
} }
} }
void I_ProcessMouseButtonEvent(NSEvent* theEvent) void ProcessMouseButtonEvent(NSEvent* theEvent)
{ {
event_t event = {}; event_t event = {};
@ -669,7 +667,7 @@ void I_ProcessMouseButtonEvent(NSEvent* theEvent)
} }
} }
void I_ProcessMouseWheelEvent(NSEvent* theEvent) void ProcessMouseWheelEvent(NSEvent* theEvent)
{ {
const CGFloat delta = [theEvent deltaY]; const CGFloat delta = [theEvent deltaY];
const bool isZeroDelta = fabs(delta) < 1.0E-5; const bool isZeroDelta = fabs(delta) < 1.0E-5;
@ -696,3 +694,50 @@ void I_ProcessMouseWheelEvent(NSEvent* theEvent)
D_PostEvent(&event); D_PostEvent(&event);
} }
} // unnamed namespace
void I_ProcessEvent(NSEvent* event)
{
const NSEventType eventType = [event type];
switch (eventType)
{
case NSMouseMoved:
ProcessMouseMoveEvent(event);
break;
case NSLeftMouseDown:
case NSLeftMouseUp:
case NSRightMouseDown:
case NSRightMouseUp:
case NSOtherMouseDown:
case NSOtherMouseUp:
ProcessMouseButtonEvent(event);
break;
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
ProcessMouseButtonEvent(event);
ProcessMouseMoveEvent(event);
break;
case NSScrollWheel:
ProcessMouseWheelEvent(event);
break;
case NSKeyDown:
case NSKeyUp:
ProcessKeyboardEvent(event);
break;
case NSFlagsChanged:
ProcessKeyboardFlagsEvent(event);
break;
default:
break;
}
}

View file

@ -377,46 +377,7 @@ ApplicationController* appCtrl;
break; break;
} }
const NSEventType eventType = [event type]; I_ProcessEvent(event);
switch (eventType)
{
case NSMouseMoved:
I_ProcessMouseMoveEvent(event);
break;
case NSLeftMouseDown:
case NSLeftMouseUp:
case NSRightMouseDown:
case NSRightMouseUp:
case NSOtherMouseDown:
case NSOtherMouseUp:
I_ProcessMouseButtonEvent(event);
break;
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
I_ProcessMouseButtonEvent(event);
I_ProcessMouseMoveEvent(event);
break;
case NSScrollWheel:
I_ProcessMouseWheelEvent(event);
break;
case NSKeyDown:
case NSKeyUp:
I_ProcessKeyboardEvent(event);
break;
case NSFlagsChanged:
I_ProcessKeyboardFlagsEvent(event);
break;
default:
break;
}
[NSApp sendEvent:event]; [NSApp sendEvent:event];
} }