[uim-commit] r1124 - trunk/gtk
tkng at freedesktop.org
tkng at freedesktop.org
Sat Aug 6 05:02:50 EST 2005
Author: tkng
Date: 2005-08-05 12:02:33 -0700 (Fri, 05 Aug 2005)
New Revision: 1124
Modified:
trunk/gtk/caret-state-indicator.c
trunk/gtk/caret-state-indicator.h
trunk/gtk/gtk-im-uim.c
Log:
* gtk/caret-state-indicator.c:
-(caret_state_indicator_set_timeout): New function to set timeout.
-(caret_state_indicator_update): Added NULL check for str.
* gtk/gtk-im-uim.c:
-(im_uim_commit_string): Update caret-state-indicator position when commit event occured.
-(update_prop_label_cb): Call caret_state_indicator_set_timeout to set timeout.
Modified: trunk/gtk/caret-state-indicator.c
===================================================================
--- trunk/gtk/caret-state-indicator.c 2005-08-05 18:55:15 UTC (rev 1123)
+++ trunk/gtk/caret-state-indicator.c 2005-08-05 19:02:33 UTC (rev 1124)
@@ -67,14 +67,16 @@
GtkWidget *label = g_object_get_data(G_OBJECT(window), "label");
gint cursor_x = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(window), "cursor_x"));
gint cursor_y = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(window), "cursor_y"));
- gchar **labels;
- labels = g_strsplit(str, "\t", 2);
+ if(str) {
+ gchar **labels;
+
+ labels = g_strsplit(str, "\t", 2);
+
+ gtk_label_set_text(GTK_LABEL(label), labels[0]);
+ g_strfreev(labels);
+ }
gtk_window_move(GTK_WINDOW(window), topwin_x + cursor_x, topwin_y + cursor_y + 3);
- gtk_label_set_text(GTK_LABEL(label), labels[0]);
- g_strfreev(labels);
- gtk_widget_show_all(window);
- g_timeout_add(2000, caret_state_indicator_timeout, (gpointer)window);
}
void
@@ -86,6 +88,13 @@
GINT_TO_POINTER(cursor_location->y+cursor_location->height));
}
+
+void
+caret_state_indicator_set_timeout(GtkWidget *window, gint timeout)
+{
+ g_timeout_add(timeout, caret_state_indicator_timeout, (gpointer)window);
+}
+
static gint
caret_state_indicator_timeout(gpointer data)
{
Modified: trunk/gtk/caret-state-indicator.h
===================================================================
--- trunk/gtk/caret-state-indicator.h 2005-08-05 18:55:15 UTC (rev 1123)
+++ trunk/gtk/caret-state-indicator.h 2005-08-05 19:02:33 UTC (rev 1124)
@@ -40,3 +40,6 @@
void
caret_state_indicator_set_cursor_location(GtkWidget *window, GdkRectangle *cursor_location);
+
+void
+caret_state_indicator_set_timeout(GtkWidget *window, gint timeout);
Modified: trunk/gtk/gtk-im-uim.c
===================================================================
--- trunk/gtk/gtk-im-uim.c 2005-08-05 18:55:15 UTC (rev 1123)
+++ trunk/gtk/gtk-im-uim.c 2005-08-05 19:02:33 UTC (rev 1124)
@@ -159,8 +159,17 @@
im_uim_commit_string(void *ptr, const char *str)
{
IMUIMContext *uic = (IMUIMContext *)ptr;
+ uim_bool show_state;
+ gint x, y;
+
g_return_if_fail(str);
g_signal_emit_by_name(uic, "commit", str);
+
+ show_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
+ if (show_state == UIM_TRUE) {
+ gdk_window_get_origin(uic->win, &x, &y);
+ caret_state_indicator_update(uic->caret_state_indicator, x, y, NULL);
+ }
}
static void
@@ -729,8 +738,13 @@
show_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
if (show_state == UIM_TRUE) {
+ gint timeout;
gdk_window_get_origin(uic->win, &x, &y);
caret_state_indicator_update(uic->caret_state_indicator, x, y, str);
+ timeout = uim_scm_symbol_value_int("bridge-show-input-state-time-length");
+ if(timeout != 0)
+ caret_state_indicator_set_timeout(uic->caret_state_indicator, timeout * 1000);
+ gtk_widget_show_all(uic->caret_state_indicator);
}
}
More information about the uim-commit
mailing list