Exemple #1
0
void Compositor::DoKey(ClientWindow *mouse_win, const Input& input) {

    ace_event_t     event;

    if (m_focussed_win) {
        if (input.Type() == INPUT_TYPE_KEY_PRESS) {
            event.type = ACE_EVTYPE_KEY_PRESS;
        }
        else {
            event.type = ACE_EVTYPE_KEY_RELEASE;
        }
        event.key.keycode     = input.Key();
        event.key.shift_state = input.ShiftState();
        //anvil_syslog(0, "Key to window (%02x)\n", key);
        m_focussed_win->AddEvent(event);
    }

}
Exemple #2
0
void Compositor::DoReleaseLeft(ClientWindow *mouse_win, const Input& input) {

    ace_event_t     event;

    //anvil_syslog(0, "Left up\n");

    /* Left mouse up */
    if (m_mouse_mode != MOUSE_MODE_NONE) {
        m_mouse_mode = MOUSE_MODE_NONE;
    }
    else {
        int win_pos_x, win_pos_y;
        if (mouse_win) {
            //anvil_syslog(0, "Mouse 1 up at %d %d\n", m_cursor_x, m_cursor_y);
            mouse_win->GetPos(win_pos_x, win_pos_y);
            event.type = ACE_EVTYPE_MOUSE_UP;
            event.mouse.shift_state = input.ShiftState();
            event.mouse.button = 0;
            event.mouse.x = m_cursor_x - win_pos_x;
            event.mouse.y = m_cursor_y - win_pos_y;
            mouse_win->AddEvent(event);
        }
    }
}
Exemple #3
0
void Compositor::DoPressLeft(ClientWindow *mouse_win, const Input& input) {

    ace_event_t     event;

    //anvil_syslog(0, "Left down\n");

    /* Left mouse down */
    int win_pos_x, win_pos_y;
    //anvil_syslog(0, "Mouse 1 down at %d %d\n", m_cursor_x, m_cursor_y);

    // This is ONLY where we set the focussed window.
    if (m_focussed_win != mouse_win) {
        //anvil_syslog(0, "Activate %016lx\n", mouse_win);

        /* Send an out of focus event to the old window */
        if (m_focussed_win) {
            event.type = ACE_EVTYPE_FOCUS;
            event.focus.state = false;
            m_focussed_win->AddEvent(event);
        }
        m_focussed_win = mouse_win;

        /* Send a focus event to the new window */
        if (m_focussed_win) {
            event.type = ACE_EVTYPE_FOCUS;
            event.focus.state = true;
            m_focussed_win->AddEvent(event);
        }
    }

    switch (m_cursor_type) {
        case -1: // outside
            m_mouse_mode = MOUSE_MODE_NONE;
            break;
        case 0: // in window - send event to the window
            if (input.ShiftState() & ACE_SHIFTSTATE_ALT) {
                if (mouse_win && mouse_win->isMoveable()) {
                    m_windowlist.Raise(mouse_win);
                    m_mouse_mode = MOUSE_MODE_MOVE;
                }
            }
            else {
                if (mouse_win) {
                    /* Send the mouse down */
                    m_windowlist.Raise(mouse_win);
                    mouse_win->GetPos(win_pos_x, win_pos_y);
                    event.type = ACE_EVTYPE_MOUSE_DOWN;
                    event.mouse.shift_state = input.ShiftState();
                    event.mouse.button = 0;
                    event.mouse.x = m_cursor_x - win_pos_x;
                    event.mouse.y = m_cursor_y - win_pos_y;
                    mouse_win->AddEvent(event);
                }
            }
            break;
        case 1: // left border
            m_mouse_mode = MOUSE_MODE_RESIZE_L;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_L\n");
            break;
        case 2: // right border
            m_mouse_mode = MOUSE_MODE_RESIZE_R;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_R\n");
            break;
        case 4: // top border
            m_mouse_mode = MOUSE_MODE_RESIZE_T;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_T\n");
            break;
        case 8: // bottom border
            m_mouse_mode = MOUSE_MODE_RESIZE_B;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_B\n");
            break;
        case 5: // top left
            m_mouse_mode = MOUSE_MODE_RESIZE_LT;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_LT\n");
            break;
        case 6: // top right
            m_mouse_mode = MOUSE_MODE_RESIZE_RT;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_RT\n");
            break;
        case 9: // bottom left
            m_mouse_mode = MOUSE_MODE_RESIZE_LB;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_LB\n");
            break;
        case 10: // bottom right
            m_mouse_mode = MOUSE_MODE_RESIZE_RB;
            //anvil_syslog(0, "MOUSE_MODE_RESIZE_RB\n");
            break;
    }

}