Exemplo n.º 1
0
Arquivo: events.c Projeto: Limsik/e17
unsigned char
handle_property_notify(event_t *ev)
{
    D_EVENTS(("handle_property_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));

#ifdef PIXMAP_OFFSET
    if (background_is_trans()) {
        Window win;
        Pixmap pmap;

        if ((ev->xany.window == TermWin.parent) || (ev->xany.window == Xroot)) {
            D_EVENTS(("On %s.  prop (_WIN_WORKSPACE) == 0x%08x, ev->xproperty.atom == 0x%08x\n",
                      ((ev->xany.window == Xroot) ? "the root window" : "TermWin.parent"), (int) props[PROP_DESKTOP],
                      (int) ev->xproperty.atom));
            if (ev->xproperty.atom == props[PROP_DESKTOP]) {
                win = get_desktop_window();
                if (win == (Window) 1) {
                    /* The desktop window is unchanged.  Ignore this event. */
                    return 1;
                }
                /* The desktop window has changed somehow. */
                if (desktop_window == None) {
                    free_desktop_pixmap();
                    FOREACH_IMAGE(if (image_mode_is(idx, MODE_TRANS)) {
                                  image_set_mode(idx, MODE_IMAGE); image_allow_mode(idx, ALLOW_IMAGE);}
                    );
                    return 1;
                }
Exemplo n.º 2
0
unsigned char
sb_handle_motion_notify(event_t *ev)
{

    D_EVENTS(("sb_handle_motion_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));

    REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);
    if ((PrivateModes & PrivMode_mouse_report) && !(button_state.bypass_keystate))
        return 1;

    D_EVENTS(("MotionNotify event for window 0x%08x\n", ev->xany.window));
    D_EVENTS(("  up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win,
              scrollbar.sa_win, scrollbar.win));

    if ((scrollbar_win_is_trough(ev->xany.window) || scrollbar_win_is_anchor(ev->xany.window)) && scrollbar_is_moving()) {
        Window unused_root, unused_child;
        int unused_root_x, unused_root_y;
        unsigned int unused_mask;

        while (XCheckTypedWindowEvent(Xdisplay, scrollbar.win, MotionNotify, ev));
        XQueryPointer(Xdisplay, scrollbar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x),
                      &(ev->xbutton.y), &unused_mask);
        scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height());
        refresh_count = refresh_limit = 0;
        scr_refresh(refresh_type);
        scrollbar_anchor_update_position(button_state.mouse_offset);
    }
    return 1;
}
Exemplo n.º 3
0
Arquivo: events.c Projeto: Limsik/e17
unsigned char
handle_key_press(event_t *ev)
{
    XWMHints *wm_hints;
#ifdef COUNT_X_EVENTS
    static unsigned long keypress_cnt = 0;
#endif

    PROF_INIT(handle_key_press);
    D_EVENTS(("handle_key_press(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));
#if UNUSED_BLOCK
    REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
#endif

    COUNT_EVENT(keypress_cnt);
    if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT))) {
        lookup_key(ev);
    }
    if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_URG_ALERT)) {
        wm_hints = XGetWMHints(Xdisplay, TermWin.parent);
        wm_hints->flags &= ~XUrgencyHint;
        XSetWMHints(Xdisplay, TermWin.parent, wm_hints);
        XFree(wm_hints);
    }
    PROF_DONE(handle_key_press);
    PROF_TIME(handle_key_press);
    return 1;
}
Exemplo n.º 4
0
unsigned char
sb_handle_focus_out(event_t *ev)
{

    D_EVENTS(("sb_handle_focus_out(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));

    REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);

    return 1;
}
Exemplo n.º 5
0
unsigned char
sb_handle_enter_notify(event_t *ev)
{

    D_EVENTS(("sb_handle_enter_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));

    REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);

    if (scrollbar_win_is_uparrow(ev->xany.window)) {
        scrollbar_draw_uparrow(IMAGE_STATE_SELECTED, 0);
    } else if (scrollbar_win_is_downarrow(ev->xany.window)) {
        scrollbar_draw_downarrow(IMAGE_STATE_SELECTED, 0);
    } else if (scrollbar_win_is_anchor(ev->xany.window)) {
        scrollbar_draw_anchor(IMAGE_STATE_SELECTED, 0);
    } else if (scrollbar_win_is_trough(ev->xany.window)) {
        scrollbar_draw_trough(IMAGE_STATE_SELECTED, 0);
    }
    return 1;
}
Exemplo n.º 6
0
unsigned char
sb_handle_button_release(event_t *ev)
{

    Window root, child;
    int root_x, root_y, win_x, win_y;
    unsigned int mask;

    D_EVENTS(("sb_handle_button_release(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));

    REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);
    button_state.mouse_offset = 0;
    button_state.report_mode = (button_state.bypass_keystate ? 0 : ((PrivateModes & PrivMode_mouse_report) ? 1 : 0));

    XQueryPointer(Xdisplay, scrollbar_get_win(), &root, &child, &root_x, &root_y, &win_x, &win_y, &mask);
    scrollbar_cancel_motion();
    if (scrollbar_win_is_uparrow(child)) {
        scrollbar_draw_uparrow(IMAGE_STATE_SELECTED, 0);
    } else {
        scrollbar_draw_uparrow(IMAGE_STATE_NORMAL, 0);
    }
    if (scrollbar_win_is_downarrow(child)) {
        scrollbar_draw_downarrow(IMAGE_STATE_SELECTED, 0);
    } else {
        scrollbar_draw_downarrow(IMAGE_STATE_NORMAL, 0);
    }
    if (scrollbar_win_is_anchor(child)) {
        scrollbar_draw_anchor(IMAGE_STATE_SELECTED, 0);
    } else {
        scrollbar_draw_anchor(IMAGE_STATE_NORMAL, 0);
    }
    if (scrollbar_win_is_trough(child)) {
        scrollbar_draw_trough(IMAGE_STATE_SELECTED, 0);
    } else {
        scrollbar_draw_trough(IMAGE_STATE_NORMAL, 0);
    }
    return 1;
}
Exemplo n.º 7
0
unsigned char
sb_handle_expose(event_t *ev)
{

    XEvent unused_xevent;

    D_EVENTS(("sb_handle_expose(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));

    REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);

    while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, Expose, &unused_xevent));
    while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, GraphicsExpose, &unused_xevent));

    if (scrollbar_win_is_uparrow(ev->xany.window)) {
        scrollbar_draw_uparrow(IMAGE_STATE_CURRENT, 0);
    } else if (scrollbar_win_is_downarrow(ev->xany.window)) {
        scrollbar_draw_downarrow(IMAGE_STATE_CURRENT, 0);
    } else if (scrollbar_win_is_anchor(ev->xany.window)) {
        scrollbar_draw_anchor(IMAGE_STATE_CURRENT, 0);
    } else if (scrollbar_win_is_trough(ev->xany.window)) {
        scrollbar_draw_trough(IMAGE_STATE_CURRENT, 0);
    }
    return 1;
}
Exemplo n.º 8
0
unsigned char
sb_handle_button_press(event_t *ev)
{

    D_EVENTS(("sb_handle_button_press(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window));

    REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0);

    button_state.bypass_keystate = (ev->xbutton.state & (Mod1Mask | ShiftMask));
    button_state.report_mode = (button_state.bypass_keystate ? 0 : ((PrivateModes & PrivMode_mouse_report) ? 1 : 0));
    scrollbar_cancel_motion();

#ifndef NO_SCROLLBAR_REPORT
    if (button_state.report_mode) {
        /* Mouse report disabled scrollbar.  Arrows send cursor key up/down, trough sends pageup/pagedown */
        if (scrollbar_win_is_uparrow(ev->xany.window))
            tt_printf((unsigned char *) "\033[A");
        else if (scrollbar_win_is_downarrow(ev->xany.window))
            tt_printf((unsigned char *) "\033[B");
        else {
            switch (ev->xbutton.button) {
                case Button2:
                    tt_printf((unsigned char *) "\014");
                    break;
                case Button1:
                    tt_printf((unsigned char *) "\033[6~");
                    break;
                case Button3:
                    tt_printf((unsigned char *) "\033[5~");
                    break;
            }
        }
    } else
#endif /* NO_SCROLLBAR_REPORT */
    {
        D_EVENTS(("ButtonPress event for window 0x%08x at %d, %d\n", ev->xany.window, ev->xbutton.x, ev->xbutton.y));
        D_EVENTS(("  up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win,
                  scrollbar.sa_win, scrollbar.win));

        if (scrollbar_win_is_uparrow(ev->xany.window)) {
            scrollbar_draw_uparrow(IMAGE_STATE_CLICKED, 0);
#ifdef SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
            scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY;
#endif
            if (scr_page(UP, 1)) {
                scrollbar_set_uparrow_pressed(1);
            }
        } else if (scrollbar_win_is_downarrow(ev->xany.window)) {
            scrollbar_draw_downarrow(IMAGE_STATE_CLICKED, 0);
#ifdef SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
            scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY;
#endif
            if (scr_page(DN, 1)) {
                scrollbar_set_downarrow_pressed(1);
            }
        } else {
            if (scrollbar_win_is_anchor(ev->xany.window)) {
                scrollbar_set_anchor_pressed(1);
                scrollbar_draw_anchor(IMAGE_STATE_CLICKED, 0);
            }
            switch (ev->xbutton.button) {
                case Button2:
                    button_state.mouse_offset = scrollbar_anchor_height() / 2;  /* Align to center */
                    if (!scrollbar_win_is_anchor(ev->xany.window)) {
                        scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height());
                    } else if (scrollbar.type == SCROLLBAR_XTERM) {
                        scr_move_to(scrollbar.anchor_top + ev->xbutton.y - button_state.mouse_offset,
                                    scrollbar_scrollarea_height());
                    }
                    scrollbar_set_motion(1);
                    break;

                case Button1:
                    button_state.mouse_offset = ((scrollbar_win_is_anchor(ev->xany.window)) ? (MAX(ev->xbutton.y, 1)) : (1));
                    /* drop */
                case Button3:
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
                    if (scrollbar.type == SCROLLBAR_MOTIF || scrollbar.type == SCROLLBAR_NEXT) {
                        if (scrollbar_is_above_anchor(ev->xany.window, ev->xbutton.y)) {
                            scrollbar_draw_trough(IMAGE_STATE_CLICKED, 0);
                            scr_page(UP, TermWin.nrow - CONTEXT_LINES);
                        } else if (scrollbar_is_below_anchor(ev->xany.window, ev->xbutton.y)) {
                            scrollbar_draw_trough(IMAGE_STATE_CLICKED, 0);
                            scr_page(DN, TermWin.nrow - CONTEXT_LINES);
                        } else {
                            scrollbar_set_motion(1);
                        }
                    }
#endif /* MOTIF_SCROLLBAR || NEXT_SCROLLBAR */

#ifdef XTERM_SCROLLBAR
                    if (scrollbar.type == SCROLLBAR_XTERM) {
                        scr_page((ev->xbutton.button == Button1 ? DN : UP), TermWin.nrow - CONTEXT_LINES);
                    }
#endif /* XTERM_SCROLLBAR */
                    break;
            }
        }
    }

    return 1;
}