Example #1
0
static int
buttonbar_event (Gpm_Event * event, void *data)
{
    WButtonBar *bb = data;
    int button;

    if (!(event->type & GPM_UP))
        return MOU_NORMAL;
    if (event->y == 2)
        return MOU_NORMAL;
    button = buttonbar_get_button_by_x_coord (bb, event->x - 1);
    if (button >= 0)
        buttonbar_call (bb, button);
    return MOU_NORMAL;
}
Example #2
0
static void
buttonbar_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event)
{
    switch (msg)
    {
    case MSG_MOUSE_CLICK:
        {
            WButtonBar *bb = BUTTONBAR (w);
            int button;

            button = buttonbar_get_button_by_x_coord (bb, event->x);
            if (button >= 0)
                buttonbar_call (bb, button);
            break;
        }

    default:
        break;
    }
}
Example #3
0
static int
buttonbar_event (Gpm_Event * event, void *data)
{
    Widget *w = WIDGET (data);

    if (!mouse_global_in_widget (event, w))
        return MOU_UNHANDLED;

    if ((event->type & GPM_UP) != 0)
    {
        WButtonBar *bb = BUTTONBAR (data);
        Gpm_Event local;
        int button;

        local = mouse_get_local (event, w);
        button = buttonbar_get_button_by_x_coord (bb, local.x - 1);
        if (button >= 0)
            buttonbar_call (bb, button);
    }

    return MOU_NORMAL;
}