예제 #1
0
void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state)
{
    if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
        self->entry->data.normal.enabled)
    {
        /* grab all this shizzle, cuz when the menu gets hidden, 'self'
           gets freed */
        ObMenuEntry *entry = self->entry;
        ObMenuExecuteFunc func = self->frame->menu->execute_func;
        gpointer data = self->frame->menu->data;
        GSList *acts = self->entry->data.normal.actions;
        ObClient *client = self->frame->client;
        ObMenuFrame *frame = self->frame;
        guint mods = obt_keyboard_only_modmasks(state);

        /* release grabs before executing the shit */
        if (!(mods & ControlMask)) {
            event_cancel_all_key_grabs();
            frame = NULL;
        }

        if (func)
            func(entry, frame, client, state, data);
        else
            actions_run_acts(acts, OB_USER_ACTION_MENU_SELECTION,
                             state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, client);
    }
}
예제 #2
0
파일: mouse.c 프로젝트: godvmxi/obwm
static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
                             ObClient *c, guint state,
                             guint button, gint x, gint y)
{
    GSList *it;
    ObMouseBinding *b;

    for (it = bound_contexts[context]; it; it = g_slist_next(it)) {
        b = it->data;
        if (b->state == state && b->button == button)
            break;
    }
    /* if not bound, then nothing to do! */
    if (it == NULL) return FALSE;

    actions_run_acts(b->actions[a], mouse_action_to_user_action(a),
                     state, x, y, button, context, c);
    return TRUE;
}