Migrated sendAreaEvents() and the areaevents.m keycode functions.

This commit is contained in:
Pietro Gagliardi 2018-05-05 20:20:57 -04:00
parent b8fc9fa817
commit 323a8945eb
5 changed files with 13 additions and 14 deletions

View File

@ -1,11 +1,3 @@
// area.m
extern int sendAreaEvents(NSEvent *);
// areaevents.m
extern BOOL fromKeycode(unsigned short keycode, uiAreaKeyEvent *ke);
extern BOOL keycodeModifier(unsigned short keycode, uiModifiers *mod);
// draw.m
extern uiDrawContext *newContext(CGContextRef, CGFloat);
extern void freeContext(uiDrawContext *);

View File

@ -264,7 +264,7 @@ mouseEvent(otherMouseUp)
ke.Up = up;
if (!fromKeycode([e keyCode], &ke))
if (!uiprivFromKeycode([e keyCode], &ke))
return 0;
return [self sendKeyEvent:&ke];
}
@ -289,7 +289,7 @@ mouseEvent(otherMouseUp)
// Mac OS X sends this event on both key up and key down.
// Fortunately -[e keyCode] IS valid here, so we can simply map from key code to Modifiers, get the value of [e modifierFlags], and check if the respective bit is set or not that will give us the up/down state
if (!keycodeModifier([e keyCode], &whichmod))
if (!uiprivKeycodeModifier([e keyCode], &whichmod))
return 0;
ke.Modifier = whichmod;
ke.Modifiers = [self parseModifiers:e];
@ -361,7 +361,7 @@ static void uiAreaDestroy(uiControl *c)
// by default, NSApplication eats some key events
// this prevents that from happening with uiArea
// see http://stackoverflow.com/questions/24099063/how-do-i-detect-keyup-in-my-nsview-with-the-command-key-held and http://lists.apple.com/archives/cocoa-dev/2003/Oct/msg00442.html
int sendAreaEvents(NSEvent *e)
int uiprivSendAreaEvents(NSEvent *e)
{
NSEventType type;
id focused;

View File

@ -129,7 +129,7 @@ static const struct {
{ 0xFFFF, 0 },
};
BOOL fromKeycode(unsigned short keycode, uiAreaKeyEvent *ke)
BOOL uiprivFromKeycode(unsigned short keycode, uiAreaKeyEvent *ke)
{
int i;
@ -146,7 +146,7 @@ BOOL fromKeycode(unsigned short keycode, uiAreaKeyEvent *ke)
return NO;
}
BOOL keycodeModifier(unsigned short keycode, uiModifiers *mod)
BOOL uiprivKeycodeModifier(unsigned short keycode, uiModifiers *mod)
{
int i;

View File

@ -14,7 +14,7 @@ static BOOL stepsIsRunning;
- (void)sendEvent:(NSEvent *)e
{
if (sendAreaEvents(e) != 0)
if (uiprivSendAreaEvents(e) != 0)
return;
[super sendEvent:e];
}

View File

@ -103,4 +103,11 @@ extern void uiprivSingleChildConstraintsEstablish(uiprivSingleChildConstraints *
extern void uiprivSingleChildConstraintsRemove(uiprivSingleChildConstraints *c, NSView *cv);
extern void uiprivSingleChildConstraintsSetMargined(uiprivSingleChildConstraints *c, int margined);
// area.m
extern int uiprivSendAreaEvents(NSEvent *);
// areaevents.m
extern BOOL uiprivFromKeycode(unsigned short keycode, uiAreaKeyEvent *ke);
extern BOOL uiprivKeycodeModifier(unsigned short keycode, uiModifiers *mod);
#import "OLD_uipriv_darwin.h"