[uim-commit] r1131 - in trunk: helper xim
ekato at freedesktop.org
ekato at freedesktop.org
Sat Aug 6 12:18:46 EST 2005
Author: ekato
Date: 2005-08-05 19:18:43 -0700 (Fri, 05 Aug 2005)
New Revision: 1131
Modified:
trunk/helper/helper-candwin-gtk.c
trunk/xim/canddisp.cpp
trunk/xim/canddisp.h
trunk/xim/convdisp.cpp
trunk/xim/convdisp.h
trunk/xim/ximserver.cpp
Log:
* helper/helper-candwin-gtk.c : Sync with updated
caret-state-indicator.
(candidate_window_init) : Set cursor_location here.
(candwin_move) : Move code for cursor_location handling into
candidate_window_init().
(caret_state_show) : Use timeout value.
(caret_state_update) : New function to update position of the
indicator.
* xim/ximserver.cpp (InputContext::candidate_update) : Show
candidate explicitly.
(InputContext::update_prop_label) : Use timeout value.
* xim/convdisp.cpp (class ConvdispOv) : Add update_caret_state
member.
(class ConvdispRw) : Ditto.
(class ConvdispOs) : Ditto.
(ConvdispRw::update_caret_state) : New.
(ConvdispOv::update_caret_state) : Ditto.
(ConvdispOs::update_caret_state) : Ditto.
(ConvdispOv::update_icxatr) : Call update_caret_state().
* xim/canddisp.cpp (Canddisp::show_caret_state) : Use timeout
value.
(Canddisp::update_caret_state) : New.
* xim/canddisp.h (class Canddisp) : Add update_caret_state member.
* xim/convdisp.h (class Convdisp) : Ditto.
Modified: trunk/helper/helper-candwin-gtk.c
===================================================================
--- trunk/helper/helper-candwin-gtk.c 2005-08-06 00:52:24 UTC (rev 1130)
+++ trunk/helper/helper-candwin-gtk.c 2005-08-06 02:18:43 UTC (rev 1131)
@@ -307,6 +307,7 @@
GtkTreeViewColumn *column;
GtkWidget *vbox;
GtkTreeSelection *selection;
+ GdkRectangle cursor_location;
vbox = gtk_vbox_new(FALSE, 0);
@@ -371,6 +372,11 @@
cwin->is_active = FALSE;
cwin->caret_state_indicator = caret_state_indicator_new();
+ cursor_location.x = 0;
+ cursor_location.y = 0;
+ cursor_location.height = 0;
+ caret_state_indicator_set_cursor_location(cwin->caret_state_indicator, &cursor_location);
+
gtk_widget_show(cwin->scrolled_window);
gtk_widget_show(cwin->view);
gtk_widget_show(cwin->num_label);
@@ -487,17 +493,10 @@
static void
candwin_move(char **str)
{
- GdkRectangle cursor_location;
-
sscanf(str[1], "%d", &cwin->pos_x);
sscanf(str[2], "%d", &cwin->pos_y);
- cursor_location.x = 0;
- cursor_location.y = 0;
- cursor_location.height = 0;
-
uim_cand_win_gtk_layout();
- caret_state_indicator_set_cursor_location(cwin->caret_state_indicator, &cursor_location);
}
static void
@@ -517,10 +516,21 @@
static void
caret_state_show(gchar **str)
{
- caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, str[1]);
- gtk_widget_show(GTK_WIDGET(cwin->caret_state_indicator));
+ int timeout;
+
+ 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));
}
+static void
+caret_state_update()
+{
+ caret_state_indicator_update(cwin->caret_state_indicator, cwin->pos_x, cwin->pos_y, NULL);
+}
+
static void str_parse(gchar *str)
{
gchar **tmp;
@@ -544,6 +554,8 @@
candwin_deactivate();
} else if (strcmp("show_caret_state", command) == 0) {
caret_state_show(tmp);
+ } else if (strcmp("update_caret_state", command) == 0) {
+ caret_state_update();
}
}
g_strfreev(tmp);
Modified: trunk/xim/canddisp.cpp
===================================================================
--- trunk/xim/canddisp.cpp 2005-08-06 00:52:24 UTC (rev 1130)
+++ trunk/xim/canddisp.cpp 2005-08-06 02:18:43 UTC (rev 1131)
@@ -178,17 +178,26 @@
check_connection();
}
-void Canddisp::show_caret_state(const char *str)
+void Canddisp::show_caret_state(const char *str, int timeout)
{
if (!candwin_w)
return;
fprintf(candwin_w, "show_caret_state\n");
+ fprintf(candwin_w, "%d\n", timeout);
fprintf(candwin_w, "%s", str);
- fprintf(candwin_w, "\n");
fflush(candwin_w);
check_connection();
}
+void Canddisp::update_caret_state()
+{
+ if (!candwin_w)
+ return;
+ fprintf(candwin_w, "update_caret_state\n\n");
+ fflush(candwin_w);
+ check_connection();
+}
+
void Canddisp::check_connection()
{
if (errno == EBADF || errno == EPIPE) {
Modified: trunk/xim/canddisp.h
===================================================================
--- trunk/xim/canddisp.h 2005-08-06 00:52:24 UTC (rev 1130)
+++ trunk/xim/canddisp.h 2005-08-06 02:18:43 UTC (rev 1131)
@@ -46,7 +46,8 @@
void show();
void hide();
void move(int x, int y);
- void show_caret_state(const char *str);
+ void show_caret_state(const char *str, int timeout);
+ void update_caret_state();
private:
void check_connection();
};
Modified: trunk/xim/convdisp.cpp
===================================================================
--- trunk/xim/convdisp.cpp 2005-08-06 00:52:24 UTC (rev 1130)
+++ trunk/xim/convdisp.cpp 2005-08-06 02:18:43 UTC (rev 1131)
@@ -265,6 +265,7 @@
virtual void clear_preedit();
virtual void update_icxatr();
virtual void move_candwin();
+ virtual void update_caret_state();
virtual void set_im_lang(const char *im_lang);
virtual bool use_xft();
private:
@@ -296,6 +297,7 @@
virtual void clear_preedit();
virtual void update_icxatr();
virtual void move_candwin();
+ virtual void update_caret_state();
virtual bool use_xft();
private:
PeLineWin *mPeWin;
@@ -309,6 +311,7 @@
virtual void clear_preedit();
virtual void update_icxatr();
virtual void move_candwin();
+ virtual void update_caret_state();
virtual bool use_xft();
private:
@@ -987,6 +990,10 @@
{
}
+void ConvdispRw::update_caret_state()
+{
+}
+
void ConvdispRw::move_candwin()
{
if (m_atr->has_atr(ICA_ClientWindow)) {
@@ -1037,6 +1044,17 @@
move_candwin();
}
+void ConvdispOv::update_caret_state()
+{
+ Canddisp *disp = canddisp_singleton();
+ InputContext *focusedContext = InputContext::focusedContext();
+
+ if (focusedContext && !focusedContext->hasActiveCandwin()) {
+ move_candwin();
+ disp->update_caret_state();
+ }
+}
+
void ConvdispOv::move_candwin()
{
if (m_atr->has_atr(ICA_SpotLocation) ) {
@@ -1115,6 +1133,12 @@
void ConvdispOv::update_icxatr()
{
+
+ if (m_atr->is_changed(ICA_SpotLocation)) {
+ update_caret_state();
+ m_atr->unset_change_mask(ICA_SpotLocation);
+ }
+
if (!m_ov_win)
return;
@@ -1150,7 +1174,7 @@
m_atr->unset_change_mask(ICA_FontSet);
}
- update_preedit();
+ draw_preedit();
}
void ConvdispOv::draw_preedit()
@@ -1510,7 +1534,11 @@
mConn->push_passive_packet(t);
}
}
-
+
+void ConvdispOs::update_caret_state()
+{
+}
+
void ConvdispOs::move_candwin()
{
if (m_atr->has_atr(ICA_ClientWindow)) {
Modified: trunk/xim/convdisp.h
===================================================================
--- trunk/xim/convdisp.h 2005-08-06 00:52:24 UTC (rev 1130)
+++ trunk/xim/convdisp.h 2005-08-06 02:18:43 UTC (rev 1131)
@@ -53,6 +53,7 @@
virtual void clear_preedit() = 0;
virtual void update_icxatr() = 0;
virtual void move_candwin() = 0;
+ virtual void update_caret_state() = 0;
virtual void set_im_lang(const char *im_lang);
virtual void set_locale_name(const char *locale);
virtual const char *get_locale_name();
Modified: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp 2005-08-06 00:52:24 UTC (rev 1130)
+++ trunk/xim/ximserver.cpp 2005-08-06 02:18:43 UTC (rev 1131)
@@ -675,6 +675,7 @@
disp->activate(active_candidates, mDisplayLimit);
disp->select(current_cand_selection);
+ disp->show();
}
void InputContext::candidate_select(int index)
@@ -753,8 +754,9 @@
free(buf);
if (show_caret_state == UIM_TRUE) {
+ int timeout = uim_scm_symbol_value_int("bridge-show-input-state-time-length");
Canddisp *disp = canddisp_singleton();
- disp->show_caret_state(str);
+ disp->show_caret_state(str, timeout);
}
}
More information about the uim-commit
mailing list