コード例 #1
0
ファイル: grabmenu.c プロジェクト: Soren-Nordstrom/Ion3
/*--lowlevel routine not to be called by the user--*/
EXTL_EXPORT
WMenu *mod_menu_do_grabmenu(WMPlex *mplex, ExtlFn handler, ExtlTab tab,
                            ExtlTab param)
{
    WMenuCreateParams fnp;
    WMPlexAttachParams par;
    WMenu *menu;
    XKeyEvent *ev;
    uint state, kcb;
    bool sub;
    
    if(!ioncore_current_key(&kcb, &state, &sub))
        return NULL;
    
    if(state==0){
        WMenu *menu=mod_menu_do_menu(mplex, handler, tab, param);
        /*
        if(menu!=NULL && cycle!=extl_fn_none()){
            uint kcb, state; 
        
            menu->cycle_bindmap=region_add_cycle_bindmap((WRegion*)menu,
                                                         kcb, state, ???,
                                                         ???);
        }*/
        return menu;
    }
    
    fnp.handler=handler;
    fnp.tab=tab;
    fnp.pmenu_mode=FALSE;
    fnp.submenu_mode=FALSE;
    fnp.big_mode=extl_table_is_bool_set(param, "big");
    fnp.initial=0;
    extl_table_gets_i(param, "initial", &(fnp.initial));

    par.flags=(MPLEX_ATTACH_SWITCHTO|
               MPLEX_ATTACH_LEVEL|
               MPLEX_ATTACH_UNNUMBERED|
               MPLEX_ATTACH_SIZEPOLICY);
    par.szplcy=SIZEPOLICY_FULL_BOUNDS;
    par.level=STACKING_LEVEL_MODAL1+2;

    menu=(WMenu*)mplex_do_attach_new(mplex, &par,
                                     (WRegionCreateFn*)create_menu,
                                     (void*)&fnp); 
    
    if(menu==NULL)
        return NULL;
 
    menu->gm_kcb=kcb;
    menu->gm_state=state;
    
    ioncore_grab_establish((WRegion*)menu, grabmenu_handler, 
                           grabkilled_handler, 0);
    
    return menu;
}
コード例 #2
0
ファイル: kbresize.c プロジェクト: dkogan/notion
/*EXTL_DOC
 * Enter move/resize mode for \var{reg}. The bindings set with
 * \fnref{ioncore.set_bindings} for \type{WMoveresMode} are used in
 * this mode. Of the functions exported by the Ion C core, only
 * \fnref{WMoveresMode.resize}, \fnref{WMoveresMode.move},
 * \fnref{WMoveresMode.cancel} and \fnref{WMoveresMode.end} are
 * allowed to be called while in this mode.
 */
EXTL_EXPORT_MEMBER
WMoveresMode *region_begin_kbresize(WRegion *reg)
{
    WMoveresMode *mode=region_begin_resize(reg, NULL, FALSE);

    if(mode==NULL)
        return NULL;

    if(!setup_resize_timer(mode))
        return NULL;

    accel_reset();

    ioncore_grab_establish(reg, resize_handler,
                           (GrabKilledHandler*)cancel_moveres, 0);

    return mode;
}