[Vm-dev] [commit][3412] Eliot' s fix for sqComplexEvent on 64-bit object memory to support iOS VM.

commits at squeakvm.org commits at squeakvm.org
Wed Jul 22 03:26:19 UTC 2015


Revision: 3412
Author:   lewis
Date:     2015-07-21 20:26:17 -0700 (Tue, 21 Jul 2015)
Log Message:
-----------
Eliot's fix for sqComplexEvent on 64-bit object memory to support iOS VM.

Requires VMMaker-dtl.367 or later

In sq.h, the sqInputEvent struct was originally defined with all fields of
type int. These fields are accessed in primitiveGetNextEvent by treating the
sqInputEvent struct as an array of int. The sqComplexEvent struct variation
was introduced for the iOS VM, and uses one of the available fields to store
an object pointer of type usqInt.

In the case of a 64 bit object memory, sizeof(usqInt) is 8, and the object
pointer cannot be stored in a C variable of type int. Therefore, change the
declaration of all sqInputEvent data structures to have fields of type long,
which are large enough to store objects pointers on all platforms of interest.
This allows the event struct to safely store both integers and object pointers
regardless of object memory word size.

Modified Paths:
--------------
    trunk/platforms/Cross/vm/sq.h

Modified: trunk/platforms/Cross/vm/sq.h
===================================================================
--- trunk/platforms/Cross/vm/sq.h	2015-07-21 06:18:27 UTC (rev 3411)
+++ trunk/platforms/Cross/vm/sq.h	2015-07-22 03:26:17 UTC (rev 3412)
@@ -239,54 +239,54 @@
 /* generic input event */
 typedef struct sqInputEvent
 {
-  int type;			/* type of event; either one of EventTypeXXX */
-  unsigned int timeStamp;	/* time stamp */
-  /* the interpretation of the following fields depend on the type of the event */
-  int unused1;
-  int unused2;
-  int unused3;
-  int unused4;
-  int unused5;
-  int windowIndex;		/* SmallInteger used in image to identify a host window structure */
+  long type;			/* type of event; either one of EventTypeXXX */
+  unsigned long timeStamp;	/* time stamp */
+  /* the longerpretation of the following fields depend on the type of the event */
+  long unused1;
+  long unused2;
+  long unused3;
+  long unused4;
+  long unused5;
+  long windowIndex;		/* SmallInteger used in image to identify a host window structure */
 } sqInputEvent;
 
 /* mouse input event */
 typedef struct sqMouseEvent
 {
-  int type;			/* EventTypeMouse */
-  unsigned int timeStamp;	/* time stamp */
-  int x;			/* mouse position x */
-  int y;			/* mouse position y */
-  int buttons;			/* combination of xxxButtonBit */
-  int modifiers;		/* combination of xxxKeyBit */
-  int reserved1;		/* reserved for future use */
-  int windowIndex;		/* host window structure */
+  long type;			/* EventTypeMouse */
+  unsigned long timeStamp;	/* time stamp */
+  long x;			/* mouse position x */
+  long y;			/* mouse position y */
+  long buttons;			/* combination of xxxButtonBit */
+  long modifiers;		/* combination of xxxKeyBit */
+  long reserved1;		/* reserved for future use */
+  long windowIndex;		/* host window structure */
 } sqMouseEvent;
 
 /* keyboard input event */
 typedef struct sqKeyboardEvent
 {
-  int type;			/* EventTypeKeyboard */
-  unsigned int timeStamp;	/* time stamp */
-  int charCode;			/* character code in Mac Roman encoding */
-  int pressCode;		/* press code; any of EventKeyXXX */
-  int modifiers;		/* combination of xxxKeyBit */
-  int utf32Code;		/* UTF-32 unicode value */
-  int reserved1;		/* reserved for future use */
-  int windowIndex;		/* host window structure */
+  long type;			/* EventTypeKeyboard */
+  unsigned long timeStamp;	/* time stamp */
+  long charCode;			/* character code in Mac Roman encoding */
+  long pressCode;		/* press code; any of EventKeyXXX */
+  long modifiers;		/* combination of xxxKeyBit */
+  long utf32Code;		/* UTF-32 unicode value */
+  long reserved1;		/* reserved for future use */
+  long windowIndex;		/* host window structure */
 } sqKeyboardEvent;
 
 /* drop files event */
 typedef struct sqDragDropFilesEvent
 {
-  int type;			/* EventTypeDropFiles */
-  unsigned int timeStamp;	/* time stamp */
-  int dragType;			/* one of DragXXX (see below) */
-  int x;			/* mouse position x */
-  int y;			/* mouse position y */
-  int modifiers;		/* combination of xxxKeyBit */
-  int numFiles;			/* number of files in transaction */
-  int windowIndex;		/* host window structure */
+  long type;			/* EventTypeDropFiles */
+  unsigned long timeStamp;	/* time stamp */
+  long dragType;			/* one of DragXXX (see below) */
+  long x;			/* mouse position x */
+  long y;			/* mouse position y */
+  long modifiers;		/* combination of xxxKeyBit */
+  long numFiles;			/* number of files in transaction */
+  long windowIndex;		/* host window structure */
 } sqDragDropFilesEvent;
 
 #define DragEnter	1 /* drag operation from OS entered Squeak window */
