Revision: 6364
Author: nogu.dev
Date: Thu May  6 04:40:56 2010
Log: * doc/HELPER-PROTOCOL
  - Add im_switcher_start and im_switcher_quit to fix bug #2112.
* helper/im-switcher-gtk.c
  - (parse_helper_str): Parse "im_switcher_{start,quit}".
  - (main): Check if another uim-im-switcher exists by trying
    to contact one. If one exists, this process exits.
* qt4/switcher/qt4.cpp
  - (UimImSwitcher::UimImSwitcher): Check if another uim-im-switcher exists
    by trying to contact one.
    If one exists, this process exits.
  - (UimImSwitcher::slotStdinActivated): Parse "im_switcher_{start,quit}".
http://code.google.com/p/uim/source/detail?r=6364

Modified:
 /trunk/doc/HELPER-PROTOCOL
 /trunk/helper/im-switcher-gtk.c
 /trunk/qt4/switcher/qt4.cpp

=======================================
--- /trunk/doc/HELPER-PROTOCOL  Mon Feb 20 07:38:43 2006
+++ /trunk/doc/HELPER-PROTOCOL  Thu May  6 04:40:56 2010
@@ -91,7 +91,9 @@
               im_change_this_application_only |
               prop_update_custom  |
               custom_reload_notify |
-              commit_string) "\n"
+              commit_string |
+              im_switcher_start |
+              im_switcher_quit) "\n"

   charset_specifier = "charset=" charset "\n"
   charset = "UTF-8" | "EUC-JP" | "GB18030" |
@@ -324,6 +326,25 @@
     commit_string = "commit_string\n" charset_specifier str_to_commit "\n"
     str_to_commit = /^[^\n]+$/

+  - im_switcher_start
+
+    This message notifies that a new uim-im-switcher is started.
+    When an existing old uim-im-switcher receives im_switcher_start,
+    the existing uim-im-switcher must send im_switcher_quit
+    to quit newly started uim-im-switcher.
+
+    See also im_switcher_quit.
+
+    im_switcher_start = "im_switcher_start\n"
+
+  - im_switcher_quit
+
+    This message requests newly started uim-im-switcher to quit.
+    All uim-im-switcher must quit immediately after received this message.
+
+    See also im_switcher_start.
+
+    im_switcher_quit = "im_switcher_quit\n"

 Local Variables:
 mode: indented-text
=======================================
--- /trunk/helper/im-switcher-gtk.c     Sun Apr  4 20:35:54 2010
+++ /trunk/helper/im-switcher-gtk.c     Thu May  6 04:40:56 2010
@@ -430,6 +430,10 @@
 {
   if (g_str_has_prefix(sent_str, "im_list") == TRUE) {
     parse_helper_str_im_list(sent_str);
+  } else if (g_str_has_prefix(sent_str, "im_switcher_start") == TRUE) {
+    uim_helper_send_message(uim_fd, "im_switcher_quit\n");
+  } else if (g_str_has_prefix(sent_str, "im_switcher_quit") == TRUE) {
+    gtk_main_quit();
   }
 }

@@ -556,6 +560,9 @@
   uim_fd = -1;
   check_helper_connection();

+  /* To check if another uim-im-switcher exists */
+  uim_helper_send_message(uim_fd, "im_switcher_start\n");
+
   /* To load input method list */
   uim_helper_send_message(uim_fd, "im_list_get\n");

=======================================
--- /trunk/qt4/switcher/qt4.cpp Sun Apr  4 20:35:54 2010
+++ /trunk/qt4/switcher/qt4.cpp Thu May  6 04:40:56 2010
@@ -85,6 +85,9 @@
     uim_fd = -1;
     checkHelperConnection();

+    /* to check if another uim-im-switcher exists */
+    uim_helper_send_message( uim_fd, "im_switcher_start\n" );
+
     /* to load input method list */
     uim_helper_send_message( uim_fd, "im_list_get\n" );

@@ -244,6 +247,10 @@
             reloadImList();
         else if ( msg.startsWith( QLatin1String( "im_list" ) ) )
             parseHelperStrImList( msg );
+        else if ( msg.startsWith( QLatin1String( "im_switcher_start" ) ) )
+            uim_helper_send_message( uim_fd,  "im_switcher_quit\n" );
+        else if ( msg.startsWith( QLatin1String( "im_switcher_quit" ) ) )
+            QApplication::instance()->quit();
     }
 }

Reply via email to