[Vm-dev] [commit] r2551 - Apply some consistent formatting to functions in sqMacUIEventsUniversal.c (move

commits at squeakvm.org commits at squeakvm.org
Tue Apr 24 17:25:09 UTC 2012


Author: eliot
Date: 2012-04-24 10:25:08 -0700 (Tue, 24 Apr 2012)
New Revision: 2551

Modified:
   branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c
Log:
Apply some consistent formatting to functions in sqMacUIEventsUniversal.c (move
function names to start of line).  Nuke trailing whitespace.  This before adding
UCKeyTranslate code.


Modified: branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c
===================================================================
--- branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c	2012-04-18 06:14:23 UTC (rev 2550)
+++ branches/Cog/platforms/Mac OS/vm/sqMacUIEventsUniversal.c	2012-04-24 17:25:08 UTC (rev 2551)
@@ -1,14 +1,14 @@
 /****************************************************************************
 *   PROJECT: Mac event interface.
 *   FILE:    sqMacUIEventsUniversal.c
-*   CONTENT: 
+*   CONTENT:
 *
 *   AUTHOR:  John Maloney, John McIntosh, and others.
-*   ADDRESS: 
+*   ADDRESS:
 *   EMAIL:   johnmci at smalltalkconsulting.com
 *   RCSID:   $Id: sqMacUIEvents.c 1297 2006-02-02 07:59:16Z johnmci $
 *
-*   NOTES: 
+*   NOTES:
 *  Feb 22nd, 2002, JMM moved code into 10 other files, see sqMacMain.c for comments
 *  Mar 1st, 2002, JMM carbon event logic, mutiple buttons with scroll wheels.
 *  Mar 8th,  2002, JMM Add logic to pass in external prim calls that require main thread UI execution
@@ -22,7 +22,7 @@
 *  3.6.0b1 Aug 5th, 2003 JMM only invoke event timer loop logic if gTapPowerManager is true (OS supports!)
 *  3.6.2b3 Nov 25th, 2003 JMM Tetsuya HAYASHI <tetha at st.rim.or.jp> supplied multiple unicode extraction
 *  3.7.0bx Nov 24th, 2003 JMM gCurrentVMEncoding
-*  3.7.1b3 Jan 29th, 2004  JMM return unicode for classic version versus virtual keyboard code 
+*  3.7.1b3 Jan 29th, 2004  JMM return unicode for classic version versus virtual keyboard code
 *  3.7.3b2 Apr 10th, 2004 JMM Tetsuya HAYASHI <tetha at st.rim.or.jp>  alteration to unicode key capture
 *  3.8.0b1 July 20th, 2004 JMM Multiple window support
 *  3.8.5b2 Jan 25th, 2005 JMM reduce qd buffer flushing.
@@ -38,7 +38,7 @@
  3.8.15b3  Feb 19th, 2007 JMM add cursor set logic
  3.8.15b5	Mar 10th, 2007 JMM check on menu item quit
  3.8.17b5	May 1st, 2007 JMM set tracking on bounds changed, not resize complete (which doesn't see the use of maximum button)
- 
+
  notes: IsUserCancelEventRef
 
 *****************************************************************************/
@@ -119,7 +119,7 @@
 sqInputEvent *nextEventPut(void);
 
 #define MAKETHESESTATIC static
- 
+
 #define KEYBUF_SIZE 64
 /* declaration of the event message hook */
 MAKETHESESTATIC eventMessageHook messageHook = NULL;
@@ -144,50 +144,50 @@
 
 /* This table maps the 5 Macintosh modifier key bits to 4 Squeak modifier
    bits. (The Mac shift and caps lock keys are both mapped to the single
-   Squeak shift bit).  This was true for squeak upto 3.0.7. Then in 3.0.8 we 
+   Squeak shift bit).  This was true for squeak upto 3.0.7. Then in 3.0.8 we
    decided to not map the cap lock key to shift
-   
+
 		Mac bits: <control><option><caps lock><shift><command>
 		ST bits:  <command><option><control><shift>
 */
- char modifierMap[256] = {	
+ char modifierMap[256] = {
  0, 8, 1, 9, 0, 8, 1, 9, 4, 12, 5, 13, 4, 12, 5, 13, //Track left and right shift keys
- 2, 10, 3, 11, 2, 10, 3, 11, 6, 14, 7, 15, 6, 14, 7, 
-15, 1, 9, 1, 9, 1, 9, 1, 9, 5, 13, 5, 13, 5, 13, 5, 
+ 2, 10, 3, 11, 2, 10, 3, 11, 6, 14, 7, 15, 6, 14, 7,
+15, 1, 9, 1, 9, 1, 9, 1, 9, 5, 13, 5, 13, 5, 13, 5,
 13, 3, 11, 3, 11, 3, 11, 3, 11, 7, 15, 7, 15, 7, 15,
  7, 15, 4, 12, 5, 13, 4, 12, 5, 13, 4, 12, 5, 13, 4,
-12, 5, 13, 6, 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15, 
+12, 5, 13, 6, 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15,
  6, 14, 7, 15, 5, 13, 5, 13, 5, 13, 5, 13, 5, 13, 5,
-13, 5, 13, 5, 13, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 
- 7, 15, 7, 15, 7, 15, 2, 10, 3, 11, 2, 10, 3, 11, 6, 
-14, 7, 15, 6, 14, 7, 15, 2, 10, 3, 11, 2, 10, 3, 11, 
- 6, 14, 7, 15, 6, 14, 7, 15, 3, 11, 3, 11, 3, 11, 3, 
- 11, 7, 15, 7, 15, 7, 15, 7, 15, 3, 11, 3, 11, 3, 11, 
- 3, 11, 7, 15, 7, 15, 7, 15, 7, 15, 6, 14, 7, 15, 6, 
- 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15, 
- 6, 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15, 7, 15, 7, 
- 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 
+13, 5, 13, 5, 13, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15,
+ 7, 15, 7, 15, 7, 15, 2, 10, 3, 11, 2, 10, 3, 11, 6,
+14, 7, 15, 6, 14, 7, 15, 2, 10, 3, 11, 2, 10, 3, 11,
+ 6, 14, 7, 15, 6, 14, 7, 15, 3, 11, 3, 11, 3, 11, 3,
+ 11, 7, 15, 7, 15, 7, 15, 7, 15, 3, 11, 3, 11, 3, 11,
+ 3, 11, 7, 15, 7, 15, 7, 15, 7, 15, 6, 14, 7, 15, 6,
+ 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15,
+ 6, 14, 7, 15, 6, 14, 7, 15, 6, 14, 7, 15, 7, 15, 7,
+ 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15,
  7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15, 7, 15 };
 
-Boolean IsKeyDown(void);    
-
-int recordDragDropEvent(EventRecord *theEvent, int numberOfItems, int dragType) {
+int
+recordDragDropEvent(EventRecord *theEvent, int numberOfItems, int dragType)
+{
 	sqDragDropFilesEvent *evt;
 	int theButtonState;
-	
+
         pthread_mutex_lock(&gEventQueueLock);
         evt = (sqDragDropFilesEvent*) nextEventPut();
 
 	/* first the basics */
 	theButtonState = MouseModifierState(theEvent);
 	evt->type = EventTypeDragDropFiles;
-	evt->timeStamp = ioMSecs() & MillisecondClockMask; 
+	evt->timeStamp = ioMSecs() & MillisecondClockMask;
 	GlobalToLocal((Point *) &theEvent->where);
 	evt->x = theEvent->where.h;
 	evt->y = theEvent->where.v;
 	evt->numFiles = numberOfItems;
 	evt->dragType = dragType;
-	
+
 	/* then the modifiers */
 	evt->modifiers = theButtonState >> 3;
 	evt->windowIndex = windowActive;
@@ -196,7 +196,9 @@
 	return 1;
 }
 
-int MouseModifierState(EventRecord *theEvent) {
+int
+MouseModifierState(EventRecord *theEvent)
+{
 	int stButtons;
 
 	stButtons = 0;
@@ -208,7 +210,7 @@
 		if ((theEvent->modifiers & cmdKey) != 0) {
 			stButtons = 1;	/* blue button if command down */
 		}
-	} 
+	}
 
 	/* button state: low three bits are mouse buttons; next 8 bits are modifier bits */
 	return ((modifierMap[(theEvent->modifiers >> 8)] << 3) |
@@ -216,7 +218,9 @@
 }
 
 
-sqInputEvent *nextEventPut(void) {
+sqInputEvent *
+nextEventPut(void)
+{
 	sqInputEvent *evt;
 	evt = eventBuffer + eventBufferPut;
 	eventBufferPut = (eventBufferPut + 1) % MAX_EVENT_BUFFER;
@@ -227,43 +231,51 @@
 	return evt;
 }
 
-void ignoreLastEvent() {
+void
+ignoreLastEvent()
+{
     eventBufferPut -= 1;
-    if (eventBufferPut < 0) 
+    if (eventBufferPut < 0)
         eventBufferPut = MAX_EVENT_BUFFER -1;
 }
 
-int ioSetInputSemaphore(int semaIndex) {
+int
+ioSetInputSemaphore(int semaIndex)
+{
 	inputSemaphoreIndex = semaIndex;
 	return 1;
 }
 
-int ioGetNextEvent(sqInputEvent *evt) {
-		ioProcessEvents();
-		pthread_mutex_lock(&gEventQueueLock);
+int
+ioGetNextEvent(sqInputEvent *evt)
+{
+	ioProcessEvents();
+	pthread_mutex_lock(&gEventQueueLock);
 	if (eventBufferGet == eventBufferPut) {
-            pthread_mutex_unlock(&gEventQueueLock);
-            return false;
-        }
+		pthread_mutex_unlock(&gEventQueueLock);
+		return false;
+	}
 	*evt = eventBuffer[eventBufferGet];
 	eventBufferGet = (eventBufferGet+1) % MAX_EVENT_BUFFER;
-        pthread_mutex_unlock(&gEventQueueLock);
-        if (evt->type == EventTypeFullScreenUpdate) {
-            fullDisplayUpdate();	//Note I think it's ok to unlock by now
-            return ioGetNextEvent(evt);
-        }
-        
-        if (evt->type == EventTypePostEventProcessing) {
-            if (postMessageHook) 
-                postMessageHook((EventRecord *) evt->unused1);
-            free((void *) evt->unused1);
-            return ioGetNextEvent(evt);
-        }
+	pthread_mutex_unlock(&gEventQueueLock);
+	if (evt->type == EventTypeFullScreenUpdate) {
+		fullDisplayUpdate();	//Note I think it's ok to unlock by now
+		return ioGetNextEvent(evt);
+	}
+
+	if (evt->type == EventTypePostEventProcessing) {
+		if (postMessageHook)
+			postMessageHook((EventRecord *) evt->unused1);
+		free((void *) evt->unused1);
+		return ioGetNextEvent(evt);
+	}
 	return true;
 }
 
-int ioGetButtonState(void) {
-	    ioProcessEvents();
+int
+ioGetButtonState(void)
+{
+	ioProcessEvents();
 	if ((cachedButtonState & 0x7) != 0) {
 		int result = cachedButtonState;
 		cachedButtonState = 0;  /* clear cached button state */
@@ -273,7 +285,9 @@
 	return buttonState;
 }
 
-int ioGetKeystroke(void) {
+int
+ioGetKeystroke(void)
+{
 	int keystate;
 
 	    ioProcessEvents();
@@ -287,7 +301,10 @@
 	}
 	return keystate;
 }
-int ioMousePoint(void) {
+
+int
+ioMousePoint(void)
+{
 	Point p;
 
 	    ioProcessEvents();
@@ -300,7 +317,9 @@
 	return (p.h << 16) | (p.v & 0xFFFF);  /* x is high 16 bits; y is low 16 bits */
 }
 
-int ioPeekKeystroke(void) {
+int
+ioPeekKeystroke(void)
+{
 	int keystate;
 	    ioProcessEvents();
 	if (keyBufGet == keyBufPut) {
@@ -313,18 +332,14 @@
 	return keystate;
 }
 
-void setMessageHook(eventMessageHook theHook) {
-    messageHook = theHook;
-}
+void
+setMessageHook(eventMessageHook theHook) { messageHook = theHook; }
 
-void setPostMessageHook(eventMessageHook theHook) {
-    postMessageHook = theHook;
-}
+void
+setPostMessageHook(eventMessageHook theHook) { postMessageHook = theHook; }
 
-Boolean IsKeyDown() {
-    interpreterProxy->success(false);
-    return null;
-}
+Boolean
+IsKeyDown() { interpreterProxy->success(false); return null; }
 
 extern MenuHandle fileMenu, editMenu;
 
@@ -342,7 +357,7 @@
 							{ kEventClassWindow, kEventWindowClose},
 							{ kEventClassWindow, kEventWindowCollapsed},
                             { kEventClassWindow, kEventWindowDeactivated}};
-                            
+
 static EventTypeSpec windEventMouseList[] = {
 							{ kEventClassMouse, kEventMouseMoved},
                             { kEventClassMouse, kEventMouseWheelMoved},
@@ -352,13 +367,13 @@
 		                    { kEventClassMouse, kEventMouseEntered },
 		                    { kEventClassMouse, kEventMouseExited }
 							};
-                            
+
 static EventTypeSpec windEventKBList[] = {{ kEventClassKeyboard, kEventRawKeyDown},
                             { kEventClassKeyboard, kEventRawKeyUp},
 							{ kEventClassKeyboard, kEventRawKeyRepeat},
                             { kEventClassKeyboard, kEventRawKeyModifiersChanged}};
-                            
-                            
+
+
 static EventTypeSpec appleEventEventList[] = {{ kEventClassAppleEvent, kEventAppleEvent}};
 
 static EventTypeSpec textInputEventList[] = {{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}};
@@ -379,28 +394,30 @@
             EventRef event, void* userData);
 static pascal OSStatus customHandleForUILocks(EventHandlerCallRef myHandler,
             EventRef event, void* userData);
-            
-static int MouseModifierStateCarbon(EventRef theEvent,UInt32 whatHappened);   
-static int ModifierStateCarbon(EventRef theEvent);   
+
+static int MouseModifierStateCarbon(EventRef theEvent,UInt32 whatHappened);
+static int ModifierStateCarbon(EventRef theEvent);
 void recordMouseEventCarbon(EventRef event,UInt32 whatHappened,Boolean noPointConversion);
 static void recordKeyboardEventCarbon(EventRef event);
 static void recordMenuEventCarbon(MenuRef menu, UInt32 menuItem);
 static void recordWindowEventCarbon(int windowType,int left, int top, int right, int bottom,int windowIndex);
-static int doPreMessageHook(EventRef event); 
+static int doPreMessageHook(EventRef event);
 static void fakeMouseWheelKeyboardEvents(EventMouseWheelAxis wheelMouseDirection,long wheelMouseDelta);
-void SetUpCarbonEvent(void);
-            
-void SetUpCarbonEvent() {
-	
+
+void
+SetUpCarbonEvent()
+{
 	if (!gSqueakHeadless) AdjustMenus();
 
 /* Installing the application event handler */
 	InstallApplicationEventHandler(NewEventHandlerUPP(MyAppEventCmdHandler), GetEventTypeCount(appEventCmdList), appEventCmdList, 0, NULL);
     InstallApplicationEventHandler(NewEventHandlerUPP(MyAppEventHandler), GetEventTypeCount(appEventList), appEventList, 0, NULL);
-    
+
 }
 
-void SetUpCarbonEventForWindowIndex(int index) {
+void
+SetUpCarbonEventForWindowIndex(int index)
+{
 	extern 	void setWindowTrackingRgn(int index);
 /* Installing the window event handler */
     InstallWindowEventHandler(windowHandleFromIndex(index), NewEventHandlerUPP(MyWindowEventHandler), GetEventTypeCount(windEventList), windEventList, 0, NULL);
@@ -411,7 +428,9 @@
 	setWindowTrackingRgn(index);
 }
 
-static int   doPreMessageHook(EventRef event) {
+static int
+doPreMessageHook(EventRef event)
+{
 #pragma unused(event)
    /* jmm rethink, breaks not thread safe
     if (messageHook) {
@@ -424,11 +443,13 @@
     return eventNotHandledErr;
 }
 
-static void   doPostMessageHook(EventRef event) {
+static void
+doPostMessageHook(EventRef event)
+{
     if (postMessageHook) {
         EventRecord *theOldEventType;
         sqInputEvent *evt;
-        
+
         theOldEventType = malloc(sizeof(EventRecord));
         if (!ConvertEventRefToEventRecord(event,theOldEventType)) {
             free(theOldEventType);
@@ -445,9 +466,11 @@
     }
 }
 
-void   postFullScreenUpdate() {
+void
+postFullScreenUpdate()
+{
     sqInputEvent *evt;
-    
+
     pthread_mutex_lock(&gEventQueueLock);
     evt = nextEventPut();
     evt->type = EventTypeFullScreenUpdate;
@@ -455,8 +478,9 @@
     pthread_mutex_unlock(&gEventQueueLock);
 }
 
-static pascal OSStatus MyAppEventHandler (EventHandlerCallRef myHandlerChain,
-    EventRef event, void* userData)
+static pascal OSStatus
+MyAppEventHandler (EventHandlerCallRef myHandlerChain,
+					EventRef event, void* userData)
 {
 #pragma unused(myHandlerChain,userData)
     UInt32 whatHappened;
@@ -493,17 +517,18 @@
         default:
             break;
     }
-    if (postMessageHook) 
+    if (postMessageHook)
         doPostMessageHook(event);
     return result;
 }
 
-static pascal OSStatus MyAppEventCmdHandler (EventHandlerCallRef myHandlerChain,
-EventRef event, void* userData)
+static pascal OSStatus
+MyAppEventCmdHandler (EventHandlerCallRef myHandlerChain,
+						EventRef event, void* userData)
 {
 #pragma unused(myHandlerChain,userData)
     UInt32 whatHappened;
-    HICommand commandStruct;    
+    HICommand commandStruct;
     OSStatus result = eventNotHandledErr; /* report failure by default */
 
     if(messageHook && ((result = doPreMessageHook(event)) != eventNotHandledErr))
@@ -539,13 +564,14 @@
         default:
             break;
     }
-    if (postMessageHook) 
+    if (postMessageHook)
         doPostMessageHook(event);
     return result;
 }
 
-static pascal OSStatus MyWindowEventHandler(EventHandlerCallRef myHandler,
-            EventRef event, void* userData)
+static pascal OSStatus
+MyWindowEventHandler(EventHandlerCallRef myHandler,
+						EventRef event, void* userData)
 {
 #pragma unused(myHandler,userData)
     UInt32 whatHappened;
@@ -553,13 +579,13 @@
     extern Boolean gSqueakWindowIsFloating;
 	Rect globalBounds;
     WindowRef window;
-  
+
     if(messageHook && ((result = doPreMessageHook(event)) != eventNotHandledErr))
         return result;
     GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL,sizeof(window), NULL, &window);
     whatHappened = GetEventKind(event);
 	//fprintf(stderr,"\nWindowEvent %i %i %i",whatHappened,IsWindowActive(window),windowIndexFromHandle((int)window)); fflush(stdout);
-	if (windowIndexFromHandle(window) == 0) 
+	if (windowIndexFromHandle(window) == 0)
 		return result;
     switch (whatHappened)
     {
@@ -569,7 +595,7 @@
 			recordWindowEventCarbon(WindowEventActivated,0, 0, 0, 0,windowActive);
              break;
         case kEventWindowDeactivated:
-            if (gSqueakWindowIsFloating) break; 
+            if (gSqueakWindowIsFloating) break;
 #warning HIView Point
             GetEventParameter (event, kEventParamMouseLocation, typeQDPoint,NULL,
                     sizeof(Point), NULL, &savedMousePosition);
@@ -582,9 +608,9 @@
             result = noErr;
             break;
        case kEventWindowResizeStarted:
-			{ 
+			{
 				windowDescriptorBlock *targetWindowBlock;
-				targetWindowBlock = windowBlockFromHandle((wHandleType)window);	
+				targetWindowBlock = windowBlockFromHandle((wHandleType)window);
 				targetWindowBlock->sync = true;
 			}
             break;
@@ -594,7 +620,7 @@
 			extern void setWindowTrackingRgn(int index);
 			setWindowTrackingRgn(windowIndexFromHandle((wHandleType)window));
 			GetWindowBounds(window,kWindowContentRgn,&globalBounds);
-			recordWindowEventCarbon(WindowEventMetricChange,globalBounds.left, globalBounds.top, 
+			recordWindowEventCarbon(WindowEventMetricChange,globalBounds.left, globalBounds.top,
 					globalBounds.right, globalBounds.bottom,windowIndexFromHandle((wHandleType)window));
 			}
 			break;
@@ -616,7 +642,7 @@
         /* application-level handler. */
         break;
     }
-    if (postMessageHook) 
+    if (postMessageHook)
         doPostMessageHook(event);
     return result;
 }
@@ -636,8 +662,9 @@
 	return amI102;
 }
 
-static pascal OSStatus MyWindowEventMouseHandler(EventHandlerCallRef myHandler,
-            EventRef event, void* userData)
+static pascal OSStatus
+MyWindowEventMouseHandler(EventHandlerCallRef myHandler,
+							EventRef event, void* userData)
 {
 #pragma unused(myHandler,userData)
     UInt32 whatHappened;
@@ -649,9 +676,9 @@
     Point  mouseLocation;
 	static RgnHandle	ioWinRgn=null;
     whatHappened	= GetEventKind(event);
-	
 
-//	if (whatHappened != 5) 
+
+//	if (whatHappened != 5)
 //		fprintf(stderr,"\nMouseEvent %i-%i ",whatHappened,windowActive); fflush(stdout);
 
 	if (!windowActive) {
@@ -659,7 +686,7 @@
 			mouseDownActivate = true;
         return result;
 	}
-	
+
     switch (whatHappened)
     {
 			case kEventMouseEntered: {
@@ -684,18 +711,18 @@
     }
 
 	if (amIOSX102X()) {
-		if (ioWinRgn == null) 
+		if (ioWinRgn == null)
 			ioWinRgn = NewRgn();
-			
+
 		GetWindowRegion(windowHandleFromIndex(windowActive),kWindowGlobalPortRgn,ioWinRgn);
 		GetEventParameter (event, kEventParamMouseLocation, typeQDPoint,NULL,sizeof(Point), NULL, &mouseLocation);
-		
+
 		if (!PtInRgn(mouseLocation,ioWinRgn)) {
 			if (mouseDownActivate && whatHappened == kEventMouseUp) {
 				mouseDownActivate = false;
 				return result;
 			}
-			if (!gButtonIsDown) 
+			if (!gButtonIsDown)
 				return result;
 		}
 	} else {
@@ -705,20 +732,20 @@
 				mouseDownActivate = false;
 				return result;
 			}
-			if (!gButtonIsDown) 
+			if (!gButtonIsDown)
 				return result;
 		}
 	}
 
     if(messageHook && ((result = doPreMessageHook(event)) != eventNotHandledErr))
         return result;
-    
+
     switch (whatHappened)
     {
         case kEventMouseMoved:
         case kEventMouseDragged:
         case kEventMouseWheelMoved:
-			if (mouseDownActivate) 
+			if (mouseDownActivate)
 				return result;
             recordMouseEventCarbon(event,whatHappened,false);
             result = noErr;
@@ -732,7 +759,7 @@
 				if (windowPartCode != inContent)
 					return result;
 			}
-			if (mouseDownActivate) 
+			if (mouseDownActivate)
 				return result;
             if (gSqueakFloatingWindowGetsFocus && gSqueakWindowIsFloating) {
                 SetUserFocusWindow(kUserFocusAuto);
@@ -756,35 +783,37 @@
         /* application-level handler. */
         break;
     }
-    if (postMessageHook) 
+    if (postMessageHook)
         doPostMessageHook(event);
 	//fprintf(stderr,"handled %i",result);
     return result;
 }
 
-static pascal OSStatus MyWindowEventKBHandler(EventHandlerCallRef myHandler,
-            EventRef event, void* userData)
+static pascal OSStatus
+MyWindowEventKBHandler(EventHandlerCallRef myHandler,
+						EventRef event, void* userData)
 {
 #pragma unused(myHandler,userData)
     UInt32 whatHappened,keyCode,keyChar;
 	SInt32 key;
     OSStatus result = eventNotHandledErr; /* report failure by default */
-	 
+
     if (!windowActive)
         return result;
 
     if(messageHook && ((result = doPreMessageHook(event)) != eventNotHandledErr))
         return result;
-		
+
     whatHappened = GetEventKind(event);
 	GetEventParameter (event, kEventParamKeyCode, typeUInt32,NULL, sizeof(typeUInt32), NULL, &keyCode);
 	/* See UCKeyTranslate in https://developer.apple.com/library/mac/#documentation/Carbon/reference/Unicode_Utilities_Ref/Reference/reference.html
-	 * for how to convert an event to one or more Unicode characters.
+	 * for how to convert an event to one or more Unicode characters. e.g.
+	 * http://www.cocoabuilder.com/archive/cocoa/184332-key-number-to-unicode-string.html
 	 */
     switch (whatHappened) {
         case kEventRawKeyDown:
 			//fprintf(stdout,"\nrawkey down %i",ioMSecs()); fflush(stdout);
-			addToKeyMap(keyCode, 0);	
+			addToKeyMap(keyCode, 0);
             result = eventNotHandledErr;
             break;
         case kEventRawKeyRepeat:
@@ -801,38 +830,41 @@
 			removeFromKeyMap(keyCode);
             result = eventNotHandledErr;
             break;
-        case kEventRawKeyModifiersChanged: 
+        case kEventRawKeyModifiersChanged:
             /* ok in this case we fake a mouse event to deal with the modifiers changing */
             if(inputSemaphoreIndex)
                 recordMouseEventCarbon(event,kEventMouseMoved,false);
             result = noErr;
             break;
-        default: 
+        default:
         /* If nobody handled the event, it gets propagated to the */
         /* application-level handler. */
         break;
     }
-    if (postMessageHook) 
+    if (postMessageHook)
         doPostMessageHook(event);
     return result;
 }
-static pascal OSStatus MyAppleEventEventHandler(EventHandlerCallRef myHandler,
-            EventRef event, void* userData)
+
+static pascal OSStatus
+MyAppleEventEventHandler(EventHandlerCallRef myHandler,
+							EventRef event, void* userData)
 {
 #pragma unused(myHandler,userData,event)
     return eventNotHandledErr;
 }
 
-static pascal OSStatus MyTextInputEventHandler(EventHandlerCallRef myHandler,
-            EventRef event, void* userData)
+static pascal OSStatus
+MyTextInputEventHandler(EventHandlerCallRef myHandler,
+						EventRef event, void* userData)
 {
 #pragma unused(myHandler,userData)
     UInt32 whatHappened;
     OSStatus result = eventNotHandledErr; /* report failure by default */
-    
+
     if (!windowActive)
         return result;
-		
+
     if(messageHook && ((result = doPreMessageHook(event)) != eventNotHandledErr))
         return result;
 
@@ -842,23 +874,25 @@
         case kEventTextInputUnicodeForKeyEvent:
             recordKeyboardEventCarbon(event);
             result = noErr;
-        default: 
+        default:
         /* If nobody handled the event, it gets propagated to the */
         /* application-level handler. */
         break;
     }
-    if (postMessageHook) 
+    if (postMessageHook)
         doPostMessageHook(event);
     return result;
 }
 
-static void recordMenuEventCarbon(MenuRef menu,UInt32 menuItem) {
+static void
+recordMenuEventCarbon(MenuRef menu,UInt32 menuItem)
+{
 	sqMenuEvent *evt;
 	pthread_mutex_lock(&gEventQueueLock);
 	evt = (sqMenuEvent*) nextEventPut();
 
 	evt->type = EventTypeMenu;
-	evt->timeStamp = ioMSecs() & MillisecondClockMask; 
+	evt->timeStamp = ioMSecs() & MillisecondClockMask;
 	evt->menu = (int) GetMenuID(menu);
 	evt->menuItem = menuItem;
 	evt->reserved1 = 0;
@@ -870,13 +904,15 @@
 	return;
 }
 
-static void recordWindowEventCarbon(int windowType,int left, int top, int right, int bottom, int windowIndex) {
+static void
+recordWindowEventCarbon(int windowType,int left, int top, int right, int bottom, int windowIndex)
+{
 	sqWindowEvent *evt;
 	pthread_mutex_lock(&gEventQueueLock);
 	evt = (sqWindowEvent*) nextEventPut();
 
 	evt->type = EventTypeWindow;
-	evt->timeStamp = ioMSecs() & MillisecondClockMask; 
+	evt->timeStamp = ioMSecs() & MillisecondClockMask;
 	evt->action = windowType;
 	evt->value1 = left;
 	evt->value2 = top;
@@ -888,26 +924,28 @@
 	return;
 }
 
-void recordMouseEventCarbon(EventRef event,UInt32 whatHappened,Boolean noPointConversion) {
+void
+recordMouseEventCarbon(EventRef event,UInt32 whatHappened,Boolean noPointConversion)
+{
 	sqMouseEvent *evt;
 	static sqMouseEvent oldEvent;
 	static Point  where;
 	EventMouseWheelAxis wheelMouseDirection=0;
 	long	wheelMouseDelta=0;
 	OSErr		err;
-	
+
 	err = GetEventParameter (event, kEventParamMouseLocation, typeQDPoint,NULL,
 				sizeof(Point), NULL, &where);
-                    
+
  	if (err == noErr && !noPointConversion && windowHandleFromIndex(windowActive))
 		QDGlobalToLocalPoint(GetWindowPort(windowHandleFromIndex(windowActive)),&where);
-	// on error use last known mouse location. 
+	// on error use last known mouse location.
 	carbonMousePosition = where;
 
 	buttonState = MouseModifierStateCarbon(event,whatHappened);
  	cachedButtonState = cachedButtonState | buttonState;
 
-      
+
         if (whatHappened == kEventMouseWheelMoved) {
             GetEventParameter( event,
                                 kEventParamKeyModifiers,
@@ -915,14 +953,14 @@
                                 NULL,
                                 sizeof(EventMouseWheelAxis),
                                 NULL,
-                                &wheelMouseDirection); 
+                                &wheelMouseDirection);
             GetEventParameter( event,
                                 kEventParamMouseWheelDelta,
                                 typeLongInteger,
                                 NULL,
                                 sizeof(long),
                                 NULL,
-                                &wheelMouseDelta); 
+                                &wheelMouseDelta);
        }
 
         pthread_mutex_lock(&gEventQueueLock);
@@ -930,7 +968,7 @@
 
 	/* first the basics */
 	evt->type = EventTypeMouse;
-	evt->timeStamp = ioMSecs() & MillisecondClockMask; 
+	evt->timeStamp = ioMSecs() & MillisecondClockMask;
         evt->x = where.h;
 	evt->y = where.v;
 	/* then the buttons */
@@ -956,30 +994,32 @@
         }
 
 	evt->windowIndex = windowActive;
-	
-	if (oldEvent.buttons == evt->buttons && 
+
+	if (oldEvent.buttons == evt->buttons &&
 	    oldEvent.x == evt->x &&
 	    oldEvent.y == evt->y &&
 	    oldEvent.modifiers == evt->modifiers &&
-            whatHappened != kEventMouseWheelMoved) 
+            whatHappened != kEventMouseWheelMoved)
 	    ignoreLastEvent();
-	    
+
         oldEvent = *evt;
      	pthread_mutex_unlock(&gEventQueueLock);
         signalAnyInterestedParties();
-                
-        if (whatHappened == kEventMouseWheelMoved) 
+
+        if (whatHappened == kEventMouseWheelMoved)
             fakeMouseWheelKeyboardEvents(wheelMouseDirection,wheelMouseDelta);
 }
 
-static void fakeMouseWheelKeyboardEvents(EventMouseWheelAxis wheelMouseDirection,long wheelMouseDelta) {
+static void
+fakeMouseWheelKeyboardEvents(EventMouseWheelAxis wheelMouseDirection,long wheelMouseDelta)
+{
     long 	i,asciiChar;
     sqKeyboardEvent *evt,*extra;
     UInt32	macKeyCode=0;
-    
+
     pthread_mutex_lock(&gEventQueueLock);
     for(i=0;i<abs(wheelMouseDelta);i++) {
-        if (wheelMouseDirection == kEventMouseWheelAxisX) 
+        if (wheelMouseDirection == kEventMouseWheelAxisX)
             if (wheelMouseDelta > 0) {//up/down
                 macKeyCode = 126;
                 asciiChar = kUpArrowCharCode;
@@ -995,7 +1035,7 @@
                 macKeyCode = 123;
                 asciiChar = kLeftArrowCharCode;
             }
-            
+
 	evt = (sqKeyboardEvent*) nextEventPut();
 	/* first the basics */
 	evt->type = EventTypeKeyboard;
@@ -1013,12 +1053,12 @@
         extra->charCode = asciiChar;
         extra->utf32Code = asciiChar;
         extra->pressCode = EventKeyChar;
-        
+
        if(!inputSemaphoreIndex) {
             int  keystate;
-    
+
             /* keystate: low byte is the ascii character; next 8 bits are modifier bits */
-    
+
             keystate = (evt->modifiers << 8) | asciiChar;
             if (keystate == getInterruptKeycode()) {
                     /* Note: interrupt key is "meta"; it not reported as a keystroke */
@@ -1049,20 +1089,22 @@
 	evt->windowIndex = windowActive;
     }
     pthread_mutex_unlock(&gEventQueueLock);
-    signalAnyInterestedParties();                
+    signalAnyInterestedParties();
 }
 
-static void recordKeyboardEventCarbon(EventRef event) {
+static void
+recordKeyboardEventCarbon(EventRef event)
+{
     int				modifierBits, keyIndex,ISawRawKeyRepeat;
     UniCharCount	uniCharCount,i;
     UniChar			modifiedUniChar, *uniCharBufPtr, *uniCharBuf;
     OSErr			err;
-    UInt32			actualSize,macKeyCode,textEntryServices; 
+    UInt32			actualSize,macKeyCode,textEntryServices;
     EventRef		actualEvent;
 	char		mackeycodeFromCarbon;
-    
+
     //  Tetsuya HAYASHI <tetha at st.rim.or.jp> supplied multiple unicode extraction
-    
+
     /*  kEventTextInputUnicodeForKeyEvent
         Required parameters:
         -->     kEventParamTextInputSendComponentInstance           typeComponentInstance
@@ -1071,7 +1113,7 @@
         -->     kEventParamTextInputSendText                        typeUnicodeText
         -->     kEventParamTextInputSendKeyboardEvent               typeEventRef
                     (This parameter is the original raw keyboard event that produced the
-                     text.  It enables access to kEventParamKeyModifiers and 
+                     text.  It enables access to kEventParamKeyModifiers and
                      kEventParamKeyCode parameters.
                      You can also extract from this event either Unicodes or Mac encoding
                      characters as follows:
@@ -1095,14 +1137,14 @@
     uniCharBuf = uniCharBufPtr = malloc(actualSize);
     err = GetEventParameter (actualEvent, kEventParamKeyUnicodes,
             typeUnicodeText, NULL, actualSize, NULL, uniCharBuf);
-                            
+
     err = GetEventParameter (event, kEventParamTextInputSendComponentInstance,
             typeComponentInstance, NULL, sizeof(UInt32), NULL, &textEntryServices);
 
-	err = GetEventParameter( actualEvent, kEventParamKeyCode, 
-			typeUInt32, NULL, sizeof(UInt32), NULL, &macKeyCode); 
+	err = GetEventParameter( actualEvent, kEventParamKeyCode,
+			typeUInt32, NULL, sizeof(UInt32), NULL, &macKeyCode);
 
-	err = GetEventParameter( actualEvent, kEventParamKeyMacCharCodes, 
+	err = GetEventParameter( actualEvent, kEventParamKeyMacCharCodes,
 			typeChar, NULL, sizeof(char), NULL, &mackeycodeFromCarbon);
 
 
@@ -1117,7 +1159,7 @@
 
 	modifierBits = modifierBits >> 3;
     pthread_mutex_lock(&gEventQueueLock);
-    
+
     /* Put sqKeyboardEvent in actualSize times */
     uniCharCount = actualSize / sizeof(UniChar);
 	keyIndex = indexInKeyMap(macKeyCode);
@@ -1129,36 +1171,38 @@
         CFStringRef theString;
         unsigned char macRomanString[2];
         int macRomanCode;
-        
+
         theString = CFStringCreateWithCharacters (nil, &modifiedUniChar, (CFIndex) 1);
         CFStringGetCString (theString,(char *)&macRomanString,2, kCFStringEncodingMacRoman);
         macRomanCode = macRomanString[0];
         CFRelease(theString);
-        
+
        /* Put the sqKeyboardEvent for KeyDown */
 		enterKeystroke ( EventTypeKeyboard, macKeyCode, EventKeyDown, 0, modifierBits);
-		
+
         /* generate extra character event */
 		enterKeystroke ( EventTypeKeyboard, macRomanCode, EventKeyChar, modifiedUniChar, modifierBits);
-        
+
     /* Put the sqKeyboardEvent for KeyUp */
 		if (!ISawRawKeyRepeat && (uniCharCount> 1 || (keyIndex < 0)))
 			enterKeystroke ( EventTypeKeyboard, macKeyCode, EventKeyUp, 0,  modifierBits);
-        
+
         uniCharBufPtr++;
         modifiedUniChar = *uniCharBufPtr;
     }
 
     free(uniCharBuf);
-    pthread_mutex_unlock(&gEventQueueLock);		        
+    pthread_mutex_unlock(&gEventQueueLock);
     signalAnyInterestedParties();
 }
 
 
-static int MouseModifierStateCarbon(EventRef event,UInt32 whatHappened) {
-/* On a two- or three-button mouse, the left button is normally considered primary and the 
-right button secondary, 
-but left-handed users can reverse these settings as a matter of preference. 
+static int
+MouseModifierStateCarbon(EventRef event,UInt32 whatHappened)
+{
+/* On a two- or three-button mouse, the left button is normally considered primary and the
+right button secondary,
+but left-handed users can reverse these settings as a matter of preference.
 The middle button on a three-button mouse is always the tertiary button. '
 
 But mapping assumes 1,2,3  red, yellow, blue
@@ -1171,15 +1215,15 @@
 	OSErr err;
 	static long buttonStateBits[4] = {0,0,0,0};
 	stButtons = buttonState;
-	
+
 	err = GetEventParameter( event,
                                 kEventParamKeyModifiers,
                                 typeUInt32,
                                 NULL,
                                 sizeof(UInt32),
                                 NULL,
-                                &keyBoardModifiers); 
-								
+                                &keyBoardModifiers);
+
   	if (whatHappened != kEventMouseMoved && whatHappened != kEventMouseWheelMoved) {
 		stButtons = 0;
 		err = GetEventParameter( event,
@@ -1188,12 +1232,12 @@
                                 NULL,
                                 sizeof(EventMouseButton),
                                 NULL,
-                                &mouseButton); 
-							
+                                &mouseButton);
+
 	DPRINTF((stderr,"VM: MouseModifierStateCarbon buttonStateBits %i modifiers %ui\n ",mouseButton,(unsigned int) keyBoardModifiers));
- 
+
 		         if (mouseButton > 0 && mouseButton < 4) {
-          /* OLD original carbon code 
+          /* OLD original carbon code
 			buttonStateBits[mouseButton] = (whatHappened == kEventMouseUp) ? 0 : 1;
             stButtons |= buttonStateBits[1]*4*
                         (!((keyBoardModifiers & optionKey) || (keyBoardModifiers & cmdKey)));
@@ -1201,7 +1245,7 @@
             stButtons |= buttonStateBits[1]*((keyBoardModifiers & cmdKey)> 0)*1;
             stButtons |= buttonStateBits[2]*1;
             stButtons |= buttonStateBits[3]*2; */
-			
+
 			modifier = 0;
 			if (keyBoardModifiers & cmdKey)
 				modifier = 1;
@@ -1209,7 +1253,7 @@
 				modifier = 2;
 			if (keyBoardModifiers & controlKey)
 				modifier = 3;
-				
+
 			if (browserActiveAndDrawingContextOkAndNOTInFullScreenMode())
 					mappedButton = gSqueakBrowserMouseMappings[modifier][mouseButton];
 				else
@@ -1220,52 +1264,57 @@
 			stButtons |= mappedButton == 3 ? (buttonStateBits[mappedButton] ? BlueButtonBit : 0)  : 0;
 		}
 	}
-	
+
 	// button state: low three bits are mouse buttons; next 8 bits are modifier bits
 	return ((modifierMap[((keyBoardModifiers & 0xFFFF) >> 8)] << 3) | (stButtons & 0x7));
 
 }
 
-static int ModifierStateCarbon(EventRef event) {
-        UInt32 keyBoardModifiers=0;
-        OSErr err;
-        
+static int
+ModifierStateCarbon(EventRef event)
+{
+	UInt32 keyBoardModifiers=0;
+	OSErr err;
+
 	err = GetEventParameter( event,
                                 kEventParamKeyModifiers,
                                 typeUInt32,
                                 NULL,
                                 sizeof(UInt32),
                                 NULL,
-                                &keyBoardModifiers); 
+                                &keyBoardModifiers);
  	/* button state: low three bits are mouse buttons; next 8 bits are modifier bits */
 	return ((modifierMap[((keyBoardModifiers & 0xFFFF) >> 8)] << 3));
 }
 
-static void checkBrowserForHeartBeat(void) {
+static void
+checkBrowserForHeartBeat(void)
+{
 	static int counter=0;
 	if (counter++ > 200) {
 		counter = 0;
-		if (getppid() == 1) 
+		if (getppid() == 1)
 			gQuitNowRightNow = 1;
-			
+
 	}
-	
+
 }
 
-static void doPendingFlush(void) {
-
+static void
+doPendingFlush(void)
+{
 	extern  Boolean gSqueakUIFlushUseHighPercisionClock,gSqueakBrowserSubProcess;
 	extern	long	gSqueakUIFlushSecondaryCleanupDelayMilliseconds,gSqueakUIFlushSecondaryCheckForPossibleNeedEveryNMilliseconds;
 	static int lastTick = 0;
 	static int nextPollTick = 0;
 	int now = gSqueakUIFlushUseHighPercisionClock ? ioMSecs(): ioLowResMSecs();
 	int delta = now - lastTick;
-		
+
 	if (browserActiveAndDrawingContextOkAndInFullScreenMode() || (!gSqueakHeadless && !gSqueakBrowserSubProcess)) {
 			if ((delta >= gSqueakUIFlushSecondaryCheckForPossibleNeedEveryNMilliseconds) || (delta < 0))  {
 			windowDescriptorBlock *windowBlock;
 			int i;
-			
+
 			for(i=1;i<=getCurrentIndexInUse();i++) {
 				windowBlock = windowBlockFromIndex(i);
 				if ((windowBlock) && (windowBlock->dirty) ) {
@@ -1284,29 +1333,30 @@
 	if (ioLowResMSecs() != nextPollTick) {
 		EventRef event;
 		static EventTargetRef target = NULL;
-		
+
 		if (target == NULL)
 			target = GetEventDispatcherTarget();
-	  
+
 		if (ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &event) == noErr) {
 			SendEventToEventTarget (event, target);
 			ReleaseEvent(event);
 		}
 		if (browserActiveAndDrawingContextOk())
 			checkBrowserForHeartBeat();
-		
+
 		if (NeedToSetCursorBackOnApplicationActivate) {  // special case of setting large cursor on app activate
 			NeedToSetCursorBackOnApplicationActivate = false;
 			SetCursorBackToSomething();
 		}
-		
+
 		nextPollTick = ioLowResMSecs();
 	}
 
 }
 
-int ioProcessEvents(void) {
-
+int
+ioProcessEvents(void)
+{
 	extern sqInt inIOProcessEvents;
 
 	/* inIOProcessEvents controls ioProcessEvents.  If negative then
@@ -1316,7 +1366,7 @@
 	if (inIOProcessEvents) return 0;
 	inIOProcessEvents += 1;
 
-	aioPoll(0);		
+	aioPoll(0);
 	doPendingFlush();
 
 	if (inIOProcessEvents > 0)
@@ -1332,23 +1382,26 @@
 	return 0;
 }
 
-int getUIToLock(sqInt *data) {
+int
+getUIToLock(sqInt *data)
+{
 	customHandleForUILocks(NULL,NULL,(void*) data);
 	return 0;
 }
 
-static pascal OSStatus customHandleForUILocks(EventHandlerCallRef myHandler,
-            EventRef event, void* userData)
+static pascal OSStatus
+customHandleForUILocks(EventHandlerCallRef myHandler,
+						EventRef event, void* userData)
 {
 #pragma unused(myHandler,event)
     sqInt *data;
     long numberOfParms;
-        
-         
+
+
 	data = userData;
-		    
+
     numberOfParms = data[0];
-    
+
     if (0 == numberOfParms)
         data[2] = ((sqInt (*) (void)) data[1]) ();
     if (1 == numberOfParms)
@@ -1367,15 +1420,18 @@
     return noErr;
 }
 
-void signalAnyInterestedParties() {
+void
+signalAnyInterestedParties()
+{
     if (inputSemaphoreIndex != 0)
         signalSemaphoreWithIndex(inputSemaphoreIndex);
 }
 
 static EventHandlerUPP gEventLoopEventHandlerUPP;   // -> EventLoopEventHandler
 
-static pascal OSStatus EventLoopEventHandler(EventHandlerCallRef inHandlerCallRef,
-                                             EventRef inEvent, void *inUserData)
+static pascal OSStatus
+EventLoopEventHandler(EventHandlerCallRef inHandlerCallRef,
+						EventRef inEvent, void *inUserData)
     // This code contains the standard Carbon event dispatch loop,
     // as per "Inside Macintosh: Handling Carbon Events", Listing 3-10,
 {
@@ -1387,7 +1443,8 @@
  }
 
 
-void RunApplicationEventLoopWithSqueak(void)
+void
+RunApplicationEventLoopWithSqueak(void)
     // A reimplementation of RunApplicationEventLoop that supports
     // yielding time to cooperative threads.  It relies on the
     // rest of your application to maintain a global variable,
@@ -1455,7 +1512,9 @@
     }
 }
 
-static sqKeyboardEvent *enterKeystroke (long type, long cc, long pc, UniChar utf32Code, long m) {
+static sqKeyboardEvent *
+enterKeystroke(long type, long cc, long pc, UniChar utf32Code, long m)
+{
 	sqKeyboardEvent 	*evt;
 	evt = (sqKeyboardEvent*) nextEventPut();
 
@@ -1495,7 +1554,8 @@
 }
 
 
-static int addToKeyMap(int keyCode, int keyChar)
+static int
+addToKeyMap(int keyCode, int keyChar)
 {
   // fprintf(stdout, "\nAddToKeyMap T %i code %i char %i i %i",ioMSecs(),keyCode,keyChar,keyMapSize); fflush(stdout);
   if (keyMapSize > KeyMapSize) { fprintf(stderr, "keymap overflow\n");  return -1; }
@@ -1503,7 +1563,8 @@
   return keyChar;
 }
 
-static int indexInKeyMap(int keyCode)
+static int
+indexInKeyMap(int keyCode)
 {
   int i;
   for (i= 0;  i < keyMapSize;  ++i)
@@ -1512,30 +1573,34 @@
   return -1;
 }
 
-static int findInKeyMap(int keyCode)
+static int
+findInKeyMap(int keyCode)
 {
   int idx= indexInKeyMap(keyCode);
   return (idx != -1) ? keyMap[idx].keyChar : -1;
 }
 
-static int findRepeatInKeyMap(int keyCode)
+static int
+findRepeatInKeyMap(int keyCode)
 {
   int idx= indexInKeyMap(keyCode);
   return (idx != -1) ? keyMap[idx].keyRepeated : 0;
 }
 
-static void setRepeatInKeyMap(int keyCode)
+static void
+setRepeatInKeyMap(int keyCode)
 {
   int idx= indexInKeyMap(keyCode);
   if (idx != -1) keyMap[idx].keyRepeated = 1;
 }
 
-static int removeFromKeyMap(int keyCode)
+static int
+removeFromKeyMap(int keyCode)
 {
   int idx= indexInKeyMap(keyCode);
   int keyChar= -1;
   //fprintf(stdout, "\nremoveFromKeyMap T %i c %i i %i",ioMSecs(),keyCode,keyMapSize-1); fflush(stdout);
-  if (idx == -1) { //fprintf(stderr, "keymap underflow\n");  
+  if (idx == -1) { //fprintf(stderr, "keymap underflow\n");
 		return -1; }
   keyChar= keyMap[idx].keyChar;
   for (; idx < keyMapSize - 1;  ++idx)
@@ -1544,21 +1609,22 @@
   return keyChar;
 }
 
-void sqRevealWindowAndHandleQuit ()
+void
+sqRevealWindowAndHandleQuit ()
 {
 	/*  When we receive a Quit command, since the image may or may not want input,
 		we have to activate (uncollapse) the main window, just in case, so the user
 		can see the (possible) confirmation dialog.
 		We reat Quit the same as main-window close, for parity with the Windows VM */
 
-		
+
 	WindowRef win = windowHandleFromIndex(1);
 	if (win) {
 		windowBlockFromIndex(1)->isInvisible  = false;
 		SelectWindow(win);
 		ShowWindow( win );
 	}
-	
+
 	recordWindowEventCarbon(WindowEventClose,0, 0, 0, 0, 1 /* main ST window index */ );
 
 }



More information about the Vm-dev mailing list