~steef/snixembed

aa42dde1b1d39c5126748ab81c0f71c447d0704c — Steef Hegeman 3 months ago 83ea8aa
initial scrolling support (non-smooth)

It seems that it's safe to ignore smooth scrolling, so this only
implements the non-smooth version for now.
2 files changed, 21 insertions(+), 0 deletions(-)

M src/proxyicon.vala
M src/statusnotifieritem.vala
M src/proxyicon.vala => src/proxyicon.vala +20 -0
@@ 29,6 29,7 @@ class ProxyIcon : Object {

        icon.activate.connect(() => item.activate(0, 0)); // TODO: consider smarter coordinate hints
        icon.button_press_event.connect(on_button_press);
        icon.scroll_event.connect(on_scroll);
    }

    bool on_button_press(Gdk.EventButton event) {


@@ 44,6 45,25 @@ class ProxyIcon : Object {
        return false;
    }

    bool on_scroll(Gdk.EventScroll event) {
        switch(event.direction) {
            case Gdk.ScrollDirection.SMOOTH:
                 // It seems that we can safely ignore this
                 break;
            case Gdk.ScrollDirection.DOWN:
            case Gdk.ScrollDirection.UP:
                 item.scroll((int)event.delta_y, "vertical");
                 break;
            case Gdk.ScrollDirection.LEFT:
            case Gdk.ScrollDirection.RIGHT:
                 item.scroll((int)event.delta_x, "horizontal");
                 break;
            default: stderr.printf("unsupported scrolling event\n");
                 break;
        }
        return true;
    }

    void set_icon() {
        var name = item.icon_name;
        if (name != null && name != "") {

M src/statusnotifieritem.vala => src/statusnotifieritem.vala +1 -0
@@ 35,6 35,7 @@ interface StatusNotifierItem : Object {
    // Methods
    public abstract void activate(int x, int y);
    public abstract void context_menu(int x, int y);
    public abstract void scroll(int delta, string orientation);

    // Signals
    public virtual signal void new_title() {