elementary / icons

Named, vector icons for elementary OS
https://elementary.io
GNU General Public License v3.0
550 stars 85 forks source link

Cursors misaligned #797

Closed markodp closed 5 months ago

markodp commented 5 years ago

A lot of cursors don't have proper offset/hotspot set. It's most noticeable with resize cursors while hovering over window resize area.

some cursor examples with highlighted current mouse position:

vlcsnap-2019-04-28-19h24m43s513

vlcsnap-2019-04-28-19h24m54s779

vlcsnap-2019-04-28-19h24m32s372

vlcsnap-2019-04-28-19h23m57s873

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/73492800-cursors-misaligned?utm_campaign=plugin&utm_content=tracker%2F27377189&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F27377189&utm_medium=issues&utm_source=github).
cassidyjames commented 5 years ago

@markodp since the cursors are shipped with the icons, I've transferred this from the stylesheet to the icons repo.

ghost commented 5 years ago

Hello. Can you replace the cursor with another, it is not very good quality. I want to offer you my cursor, the first you can see and comment on here - https://www.deviantart.com/vladsukhetskyi/art/Black-cursor-795861907

danirabbit commented 4 years ago

@markodp what's the program you're using to test this? I'd like to work on a fix for this

markodp commented 4 years ago

It's just a simple tool i wrote to see if my perceptions about misaligned are true. Just use mouse wheel to scroll between cursors.

// valac --pkg gtk+-3.0  cursor.vala

void main(string[] args) {
    new Cursors().run();
}

class Cursors : Gtk.Application {
    protected override void activate() {
        var w = new Gtk.ApplicationWindow(this);
        w.add(new Area());
        w.show_all();
    }
}

class Area : Gtk.DrawingArea {
    public double mx;
    public double my;
    construct {
        add_events(Gdk.EventMask.POINTER_MOTION_MASK|Gdk.EventMask.SCROLL_MASK);
        set_size_request(100, 100);
    }

    public override bool motion_notify_event(Gdk.EventMotion e) {
        mx = e.x;
        my = e.y;
        queue_draw();
        return false;
    }
    public override bool scroll_event (Gdk.EventScroll e) {
        switch(e.direction) {
            case DOWN: choice = (choice + 1) % choices.length; break;
            case UP: choice = (choice + choices.length - 1) % choices.length;  break;
        }
        queue_draw();
        return true;
    }
    public override bool draw(Cairo.Context cr) {
        var c = new Gdk.Cursor.from_name(get_display(), choices[choice]);
        get_parent_window().set_cursor(c);

        int w = get_allocated_width();
        int h = get_allocated_height();

        cr.set_source_rgb(0,0,1);
        cr.move_to(5, 20);
        cr.show_text(choices[choice]);

        cr.set_source_rgb(1,0,0);
        cr.set_line_width(1);
        cr.move_to(mx, 0);
        cr.line_to(mx, h);
        cr.move_to(0, my);
        cr.line_to(w, my);
        cr.stroke();

        return false;
    }
    int choice = 2;
    string[] choices = {
        "none",
        "default",
        "help",
        "pointer",
        "context-menu",
        "progress","wait",
        "cell",
        "crosshair",
        "text","vertical-text",
        "alias",
        "copy",
        "no-drop",
        "move",
        "not-allowed",
        "grab","grabbing",
        "all-scroll",
        "col-resize","row-resize",
        "n-resize","e-resize","s-resize","w-resize",
        "ne-resize","nw-resize","sw-resize","se-resize",
        "ew-resize","ns-resize","nesw-resize","nwse-resize",
        "zoom-in","zoom-out",
    };
}