Skip to content

Commit

Permalink
hopefully the last cursor sync (match changes to xarcan)
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 7e69c1bfa0b96d643049087337a2dd9304526e8efcb81687a1cc4ea96d91663b
  • Loading branch information
void committed Mar 21, 2024
1 parent 0bbd0ca commit 247f01a
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 28 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions durden/builtin/mouse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand All @@ -1387,24 +1385,23 @@ 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;
end

local ct = cursors[label];
mouse_custom_cursor(ct);
mstate.active_label = label;
end

function mouse_cursors()
Expand Down
Binary file added durden/cursor/default/context.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 30 additions & 14 deletions durden/cursor/default/default.lua
Original file line number Diff line number Diff line change
@@ -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},
}
Binary file added durden/cursor/default/drag-reject.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added durden/cursor/default/forbidden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added durden/cursor/default/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added durden/cursor/default/rz_updown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions durden/durden.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
16 changes: 8 additions & 8 deletions durden/tiler_mh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 247f01a

Please sign in to comment.