diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-22 23:06:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-22 23:06:41 +0400 |
commit | 2bfd10131e7bcd5926c65c381a3e987145b02ad9 (patch) | |
tree | b88f9d4cc842a78db4f555d23c1412a950569661 /intern | |
parent | 83a44e48e7cb5cc6c794b50bb168a21144baeb06 (diff) | |
parent | 726fa618172733f3c4dc5ee85642829400e68f7b (diff) |
Cycles: svn merge -r41182:41205 ^/trunk/blender
Diffstat (limited to 'intern')
-rw-r--r-- | intern/audaspace/intern/AUD_SequencerReader.cpp | 10 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 43 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/test/multitest/MultiTest.c | 5 | ||||
-rw-r--r-- | intern/memutil/MEM_SmartPtr.h | 4 |
5 files changed, 24 insertions, 40 deletions
diff --git a/intern/audaspace/intern/AUD_SequencerReader.cpp b/intern/audaspace/intern/AUD_SequencerReader.cpp index c8af1161530..23d50c78508 100644 --- a/intern/audaspace/intern/AUD_SequencerReader.cpp +++ b/intern/audaspace/intern/AUD_SequencerReader.cpp @@ -107,8 +107,14 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer) if(result < 0) { - handle = new AUD_SequencerHandle(entry, m_device); - handles.push_front(handle); + try + { + handle = new AUD_SequencerHandle(entry, m_device); + handles.push_front(handle); + } + catch(AUD_Exception&) + { + } eit++; } else if(result == 0) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 1a6aaadb506..9ec8dd0abad 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1655,15 +1655,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) return GHOST_kFailure; } - /* unicode input - not entirely supported yet - * but we are getting the right byte, Blender is not drawing it though - * also some languages may need special treatment: - - Japanese: romanji is used as input, and every 2 letters OSX converts the text - to Hiragana/Katakana. - - Korean: one add one letter at a time, and then the OSX join them in the equivalent - combined letter. - */ char utf8_buf[6]= {'\0'}; + ascii = 0; switch ([event type]) { @@ -1678,32 +1671,18 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) keyCode = convertKey([event keyCode],0, [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp); - /* ascii */ + /* handling both unicode or ascii */ characters = [event characters]; - if ([characters length]>0) { //Check for dead keys - //Convert characters to iso latin 1 encoding - convertedCharacters = [characters dataUsingEncoding:NSISOLatin1StringEncoding]; - if ([convertedCharacters length]>0) - ascii =((char*)[convertedCharacters bytes])[0]; - else - ascii = 0; //Character not available in iso latin 1 encoding - } - else - ascii= 0; - - /* unicode */ if ([characters length]>0) { convertedCharacters = [characters dataUsingEncoding:NSUTF8StringEncoding]; - if ([convertedCharacters length]>0) { - utf8_buf[0] = ((char*)[convertedCharacters bytes])[0]; - utf8_buf[1] = ((char*)[convertedCharacters bytes])[1]; - utf8_buf[2] = ((char*)[convertedCharacters bytes])[2]; - utf8_buf[3] = ((char*)[convertedCharacters bytes])[3]; - utf8_buf[4] = ((char*)[convertedCharacters bytes])[4]; - utf8_buf[5] = ((char*)[convertedCharacters bytes])[5]; + + for (int x = 0; x < [convertedCharacters length]; x++) { + utf8_buf[x] = ((char*)[convertedCharacters bytes])[x]; } - else { - utf8_buf[0] = '\0'; + + /* ascii is a subset of unicode */ + if ([convertedCharacters length] == 1) { + ascii = utf8_buf[0]; } } @@ -1714,9 +1693,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } else { - // XXX Font Object bug - backspace or adding new chars are being computed twice (keydown and keyup) - utf8_buf[0] = '\0'; - pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii, utf8_buf) ); + pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, 0, '\0') ); //printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } break; diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 99ce81165ad..956a159a4ec 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -725,6 +725,8 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP (wchar_t*)utf16, 1, (LPSTR) utf8_char, 5, NULL,NULL); else *utf8_char = 0; + + if(!keyDown) utf8_char[0] = '\0'; event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, (*utf8_char & 0x80)?'?':*utf8_char, utf8_char); diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c index 00939e907d6..1ba28d21808 100644 --- a/intern/ghost/test/multitest/MultiTest.c +++ b/intern/ghost/test/multitest/MultiTest.c @@ -50,9 +50,8 @@ extern int datatoc_bfont_ttf_size; extern char datatoc_bfont_ttf[]; - // XXX, bad, but BLI uses these - char bprogname[160]= ""; -char U[1024]= {0}; + /* cheat */ + char U[1024]= {0}; #endif #include "Util.h" diff --git a/intern/memutil/MEM_SmartPtr.h b/intern/memutil/MEM_SmartPtr.h index 50d69cfd8dd..ee3c4f22536 100644 --- a/intern/memutil/MEM_SmartPtr.h +++ b/intern/memutil/MEM_SmartPtr.h @@ -49,14 +49,14 @@ * the Standard Template Library but without the painful get() * semantics to access the internal c style pointer. * - * It is often useful to explicitely decalre ownership of memory + * It is often useful to explicitly declare ownership of memory * allocated on the heap within class or function scope. This * class helps you to encapsulate this ownership within a value * type. When an instance of this class goes out of scope it * makes sure that any memory associated with it's internal pointer * is deleted. It can help to inform users of an aggregate class * that it owns instances of it's members and these instances - * should not be shared. This is not reliably enforcable in C++ + * should not be shared. This is not reliably enforceable in C++ * but this class attempts to make the 1-1 relationship clear. * * @section Example usage |