Re: chinese support glitches?



In <1078653964 3425 29 camel linux local>
  "Re: chinese support glitches?" on Sun, 07 Mar 2004 11:06:04 +0100,
  Lars Clausen <lars raeder dk> wrote:
+        default:
+          if (kevent->string && 0 == strcmp(" ",kevent->string)) {
+            tool_select_former();
+          } else {

Haven't tried applying it, but it seems to me that the above lines would
steal your pressing space, wouldn't it?  That would probably need to be
guarded by something that checks that the appropriate modifiers are not
used.

Oops, you're right.

I made another patch which makes Canvas pass any keys to
IM. Dia handles key if Dia can't get a focus or IM doesn't
need received key. Ctrl-arrowkey etc. are available except
while editing the text.

# This patch includes bug fix for tool_select_former()
# doesn't run when Ctrl + Space in passing.

--
kou
Index: app/disp_callbacks.c
===================================================================
RCS file: /cvs/gnome/dia/app/disp_callbacks.c,v
retrieving revision 1.74
diff -u -p -r1.74 disp_callbacks.c
--- app/disp_callbacks.c        18 Feb 2004 14:35:21 -0000      1.74
+++ app/disp_callbacks.c        7 Mar 2004 14:20:24 -0000
@@ -428,7 +428,8 @@ ddisplay_canvas_events (GtkWidget *canva
   int key_handled;
   int width, height;
   int new_size;
-
+  int im_context_used;
+  
   return_val = FALSE;
  
   if (!canvas->window) 
@@ -641,10 +642,10 @@ ddisplay_canvas_events (GtkWidget *canva
         kevent = (GdkEventKey *)event;
         state = kevent->state;
         key_handled = FALSE;
+        im_context_used = FALSE;
 
         focus = active_focus();
-        if ((focus != NULL) &&
-            !(state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) ) {
+        if (focus != NULL) {
               /* Keys goes to the active focus. */
           obj = focus->obj;
           if (diagram_is_selected(ddisp->diagram, obj)) {
@@ -657,15 +658,15 @@ ddisplay_canvas_events (GtkWidget *canva
                                kevent->string, kevent->length);
 
               diagram_flush(ddisp->diagram);
+
+              return_val = key_handled = im_context_used = TRUE;
             }
           }
-          return_val = key_handled = TRUE;
         }
 
-        if (!key_handled) {
-              /* No focus to receive keys, take care of it ourselves. */
+        if (!key_handled && (state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) {
+              /* IM doesn't need receive keys, take care of it ourselves. */
           return_val = TRUE;
-          gtk_im_context_reset(GTK_IM_CONTEXT(ddisp->im_context));
           
           switch(kevent->keyval) {
               case GDK_Up:
@@ -706,13 +707,17 @@ ddisplay_canvas_events (GtkWidget *canva
                   set_zoom_out(active_tool);
                 break;
               default:
-                if (kevent->string && 0 == strcmp(" ",kevent->string)) {
+                if (kevent->string && kevent->keyval == ' ') {
                   tool_select_former();
                 } else { 
                   return_val = FALSE;
                 }
           }
         }
+
+        if (!im_context_used)
+          gtk_im_context_reset(GTK_IM_CONTEXT(ddisp->im_context));
+        
         break;
 
       case GDK_KEY_RELEASE:


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