diff --git a/README.md b/README.md index 09769b5d..9a2f1d75 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,9 @@ and licensed under the Apache-2.0 license. The included UI font, IBM/Plex, is provided free via the SIL OpenFont License 1.1. +The included cursors, phinger, are provided free (cc-by-sa 4.0) +https://github.com/phisch/phinger-cursors + The included fallback font, Emoji-One, is provided free (cc-by 4.0 attribution) by http://emojione.com diff --git a/durden/builtin/mouse.lua b/durden/builtin/mouse.lua index 0a8363f1..3321aa1a 100644 --- a/durden/builtin/mouse.lua +++ b/durden/builtin/mouse.lua @@ -1377,8 +1377,6 @@ function mouse_custom_cursor(ct) image_shader(mstate.cursor, "DEFAULT"); end - print("custom-cursor", ct.hotspot_x, ct.hotspot_y); - mstate.hotspot_x = ct.hotspot_x; mstate.hotspot_y = ct.hotspot_y; mstate.active_label = ""; @@ -1387,17 +1385,15 @@ function mouse_custom_cursor(ct) mouse_cursor_draw(); end -function mouse_switch_cursor(label) +function mouse_switch_cursor(label, force) if (label == nil) then label = "default"; end - if (label == mstate.active_label) then + if (label == mstate.active_label and not force) then return; end - mstate.active_label = label; - if (cursors[label] == nil) then hide_image(mstate.cursor); return; @@ -1405,6 +1401,7 @@ function mouse_switch_cursor(label) local ct = cursors[label]; mouse_custom_cursor(ct); + mstate.active_label = label; end function mouse_cursors() diff --git a/durden/cursor/default/context.png b/durden/cursor/default/context.png new file mode 100644 index 00000000..8c87ec51 Binary files /dev/null and b/durden/cursor/default/context.png differ diff --git a/durden/cursor/default/default.lua b/durden/cursor/default/default.lua index 5dfa07c6..708ddac0 100644 --- a/durden/cursor/default/default.lua +++ b/durden/cursor/default/default.lua @@ -1,22 +1,38 @@ return { +-- generic default = {"default.png", 0, 0}, - drag = {"drag.png", 8, 7}, wait = {"wait.png", 12, 12}, forbidden = {"forbidden.png", 12, 12}, grabhint = {"grabhint.png", 8, 10}, - hand = {"pointer.png", 14, 6}, - sizeall = {"sizeall.png", 16, 16}, crosshair = {"crosshair.png", 12, 12}, - ["col-resize"] = {"rz_col.png", 16, 15}, - cell = {"cell.png", 12, 12}, - typefield = {"typefield.png", 12, 12}, - rz_diag_l = {"rz_diag_l.png", 6, 6}, - rz_diag_r = {"rz_diag_r.png", 6, 6}, - rz_down = {"rz_down.png", 6, 13}, - rz_left = {"rz_left.png", 0, 5}, - rz_right = {"rz_right.png", 14, 5}, - rz_up = {"rz_up.png", 5, 0}, + hand = {"pointer.png", 14, 6}, ["zoom-in"] = {"zoom-in.png", 11, 11}, - ["zoom-out"] = {"zoom-out.png", 11, 11} -} + ["zoom-out"] = {"zoom-out.png", 11, 11}, + help = {"help.png", 0, 0}, + ["context-menu"] = {"context.png", 1, 1}, +-- data oriented + typefield = {"typefield.png", 12, 12}, + datafield = {"typefield.png", 12, 12}, + ["vertical-datafield"] = {"verticaldata.png", 12, 12}, + cell = {"cell.png", 12, 12}, + alias = {"alias.png", 12, 12}, +-- drag and drop + drag = {"drag.png", 8, 7}, + ["drag-drop"] = {"drag-drop.png", 0, 0}, + ["drag-reject"] = {"drag-reject.png", 0, 0}, +-- resizing operations + sizeall = {"sizeall.png", 16, 16}, + west = {"rz_left.png", 0, 5}, + east = {"rz_right.png", 16, 15}, + north = {"rz_up.png", 5, 0}, + south = {"rz_down.png", 5, 0}, + ["west-east"] = {"rz_leftright.png", 15, 15}, + ["north-south"] = {"rz_updown.png", 12, 12}, + ["north-west"] = {"rz_diag_l.png", 6, 6}, + ["south-west"] = {"rz_diag_l.png", 6, 6}, + ["north-east"] = {"rz_diag_r.png", 6, 6}, + ["south-east"] = {"rz_diag_r.png", 6, 6}, + ["north-west-south-east"] = {"rz_diag_l.png", 6, 6}, + ["south-west-north-east"] = {"rz_diag_r.png", 6, 6}, + } diff --git a/durden/cursor/default/drag-reject.png b/durden/cursor/default/drag-reject.png new file mode 100644 index 00000000..572c5694 Binary files /dev/null and b/durden/cursor/default/drag-reject.png differ diff --git a/durden/cursor/default/forbidden.png b/durden/cursor/default/forbidden.png new file mode 100644 index 00000000..26069348 Binary files /dev/null and b/durden/cursor/default/forbidden.png differ diff --git a/durden/cursor/default/help.png b/durden/cursor/default/help.png new file mode 100644 index 00000000..09b0c8f3 Binary files /dev/null and b/durden/cursor/default/help.png differ diff --git a/durden/cursor/default/rz_updown.png b/durden/cursor/default/rz_updown.png new file mode 100644 index 00000000..0aaf8d6d Binary files /dev/null and b/durden/cursor/default/rz_updown.png differ diff --git a/durden/durden.lua b/durden/durden.lua index 4d99aac6..9b060061 100644 --- a/durden/durden.lua +++ b/durden/durden.lua @@ -283,6 +283,7 @@ load_configure_mouse = function() local setname = gconfig_get("mouse_cursorset") or "default" mouse_load_theme("cursor", setname) + mouse_switch_cursor("default", true) switch_default_texfilter(FILTER_NONE); diff --git a/durden/tiler_mh.lua b/durden/tiler_mh.lua index d6ea3514..d9c185a6 100644 --- a/durden/tiler_mh.lua +++ b/durden/tiler_mh.lua @@ -21,14 +21,14 @@ end -- map rectangle edge to mouse-cursor direction and name local dir_lut = { - ul = {"rz_diag_r", {-1, -1, 1, 1}}, - u = {"rz_up", {0, -1, 0, 1}}, - ur = {"rz_diag_l", {1, -1, 0, 1}}, - r = {"rz_right", {1, 0, 0, 0}}, - lr = {"rz_diag_r", {1, 1, 0, 0}}, - d = {"rz_down", {0, 1, 0, 0}}, - ll = {"rz_diag_l", {-1, 1, 1, 0}}, - l = {"rz_left", {-1, 0, 1, 0}} + ul = {"north-west", {-1, -1, 1, 1}}, + u = {"north", {0, -1, 0, 1}}, + ur = {"north-east", {1, -1, 0, 1}}, + r = {"east", {1, 0, 0, 0}}, + lr = {"south-east", {1, 1, 0, 0}}, + d = {"south", {0, 1, 0, 0}}, + ll = {"south-west", {-1, 1, 1, 0}}, + l = {"left", {-1, 0, 1, 0}} }; -- display- local coordinate to window border conversion