X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=mod_query%2Fquery.c;h=9418af5e11d5b8518fa93795a5c46b02a3c2b6b4;hp=9318c897144d91e510d75734a15b8fbb1940b7f4;hb=de22e45179cb3bafa490294d31d47f361047a30a;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d diff --git a/mod_query/query.c b/mod_query/query.c index 9318c89..9418af5 100644 --- a/mod_query/query.c +++ b/mod_query/query.c @@ -15,43 +15,12 @@ #include #include #include +#include #include #include "query.h" #include "wedln.h" -static void create_cycle_binding(WEdln *wedln, uint kcb, uint state, ExtlFn cycle) -{ - WBindmap *bindmap=create_bindmap(); - WBinding b; - - if(bindmap==NULL) - return; - - b.ksb=XKeycodeToKeysym(ioncore_g.dpy, kcb, 0); - b.kcb=kcb; - b.state=state; - b.act=BINDING_KEYPRESS; - b.area=0; - b.wait=FALSE; - b.submap=NULL; - b.func=extl_ref_fn(cycle); - - if(!bindmap_add_binding(bindmap, &b)){ - extl_unref_fn(b.func); - bindmap_destroy(bindmap); - return; - } - - if(!region_add_bindmap((WRegion*)wedln, bindmap)){ - bindmap_destroy(bindmap); - return; - } - - wedln->cycle_bindmap=bindmap; -} - - /*--lowlevel routine not to be called by the user--EXTL_DOC * Show a query window in \var{mplex} with prompt \var{prompt}, initial * contents \var{dflt}. The function \var{handler} is called with @@ -62,7 +31,8 @@ static void create_cycle_binding(WEdln *wedln, uint kcb, uint state, ExtlFn cycl */ EXTL_EXPORT WEdln *mod_query_do_query(WMPlex *mplex, const char *prompt, const char *dflt, - ExtlFn handler, ExtlFn completor, ExtlFn cycle) + ExtlFn handler, ExtlFn completor, + ExtlFn cycle, ExtlFn bcycle) { WRectangle geom; WEdlnCreateParams fnp; @@ -88,8 +58,11 @@ WEdln *mod_query_do_query(WMPlex *mplex, const char *prompt, const char *dflt, uint kcb, state; bool sub; - if(ioncore_current_key(&kcb, &state, &sub) && !sub) - create_cycle_binding(wedln, kcb, state, cycle); + if(ioncore_current_key(&kcb, &state, &sub) && !sub){ + wedln->cycle_bindmap=region_add_cycle_bindmap((WRegion*)wedln, + kcb, state, cycle, + bcycle); + } } return wedln;