@@ -298,29 +298,29 @@
 /* menu event */
 typedef struct sqMenuEvent
 {
-  int type;			/* type of event; EventTypeMenu */
-  unsigned int timeStamp;	/* time stamp */
-  /* the interpretation of the following fields depend on the type  of the event */
-  int menu;			/* platform-dependent to indicate which menu was picked */
-  int menuItem;			/* given a menu having 1 to N items this maps to the menu item number */
-  int reserved1;		/* reserved for future use */
-  int reserved2;		/* reserved for future use */
-  int reserved3;		/* reserved for future use */
-  int windowIndex;		/* host window structure */
+  long type;			/* type of event; EventTypeMenu */
+  unsigned long timeStamp;	/* time stamp */
+  /* the longerpretation of the following fields depend on the type  of the event */
+  long menu;			/* platform-dependent to indicate which menu was picked */
+  long menuItem;			/* given a menu having 1 to N items this maps to the menu item number */
+  long reserved1;		/* reserved for future use */
+  long reserved2;		/* reserved for future use */
+  long reserved3;		/* reserved for future use */
+  long windowIndex;		/* host window structure */
 } sqMenuEvent;
 
 /* window action event */
 typedef struct sqWindowEvent
 {
-  int type;			/* type of event;  EventTypeWindow */
-  unsigned int timeStamp;	/* time stamp */
-  /* the interpretation of the following fields depend on the type  of the event */
-  int action;		        /* one of WindowEventXXX (see below) */
-  int value1;			/* used for rectangle edges */
-  int value2;			/* used for rectangle edges */
-  int value3;			/* used for rectangle edges */
-  int value4;			/* used for rectangle edges */
-  int windowIndex;		/* host window structure */
+  long type;			/* type of event;  EventTypeWindow */
+  unsigned long timeStamp;	/* time stamp */
+  /* the longerpretation of the following fields depend on the type  of the event */
+  long action;		        /* one of WindowEventXXX (see below) */
+  long value1;			/* used for rectangle edges */
+  long value2;			/* used for rectangle edges */
+  long value3;			/* used for rectangle edges */
+  long value4;			/* used for rectangle edges */
+  long windowIndex;		/* host window structure */
 } sqWindowEvent;
 
 #define WindowEventMetricChange	1 /* size or position of window changed - value1-4 are left/top/right/bottom values */
@@ -332,15 +332,15 @@
 
 typedef struct sqComplexEvent
 	{
-		int type;			/* type of event;  EventTypeComplex */
-		unsigned int timeStamp;	/* time stamp */
-		/* the interpretation of the following fields depend on the type  of the event */
-		int action;		        /* one of ComplexEventXXX (see below) */
-		usqInt objectPointer;	/* used to point to object */
-		int unused1;			/*  */
-		int unused2;			/*  */
-		int unused3;			/*  */
-		int windowIndex;	/* host window structure */
+		long type;			/* type of event;  EventTypeComplex */
+		unsigned long timeStamp;	/* time stamp */
+		/* the longerpretation of the following fields depend on the type  of the event */
+		long action;		        /* one of ComplexEventXXX (see below) */
+		long objectPointer;	/* used to point to object (usqInt object pointer) */
+		long unused1;			/*  */
+		long unused2;			/*  */
+		long unused3;			/*  */
+		long windowIndex;	/* host window structure */
 	} sqComplexEvent;
 
 #define ComplexEventTypeTouchsDown	1 /*  */



More information about the Vm-dev mailing list