[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

patch to fix the Key confilict with IM_context



Hi,
    This is a patch related to I18N. The CJK users may find that it's not
possible to activate the input method(XIM) with CTRL-Space, CTRL-SHIFT, or
some other key-bindings when inputting text, so they have to use mouse
to activate the input method, and this is very inconvenient.
    
     This bug is caused by the code which processes key_presss event in
disp_callbacks.c. When it finds that CTRL or MOD1 is pressed, it will
not use gtk_im_context_filter_keypress to process the input. So the
input method can't be activated by CTRL-Space, which is usually the 
default keybinding of most CJK input method.

    I attached a simple to patch to fix this bug, hoping it can be useful.

Regards,
Ming.
Index: disp_callbacks.c
===================================================================
RCS file: /cvs/gnome/dia/app/disp_callbacks.c,v
retrieving revision 1.80
diff -u -p -r1.80 disp_callbacks.c
--- disp_callbacks.c	3 Jun 2004 08:46:44 -0000	1.80
+++ disp_callbacks.c	11 Jun 2004 11:52:48 -0000
@@ -668,19 +668,15 @@ ddisplay_canvas_events (GtkWidget *canva
 
         focus = active_focus();
         if (focus != NULL) {
-          if (!(state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) ) {
+	  if (gtk_im_context_filter_keypress(GTK_IM_CONTEXT(ddisp->im_context), kevent)) {
+	    return_val = key_handled = TRUE;
+	  } else if (!(state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) ) {
 	    /* Keys goes to the active focus. */
 	    obj = focus->obj;
-	    if (diagram_is_selected(ddisp->diagram, obj)) {
-	      
-	      if (!gtk_im_context_filter_keypress
-		  (GTK_IM_CONTEXT(ddisp->im_context), kevent)) {
-		/*! key event not swallowed by the input method ? */
-		handle_key_event(ddisp, focus, kevent->keyval,
-				 kevent->string, kevent->length);
-		
-		diagram_flush(ddisp->diagram);
-	      }
+	    if (diagram_is_selected(ddisp->diagram, obj)) { 
+	      handle_key_event(ddisp, focus, kevent->keyval, 
+		  kevent->string, kevent->length); 
+	      diagram_flush(ddisp->diagram);
 	    }
 	    return_val = key_handled = TRUE;
 	  }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK