mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
Internals of native OS X backend event processing are no longer exposed
This commit is contained in:
parent
21d557ee11
commit
1c102ef9c9
3 changed files with 56 additions and 55 deletions
|
@ -45,12 +45,7 @@ inline bool I_IsHiDPISupported()
|
|||
return NSAppKitVersionNumber >= 1138;
|
||||
}
|
||||
|
||||
void I_ProcessKeyboardEvent(NSEvent* event);
|
||||
void I_ProcessKeyboardFlagsEvent(NSEvent* event);
|
||||
|
||||
void I_ProcessMouseMoveEvent(NSEvent* event);
|
||||
void I_ProcessMouseButtonEvent(NSEvent* event);
|
||||
void I_ProcessMouseWheelEvent(NSEvent* event);
|
||||
void I_ProcessEvent(NSEvent* event);
|
||||
|
||||
void I_StartupJoysticks();
|
||||
void I_ShutdownJoysticks();
|
||||
|
|
|
@ -535,10 +535,8 @@ void ProcessMouseMoveInGame(NSEvent* theEvent)
|
|||
}
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
|
||||
void I_ProcessKeyboardEvent(NSEvent* theEvent)
|
||||
void ProcessKeyboardEvent(NSEvent* theEvent)
|
||||
{
|
||||
const unsigned short keyCode = [theEvent keyCode];
|
||||
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 =
|
||||
NSDeviceIndependentModifierFlagsMask & ~NSNumericPadKeyMask;
|
||||
|
@ -606,7 +604,7 @@ void I_ProcessKeyboardFlagsEvent(NSEvent* theEvent)
|
|||
}
|
||||
|
||||
|
||||
void I_ProcessMouseMoveEvent(NSEvent* theEvent)
|
||||
void ProcessMouseMoveEvent(NSEvent* theEvent)
|
||||
{
|
||||
if (GUICapture)
|
||||
{
|
||||
|
@ -618,7 +616,7 @@ void I_ProcessMouseMoveEvent(NSEvent* theEvent)
|
|||
}
|
||||
}
|
||||
|
||||
void I_ProcessMouseButtonEvent(NSEvent* theEvent)
|
||||
void ProcessMouseButtonEvent(NSEvent* theEvent)
|
||||
{
|
||||
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 bool isZeroDelta = fabs(delta) < 1.0E-5;
|
||||
|
@ -696,3 +694,50 @@ void I_ProcessMouseWheelEvent(NSEvent* theEvent)
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,48 +376,9 @@ ApplicationController* appCtrl;
|
|||
{
|
||||
break;
|
||||
}
|
||||
|
||||
const NSEventType eventType = [event type];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
I_ProcessEvent(event);
|
||||
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue