|
From: John M M. <jo...@us...> - 2003-12-02 05:02:25
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/vm
In directory sc8-pr-cvs1:/tmp/cvs-serv13899/squeak/platforms/Mac OS/vm
Modified Files:
sqMacUIEvents.c
Log Message:
* 3.6.2b3 Nov 25th, 2003 JMM Tetsuya HAYASHI <te...@st...> supplied multiple unicode extraction from input method text entry.
* 3.7.0bx Nov 24th, 2003 JMM gCurrentVMEncoding. Changes to support encoding of file names.
Index: sqMacUIEvents.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/vm/sqMacUIEvents.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** sqMacUIEvents.c 3 Oct 2003 19:05:19 -0000 1.18
--- sqMacUIEvents.c 2 Dec 2003 04:48:24 -0000 1.19
***************
*** 21,24 ****
--- 21,26 ----
* 3.5.1b5 June 25th, 2003 JMM don't close window on floating full screen, handle issue with keydown and floating window if required.
* 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 <te...@st...> supplied multiple unicode extraction
+ * 3.7.0bx Nov 24th, 2003 JMM gCurrentVMEncoding
notes: see incontent, I think it's a bug, click to bring to foreground signls mousedown. bad...
***************
*** 692,696 ****
--- 694,702 ----
ioProcessEvents();
if (windowActive) {
+ GrafPtr savePort;
+ GetPort(&savePort);
+ SetPortWindowPort(getSTWindow());
GetMouse(&p);
+ SetPort(savePort);
} else {
/* don't report mouse motion if window is not active */
***************
*** 1692,1698 ****
void recordKeyboardEventCarbon(EventRef event) {
! int asciiChar, modifierBits;
char macCharCode;
! UInt32 macKeyCode;
sqKeyboardEvent *evt, *extra;
OSErr err;
--- 1698,1705 ----
void recordKeyboardEventCarbon(EventRef event) {
! int modifierBits, i;
char macCharCode;
! UniCharCount uniCharCount;
! UniChar uniChar, modifiedUniChar, *uniCharBufPtr, *uniCharBuf;
sqKeyboardEvent *evt, *extra;
OSErr err;
***************
*** 1701,1704 ****
--- 1708,1713 ----
EventRef actualEvent;
+ // Tetsuya HAYASHI <te...@st...> supplied multiple unicode extraction
+
/* kEventTextInputUnicodeForKeyEvent
Required parameters:
***************
*** 1722,1759 ****
*/
! err = GetEventParameter (event, kEventParamTextInputSendText,
! typeUnicodeText, NULL, 0, &actualSize, NULL);
!
! if (actualSize != 2)
! return;
!
! err = GetEventParameter (event, kEventParamTextInputSendText,
! typeUnicodeText, NULL, actualSize, NULL, &text);
!
err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent,
typeEventRef, NULL, sizeof(EventRef), NULL, &actualEvent);
!
! err = GetEventParameter( actualEvent,
! kEventParamKeyMacCharCodes,
! typeChar,
! NULL,
! sizeof(char),
! NULL,
! &macCharCode);
! err = GetEventParameter( actualEvent,
! kEventParamKeyCode,
! typeUInt32,
! NULL,
! sizeof(UInt32),
! NULL,
! &macKeyCode);
! asciiChar = (unsigned char) macCharCode;
buttonState = modifierBits =ModifierStateCarbon(actualEvent,0); //Capture option states
if (((modifierBits >> 3) & 0x9) == 0x9) { /* command and shift */
! if ((asciiChar >= 97) && (asciiChar <= 122)) {
/* convert ascii code of command-shift-letter to upper case */
! asciiChar = asciiChar - 32;
}
}
--- 1731,1752 ----
*/
! /* Get the actual keyboard event */
err = GetEventParameter (event, kEventParamTextInputSendKeyboardEvent,
typeEventRef, NULL, sizeof(EventRef), NULL, &actualEvent);
! /* Get the actual data size */
! err = GetEventParameter (event, kEventParamTextInputSendText,
! typeUnicodeText, NULL, 0, &actualSize, NULL);
! /* Get the actual character data */
! uniCharBuf = uniCharBufPtr = malloc(actualSize);
! err = GetEventParameter (actualEvent, kEventParamKeyUnicodes,
! typeUnicodeText, NULL, actualSize, NULL, uniCharBuf);
! uniChar = modifiedUniChar = *uniCharBufPtr;
buttonState = modifierBits =ModifierStateCarbon(actualEvent,0); //Capture option states
if (((modifierBits >> 3) & 0x9) == 0x9) { /* command and shift */
! if ((modifiedUniChar >= 97) && (modifiedUniChar <= 122)) {
/* convert ascii code of command-shift-letter to upper case */
! modifiedUniChar = modifiedUniChar - 32;
}
}
***************
*** 1767,1771 ****
/* now the key code */
/* press code must differentiate */
! evt->charCode = text;
evt->pressCode = EventKeyDown;
evt->modifiers = modifierBits >> 3;
--- 1760,1764 ----
/* now the key code */
/* press code must differentiate */
! evt->charCode = uniChar;
evt->pressCode = EventKeyDown;
evt->modifiers = modifierBits >> 3;
***************
*** 1773,1805 ****
evt->reserved1 = 0;
evt->reserved2 = 0;
- /* generate extra character event */
- extra = (sqKeyboardEvent*)nextEventPut();
- *extra = *evt;
- extra->charCode = 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 */
! setInterruptPending(true);
! setInterruptCheckCounter(0);
! } else {
! keyBuf[keyBufPut] = keystate;
! keyBufPut = (keyBufPut + 1) % KEYBUF_SIZE;
! if (keyBufGet == keyBufPut) {
! /* buffer overflow; drop the last character */
! keyBufGet = (keyBufGet + 1) % KEYBUF_SIZE;
! keyBufOverflows++;
! }
}
!
}
- evt = (sqKeyboardEvent*) nextEventPut();
/* first the basics */
evt->type = EventTypeKeyboard;
--- 1766,1806 ----
evt->reserved1 = 0;
evt->reserved2 = 0;
! /* Put sqKeyboardEvent in actualSize times */
! uniCharCount = actualSize / sizeof(UniChar);
! for (i=0; i<uniCharCount; i++) {
! /* generate extra character event */
! extra = (sqKeyboardEvent*)nextEventPut();
! extra->type = EventTypeKeyboard;
! extra->timeStamp = ioMSecs() & 536870911;
! extra->charCode = modifiedUniChar;
! extra->pressCode = EventKeyChar;
! extra->modifiers = modifierBits >> 3;
!
! if(!inputSemaphoreIndex) {
! int keystate;
!
! /* keystate: low byte is the ascii character; next 8 bits are modifier bits */
! keystate = (evt->modifiers << 8) | (unsigned char) uniChar;
! if (keystate == getInterruptKeycode()) {
! /* Note: interrupt key is "meta"; it not reported as a keystroke */
! setInterruptPending(true);
! setInterruptCheckCounter(0);
! } else {
! keyBuf[keyBufPut] = keystate;
! keyBufPut = (keyBufPut + 1) % KEYBUF_SIZE;
! if (keyBufGet == keyBufPut) {
! /* buffer overflow; drop the last character */
! keyBufGet = (keyBufGet + 1) % KEYBUF_SIZE;
! keyBufOverflows++;
! }
! }
}
! uniCharBufPtr++;
! modifiedUniChar = *uniCharBufPtr;
}
+ /* Put the sqKeyboardEvent for KeyUp */
+ evt = (sqKeyboardEvent*) nextEventPut();
/* first the basics */
evt->type = EventTypeKeyboard;
***************
*** 1807,1811 ****
/* now the key code */
/* press code must differentiate */
! evt->charCode = text;
evt->pressCode = EventKeyUp;
evt->modifiers = modifierBits >> 3;
--- 1808,1812 ----
/* now the key code */
/* press code must differentiate */
! evt->charCode = uniChar;
evt->pressCode = EventKeyUp;
evt->modifiers = modifierBits >> 3;
***************
*** 1813,1816 ****
--- 1814,1819 ----
evt->reserved1 = 0;
evt->reserved2 = 0;
+
+ free(uniCharBuf);
pthread_mutex_unlock(&gEventQueueLock);
signalAnyInterestedParties();
|