[uim-commit] r1157 - in branches/r5rs: . doc fep gtk helper scm uim
xim
tkng at freedesktop.org
tkng at freedesktop.org
Mon Aug 8 02:12:49 EST 2005
Author: tkng
Date: 2005-08-07 09:12:43 -0700 (Sun, 07 Aug 2005)
New Revision: 1157
Added:
branches/r5rs/uim.desktop.in
Removed:
branches/r5rs/uim.desktop
Modified:
branches/r5rs/
branches/r5rs/configure.ac
branches/r5rs/doc/HELPER-CANDWIN
branches/r5rs/fep/escseq.c
branches/r5rs/fep/uim-fep.c
branches/r5rs/gtk/gtk-im-uim.c
branches/r5rs/helper/eggtrayicon.c
branches/r5rs/helper/helper-candwin-gtk.c
branches/r5rs/scm/custom.scm
branches/r5rs/scm/im-custom.scm
branches/r5rs/uim/Makefile.am
branches/r5rs/uim/uim-helper-server.c
branches/r5rs/xim/canddisp.cpp
branches/r5rs/xim/canddisp.h
branches/r5rs/xim/convdisp.cpp
branches/r5rs/xim/convdisp.h
branches/r5rs/xim/helper.cpp
branches/r5rs/xim/ximserver.cpp
Log:
r2777 at t42 (orig r1126): tkng | 2005-08-06 04:58:00 +0900
* scm/custom.scm: This commit will fix the bug #3953.
See https://bugs.freedesktop.org/show_bug.cgi?id=3953 for more details.
-(custom-group-label): Added a NULL check.
-(custom-group-desc): Added a NULL check.
r2778 at t42 (orig r1127): tkng | 2005-08-06 05:04:08 +0900
* scm/custom.scm:
-(custom-group-label, custom-group-desc): Changed error messages a bit.
* scm/im-custom.scm: Added a new custom group 'preedit'.
r2780 at t42 (orig r1129): tkng | 2005-08-06 06:10:57 +0900
* configure.ac: Generate uim.desktop automatically.
* uim.desktop.in: New file.
* uim.desktop: Removed because it's already automatically
generated file.
r2781 at t42 (orig r1130): tkng | 2005-08-06 09:52:24 +0900
* scm/im-custom.scm:
-(bridge-show-input-state-time-length): Described long description.
r2782 at t42 (orig r1131): ekato | 2005-08-06 11:18:43 +0900
* 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.
r2783 at t42 (orig r1132): tkng | 2005-08-06 14:04:17 +0900
* helper/eggtrayicon.c: Added a function prototype to fix warning.
-(egg_tray_icon_new_for_xscreen): The prototype of this function is added.
But this function is not reffered from other file directory, maybe we
should mark this function static.
r2784 at t42 (orig r1133): ekato | 2005-08-06 15:23:56 +0900
* xim/canddisp.cpp (Canddisp::show_caret_state) : Terminate
helper candwin message properly.
r2785 at t42 (orig r1134): ekato | 2005-08-06 15:39:50 +0900
* doc/HELPER-CANDWIN : Update.
r2786 at t42 (orig r1135): yamamoto | 2005-08-06 15:49:01 +0900
uim/Makefile.am: add setenv.c to uim_module_manager_SOURCES
r2787 at t42 (orig r1136): yamamoto | 2005-08-06 15:54:49 +0900
fep/uim-fep.c (my_forkpty) : unset ISTRIP flag of slave's termio
r2788 at t42 (orig r1137): ekato | 2005-08-06 17:24:10 +0900
* helper/helper-candwin-gtk.c (caret_state_hide) : New.
(str_parse) : Handle "hide_caret_state" message.
* xim/ximserver.cpp (XimServer::customContext) : Check
"bridge-show-input-state?".
* xim/convdisp.cpp (ConvdispOv::update_icxatr) : Ditto.
* xim/canddisp.cpp (Canddisp::hide_caret_state) : New.
* xim/canddisp.h (class Canddisp) : Add hide_caret_state().
r2789 at t42 (orig r1138): yamamoto | 2005-08-06 18:26:59 +0900
escseq.c (put_save_cursor, put_restore_cursor): reset attribute mode
r2790 at t42 (orig r1139): ekato | 2005-08-06 21:14:48 +0900
* xim/convdisp.cpp (ConvdispOv::update_icxatr) : Update caret
state on focused context only.
r2791 at t42 (orig r1140): ekato | 2005-08-06 21:41:13 +0900
* xim/helper.cpp (helper_str_parse) : Hide caret state upon
receiving "focus_in".
* gtk/gtk-im-uim.c (im_uim_parse_helper_str) : Ditto.
r2792 at t42 (orig r1141): ekato | 2005-08-06 22:17:13 +0900
* gtk/gtk-im-uim.c (helper_str_parse) : Move code for hiding a
caret state indicator into focus_out().
(focus_out) : Hide caret state indicator here.
r2793 at t42 (orig r1142): ekato | 2005-08-06 23:04:34 +0900
* xim/convdisp.cpp (ConvdispOv::update_icxatr) : Invoke
move_candwin() with proper timing.
(ConvdispOv::update_caret_state) : Ditto.
r2799 at t42 (orig r1148): yamamoto | 2005-08-07 15:02:03 +0900
* fep/escseq.c (get_cursor_position) :
parse cursor report by own routine instead of sscanf
r2800 at t42 (orig r1149): yamamoto | 2005-08-07 16:41:44 +0900
escseq.c (put_save_cursor, put_restore_cursor):
revert the change of r1138
r2801 at t42 (orig r1150): tkng | 2005-08-07 17:23:09 +0900
* configure.ac: Version updated to 0.4.8.
r2804 at t42 (orig r1153): tkng | 2005-08-07 19:10:01 +0900
* uim/uim-helper-server.c:
All 'serv_fd' are replaced with 'server_fd' for improvement of readability.
-(init_server_fd): Renamed from init_serv_fd.
r2805 at t42 (orig r1154): tkng | 2005-08-07 19:18:58 +0900
* uim/uim-helper-server.c: This commit aims for refactoring.
-(accept_new_connection): New function.
-(uim_helper_server_process_connection): Replaced long acception code
with accept_new_connection.
Property changes on: branches/r5rs
___________________________________________________________________
Name: svk:merge
- fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:1124
+ fb73e508-85ea-0310-95c3-a85c473e0941:/trunk:1154
Modified: branches/r5rs/configure.ac
===================================================================
--- branches/r5rs/configure.ac 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/configure.ac 2005-08-07 16:12:43 UTC (rev 1157)
@@ -1,6 +1,6 @@
AC_PREREQ(2.57)
-AC_INIT([uim], 0.4.8beta1, [tkng at xem.jp])
+AC_INIT([uim], 0.4.8, [tkng at xem.jp])
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
AC_CONFIG_SRCDIR([COPYING])
@@ -774,7 +774,9 @@
examples/Makefile
examples/uim-custom/Makefile
pixmaps/Makefile
- uim.pc])
+ uim.pc
+ uim.desktop
+ ])
AC_OUTPUT
Modified: branches/r5rs/doc/HELPER-CANDWIN
===================================================================
--- branches/r5rs/doc/HELPER-CANDWIN 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/doc/HELPER-CANDWIN 2005-08-07 16:12:43 UTC (rev 1157)
@@ -21,11 +21,12 @@
show |
hide |
deactivate |
- show_caret_state) "\n" "\n"
+ show_caret_state |
+ update_caret_state) "\n"
charset_specifier = "charset=" charset "\n"
charset = "UTF-8" | "EUC-JP" | "GB18030" |
<or any name that can be specified as iconv_open(3) argument>
- str = str <any characters except for '\0', '\t' or '\n'> | ""
+ str = str <any characters except for '\0', '\t', or '\n'> | ""
num = /[0-9]+/
1. activate
@@ -45,12 +46,12 @@
2. select
Selecting the specified candidate in helper-candwin window.
- select = "select" "\n" num
+ select = "select" "\n" num "\n"
3. move
Moving the helper-candwin window.
- move = "move" "\n" XPos "\n" YPos
+ move = "move" "\n" XPos "\n" YPos "\n"
XPos = num
YPos = num
@@ -72,9 +73,15 @@
7. show_caret_state
Show caret state of the input mode
- show_caret_state = "show_caret_state" "\n" caret_state
- caret_state = "\n" str
+ show_caret_state = "show_caret_state" "\n" timeout "\n" caret_state "\n"
+ timeout = num
+ caret_state = str
+ 8. update_caret_state
+ Update caret state of the input mode
+
+ update_caret_state = "update_caret_state" "\n"
+
Sending Message format BNF
session = messages
messages = messages message | message
@@ -88,4 +95,4 @@
1. index
Sending index of selected candidate with mouse pointer to uim-xim.
- index = "index" "\n" num "\n\n"
+ index = "index" "\n" num "\n"
Modified: branches/r5rs/fep/escseq.c
===================================================================
--- branches/r5rs/fep/escseq.c 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/fep/escseq.c 2005-08-07 16:12:43 UTC (rev 1157)
@@ -476,6 +476,7 @@
if (g_opt.no_report_cursor) {
my_putp(save_cursor);
s_save_cursor = s_cursor;
+ /* put_exit_attribute_mode(); */
} else {
s_save_cursor = get_cursor_position();
}
@@ -495,12 +496,20 @@
/* DOS¥×¥í¥ó¥×¥È¤Ç¤Ï1²ó¤Îrestore_cursor¤Ç¤ÏÌá¤é¤Ê¤¤ */
my_putp(restore_cursor);
s_cursor = s_save_cursor;
+ /* DOS¥×¥í¥ó¥×¥È¤Ç¤Ï°À¤òÊݸ¤·¤Ê¤¤ */
+ /* put_exit_attribute_mode(); */
} else {
put_cursor_address_p(&s_save_cursor);
}
}
}
+#define range_check(i) do { \
+ if ((i) > escseq_len - 1) { \
+ goto retry; \
+ } \
+} while(FALSE)
+
/*
* ¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤òÊÖ¤¹
* º¸¾å¤Ï0, 0
@@ -508,7 +517,7 @@
*/
struct point_tag get_cursor_position(void)
{
- char ibuf[BUFSIZ];
+ char ibuf[300];
ssize_t len = 0;
ssize_t read_len = 0;
char *escseq = ibuf - 1;
@@ -524,6 +533,7 @@
while (TRUE) {
char *next_escseq;
+ retry:
len += (read_len = read_stdin(ibuf + len, sizeof(ibuf) - len));
if (read_len == 0) {
debug(("loop = %d\n", loop_count + 1));
@@ -531,7 +541,6 @@
break;
}
}
- ibuf[len] = '\0';
debug2(("get = \""));
debug_write2(ibuf, len);
@@ -540,37 +549,126 @@
if (escseq != ibuf - 1) {
escseq--;
}
+
+ /* NUL¤¬Æþ¤Ã¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¤Î¤Ç strchr ¤Ç¤Ï¤Ê¤¯ memchr */
while ((next_escseq = memchr(escseq + 1, ESCAPE_CODE, len - (escseq - ibuf) - 1)) != NULL) {
- int n;
- char R;
+ int i = 1;
+ int row = UNDEFINED;
+ int col = UNDEFINED;
+ char unget_buf[300];
+ int unget_count = 0;
+ int escseq_len;
+
escseq = next_escseq;
- n = sscanf(escseq, "\033[%d;%d%c", &(s_cursor.row), &(s_cursor.col), &R);
- if (n == 3 && R == 'R') {
- char *next_to_R = strchr(escseq, 'R') + 1;
- /* ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤ÎÁ°¤Ëʸ»úÎ󤬤¢¤ë¤« */
- if (escseq > ibuf) {
- unget_stdin(ibuf, escseq - ibuf);
+ escseq_len = len - (escseq - ibuf);
+
+ if (strlen("\033[0;0R") > escseq_len) {
+ break; /* goto retry */
+ }
+
+ /* n = sscanf(escseq, "\033[%d;%d%c", &(s_cursor.row), &(s_cursor.col), &R); */
+
+ if (escseq[i] != '[') {
+ unget_buf[unget_count++] = escseq[i++];
+ if (escseq[i] != '[') {
+ break; /* goto retry */
}
+ }
+
+ if (escseq[i + 1] == '[') {
+ unget_buf[unget_count++] = escseq[i++];
+ }
- /* ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤Î¸å¤Îʸ»úÎó */
- unget_stdin(next_to_R, len - (next_to_R - ibuf));
+ while (TRUE) {
+ i++;
+ range_check(i);
+ if (!isdigit((unsigned char)escseq[i])) {
+ if (row != UNDEFINED && escseq[i] == ';') {
+ break;
+ }
+ unget_buf[unget_count++] = escseq[i++];
+ range_check(i);
+ }
+ if (isdigit((unsigned char)escseq[i])) {
+ if (row == UNDEFINED) {
+ row = 0;
+ }
+ row = row * 10 + escseq[i] - '0';
+ } else {
+ break;
+ }
+ }
- s_cursor.row--;
- s_cursor.col--;
- s_cursor.row -= s_cursor_diff.row;
- s_cursor.col -= s_cursor_diff.col;
+ if (row == UNDEFINED) {
+ break; /* goto retry */
+ }
- /* GNU screen ¤Ç¤Ï¤³¤¦¤Ê¤ë¤³¤È¤¬¤¢¤ë */
- if (s_cursor.col > g_win->ws_col - 1) {
- put_crlf();
+ if (escseq[i] != ';') {
+ break; /* goto retry */
+ }
+
+ range_check(i + 1);
+ if (escseq[i + 1] == ';') {
+ unget_buf[unget_count++] = escseq[i++];
+ }
+
+ while (TRUE) {
+ i++;
+ range_check(i);
+ if (!isdigit((unsigned char)escseq[i])) {
+ if (col != UNDEFINED && escseq[i] == 'R') {
+ break;
+ }
+ unget_buf[unget_count++] = escseq[i++];
+ range_check(i);
}
- debug(("<get row = %d col = %d>", s_cursor.row, s_cursor.col));
- return s_cursor;
+ if (isdigit((unsigned char)escseq[i])) {
+ if (col == UNDEFINED) {
+ col = 0;
+ }
+ col = col * 10 + escseq[i] - '0';
+ } else {
+ break;
+ }
+ }
- } else {
- /* ESC¤Ï¤¢¤ë¤¬, ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤È¤·¤Æ¤ÏÉÔ½½Ê¬ */
- s_cursor.row = s_cursor.col = UNDEFINED;
+ if (col == UNDEFINED) {
+ break; /* goto retry */
}
+
+ if (escseq[i] != 'R') {
+ break; /* goto retry */
+ }
+
+ /* ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤ÎÁ°¤Ëʸ»úÎ󤬤¢¤ë¤« */
+ if (escseq > ibuf) {
+ unget_stdin(ibuf, escseq - ibuf);
+ }
+
+ /* ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤ÎÃæ¤Îʸ»úÎó */
+ if (unget_count > 0) {
+ unget_stdin(unget_buf, unget_count);
+ }
+
+ /* ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤Î¸å¤Îʸ»úÎó */
+ if (i < escseq_len - 1) {
+ unget_stdin(&escseq[i + 1], escseq_len - 1 - i);
+ }
+
+ row--;
+ col--;
+ row -= s_cursor_diff.row;
+ col -= s_cursor_diff.col;
+
+ s_cursor.row = row;
+ s_cursor.col = col;
+
+ /* GNU screen ¤Ç¤Ï¤³¤¦¤Ê¤ë¤³¤È¤¬¤¢¤ë */
+ if (s_cursor.col > g_win->ws_col - 1) {
+ put_crlf();
+ }
+ debug(("<get row = %d col = %d>", s_cursor.row, s_cursor.col));
+ return s_cursor;
}
}
Modified: branches/r5rs/fep/uim-fep.c
===================================================================
--- branches/r5rs/fep/uim-fep.c 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/fep/uim-fep.c 2005-08-07 16:12:43 UTC (rev 1157)
@@ -615,7 +615,10 @@
return -6;
}
if (termp != NULL) {
+ tcflag_t save_iflag = termp->c_iflag;
+ termp->c_iflag &= ~ISTRIP;
tcsetattr(slave, TCSAFLUSH, termp);
+ termp->c_iflag = save_iflag;
}
if (winp != NULL) {
ioctl(slave, TIOCSWINSZ, winp);
Modified: branches/r5rs/gtk/gtk-im-uim.c
===================================================================
--- branches/r5rs/gtk/gtk-im-uim.c 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/gtk/gtk-im-uim.c 2005-08-07 16:12:43 UTC (rev 1157)
@@ -515,6 +515,7 @@
if (uic->cwin) {
gtk_widget_hide(GTK_WIDGET(uic->cwin));
}
+ gtk_widget_hide(uic->caret_state_indicator);
}
static void
Modified: branches/r5rs/helper/eggtrayicon.c
===================================================================
--- branches/r5rs/helper/eggtrayicon.c 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/helper/eggtrayicon.c 2005-08-07 16:12:43 UTC (rev 1157)
@@ -35,6 +35,8 @@
static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
+EggTrayIcon *egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name);
+
GType
egg_tray_icon_get_type (void)
{
Modified: branches/r5rs/helper/helper-candwin-gtk.c
===================================================================
--- branches/r5rs/helper/helper-candwin-gtk.c 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/helper/helper-candwin-gtk.c 2005-08-07 16:12:43 UTC (rev 1157)
@@ -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,27 @@
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
+caret_state_hide()
+{
+ gtk_widget_hide(cwin->caret_state_indicator);
+}
+
static void str_parse(gchar *str)
{
gchar **tmp;
@@ -544,6 +560,10 @@
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();
+ } else if (strcmp("hide_caret_state", command) == 0) {
+ caret_state_hide();
}
}
g_strfreev(tmp);
Modified: branches/r5rs/scm/custom.scm
===================================================================
--- branches/r5rs/scm/custom.scm 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/scm/custom.scm 2005-08-07 16:12:43 UTC (rev 1157)
@@ -391,12 +391,16 @@
;; API
(define custom-group-label
(lambda (gsym)
- (custom-group-rec-label (custom-group-rec gsym))))
+ (if (custom-group-rec gsym)
+ (custom-group-rec-label (custom-group-rec gsym))
+ (string-append "Error: " gsym " not found."))))
;; API
(define custom-group-desc
(lambda (gsym)
- (custom-group-rec-desc (custom-group-rec gsym))))
+ (if (custom-group-rec gsym)
+ (custom-group-rec-desc (custom-group-rec gsym))
+ (string-append "Error: " gsym " not found."))))
;; API
(define custom-group-subgroups
Modified: branches/r5rs/scm/im-custom.scm
===================================================================
--- branches/r5rs/scm/im-custom.scm 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/scm/im-custom.scm 2005-08-07 16:12:43 UTC (rev 1157)
@@ -348,7 +348,7 @@
'(global visual-preference)
'(integer 0 100)
(_ "Time length for showing input mode nearby the cursor")
- (_ "long description will be here."))
+ (_ "Set 0 to show indicator always."))
;; EB Library support
;; 2005-02-08 Takuro Ashie <ashie at homa.ne.jp>
@@ -376,6 +376,10 @@
(_ "XIM settings")
(_ "long description will be here."))
+(define-custom-group 'preedit
+ (_ "Preedit settings of XIM")
+ (_ "long description will be here."))
+
(define-custom 'uim-xim-use-xft-font? #f
'(xim preedit)
'(boolean)
Modified: branches/r5rs/uim/Makefile.am
===================================================================
--- branches/r5rs/uim/Makefile.am 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/uim/Makefile.am 2005-08-07 16:12:43 UTC (rev 1157)
@@ -125,6 +125,9 @@
uim_module_manager_CFLAGS =
uim_module_manager_LDADD = libuim.la
uim_module_manager_SOURCES = uim-module-manager.c
+if NEED_SETENV_C
+uim_module_manager_SOURCES += setenv.c
+endif
noinst_PROGRAMS = uim-agent
Modified: branches/r5rs/uim/uim-helper-server.c
===================================================================
--- branches/r5rs/uim/uim-helper-server.c 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/uim/uim-helper-server.c 2005-08-07 16:12:43 UTC (rev 1157)
@@ -74,10 +74,10 @@
static char read_buf[BUFFER_SIZE];
/*
- prepare file descriptor.
+ initialize server's file descriptor.
*/
static int
-init_serv_fd(char *path)
+init_server_fd(char *path)
{
int foo;
int fd;
@@ -216,15 +216,61 @@
}
+static uim_bool
+accept_new_connection(int server_fd)
+{
+ struct sockaddr_un clientsoc;
+ socklen_t len = sizeof(clientsoc);
+ int new_fd;
+ int flag;
+ struct client *cl;
+ new_fd = accept(server_fd, (struct sockaddr *)&clientsoc, &len);
+
+ if (new_fd < 0) {
+ perror("accpet failed");
+ return UIM_FALSE;
+ }
+
+ if ((flag = fcntl(new_fd, F_GETFL)) == -1) {
+ close(new_fd);
+ return UIM_FALSE;
+ }
+
+ flag |= O_NONBLOCK;
+ if (fcntl(new_fd, F_SETFL, flag) == -1) {
+ close(new_fd);
+ return UIM_FALSE;
+ }
+
+ cl = get_unused_client();
+ if (!cl) {
+ close(new_fd);
+ return UIM_FALSE;
+ }
+ cl->fd = new_fd;
+#ifdef LOCAL_CREDS /* for NetBSD */
+ {
+ char buf[1] = { '\0' };
+ write(cl->fd, buf, 1);
+ }
+#endif
+ FD_SET(cl->fd, &s_fdset_read);
+ if (cl->fd > s_max_fd)
+ s_max_fd = cl->fd;
+
+ return UIM_TRUE;
+}
+
/* FIXME: This function is too long to read... */
static void
-uim_helper_server_process_connection(int serv_fd)
+uim_helper_server_process_connection(int server_fd)
{
int i;
fd_set readfds;
fd_set writefds;
while (1) {
+ /* Could we replace this memcpy with direct assignment? */
memcpy(&readfds, &s_fdset_read, sizeof(fd_set));
memcpy(&writefds, &s_fdset_write, sizeof(fd_set));
@@ -236,45 +282,12 @@
}
/* for accept new connection */
- if (FD_ISSET(serv_fd, &readfds)) {
- struct sockaddr_un clientsoc;
- socklen_t len = sizeof(clientsoc);
- int new_fd;
- int flag;
- struct client *cl;
- new_fd = accept(serv_fd, (struct sockaddr *)&clientsoc, &len);
-
- if (new_fd < 0) {
- perror("accpet failed");
- continue;
+ if (FD_ISSET(server_fd, &readfds)) {
+ uim_bool accepted;
+ accepted = accept_new_connection(server_fd);
+ if(accepted == UIM_FALSE) {
+ continue; /* acception failed, go next loop without message processing. */
}
-
- if ((flag = fcntl(new_fd, F_GETFL)) == -1) {
- close(new_fd);
- continue;
- }
-
- flag |= O_NONBLOCK;
- if (fcntl(new_fd, F_SETFL, flag) == -1) {
- close(new_fd);
- continue;
- }
-
- cl = get_unused_client();
- if (!cl) {
- close(new_fd);
- continue;
- }
- cl->fd = new_fd;
-#ifdef LOCAL_CREDS /* for NetBSD */
- {
- char buf[1] = { '\0' };
- write(cl->fd, buf, 1);
- }
-#endif
- FD_SET(cl->fd, &s_fdset_read);
- if (cl->fd > s_max_fd)
- s_max_fd = cl->fd;
} else {
/* check data to write and from clients reached */
for (i = 0; i < nr_client_slots; i++) {
@@ -343,7 +356,7 @@
main(int argc, char **argv)
{
char *path = uim_helper_get_pathname();
- int serv_fd;
+ int server_fd;
unlink(path);
clients = NULL;
@@ -352,7 +365,7 @@
FD_ZERO(&s_fdset_read);
FD_ZERO(&s_fdset_write);
s_max_fd = 0;
- serv_fd = init_serv_fd(path);
+ server_fd = init_server_fd(path);
printf("waiting\n\n");
fflush(stdout);
@@ -360,7 +373,7 @@
fclose(stdin);
fclose(stdout);
- if (serv_fd < 0) {
+ if (server_fd < 0) {
return 0;
}
/* fprintf(stderr,"Waiting for connection at %s\n", path);*/
@@ -369,7 +382,7 @@
signal(SIGPIPE, SIG_IGN);
- uim_helper_server_process_connection(serv_fd);
+ uim_helper_server_process_connection(server_fd);
return 0;
}
Deleted: branches/r5rs/uim.desktop
===================================================================
--- branches/r5rs/uim.desktop 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/uim.desktop 2005-08-07 16:12:43 UTC (rev 1157)
@@ -1,12 +0,0 @@
-[Desktop Entry]
-Type=Application
-Encoding=UTF-8
-Name=preference of uim
-Name[ja]=uimã®è¨å®
-Comment=
-Comment[ja]=
-Exec=uim-pref-gtk
-Icon=uim.png
-Terminal=false
-MimeType=text/plain
-Categories=Settings
Added: branches/r5rs/uim.desktop.in
===================================================================
--- branches/r5rs/uim.desktop.in 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/uim.desktop.in 2005-08-07 16:12:43 UTC (rev 1157)
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Type=Application
+Encoding=UTF-8
+Name=Preference of uim
+Name[ja]=uimã®è¨å®
+Comment=
+Comment[ja]=
+Exec=uim-pref-gtk
+Icon=@uim_pixmapsdir@/uim-icon.png
+Terminal=false
+MimeType=text/plain
+Categories=Settings
Modified: branches/r5rs/xim/canddisp.cpp
===================================================================
--- branches/r5rs/xim/canddisp.cpp 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/xim/canddisp.cpp 2005-08-07 16:12:43 UTC (rev 1157)
@@ -178,17 +178,36 @@
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::hide_caret_state()
+{
+ if (!candwin_w)
+ return;
+ fprintf(candwin_w, "hide_caret_state\n\n");
+ fflush(candwin_w);
+ check_connection();
+}
+
void Canddisp::check_connection()
{
if (errno == EBADF || errno == EPIPE) {
Modified: branches/r5rs/xim/canddisp.h
===================================================================
--- branches/r5rs/xim/canddisp.h 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/xim/canddisp.h 2005-08-07 16:12:43 UTC (rev 1157)
@@ -46,7 +46,9 @@
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();
+ void hide_caret_state();
private:
void check_connection();
};
Modified: branches/r5rs/xim/convdisp.cpp
===================================================================
--- branches/r5rs/xim/convdisp.cpp 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/xim/convdisp.cpp 2005-08-07 16:12:43 UTC (rev 1157)
@@ -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,18 @@
move_candwin();
}
+void ConvdispOv::update_caret_state()
+{
+ Canddisp *disp = canddisp_singleton();
+ InputContext *focusedContext = InputContext::focusedContext();
+
+ if (focusedContext && focusedContext == mKkContext) {
+ move_candwin();
+ disp->update_caret_state();
+ m_atr->unset_change_mask(ICA_SpotLocation);
+ }
+}
+
void ConvdispOv::move_candwin()
{
if (m_atr->has_atr(ICA_SpotLocation) ) {
@@ -1115,6 +1134,13 @@
void ConvdispOv::update_icxatr()
{
+
+ if (m_atr->is_changed(ICA_SpotLocation)) {
+ uim_bool show_caret_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
+ if (show_caret_state == UIM_TRUE)
+ update_caret_state();
+ }
+
if (!m_ov_win)
return;
@@ -1150,7 +1176,11 @@
m_atr->unset_change_mask(ICA_FontSet);
}
- update_preedit();
+ if (m_atr->is_changed(ICA_SpotLocation)) {
+ move_candwin();
+ m_atr->unset_change_mask(ICA_SpotLocation);
+ }
+ draw_preedit();
}
void ConvdispOv::draw_preedit()
@@ -1510,7 +1540,11 @@
mConn->push_passive_packet(t);
}
}
-
+
+void ConvdispOs::update_caret_state()
+{
+}
+
void ConvdispOs::move_candwin()
{
if (m_atr->has_atr(ICA_ClientWindow)) {
Modified: branches/r5rs/xim/convdisp.h
===================================================================
--- branches/r5rs/xim/convdisp.h 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/xim/convdisp.h 2005-08-07 16:12:43 UTC (rev 1157)
@@ -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: branches/r5rs/xim/helper.cpp
===================================================================
--- branches/r5rs/xim/helper.cpp 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/xim/helper.cpp 2005-08-07 16:12:43 UTC (rev 1157)
@@ -175,6 +175,7 @@
InputContext::deletefocusedContext();
Canddisp *disp = canddisp_singleton();
disp->hide();
+ disp->hide_caret_state();
return;
} else if (strcmp("im_list_get", line) == 0) {
send_im_list();
Modified: branches/r5rs/xim/ximserver.cpp
===================================================================
--- branches/r5rs/xim/ximserver.cpp 2005-08-07 16:07:30 UTC (rev 1156)
+++ branches/r5rs/xim/ximserver.cpp 2005-08-07 16:12:43 UTC (rev 1157)
@@ -153,6 +153,13 @@
if (!strcmp(custom, "uim-xim-xft-font-name"))
update_default_xftfont();
#endif
+
+ if (!strcmp(custom, "bridge-show-input-state?") &&
+ !uim_scm_symbol_value_bool("bridge-show-input-state?")) {
+ Canddisp *disp = canddisp_singleton();
+ disp->hide_caret_state();
+ }
+
}
bool
@@ -675,6 +682,7 @@
disp->activate(active_candidates, mDisplayLimit);
disp->select(current_cand_selection);
+ disp->show();
}
void InputContext::candidate_select(int index)
@@ -753,8 +761,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