diff -upr uim-1.8.0.org//gtk2/candwin/gtk.c uim-1.8.0//gtk2/candwin/gtk.c --- uim-1.8.0.org//gtk2/candwin/gtk.c 2012-03-30 22:01:28.000000000 +0900 +++ uim-1.8.0//gtk2/candwin/gtk.c 2012-05-09 00:46:01.000000000 +0900 @@ -44,6 +44,10 @@ #include #include #include +#if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ +# include +# include +#endif #include "../gtk2/immodule/caret-state-indicator.h" @@ -625,6 +629,9 @@ candwin_activate(gchar **str) uim_cand_win_gtk_set_page(cwin, 0); update_label(cwin); + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"candwin_activate(): gtk_widget_show_all()\n" ); + #endif gtk_widget_show_all(GTK_WIDGET(cwin)); cwin->is_active = TRUE; } @@ -653,6 +660,9 @@ static void candwin_show(void) { if (cwin->is_active) { + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"candwin_show(): gtk_widget_show_all()\n" ); + #endif gtk_widget_show_all(GTK_WIDGET(cwin)); if (cwin->sub_window.active) gtk_widget_show(cwin->sub_window.window); @@ -662,22 +672,58 @@ candwin_show(void) static void candwin_deactivate(void) { + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"candwin_deactivate(): gtk_widget_hide()\n" ); + #endif gtk_widget_hide(GTK_WIDGET(cwin)); cwin->is_active = FALSE; if (cwin->sub_window.window) gtk_widget_hide(cwin->sub_window.window); } +#if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ +static int caret_state_flag = 0; +#endif + static void caret_state_show(gchar **str) { int timeout; + #if 0 /* Patched by G-HAL, 2009/01/18 */ sscanf(str[1], "%d", &timeout); caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, str[2]); if (timeout != 0) caret_state_indicator_set_timeout(cwin->caret_state_indicator, timeout * 1000); gtk_widget_show_all(GTK_WIDGET(cwin->caret_state_indicator)); + #else + if ('\0' != (*(str[1]))) { + const int ret = sscanf(str[1], "%d", &timeout); + if (ret < 1) { + timeout = 0; + } + } else { + timeout = 0; + } + caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, str[2]); + if (0 < timeout) { + caret_state_indicator_set_timeout(cwin->caret_state_indicator, timeout * 1000); + } else { + caret_state_indicator_set_timeout(cwin->caret_state_indicator, -1); + } + if (0 <= timeout) { + #if defined(DEBUG) + syslog(LOG_DEBUG,"caret_state_show(): gtk_widget_show_all()\n" ); + caret_state_flag = 1; + #endif + gtk_widget_show_all(GTK_WIDGET(cwin->caret_state_indicator)); + } else { + #if defined(DEBUG) + syslog(LOG_DEBUG,"caret_state_show(): gtk_widget_hide_all()\n" ); + #endif + gtk_widget_hide(GTK_WIDGET(cwin->caret_state_indicator)); + } + #endif } static void @@ -689,7 +735,15 @@ caret_state_update() static void caret_state_hide() { + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + if (caret_state_flag) { + syslog(LOG_DEBUG,"caret_state_hide(): gtk_widget_hide()\n" ); + caret_state_flag = 0; + gtk_widget_hide(cwin->caret_state_indicator); + } + #else gtk_widget_hide(cwin->caret_state_indicator); + #endif } static void @@ -792,6 +846,9 @@ candwin_show_page(gchar **str) sscanf(str[1], "%d", &page); uim_cand_win_gtk_set_page(cwin, page); + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"candwin_show_page(): gtk_widget_show_all()\n" ); + #endif gtk_widget_show_all(GTK_WIDGET(cwin)); } @@ -811,6 +868,9 @@ static void str_parse(gchar *str) } else if (strcmp("show", command) == 0) { candwin_show(); } else if (strcmp("hide", command) == 0) { + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"str_parse(): gtk_widget_hide()\n" ); + #endif gtk_widget_hide(GTK_WIDGET(cwin)); if (cwin->sub_window.window) gtk_widget_hide(cwin->sub_window.window); diff -upr uim-1.8.0.org//gtk2/immodule/caret-state-indicator.c uim-1.8.0//gtk2/immodule/caret-state-indicator.c --- uim-1.8.0.org//gtk2/immodule/caret-state-indicator.c 2012-03-30 22:01:28.000000000 +0900 +++ uim-1.8.0//gtk2/immodule/caret-state-indicator.c 2012-05-09 00:42:24.000000000 +0900 @@ -34,6 +34,10 @@ #include #include +#if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ +# include +# include +#endif #include "uim/uim.h" #include "uim/uim-helper.h" @@ -71,8 +75,17 @@ caret_state_indicator_timeout(gpointer d "called_time")); current_time = get_current_time(); + #if 0 /* Patched by G-HAL, 2009/01/18 */ if ((current_time - called_time) * 1000 >= timeout) gtk_widget_hide(window); + #else + if ((0 < timeout) && (timeout <= ((current_time - called_time) * 1000))) { + # if defined(DEBUG) + syslog(LOG_DEBUG,"caret_state_indicator_timeout(): gtk_widget_hide()\n" ); + # endif + gtk_widget_hide(window); + } + #endif g_object_set_data(G_OBJECT(window), "timeout-tag", GUINT_TO_POINTER(0)); @@ -213,8 +226,30 @@ caret_state_indicator_update(GtkWidget * g_strfreev(cols); } + #if 0 /* Patched by G-HAL, 2009/01/18 */ gtk_window_move(GTK_WINDOW(window), topwin_x + cursor_x, topwin_y + cursor_y + 3); + #else + { + gint pos_x = topwin_x + cursor_x; + gint pos_y = topwin_y + cursor_y + 16; + gint size_x, size_y; + gint limit_x, limit_y; + gtk_window_get_size(GTK_WINDOW(window), &size_x, &size_y); + limit_x = gdk_screen_get_width(gdk_screen_get_default()) - size_x; + limit_y = gdk_screen_get_height(gdk_screen_get_default()) - size_y; + if (limit_x < pos_x) { + pos_x -= size_x; + if (limit_x < pos_x) { + pos_x = limit_x; + } + } + if (limit_y < pos_y) { + pos_y -= (16 + size_y + 32); + } + gtk_window_move(GTK_WINDOW(window), pos_x, pos_y); + } + #endif } void diff -upr uim-1.8.0.org//gtk2/immodule/gtk-im-uim.c uim-1.8.0//gtk2/immodule/gtk-im-uim.c --- uim-1.8.0.org//gtk2/immodule/gtk-im-uim.c 2012-03-30 22:01:28.000000000 +0900 +++ uim-1.8.0//gtk2/immodule/gtk-im-uim.c 2012-05-09 00:42:24.000000000 +0900 @@ -48,6 +48,10 @@ #include #include #include +#if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ +# include +# include +#endif #include "uim/uim.h" #include "uim/uim-util.h" @@ -313,9 +317,15 @@ show_preedit(GtkIMContext *ic, GtkWidget pango_layout_get_pixel_size(layout, &w, &h); gtk_window_resize(GTK_WINDOW(preedit_window), w, h); + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"show_preedit(): gtk_widget_show()\n" ); + #endif gtk_widget_show(preedit_window); } else { gtk_label_set_text(GTK_LABEL(preedit_label), ""); + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"show_preedit(): gtk_widget_hide()\n" ); + #endif gtk_widget_hide(preedit_window); gtk_window_resize(GTK_WINDOW(preedit_window), 1, 1); } @@ -702,6 +712,11 @@ update_prop_list_cb(void *ptr, const cha if (uic->win) { if (show_state && !(show_state_mode && !show_state_mode_on)) { + #if 0 /* Patched by G-HAL, 2009/01/18 */ + #else + gint timeout_at_off; + gint timeout_at_on; + #endif gint timeout; gint x, y; GString *label; @@ -710,6 +725,7 @@ update_prop_list_cb(void *ptr, const cha label = get_caret_state_label_from_prop_list(str); caret_state_indicator_update(uic->caret_state_indicator, x, y, label->str); g_string_free(label, TRUE); + #if 0 /* Patched by G-HAL, 2009/01/18 */ if (strcmp(show_state_with, "time") == 0) timeout = uim_scm_symbol_value_int("bridge-show-input-state-time-length"); else @@ -719,6 +735,49 @@ update_prop_list_cb(void *ptr, const cha caret_state_indicator_set_timeout(uic->caret_state_indicator, timeout * 1000); gtk_widget_show_all(uic->caret_state_indicator); + #else + timeout_at_off = uim_scm_symbol_value_int("bridge-show-input-state-time-length-at-off"); + timeout_at_on = uim_scm_symbol_value_int("bridge-show-input-state-time-length-at-on"); + if ((0 == timeout_at_off) && (0 == timeout_at_on)) { + if (strcmp(show_state_with, "time") == 0) { + timeout = uim_scm_symbol_value_int("bridge-show-input-state-time-length"); + } else { + timeout = 0; + } + + if (timeout != 0) { + caret_state_indicator_set_timeout(uic->caret_state_indicator, + timeout * 1000); + } + gtk_widget_show_all(uic->caret_state_indicator); + } else { + timeout = timeout_at_on; + if (strstr(str, "branch\tja_direct\t")) { + timeout = timeout_at_off; + } + + if (0 < timeout) { + caret_state_indicator_set_timeout(uic->caret_state_indicator, timeout * 1000); + # if defined(DEBUG) + syslog(LOG_DEBUG,"update_prop_list_cb(): timeout:%d\n", timeout ); + # endif + gtk_widget_show_all(uic->caret_state_indicator); + } else { + caret_state_indicator_set_timeout(uic->caret_state_indicator, -1); + if (0 == timeout) { + # if defined(DEBUG) + syslog(LOG_DEBUG,"update_prop_list_cb(): gtk_widget_show_all()\n" ); + # endif + gtk_widget_show_all(uic->caret_state_indicator); + } else { + # if defined(DEBUG) + syslog(LOG_DEBUG,"update_prop_list_cb(): gtk_widget_hide()\n" ); + # endif + gtk_widget_hide(uic->caret_state_indicator); + } + } + } + #endif } else if (show_state_mode && !show_state_mode_on) { gtk_widget_hide(uic->caret_state_indicator); } @@ -799,6 +858,9 @@ cand_activate_cb(void *ptr, int nr, int #endif /* IM_UIM_USE_NEW_PAGE_HANDLING */ layout_candwin(uic); + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"cand_activate_cb(): gtk_widget_show()\n" ); + #endif gtk_widget_show(GTK_WIDGET(uic->cwin)); if (uic->win) { @@ -1420,12 +1482,30 @@ im_uim_focus_in(GtkIMContext *ic) uim_prop_list_update(uic->uc); for (cc = context_list.next; cc != &context_list; cc = cc->next) { + #if 0 /* Patched by G-HAL, 2009/01/18 */ if (cc != uic && cc->cwin) gtk_widget_hide(GTK_WIDGET(cc->cwin)); + #else + if (cc != uic && cc->cwin) { + # if defined(DEBUG) + syslog(LOG_DEBUG,"im_uim_focus_in(): gtk_widget_hide()\n" ); + # endif + gtk_widget_hide(GTK_WIDGET(cc->cwin)); + } + #endif } + #if 0 /* Patched by G-HAL, 2009/01/18 */ if (uic->cwin && uic->cwin_is_active) gtk_widget_show(GTK_WIDGET(uic->cwin)); + #else + if (uic->cwin && uic->cwin_is_active) { + # if defined(DEBUG) + syslog(LOG_DEBUG,"im_uim_focus_in(): gtk_widget_show()\n" ); + # endif + gtk_widget_show(GTK_WIDGET(uic->cwin)); + } + #endif uim_focus_in_context(uic->uc); } @@ -1449,8 +1529,21 @@ im_uim_focus_out(GtkIMContext *ic) check_helper_connection(); uim_helper_client_focus_out(uic->uc); + #if 0 /* Patched by G-HAL, 2009/01/18 */ if (uic->cwin) gtk_widget_hide(GTK_WIDGET(uic->cwin)); + #else + if (uic->cwin) { + # if defined(DEBUG) + syslog(LOG_DEBUG,"im_uim_focus_out(): gtk_widget_hide()\n" ); + # endif + gtk_widget_hide(GTK_WIDGET(uic->cwin)); + } + + # if defined(DEBUG) + syslog(LOG_DEBUG,"im_uim_focus_out(): gtk_widget_hide()\n" ); + # endif + #endif gtk_widget_hide(uic->caret_state_indicator); } @@ -1490,6 +1583,9 @@ im_uim_set_use_preedit(GtkIMContext *ic, uic->preedit_window = gtk_window_new(GTK_WINDOW_POPUP); preedit_label = gtk_label_new(""); gtk_container_add(GTK_CONTAINER(uic->preedit_window), preedit_label); + #if defined(DEBUG) /* Patched by G-HAL, 2009/01/18 */ + syslog(LOG_DEBUG,"im_uim_set_use_preedit(): gtk_widget_show()\n" ); + #endif gtk_widget_show(preedit_label); } uic->preedit_handler_id = diff -upr uim-1.8.0.org//xim/ximserver.cpp uim-1.8.0//xim/ximserver.cpp --- uim-1.8.0.org//xim/ximserver.cpp 2012-03-30 22:01:28.000000000 +0900 +++ uim-1.8.0//xim/ximserver.cpp 2012-05-08 23:01:54.000000000 +0900 @@ -1164,6 +1164,7 @@ void InputContext::update_prop_list(cons uim_bool show_caret_mode = (strcmp(show_caret_with, "mode") == 0); uim_bool show_caret_mode_on = uim_scm_symbol_value_bool("bridge-show-input-state-mode-on?"); + #if 0 /* Patched by G-HAL, 2009/01/18 */ if (show_caret_state == UIM_TRUE && !(show_caret_mode && !show_caret_mode_on)) { char *label; int timeout; @@ -1184,6 +1185,47 @@ void InputContext::update_prop_list(cons disp->hide_caret_state(); } free(show_caret_with); + #else + char *label = get_caret_state_label_from_prop_list(str); + int timeout_at_off = uim_scm_symbol_value_int("bridge-show-input-state-time-length-at-off"); + int timeout_at_on = uim_scm_symbol_value_int("bridge-show-input-state-time-length-at-on"); + int timeout; + Canddisp *disp = canddisp_singleton(); + + if ((0 == timeout_at_off) && (0 == timeout_at_on)) { + if (show_caret_state == UIM_TRUE && !(show_caret_mode && !show_caret_mode_on)) { + Canddisp *disp = canddisp_singleton(); + + if (strcmp(show_caret_with, "time") == 0) { + timeout = static_cast(uim_scm_symbol_value_int("bridge-show-input-state-time-length")); + } else { + timeout = 0; + } + + disp->show_caret_state(label, timeout); + mCaretStateShown = true; + } else if (show_caret_mode && !show_caret_mode_on) { + Canddisp *disp = canddisp_singleton(); + disp->hide_caret_state(); + } + } else { + if (show_caret_state == UIM_TRUE) { + timeout = timeout_at_on; + if (strstr(str, "branch\tja_direct\t")) { + timeout = timeout_at_off; + } + if (0 <= timeout) { + disp->show_caret_state(label, timeout); + mCaretStateShown = true; + } else if (mCaretStateShown) { + disp->show_caret_state(label, -1); + mCaretStateShown = false; + } + } + } + free(show_caret_with); + free(label); + #endif #endif }