@@ -1276,7 +1276,9 @@ utf_char2cells(c)
12761276 {0xfe68 , 0xfe6b },
12771277 {0xff01 , 0xff60 },
12781278 {0xffe0 , 0xffe6 },
1279- {0x10000 , 0x1fffd },
1279+ {0x1f200 , 0x1f200 },
1280+ {0x1f210 , 0x1f231 },
1281+ {0x1f240 , 0x1f248 },
12801282 {0x20000 , 0x2fffd },
12811283 {0x30000 , 0x3fffd }
12821284 };
@@ -4448,19 +4450,16 @@ iconv_end()
44484450# define g_return_if_fail (x ) if (!(x)) return;
44494451# endif
44504452
4453+ # if defined(FEAT_GUI_GTK ) || defined(FEAT_GUI_MACVIM ) || defined(PROTO )
4454+ static int xim_has_preediting INIT (= FALSE); /* IM current status */
4455+
44514456static int im_is_active = FALSE; /* IM is enabled for current mode */
44524457static int preedit_is_active = FALSE;
44534458
44544459static unsigned long im_commit_handler_id = 0 ;
44554460# ifndef FEAT_GUI_MACVIM
44564461static unsigned int im_activatekey_keyval = GDK_VoidSymbol ;
44574462static unsigned int im_activatekey_state = 0 ;
4458- # endif
4459-
4460- static GtkWidget * preedit_window = NULL ;
4461- static GtkWidget * preedit_label = NULL ;
4462-
4463- static void im_preedit_window_set_position (void );
44644463
44654464static GtkWidget * preedit_window = NULL ;
44664465static GtkWidget * preedit_label = NULL ;
@@ -4499,8 +4498,6 @@ im_set_active(int active)
44994498{
45004499 if (gui .in_use )
45014500 gui_im_set_active (active );
4502- else
4503- uimfep_set_active (active );
45044501}
45054502# endif
45064503
@@ -4536,7 +4533,6 @@ im_set_position(int row, int col)
45364533 im_preedit_window_set_position ();
45374534 }
45384535}
4539- # endif
45404536
45414537# if 0 || defined(PROTO ) /* apparently only used in gui_x11.c */
45424538 void
@@ -4561,31 +4557,8 @@ im_add_to_input(char_u *str, int len)
45614557 if (input_conv .vc_type != CONV_NONE )
45624558 vim_free (str );
45634559
4564- # ifndef FEAT_GUI_MACVIM
45654560 if (p_mh ) /* blank out the pointer if necessary */
45664561 gui_mch_mousehide (TRUE);
4567- # endif
4568- }
4569-
4570- static void
4571- im_preedit_window_set_position (void )
4572- {
4573- int x , y , w , h , sw , sh ;
4574-
4575- if (preedit_window == NULL )
4576- return ;
4577-
4578- sw = gdk_screen_get_width (gtk_widget_get_screen (preedit_window ));
4579- sh = gdk_screen_get_height (gtk_widget_get_screen (preedit_window ));
4580- gdk_window_get_origin (gui .drawarea -> window , & x , & y );
4581- gtk_window_get_size (GTK_WINDOW (preedit_window ), & w , & h );
4582- x = x + FILL_X (gui .col );
4583- y = y + FILL_Y (gui .row );
4584- if (x + w > sw )
4585- x = sw - w ;
4586- if (y + h > sh )
4587- y = sh - h ;
4588- gtk_window_move (GTK_WINDOW (preedit_window ), x , y );
45894562}
45904563
45914564 static void
@@ -4608,10 +4581,12 @@ im_preedit_window_set_position(void)
46084581 y = sh - h ;
46094582 gtk_window_move (GTK_WINDOW (preedit_window ), x , y );
46104583}
4584+ # endif
46114585
46124586 static void
46134587im_preedit_window_open ()
46144588{
4589+ # ifndef FEAT_GUI_MACVIM
46154590 char * preedit_string ;
46164591 char buf [8 ];
46174592 PangoAttrList * attr_list ;
@@ -4655,22 +4630,27 @@ im_preedit_window_open()
46554630
46564631 g_free (preedit_string );
46574632 pango_attr_list_unref (attr_list );
4633+ # endif
46584634}
46594635
46604636 static void
46614637im_preedit_window_close ()
46624638{
4639+ # ifndef FEAT_GUI_MACVIM
46634640 if (preedit_window != NULL )
46644641 gtk_widget_hide (preedit_window );
4642+ # endif
46654643}
46664644
46674645 static void
46684646im_show_preedit ()
46694647{
46704648 im_preedit_window_open ();
46714649
4650+ # ifndef FEAT_GUI_MACVIM
46724651 if (p_mh ) /* blank out the pointer if necessary */
46734652 gui_mch_mousehide (TRUE);
4653+ # endif
46744654}
46754655
46764656 static void
@@ -4806,9 +4786,6 @@ im_preedit_end_macvim()
48064786im_preedit_abandon_macvim ()
48074787{
48084788 /* Abandon preedit text, don't send any backspace sequences. */
4809- im_preedit_cursor = 0 ;
4810- im_preedit_trailing = 0 ;
4811-
48124789 im_preedit_end_macvim ();
48134790}
48144791#endif
@@ -4862,6 +4839,7 @@ im_preedit_changed_macvim(char *preedit_string, int start_index, int cursor_inde
48624839 char * preedit_string = NULL ;
48634840
48644841 gtk_im_context_get_preedit_string (context , & preedit_string , NULL , NULL );
4842+ #endif
48654843
48664844#ifdef XIM_DEBUG
48674845 xim_log ("im_preedit_changed_cb(): %s\n" , preedit_string );
@@ -4879,6 +4857,13 @@ im_preedit_changed_macvim(char *preedit_string, int start_index, int cursor_inde
48794857 xim_has_preediting = TRUE;
48804858 im_show_preedit ();
48814859 }
4860+
4861+ # ifndef FEAT_GUI_MACVIM
4862+ g_free (preedit_string );
4863+
4864+ if (gtk_main_level () > 0 )
4865+ gtk_main_quit ();
4866+ # endif
48824867}
48834868
48844869 void
@@ -5240,7 +5225,7 @@ im_get_status(void)
52405225 if (gui .in_use )
52415226 return gui_im_get_status ();
52425227 else
5243- return uimfep_get_status () ;
5228+ return im_is_active ;
52445229}
52455230# endif
52465231
0 commit comments