88#include <ctype.h>
99#include <glib.h>
1010
11+ #define handle_log (funcName ) \
12+ g_info("* self_handle_%s(-,%x(%s),%x(%s))", funcName, kSym, ibus_keyval_name(kSym), \
13+ unmaskedMod, modifiers_to_string(unmaskedMod));
14+
1115/**************************************
1216 * Methods
1317 */
@@ -54,19 +58,18 @@ void ibus_chewing_pre_edit_update_outgoing(IBusChewingPreEdit *self) {
5458 /* commit_Check=1 means new commit available */
5559 gchar * commitStr = chewing_commit_String (self -> context );
5660
57- IBUS_CHEWING_LOG ( INFO , "commitStr=|%s|\n" , commitStr );
61+ g_info ( "commitStr=|%s|\n" , commitStr );
5862 g_string_append (self -> outgoing , commitStr );
5963
6064 chewing_free (commitStr );
6165 chewing_ack (self -> context );
6266 }
63- IBUS_CHEWING_LOG (INFO , "outgoing=|%s|\n" , self -> outgoing -> str );
64- IBUS_CHEWING_LOG (DEBUG , "ibus_chewing_pre_edit_update_outgoing(-): return: outgoing=|%s|" ,
65- self -> outgoing -> str );
67+ g_info ("outgoing=|%s|\n" , self -> outgoing -> str );
68+ g_debug ("ibus_chewing_pre_edit_update_outgoing(-): return: outgoing=|%s|" , self -> outgoing -> str );
6669}
6770
6871void ibus_chewing_pre_edit_update (IBusChewingPreEdit * self ) {
69- IBUS_CHEWING_LOG ( DEBUG , "* ibus_chewing_pre_edit_update(-)" );
72+ g_debug ( "* ibus_chewing_pre_edit_update(-)" );
7073
7174 /* Make preEdit */
7275 gchar * bufferStr = chewing_buffer_String (self -> context );
@@ -79,10 +82,9 @@ void ibus_chewing_pre_edit_update(IBusChewingPreEdit *self) {
7982 gchar * cP = bufferStr ;
8083 gunichar uniCh ;
8184
82- IBUS_CHEWING_LOG (INFO ,
83- "* ibus_chewing_pre_edit_update(-) bufferStr=|%s|, "
84- "bpmfStr=|%s| bpmfLen=%d cursor=%d" ,
85- bufferStr , bpmfStr , self -> bpmfLen , cursor_current );
85+ g_info ("* ibus_chewing_pre_edit_update(-) bufferStr=|%s|, "
86+ "bpmfStr=|%s| bpmfLen=%d cursor=%d" ,
87+ bufferStr , bpmfStr , self -> bpmfLen , cursor_current );
8688
8789 for (i = 0 ; i < chewing_buffer_Len (self -> context ) && cP != NULL ; i ++ ) {
8890 if (i == cursor_current ) {
@@ -107,21 +109,15 @@ void ibus_chewing_pre_edit_update(IBusChewingPreEdit *self) {
107109
108110guint ibus_chewing_pre_edit_length (IBusChewingPreEdit * self ) { return self -> preEdit -> len ; }
109111
110- guint ibus_chewing_pre_edit_word_length (IBusChewingPreEdit * self ) { return self -> wordLen ; }
111-
112- guint ibus_chewing_pre_edit_word_limit (IBusChewingPreEdit * self ) {
113- return chewing_get_maxChiSymbolLen (self -> context );
114- }
115-
116112gchar * ibus_chewing_pre_edit_get_pre_edit (IBusChewingPreEdit * self ) { return self -> preEdit -> str ; }
117113
118114gchar * ibus_chewing_pre_edit_get_outgoing (IBusChewingPreEdit * self ) { return self -> outgoing -> str ; }
119115
120116/* currently, ibus_chewing_pre_edit_force_commit() is called only by test cases.
121117 */
122118void ibus_chewing_pre_edit_force_commit (IBusChewingPreEdit * self ) {
123- IBUS_CHEWING_LOG ( INFO , "ibus_chewing_pre_edit_force_commit(-) bpmf_check=%d buffer_check=%d" ,
124- bpmf_check , chewing_buffer_Check (self -> context ));
119+ g_info ( "ibus_chewing_pre_edit_force_commit(-) bpmf_check=%d buffer_check=%d" , bpmf_check ,
120+ chewing_buffer_Check (self -> context ));
125121
126122 /* Ignore the context and commit whatever in preedit buffer */
127123 g_string_append (self -> outgoing , self -> preEdit -> str );
@@ -130,13 +126,13 @@ void ibus_chewing_pre_edit_force_commit(IBusChewingPreEdit *self) {
130126}
131127
132128void ibus_chewing_pre_edit_clear (IBusChewingPreEdit * self ) {
133- IBUS_CHEWING_LOG ( INFO , "ibus_chewing_pre_edit_clear(-)" );
129+ g_info ( "ibus_chewing_pre_edit_clear(-)" );
134130 ibus_chewing_pre_edit_clear_outgoing (self );
135131 ibus_chewing_pre_edit_clear_pre_edit (self );
136132}
137133
138134void ibus_chewing_pre_edit_clear_bopomofo (IBusChewingPreEdit * self ) {
139- IBUS_CHEWING_LOG ( DEBUG , "ibus_chewing_pre_edit_clear_bopomofo(-)" );
135+ g_debug ( "ibus_chewing_pre_edit_clear_bopomofo(-)" );
140136
141137 /* Esc key can close candidate list, clear bopomofo, and clear
142138 * the whole pre-edit buffer. Make sure it acts as we expected.
@@ -151,7 +147,7 @@ void ibus_chewing_pre_edit_clear_bopomofo(IBusChewingPreEdit *self) {
151147}
152148
153149void ibus_chewing_pre_edit_clear_pre_edit (IBusChewingPreEdit * self ) {
154- IBUS_CHEWING_LOG ( DEBUG , "ibus_chewing_pre_edit_clear_pre_edit(-)" );
150+ g_debug ( "ibus_chewing_pre_edit_clear_pre_edit(-)" );
155151
156152 ibus_chewing_pre_edit_clear_bopomofo (self );
157153
@@ -167,7 +163,7 @@ void ibus_chewing_pre_edit_clear_pre_edit(IBusChewingPreEdit *self) {
167163}
168164
169165void ibus_chewing_pre_edit_clear_outgoing (IBusChewingPreEdit * self ) {
170- IBUS_CHEWING_LOG ( DEBUG , "ibus_chewing_pre_edit_clear_outgoing(-)" );
166+ g_debug ( "ibus_chewing_pre_edit_clear_outgoing(-)" );
171167 g_string_assign (self -> outgoing , "" );
172168}
173169
@@ -258,8 +254,8 @@ EventResponse self_handle_key_sym_default(IBusChewingPreEdit *self, KSym kSym,
258254 EventResponse response = EVENT_RESPONSE_UNDECIDED ;
259255 KSym fixedKSym = self_key_sym_fix (self , kSym , unmaskedMod );
260256
261- IBUS_CHEWING_LOG ( DEBUG , "* self_handle_key_sym_default(): new kSym %x(%s), %x(%s)" , fixedKSym ,
262- ibus_keyval_name (fixedKSym ), unmaskedMod , modifiers_to_string (unmaskedMod ));
257+ g_debug ( "* self_handle_key_sym_default(): new kSym %x(%s), %x(%s)" , fixedKSym ,
258+ ibus_keyval_name (fixedKSym ), unmaskedMod , modifiers_to_string (unmaskedMod ));
263259 gint ret = chewing_handle_Default (self -> context , fixedKSym );
264260
265261 /* Handle quick commit */
@@ -280,7 +276,7 @@ EventResponse self_handle_key_sym_default(IBusChewingPreEdit *self, KSym kSym,
280276 break ;
281277 }
282278
283- IBUS_CHEWING_LOG ( DEBUG , "self_handle_key_sym_default() ret=%d response=%d" , ret , response );
279+ g_debug ( "self_handle_key_sym_default() ret=%d response=%d" , ret , response );
284280 /* Restore easySymbolInput */
285281 chewing_set_easySymbolInput (self -> context , easySymbolInput );
286282 return response ;
@@ -655,7 +651,7 @@ EventResponse self_handle_special([[maybe_unused]] IBusChewingPreEdit *self,
655651 [[maybe_unused ]] KSym kSym ,
656652 [[maybe_unused ]] KeyModifiers unmaskedMod ) {
657653 /* KSym >=128 is special key, which IM ignore. */
658- IBUS_CHEWING_LOG ( MSG , "ignore special key" );
654+ g_message ( "ignore special key" );
659655 return EVENT_RESPONSE_IGNORE ;
660656}
661657
@@ -749,12 +745,11 @@ static KeyHandlingRule *self_key_sym_find_key_handling_rule(KSym kSym) {
749745 (self_key_sym_find_key_handling_rule(kSym))->keyFunc(self, kSym, unmaskedMod)
750746
751747#define process_key_debug (prompt ) \
752- IBUS_CHEWING_LOG(DEBUG, \
753- "ibus_chewing_pre_edit_process_key(): %s flags=%x " \
754- "buff_check=%d bpmf_check=%d cursor=%d total_choice=%d " \
755- "is_chinese=%d is_full_shape=%d", \
756- prompt, self->flags, chewing_buffer_Check(self->context), bpmf_check, \
757- cursor_current, total_choice, is_chinese, is_full_shape)
748+ g_debug("ibus_chewing_pre_edit_process_key(): %s flags=%x " \
749+ "buff_check=%d bpmf_check=%d cursor=%d total_choice=%d " \
750+ "is_chinese=%d is_full_shape=%d", \
751+ prompt, self->flags, chewing_buffer_Check(self->context), bpmf_check, cursor_current, \
752+ total_choice, is_chinese, is_full_shape)
758753
759754gboolean is_shift_key (KSym kSym ) { return kSym == IBUS_KEY_Shift_L || kSym == IBUS_KEY_Shift_R ; }
760755
@@ -770,8 +765,8 @@ gboolean is_shift_toggle(KSym keyLast, KSym kSym, KeyModifiers unmaskedMod) {
770765/* keyCode should be converted to kSym already */
771766gboolean ibus_chewing_pre_edit_process_key (IBusChewingPreEdit * self , KSym kSym ,
772767 KeyModifiers unmaskedMod ) {
773- IBUS_CHEWING_LOG ( INFO , "***** ibus_chewing_pre_edit_process_key(-,%x(%s),%x(%s))" , kSym ,
774- ibus_keyval_name ( kSym ), unmaskedMod , modifiers_to_string (unmaskedMod ));
768+ g_info ( "***** ibus_chewing_pre_edit_process_key(-,%x(%s),%x(%s))" , kSym , ibus_keyval_name ( kSym ) ,
769+ unmaskedMod , modifiers_to_string (unmaskedMod ));
775770 process_key_debug ("Before response" );
776771
777772 /* Find corresponding rule */
@@ -803,7 +798,7 @@ gboolean ibus_chewing_pre_edit_process_key(IBusChewingPreEdit *self, KSym kSym,
803798 self -> keyLast = kSym ;
804799 self -> keyLastTs = g_get_monotonic_time ();
805800
806- IBUS_CHEWING_LOG ( DEBUG , "ibus_chewing_pre_edit_process_key() response=%x" , response );
801+ g_debug ( "ibus_chewing_pre_edit_process_key() response=%x" , response );
807802 process_key_debug ("After response" );
808803 switch (response ) {
809804 case EVENT_RESPONSE_ABSORB :
@@ -818,7 +813,7 @@ gboolean ibus_chewing_pre_edit_process_key(IBusChewingPreEdit *self, KSym kSym,
818813
819814 guint candidateCount = ibus_chewing_lookup_table_update (self -> iTable , self -> context );
820815
821- IBUS_CHEWING_LOG ( INFO , "ibus_chewing_pre_edit_process_key() candidateCount=%d" , candidateCount );
816+ g_info ( "ibus_chewing_pre_edit_process_key() candidateCount=%d" , candidateCount );
822817
823818 if (candidateCount ) {
824819 ibus_chewing_pre_edit_set_flag (self , FLAG_TABLE_SHOW );
0 commit comments