2020 * USA.
2121 */
2222#include "ibus-chewing-engine.h"
23- #include "ibus-chewing-preedit .h"
23+ #include "ibus-chewing-engine-private .h"
2424#include "ibus-chewing-lookup-table.h"
25+ #include "ibus-chewing-preedit.h"
2526#include "ibus-chewing-util.h"
26- #include "maker-dialog-util.h"
27- #include "ibus-chewing-engine-private.h"
2827#include <chewing.h>
2928#include <glib.h>
3029#include <glib/gi18n.h>
@@ -569,7 +568,7 @@ void ibus_chewing_engine_refresh_property(IBusChewingEngine *self,
569568#ifndef UNIT_TEST
570569 IBUS_CHEWING_LOG (DEBUG , "refresh_property(%s) status=%x" , prop_name , self -> statusFlags );
571570
572- if (STRING_EQUALS (prop_name , "InputMode" )) {
571+ if (g_strcmp0 (prop_name , "InputMode" ) == 0 ) {
573572
574573 ibus_property_set_label (self -> InputMode ,
575574 ibus_chewing_pre_edit_get_chi_eng_mode (self -> icPreEdit )
@@ -585,7 +584,7 @@ void ibus_chewing_engine_refresh_property(IBusChewingEngine *self,
585584
586585 ibus_engine_update_property (IBUS_ENGINE (self ), self -> InputMode );
587586
588- } else if (STRING_EQUALS (prop_name , "AlnumSize" )) {
587+ } else if (g_strcmp0 (prop_name , "AlnumSize" ) == 0 ) {
589588
590589 ibus_property_set_label (self -> AlnumSize , chewing_get_ShapeMode (self -> icPreEdit -> context )
591590 ? self -> AlnumSize_label_full
@@ -601,7 +600,7 @@ void ibus_chewing_engine_refresh_property(IBusChewingEngine *self,
601600 if (self -> statusFlags & ENGINE_FLAG_PROPERTIES_REGISTERED )
602601 ibus_engine_update_property (IBUS_ENGINE (self ), self -> AlnumSize );
603602
604- } else if (STRING_EQUALS (prop_name , "setup_prop" )) {
603+ } else if (g_strcmp0 (prop_name , "setup_prop" ) == 0 ) {
605604#if IBUS_CHECK_VERSION (1 , 5 , 0 )
606605 ibus_property_set_symbol (self -> setup_prop , self -> setup_prop_symbol );
607606#endif
@@ -650,11 +649,11 @@ static IBusProperty *ibus_chewing_engine_get_ibus_property_by_name(IBusChewingEn
650649 g_return_val_if_fail (self != NULL , (IBusProperty * )0 );
651650 g_return_val_if_fail (IBUS_IS_CHEWING_ENGINE (self ), (IBusProperty * )0 );
652651 {
653- if (STRING_EQUALS (prop_name , "InputMode" )) {
652+ if (g_strcmp0 (prop_name , "InputMode" ) == 0 ) {
654653 return self -> InputMode ;
655- } else if (STRING_EQUALS (prop_name , "AlnumSize" )) {
654+ } else if (g_strcmp0 (prop_name , "AlnumSize" ) == 0 ) {
656655 return self -> AlnumSize ;
657- } else if (STRING_EQUALS (prop_name , "setup_prop" )) {
656+ } else if (g_strcmp0 (prop_name , "setup_prop" ) == 0 ) {
658657 return self -> setup_prop ;
659658 }
660659 IBUS_CHEWING_LOG (MSG , "get_ibus_property_by_name(%s): NULL is returned" , prop_name );
@@ -848,8 +847,8 @@ static void parent_update_pre_edit_text_with_mode([[maybe_unused]] IBusEngine *i
848847 IBusText * iText , guint cursor_pos ,
849848 gboolean visible , IBusPreeditFocusMode mode ) {
850849#ifdef UNIT_TEST
851- printf ("# * parent_update_pre_edit_text_with_mode(-, %s, %u, %x, %x)\n" , iText -> text , cursor_pos ,
852- visible , mode );
850+ printf ("# * parent_update_pre_edit_text_with_mode(-, %s, %u, %x, %x)\n" , iText -> text ,
851+ cursor_pos , visible , mode );
853852#else
854853 ibus_engine_update_preedit_text_with_mode (iEngine , iText , cursor_pos , visible , mode );
855854#endif
@@ -858,7 +857,8 @@ static void parent_update_pre_edit_text_with_mode([[maybe_unused]] IBusEngine *i
858857static void parent_update_auxiliary_text ([[maybe_unused ]] IBusEngine * iEngine , IBusText * iText ,
859858 gboolean visible ) {
860859#ifdef UNIT_TEST
861- printf ("# * parent_update_auxiliary_text(-, %s, %x)\n" , (iText ) ? iText -> text : "NULL" , visible );
860+ printf ("# * parent_update_auxiliary_text(-, %s, %x)\n" , (iText ) ? iText -> text : "NULL" ,
861+ visible );
862862#else
863863 if (!visible || ibus_text_is_empty (iText )) {
864864 ibus_engine_hide_auxiliary_text (iEngine );
@@ -1017,7 +1017,7 @@ void commit_text(IBusChewingEngine *self) {
10171017gboolean ibus_chewing_engine_process_key_event (IBusEngine * engine , KSym keySym , guint keycode ,
10181018 KeyModifiers unmaskedMod ) {
10191019 IBUS_CHEWING_LOG (MSG , "******** process_key_event(-,%x(%s),%x,%x) %s" , keySym ,
1020- key_sym_get_name (keySym ), keycode , unmaskedMod ,
1020+ ibus_keyval_name (keySym ), keycode , unmaskedMod ,
10211021 modifiers_to_string (unmaskedMod ));
10221022
10231023 IBusChewingEngine * self = IBUS_CHEWING_ENGINE (engine );
@@ -1081,17 +1081,17 @@ void ibus_chewing_engine_property_activate(IBusEngine *engine, const gchar *prop
10811081 IBUS_CHEWING_LOG (INFO , "property_activate(-, %s, %u)" , prop_name , prop_state );
10821082 IBusChewingEngine * self = IBUS_CHEWING_ENGINE (engine );
10831083
1084- if (STRING_EQUALS (prop_name , "InputMode" )) {
1084+ if (g_strcmp0 (prop_name , "InputMode" ) == 0 ) {
10851085 /* Toggle Chinese <-> English */
10861086 ibus_chewing_pre_edit_toggle_chi_eng_mode (self -> icPreEdit );
10871087 IBUS_CHEWING_LOG (INFO , "property_activate chinese=%d" , is_chinese_mode (self ));
10881088 ibus_chewing_engine_refresh_property (self , prop_name );
1089- } else if (STRING_EQUALS (prop_name , "AlnumSize" )) {
1089+ } else if (g_strcmp0 (prop_name , "AlnumSize" ) == 0 ) {
10901090 /* Toggle Full <-> Half */
10911091 ibus_chewing_pre_edit_toggle_full_half_mode (self -> icPreEdit );
10921092 IBUS_CHEWING_LOG (INFO , "property_activate fullwidth=%d" , is_fullwidth_mode (self ));
10931093 ibus_chewing_engine_refresh_property (self , prop_name );
1094- } else if (STRING_EQUALS (prop_name , "setup_prop" )) {
1094+ } else if (g_strcmp0 (prop_name , "setup_prop" ) == 0 ) {
10951095 /* open preferences window */
10961096 char * argv [] = {QUOTE_ME (LIBEXEC_DIR ) "/ibus-setup-chewing" , NULL };
10971097 g_spawn_async (NULL , argv , NULL , G_SPAWN_DEFAULT , NULL , NULL , NULL , NULL );
@@ -1103,16 +1103,16 @@ void ibus_chewing_engine_property_activate(IBusEngine *engine, const gchar *prop
11031103
11041104char ibus_chewing_engine_get_default_english_case (IBusChewingEngine * self ) {
11051105 char * prop = self -> prop_default_english_case ;
1106- return STRING_EQUALS (prop , "lowercase" ) ? 'l' : STRING_EQUALS (prop , "uppercase" ) ? 'u' : 'n' ;
1106+ return g_strcmp0 (prop , "lowercase" ) == 0 ? 'l' : g_strcmp0 (prop , "uppercase" ) == 0 ? 'u' : 'n' ;
11071107}
11081108
11091109char ibus_chewing_engine_get_chinese_english_toggle_key (IBusChewingEngine * self ) {
11101110 char * prop = self -> prop_chi_eng_mode_toggle ;
1111- return STRING_EQUALS (prop , "caps_lock" ) ? 'c'
1112- : STRING_EQUALS (prop , "shift" ) ? 's'
1113- : STRING_EQUALS (prop , "shift_l" ) ? 'l'
1114- : STRING_EQUALS (prop , "shift_r" ) ? 'r'
1115- : 'n' ;
1111+ return g_strcmp0 (prop , "caps_lock" ) == 0 ? 'c'
1112+ : g_strcmp0 (prop , "shift" ) == 0 ? 's'
1113+ : g_strcmp0 (prop , "shift_l" ) == 0 ? 'l'
1114+ : g_strcmp0 (prop , "shift_r" ) == 0 ? 'r'
1115+ : 'n' ;
11161116 return 'n' ;
11171117}
11181118
0 commit comments