void OSXKeyState::setGroup(SInt32 group) { #if defined(MAC_OS_X_VERSION_10_5) TISSetInputMethodKeyboardLayoutOverride(m_groups[group]); #else KLSetCurrentKeyboardLayout(m_groups[group]); #endif }
void keyboard_layout_anything(t_keyboard_layout *x, t_symbol *s, short argc, t_atom *argv) { //OSStatus err; KeyboardLayoutRef currentLayoutRef; const void *keyboardName; char cKeyboardName[100]; keyboardName= CFStringCreateWithCString(NULL, s->s_name, kCFStringEncodingASCII); KLGetKeyboardLayoutWithName(keyboardName, ¤tLayoutRef); KLGetKeyboardLayoutProperty(currentLayoutRef, kKLName, (const void **)&keyboardName); CFStringGetCString((CFStringRef)keyboardName, cKeyboardName, 100, kCFStringEncodingASCII); KLSetCurrentKeyboardLayout(currentLayoutRef); //outlet_anything(x->t_out, s, 0, NULL); keyboard_layout_bang(x); }