@@ -4448,9 +4448,6 @@ iconv_end()
44484448# define g_return_if_fail (x ) if (!(x)) return;
44494449# endif
44504450
4451- # if defined(FEAT_GUI_GTK ) || defined(FEAT_GUI_MACVIM ) || defined(PROTO )
4452- static int xim_has_preediting INIT (= FALSE); /* IM current status */
4453-
44544451static int im_is_active = FALSE; /* IM is enabled for current mode */
44554452static int preedit_is_active = FALSE;
44564453
@@ -4463,6 +4460,11 @@ static unsigned int im_activatekey_state = 0;
44634460static GtkWidget * preedit_window = NULL ;
44644461static GtkWidget * preedit_label = NULL ;
44654462
4463+ static void im_preedit_window_set_position (void );
4464+
4465+ static GtkWidget * preedit_window = NULL ;
4466+ static GtkWidget * preedit_label = NULL ;
4467+
44664468static void im_preedit_window_set_position (void );
44674469
44684470 void
@@ -4570,6 +4572,27 @@ im_preedit_window_set_position(void)
45704572{
45714573 int x , y , w , h , sw , sh ;
45724574
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 );
4589+ }
4590+
4591+ static void
4592+ im_preedit_window_set_position (void )
4593+ {
4594+ int x , y , w , h , sw , sh ;
4595+
45734596 if (preedit_window == NULL )
45744597 return ;
45754598
@@ -4856,13 +4879,6 @@ im_preedit_changed_macvim(char *preedit_string, int start_index, int cursor_inde
48564879 xim_has_preediting = TRUE;
48574880 im_show_preedit ();
48584881 }
4859-
4860- # ifndef FEAT_GUI_MACVIM
4861- g_free (preedit_string );
4862-
4863- if (gtk_main_level () > 0 )
4864- gtk_main_quit ();
4865- # endif
48664882}
48674883
48684884 void
0 commit comments