[uim-commit] r1231 - in trunk: helper xim

ekato at freedesktop.org ekato at freedesktop.org
Thu Aug 18 21:28:31 PDT 2005


Author: ekato
Date: 2005-08-18 21:28:28 -0700 (Thu, 18 Aug 2005)
New Revision: 1231

Modified:
   trunk/helper/helper-candwin-gtk.c
   trunk/xim/canddisp.cpp
   trunk/xim/helper.cpp
   trunk/xim/main.cpp
   trunk/xim/ximserver.cpp
   trunk/xim/ximserver.h
Log:
* xim/helper.cpp (helper_str_parse) : Call
  Ximserver::reloadConfigs() instated of uim_prop_reload_configs()
  upon "custom_reload_notify".
* xim/ximserver.cpp (XimServer::reloadConfigs) : New.
  uim_prop_reload_configs() is disabled by #if 0 for now.
* xim/main.cpp (reload_uim) : Remove static.
* xim/canddisp.cpp : Simplified using
  terminate_canddisp_connection().
* xim/ximserver.h : Add reload_uim() declaration.
(class XimServer) : Add reloadConfigs() member.

* helper/helper-candwin-gtk.c : Frame added as
  gtk/uim-cand-win-gtk.c in r1177.


Modified: trunk/helper/helper-candwin-gtk.c
===================================================================
--- trunk/helper/helper-candwin-gtk.c	2005-08-18 22:30:48 UTC (rev 1230)
+++ trunk/helper/helper-candwin-gtk.c	2005-08-19 04:28:28 UTC (rev 1231)
@@ -58,7 +58,6 @@
 struct _UIMCandidateWindow {
   GtkWindow parent;
 
-  GtkWidget *scrolled_window;
   GtkWidget *view;
   GtkWidget *num_label;
 
@@ -305,33 +304,37 @@
 {
   GtkCellRenderer *renderer;
   GtkTreeViewColumn *column; 
+  GtkWidget *scrolled_window;
   GtkWidget *vbox;
+  GtkWidget *frame;
   GtkTreeSelection *selection;
   GdkRectangle cursor_location;
   
   vbox = gtk_vbox_new(FALSE, 0);
+  frame = gtk_frame_new(NULL);
 
   cwin->stores = g_ptr_array_new();
   
-  gtk_container_set_border_width(GTK_CONTAINER(cwin), 1);
   gtk_window_set_default_size(GTK_WINDOW(cwin),
 		  CANDWIN_DEFAULT_WIDTH, -1);
   
 
-  cwin->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
-  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(cwin->scrolled_window),
+  scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
 				 GTK_POLICY_NEVER,
 				 GTK_POLICY_NEVER);
-  gtk_box_pack_start(GTK_BOX(vbox), cwin->scrolled_window, TRUE, TRUE, 0);
+  gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
   
   cwin->view = gtk_tree_view_new();
   g_signal_connect(G_OBJECT(cwin->view), "destroy", 
   		   G_CALLBACK(cb_tree_view_destroy), cwin->stores);
   gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(cwin->view), TRUE);
   gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(cwin->view), FALSE);
-  gtk_container_add(GTK_CONTAINER(cwin->scrolled_window), cwin->view);
+  gtk_container_add(GTK_CONTAINER(scrolled_window), cwin->view);
 
-  gtk_container_add(GTK_CONTAINER(cwin), vbox);
+  gtk_container_add(GTK_CONTAINER(frame), vbox);
+  gtk_container_add(GTK_CONTAINER(cwin), frame);
+  gtk_container_set_border_width(GTK_CONTAINER(frame), 0);
     
   selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cwin->view));
 
@@ -376,11 +379,6 @@
   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);
-  gtk_widget_show_all(vbox);
 }
 
 static void

Modified: trunk/xim/canddisp.cpp
===================================================================
--- trunk/xim/canddisp.cpp	2005-08-18 22:30:48 UTC (rev 1230)
+++ trunk/xim/canddisp.cpp	2005-08-19 04:28:28 UTC (rev 1231)
@@ -210,12 +210,8 @@
 
 void Canddisp::check_connection()
 {
-    if (errno == EBADF || errno == EPIPE) {
-	disp = NULL;
-	int fd = fileno(candwin_r);
-	remove_current_fd_watch(fd);
-	delete this;
-    }
+    if (errno == EBADF || errno == EPIPE)
+	terminate_canddisp_connection();
 }
 
 static void candwin_read_cb(int fd, int ev)
