[uim-commit] r3150 - trunk/xim

ekato at freedesktop.org ekato at freedesktop.org
Wed Mar 1 10:11:48 PST 2006


Author: ekato
Date: 2006-03-01 10:11:44 -0800 (Wed, 01 Mar 2006)
New Revision: 3150

Modified:
   trunk/xim/ximserver.cpp
   trunk/xim/ximserver.h
Log:
* xim/ximserver.h (class InputContext) : Add
  switch_app_global_im() and switch_system_global_im() public
  member and switch_app_global_im_cb() and
  switch_system_global_im_cb() static member.
* xim/ximserver.cpp (InputContext::createUimContext) : Set
  uim_set_im_switch_request_cb.
(InputContext::switch_app_global_im) : New.
(InputContext::switch_system_global_im) : Ditto.
(InputContext::switch_app_global_im_cb) : Ditto.
(InputContext::switch_system_global_im_cb) : Ditto.


Modified: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp	2006-03-01 09:29:24 UTC (rev 3149)
+++ trunk/xim/ximserver.cpp	2006-03-01 18:11:44 UTC (rev 3150)
@@ -413,6 +413,9 @@
 #endif
 	uim_set_configuration_changed_cb(uc,
 			InputContext::configuration_changed_cb);
+	uim_set_im_switch_request_cb(uc,
+				     InputContext::switch_app_global_im_cb,
+				     InputContext::switch_system_global_im_cb);
 
 	if (mFocusedContext == this)
 	    uim_prop_list_update(uc);
@@ -455,6 +458,24 @@
 	send_im_list();
 }
 
+void InputContext::switch_app_global_im(const char *name)
+{
+    get_im_by_id(this->get_ic()->get_imid())->changeContext(name);
+}
+
+void InputContext::switch_system_global_im(const char *name)
+{
+  char *msg;
+  std::map<Window, XimServer *>::iterator it;
+
+  for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it)
+    (*it).second->changeContext(name);
+
+  asprintf(&msg, "im_change_whole_desktop\n%s\n", name);
+  uim_helper_send_message(lib_uim_fd, msg);
+  free(msg);
+}
+
 void InputContext::review_im(const char *engine)
 {
     char *locale;
@@ -625,6 +646,20 @@
     ic->configuration_changed();
 }
 
+void InputContext::switch_app_global_im_cb(void *ptr, const char *name)
+{
+    InputContext *ic = (InputContext *)ptr;
+
+    ic->switch_app_global_im(name);
+}
+
+void InputContext::switch_system_global_im_cb(void *ptr, const char *name)
+{
+    InputContext *ic = (InputContext *)ptr;
+
+    ic->switch_system_global_im(name);
+}
+
 void InputContext::clear_pe_stat()
 {
     m_pe->clear();

Modified: trunk/xim/ximserver.h
===================================================================
--- trunk/xim/ximserver.h	2006-03-01 09:29:24 UTC (rev 3149)
+++ trunk/xim/ximserver.h	2006-03-01 18:11:44 UTC (rev 3150)
@@ -179,6 +179,8 @@
     void customContext(const char *custom, const char *val);
     void createUimContext(const char *engine);
     void configuration_changed();
+    void switch_app_global_im(const char *name);
+    void switch_system_global_im(const char *name);
 public:
     static void commit_cb(void *ptr, const char *str);
     static void clear_cb(void *ptr);
@@ -191,6 +193,8 @@
     static void update_prop_list_cb(void *ptr, const char *str);
     static void update_prop_label_cb(void *ptr, const char *str);
     static void configuration_changed_cb(void *ptr);
+    static void switch_app_global_im_cb(void *ptr, const char *name);
+    static void switch_system_global_im_cb(void *ptr, const char *name);
     static InputContext *focusedContext();
     static void deletefocusedContext();
 private:



More information about the uim-commit mailing list