wchar_t* uniChars = NULL ;
UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
- UniChar* charBuf;
+ UniChar* charBuf = NULL;
UInt32 dataSize = 0 ;
int numChars = 0 ;
UniChar buf[2] ;
if ( GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr )
{
- numChars = dataSize / sizeof( UniChar) ;
+ numChars = dataSize / sizeof( UniChar) + 1;
charBuf = buf ;
- if ( dataSize > sizeof(buf) )
+ if ( numChars * 2 > sizeof(buf) )
charBuf = new UniChar[ numChars ] ;
else
charBuf = buf ;
uniChars = new wchar_t[ numChars ] ;
GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ;
+ charBuf[ numChars - 1 ] = 0;
#if SIZEOF_WCHAR_T == 2
uniChars = (wchar_t*) charBuf ;
- memcpy( uniChars , charBuf , dataSize ) ;
+ memcpy( uniChars , charBuf , numChars * 2 ) ;
#else
// the resulting string will never have more chars than the utf16 version, so this is safe
wxMBConvUTF16 converter ;
delete [] uniChars ;
if ( charBuf != buf )
delete [] charBuf ;
-
+
return result ;
}
bool wxWindowMac::MacCanFocus() const
{
// TODO : evaluate performance hits by looking up this value, eventually cache the results for a 1 sec or so
- // CAUTION : the value returned currently is 0 or 2, I've also found values of 1 having the same meaning, but the value range
- // is nowhere documented
+ // CAUTION : the value returned currently is 0 or 2, I've also found values of 1 having the same meaning,
+ // but the value range is nowhere documented
Boolean keyExistsAndHasValidFormat ;
- CFIndex fullKeyboardAccess = CFPreferencesGetAppIntegerValue ( CFSTR("AppleKeyboardUIMode" ) ,
- kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
-
+ CFIndex fullKeyboardAccess = CFPreferencesGetAppIntegerValue( CFSTR("AppleKeyboardUIMode" ) ,
+ kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat );
+
if ( keyExistsAndHasValidFormat && fullKeyboardAccess > 0 )
+ {
return true ;
+ }
else
{
UInt32 features = 0 ;
wxApp::s_captureWindow = this ;
}
-wxWindow* wxWindowBase::GetCapture()
+wxWindow * wxWindowBase::GetCapture()
{
return wxApp::s_captureWindow ;
}
#endif
-// Old style file-manager drag&drop
+// Old-style File Manager Drag & Drop
void wxWindowMac::DragAcceptFiles(bool accept)
{
// TODO:
int& x, int& y,
int& w, int& h , bool adjustOrigin ) const
{
- bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
-
// the desired size, minus the border pixels gives the correct size of the control
-
x = (int)pos.x;
y = (int)pos.y;
w = wxMax(size.x, 0) ; // WidthDefault( size.x );
h = wxMax(size.y, 0) ; // HeightDefault( size.y ) ;
+ bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
if ( !isCompositing )
GetParent()->MacWindowToRootWindow( &x , &y ) ;