@@ -225,11 +221,7 @@
 
     n = read(fd, buf, 1024 - 1);
     if (n == 0) {
-	int fd_w = fileno(candwin_w);
-	if (fd != -1)
-	    close(fd_w);
-	close(fd);
-	remove_current_fd_watch(fd);
+	terminate_canddisp_connection();
 	return;
     }
     if (n == -1)
@@ -237,11 +229,7 @@
     buf[n] = '\0';
 
     if (!strcmp(buf, "err")) {
-	int fd_w = fileno(candwin_w);
-	if (fd != -1)
-	    close(fd_w);
-	close(fd);
-	remove_current_fd_watch(fd);
+	terminate_canddisp_connection();
 	return;
     }
 
@@ -283,6 +271,8 @@
 	close(fd_w);
     }
 
+    candwin_w = candwin_r = NULL;
+    delete disp;
     disp = NULL;
     return;
 }

Modified: trunk/xim/helper.cpp
===================================================================
--- trunk/xim/helper.cpp	2005-08-18 22:30:48 UTC (rev 1230)
+++ trunk/xim/helper.cpp	2005-08-19 04:28:28 UTC (rev 1231)
@@ -225,7 +225,11 @@
 	}
 	return;
     } else if (strcmp("custom_reload_notify", line) == 0) {
-	uim_prop_reload_configs();
+	std::map<Window, XimServer *>::iterator it;
+	for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); it++) {
+	    (*it).second->reloadConfigs();
+	}
+	return;
     }
 }
 

Modified: trunk/xim/main.cpp
===================================================================
--- trunk/xim/main.cpp	2005-08-18 22:30:48 UTC (rev 1230)
+++ trunk/xim/main.cpp	2005-08-19 04:28:28 UTC (rev 1231)
@@ -507,7 +507,7 @@
     remove_current_fd_watch(fd);
 }
 
-static void
+void
 reload_uim(int x)
 {
     fprintf(stderr, "\nReloading uim...\n\n");

Modified: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp	2005-08-18 22:30:48 UTC (rev 1230)
+++ trunk/xim/ximserver.cpp	2005-08-19 04:28:28 UTC (rev 1231)
@@ -156,10 +156,32 @@
 
     if (!strcmp(custom, "bridge-show-input-state?") &&
 		    !uim_scm_symbol_value_bool("bridge-show-input-state?")) {
-	    Canddisp *disp = canddisp_singleton();
-	    disp->hide_caret_state();
+	Canddisp *disp = canddisp_singleton();
+	disp->hide_caret_state();
     }
+}
 
+void XimServer::reloadConfigs() {
+#if 0
+    // uim_prop_reload_configs() seems broken... --ekato Aug 19 2005
+    uim_prop_reload_configs();
+#else
+    reload_uim(0);
+#endif
+
+    // Updated global IM of XimServer
+    char *im = uim_scm_symbol_value_str("default-im-name");
+    set_im(im);
+    free(im);
+
+#if HAVE_XFT_UTF8_STRING
+    update_default_xftfont();
+#endif
+
+    if (!uim_scm_symbol_value_bool("bridge-show-input-state?")) {
+	Canddisp *disp = canddisp_singleton();
+	disp->hide_caret_state();
+    }
 }
 
 bool

Modified: trunk/xim/ximserver.h
===================================================================
--- trunk/xim/ximserver.h	2005-08-18 22:30:48 UTC (rev 1230)
+++ trunk/xim/ximserver.h	2005-08-19 04:28:28 UTC (rev 1231)
@@ -84,6 +84,7 @@
 void init_default_xftfont();
 void update_default_xftfont();
 #endif
+void reload_uim(int x);
 
 
 // for command line option
@@ -238,6 +239,7 @@
     void set_im(const char *name);
     void changeContext(const char *engine);
     void customContext(const char *custom, const char *val);
+    void reloadConfigs();
     std::list<InputContext *> ic_list;
 public:
     static XimServer *findServer(Window w);



More information about the uim-commit mailing list