1318 {
1319 #ifdef IM_DEBUG
1320 fprintf(stderr, "AWTView InputMethod Selector Called : [setInputMethod]\n");
1321 #endif // IM_DEBUG
1322
1323 JNIEnv *env = [ThreadUtilities getJNIEnv];
1324
1325 // Get rid of the old one
1326 if (fInputMethodLOCKABLE) {
1327 JNFDeleteGlobalRef(env, fInputMethodLOCKABLE);
1328 }
1329
1330 // Save a global ref to the new input method.
1331 if (inputMethod != NULL)
1332 fInputMethodLOCKABLE = JNFNewGlobalRef(env, inputMethod);
1333 else
1334 fInputMethodLOCKABLE = NULL;
1335
1336 NSTextInputContext *curContxt = [NSTextInputContext currentInputContext];
1337 kbdLayout = curContxt.selectedKeyboardInputSource;
1338 [[NSNotificationCenter defaultCenter] addObserver:self
1339 selector:@selector(keyboardInputSourceChanged:)
1340 name:NSTextInputContextKeyboardSelectionDidChangeNotification
1341 object:nil];
1342 }
1343
1344 - (void)abandonInput
1345 {
1346 #ifdef IM_DEBUG
1347 fprintf(stderr, "AWTView InputMethod Selector Called : [abandonInput]\n");
1348 #endif // IM_DEBUG
1349
1350 [ThreadUtilities performOnMainThread:@selector(markedTextAbandoned:) on:[NSInputManager currentInputManager] withObject:self waitUntilDone:YES];
1351 [self unmarkText];
1352 }
1353
1354 /******************************** END NSTextInputClient Protocol ********************************/
1355
1356
1357
1358
|
1318 {
1319 #ifdef IM_DEBUG
1320 fprintf(stderr, "AWTView InputMethod Selector Called : [setInputMethod]\n");
1321 #endif // IM_DEBUG
1322
1323 JNIEnv *env = [ThreadUtilities getJNIEnv];
1324
1325 // Get rid of the old one
1326 if (fInputMethodLOCKABLE) {
1327 JNFDeleteGlobalRef(env, fInputMethodLOCKABLE);
1328 }
1329
1330 // Save a global ref to the new input method.
1331 if (inputMethod != NULL)
1332 fInputMethodLOCKABLE = JNFNewGlobalRef(env, inputMethod);
1333 else
1334 fInputMethodLOCKABLE = NULL;
1335
1336 NSTextInputContext *curContxt = [NSTextInputContext currentInputContext];
1337 kbdLayout = curContxt.selectedKeyboardInputSource;
1338 [[NSNotificationCenter defaultCenter] addObserver:[AWTView class]
1339 selector:@selector(keyboardInputSourceChanged:)
1340 name:NSTextInputContextKeyboardSelectionDidChangeNotification
1341 object:nil];
1342 }
1343
1344 - (void)abandonInput
1345 {
1346 #ifdef IM_DEBUG
1347 fprintf(stderr, "AWTView InputMethod Selector Called : [abandonInput]\n");
1348 #endif // IM_DEBUG
1349
1350 [ThreadUtilities performOnMainThread:@selector(markedTextAbandoned:) on:[NSInputManager currentInputManager] withObject:self waitUntilDone:YES];
1351 [self unmarkText];
1352 }
1353
1354 /******************************** END NSTextInputClient Protocol ********************************/
1355
1356
1357
1358
|