]> git.decadent.org.uk Git - ion3.git/blobdiff - mod_query/query.c
[svn-upgrade] Integrating new upstream version, ion3 (20070203)
[ion3.git] / mod_query / query.c
index b56c087a4b24bc5d8e108af305927c71bbca053b..9318c897144d91e510d75734a15b8fbb1940b7f4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ion/mod_query/query.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2006
+ * Copyright (c) Tuomo Valkonen 1999-2007
  *
  * Ion is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by
@@ -20,7 +20,7 @@
 #include "wedln.h"
 
 
-static void create_cycle_binding(WEdln *wedln, XKeyEvent *ev, ExtlFn cycle)
+static void create_cycle_binding(WEdln *wedln, uint kcb, uint state, ExtlFn cycle)
 {
     WBindmap *bindmap=create_bindmap();
     WBinding b;
@@ -28,9 +28,9 @@ static void create_cycle_binding(WEdln *wedln, XKeyEvent *ev, ExtlFn cycle)
     if(bindmap==NULL)
         return;
         
-    b.ksb=XKeycodeToKeysym(ioncore_g.dpy, ev->keycode, 0);
-    b.kcb=ev->keycode;
-    b.state=ev->state;
+    b.ksb=XKeycodeToKeysym(ioncore_g.dpy, kcb, 0);
+    b.kcb=kcb;
+    b.state=state;
     b.act=BINDING_KEYPRESS;
     b.area=0;
     b.wait=FALSE;
@@ -67,7 +67,6 @@ WEdln *mod_query_do_query(WMPlex *mplex, const char *prompt, const char *dflt,
     WRectangle geom;
     WEdlnCreateParams fnp;
     WMPlexAttachParams par;
-    XKeyEvent *ev=ioncore_current_key_event();
     WEdln *wedln;
 
     fnp.prompt=prompt;
@@ -85,9 +84,13 @@ WEdln *mod_query_do_query(WMPlex *mplex, const char *prompt, const char *dflt,
                                       (WRegionCreateFn*)create_wedln,
                                       (void*)&fnp); 
                                       
-    if(wedln!=NULL && ev!=NULL && cycle!=extl_fn_none())
-        create_cycle_binding(wedln, ev, cycle);
+    if(wedln!=NULL && cycle!=extl_fn_none()){
+        uint kcb, state; 
+        bool sub;
         
+        if(ioncore_current_key(&kcb, &state, &sub) && !sub)
+            create_cycle_binding(wedln, kcb, state, cycle);
+    }
     
     return wedln;
 }