Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: src/IBusChewingEngine-def.c

Issue 5535007: ibus-chewing: Support IBus-1.4 API. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/ibus-chewing.git@master
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/IBusChewingEngine.gob ('k') | src/main.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 const gchar *page_labels[]={ 1 const gchar *page_labels[]={
2 N_("Editing"), 2 N_("Editing"),
3 N_("Selecting"), 3 N_("Selecting"),
4 N_("Keyboard"), 4 N_("Keyboard"),
5 NULL 5 NULL
6 }; 6 };
7 7
8 const gchar *button_labels[]={ 8 const gchar *button_labels[]={
9 GTK_STOCK_SAVE, 9 GTK_STOCK_SAVE,
10 NULL 10 NULL
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 0, 0, 0, 370 0, 0, 0,
371 NULL, 371 NULL,
372 }, 372 },
373 }; 373 };
374 374
375 /*============================================ 375 /*============================================
376 * Supporting functions 376 * Supporting functions
377 */ 377 */
378 #ifdef IBUS_CHEWING_MAIN 378 #ifdef IBUS_CHEWING_MAIN
379 379
380 #if IBUS_CHECK_VERSION(1,3,99)
381 void g_variant_to_g_value(GVariant *gVar, GValue *gValue){
382 const GVariantType *gVType=g_variant_get_type(gVar);
383 if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_BOOLEAN)){
384 g_value_set_boolean(gValue, g_variant_get_boolean(gVar));
385 }else if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_UINT16)){
386 g_value_set_uint(gValue, g_variant_get_uint16(gVar));
387 }else if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_UINT32)){
388 g_value_set_uint(gValue, g_variant_get_uint32(gVar));
389 }else if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_UINT64)){
390 g_value_set_uint64(gValue, g_variant_get_uint64(gVar));
391 }else if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_INT16)){
392 g_value_set_int(gValue, g_variant_get_int16(gVar));
393 }else if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_INT32)){
394 g_value_set_int(gValue, g_variant_get_int32(gVar));
395 }else if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_INT64)){
396 g_value_set_int64(gValue, g_variant_get_int64(gVar));
397 }else if (g_variant_type_is_subtype_of(gVType, G_VARIANT_TYPE_STRING)){
398 g_value_set_int64(gValue, g_variant_get_string(gVar, NULL));
399 }
400 }
401
402 GVariant *g_value_to_g_variant(GValue *gValue){
403 GType gType=g_value_get_gtype(gValue);
404 GVariant *gVar=NULL;
405 switch(gType){
406 case G_TYPE_BOOLEAN:
407 gVar=g_variant_new_boolean(g_value_get_boolean(gValue));
408 break;
409 case G_TYPE_UINT:
410 gVar=g_variant_new_uint32(g_value_get_uint(gValue));
411 break;
412 case G_TYPE_INT:
413 gVar=g_variant_new_int32(g_value_get_int(gValue));
414 break;
415 case G_TYPE_STRING:
416 gVar=g_variant_new_string(g_value_get_string(gValue));
417 break;
418 default:
419 break;
420 }
421 return gVar;
422 }
423
424 #endif
425
426 static gboolean ibus_chewing_config_get_value(IBusConfig *config, const gchar *s ection, const gchar *key, GValue *gValue){
427 #if IBUS_CHECK_VERSION(1,3,99)
428 GVariant *gVar=g_variant_ref_sink(ibus_config_get_value(config, section, key ));
429 if (gVar!=NULL){
430 g_variant_to_g_value(gVar, gValue);
431 g_variant_unref(gVar);
432 return TRUE;
433 }else{
434 return FALSE;
435 }
436 #else
437 return ibus_config_get_value(config, section, key, gValue);
438 #endif
439
440 }
441
442 static gboolean ibus_chewing_config_set_value(IBusConfig *config, const gchar *s ection, const gchar *key, GValue *gValue){
443 #if IBUS_CHECK_VERSION(1,3,99)
444 GVariant *gVar=g_variant_ref_sink(g_value_to_g_variant(gValue));
445 if (gVar!=NULL){
446 return ibus_config_set_value(config, section, key, gVar);
447 }else{
448 return FALSE;
449 }
450 #else
451 return ibus_config_set_value(config, section, key, gValue);
452 #endif
453
454 }
455
456
457
380 static guint keysym_KP_to_normal(guint keysym){ 458 static guint keysym_KP_to_normal(guint keysym){
381 if (keysym < IBUS_KP_0 || keysym > IBUS_KP_9){ 459 if (keysym < IBUS_KP_0 || keysym > IBUS_KP_9){
382 switch(keysym){ 460 switch(keysym){
383 case IBUS_KP_Decimal: 461 case IBUS_KP_Decimal:
384 return IBUS_period; 462 return IBUS_period;
385 case IBUS_KP_Add: 463 case IBUS_KP_Add:
386 return IBUS_plus; 464 return IBUS_plus;
387 case IBUS_KP_Subtract: 465 case IBUS_KP_Subtract:
388 return IBUS_minus; 466 return IBUS_minus;
389 case IBUS_KP_Multiply: 467 case IBUS_KP_Multiply:
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 static void key_send_fake_event(KeySym key, Display *pDisplay) 617 static void key_send_fake_event(KeySym key, Display *pDisplay)
540 { 618 {
541 KeyCode keyCode = XKeysymToKeycode(pDisplay, key); 619 KeyCode keyCode = XKeysymToKeycode(pDisplay, key);
542 G_DEBUG_MSG(2,"key_sent_fake_event(%lx,-), keyCode=%x",key,keyCode); 620 G_DEBUG_MSG(2,"key_sent_fake_event(%lx,-), keyCode=%x",key,keyCode);
543 XTestFakeKeyEvent(pDisplay, keyCode, True, CurrentTime); 621 XTestFakeKeyEvent(pDisplay, keyCode, True, CurrentTime);
544 XTestFakeKeyEvent(pDisplay, keyCode, False, CurrentTime); 622 XTestFakeKeyEvent(pDisplay, keyCode, False, CurrentTime);
545 623
546 } 624 }
547 625
548 #endif 626 #endif
OLDNEW
« no previous file with comments | « src/IBusChewingEngine.gob ('k') | src/main.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698