From 323a8945eb1d7065f4d44a3ae7feefe6f96afa45 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 5 May 2018 20:20:57 -0400 Subject: [PATCH] Migrated sendAreaEvents() and the areaevents.m keycode functions. --- darwin/OLD_uipriv_darwin.h | 8 -------- darwin/area.m | 6 +++--- darwin/areaevents.m | 4 ++-- darwin/main.m | 2 +- darwin/uipriv_darwin.h | 7 +++++++ 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/darwin/OLD_uipriv_darwin.h b/darwin/OLD_uipriv_darwin.h index c2cfb957..998ab36c 100644 --- a/darwin/OLD_uipriv_darwin.h +++ b/darwin/OLD_uipriv_darwin.h @@ -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 *); diff --git a/darwin/area.m b/darwin/area.m index 1db9233e..5705c896 100644 --- a/darwin/area.m +++ b/darwin/area.m @@ -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; diff --git a/darwin/areaevents.m b/darwin/areaevents.m index d7ceaaad..27b5dd64 100644 --- a/darwin/areaevents.m +++ b/darwin/areaevents.m @@ -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; diff --git a/darwin/main.m b/darwin/main.m index b11beb68..4c930dae 100644 --- a/darwin/main.m +++ b/darwin/main.m @@ -14,7 +14,7 @@ static BOOL stepsIsRunning; - (void)sendEvent:(NSEvent *)e { - if (sendAreaEvents(e) != 0) + if (uiprivSendAreaEvents(e) != 0) return; [super sendEvent:e]; } diff --git a/darwin/uipriv_darwin.h b/darwin/uipriv_darwin.h index b3cd3e23..1cd88dbd 100644 --- a/darwin/uipriv_darwin.h +++ b/darwin/uipriv_darwin.h @@ -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"