Skip to content

Commit b28d28e

Browse files
format + bring back comment
1 parent 3d197d5 commit b28d28e

File tree

2 files changed

+60
-24
lines changed

2 files changed

+60
-24
lines changed

apps/desktop/src/routes/(window-chrome)/settings/general.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
createMemo,
1515
createResource,
1616
For,
17-
ParentProps,
17+
type ParentProps,
1818
Show,
1919
} from "solid-js";
2020
import { createStore, reconcile } from "solid-js/store";

crates/cursor-info/src/macos.rs

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub enum CursorShapeMacOS {
4242
ResizeUpDown,
4343
/// https://developer.apple.com/documentation/appkit/nscursor/ibeamcursorforverticallayout
4444
IBeamVerticalForVerticalLayout,
45-
45+
4646
// macOS Tahoe Cursors
4747
TahoeArrow,
4848
TahoeContextualMenu,
@@ -63,7 +63,7 @@ pub enum CursorShapeMacOS {
6363
TahoeResizeUpDown,
6464
TahoeIBeamVerticalForVerticalLayout,
6565
TahoeZoomOut,
66-
TahoeZoomIn
66+
TahoeZoomIn,
6767
}
6868

6969
impl CursorShapeMacOS {
@@ -138,7 +138,7 @@ impl CursorShapeMacOS {
138138
raw: include_str!("../assets/mac/ibeam_vertical.svg"),
139139
hotspot: (0.51, 0.49),
140140
},
141-
141+
142142
// Tahoe cursor variants
143143
Self::TahoeArrow => ResolvedCursor {
144144
raw: include_str!("../assets/mac/tahoe/default.svg"),
@@ -205,7 +205,7 @@ impl CursorShapeMacOS {
205205
raw: include_str!("../assets/mac/tahoe/resize-ns.svg"),
206206
hotspot: (0.5, 0.5),
207207
},
208-
208+
209209
Self::TahoeResizeUp => ResolvedCursor {
210210
raw: include_str!("../assets/mac/tahoe/resize-n.svg"),
211211
hotspot: (0.5, 0.5),
@@ -222,10 +222,12 @@ impl CursorShapeMacOS {
222222
raw: include_str!("../assets/mac/tahoe/zoom-out.svg"),
223223
hotspot: (0.51, 0.49),
224224
},
225-
226225
})
227226
}
228227

228+
/// Derive the cursor type from a hash
229+
/// macOS doesn't allow comparing `NSCursor` instances directly so we hash the image data.
230+
/// macOS cursor are also resolution-independent so this works.
229231
pub fn from_hash(hash: &str) -> Option<Self> {
230232
Some(match hash {
231233
// Regular macOS cursor hashes
@@ -261,28 +263,62 @@ impl CursorShapeMacOS {
261263
"024e1d486a7f16368669d419e69c9a326e464ec1b8ed39645e5c89cb183e03c5" => {
262264
Self::IBeamVerticalForVerticalLayout
263265
}
264-
266+
265267
//Hash values obtained from a macOS Tahoe system.
266268
"57a1d610df3e421ebef670ba58c97319d2ab6990d64dca34d28140e4527fd54d" => Self::TahoeArrow,
267-
"877e1c153d942d18ddfe88e72e2f34ad4435a6839fc447c1a32a71e6bbe1104c" => Self::TahoeContextualMenu,
268-
"bc1a01ced20ea38eda8f0eb1976bfe74ac39150ed9a044d3df918faf3dff15ae" => Self::TahoeClosedHand,
269-
"0aa0d950a742ed4802ed44095cbf5834de3eea84bf78026cacb8e2c37d244f46" => Self::TahoeCrosshair,
270-
"f44a524d6fcfe5a1b1bebf23fcb12fbfeaea0ecf92beb7f69fdf586c319dd8ab" => Self::TahoeDisappearingItem,
271-
"93d05bf80e702fdf5d6924447c91a0ab5fb196251d5758e98c5b6a5f08f0e960" => Self::TahoeDragCopy,
272-
"00cdb9c59246bf98172a027a94b323498bf8d82c701c4d0d85c6e452549fa351" => Self::TahoeDragLink,
269+
"877e1c153d942d18ddfe88e72e2f34ad4435a6839fc447c1a32a71e6bbe1104c" => {
270+
Self::TahoeContextualMenu
271+
}
272+
"bc1a01ced20ea38eda8f0eb1976bfe74ac39150ed9a044d3df918faf3dff15ae" => {
273+
Self::TahoeClosedHand
274+
}
275+
"0aa0d950a742ed4802ed44095cbf5834de3eea84bf78026cacb8e2c37d244f46" => {
276+
Self::TahoeCrosshair
277+
}
278+
"f44a524d6fcfe5a1b1bebf23fcb12fbfeaea0ecf92beb7f69fdf586c319dd8ab" => {
279+
Self::TahoeDisappearingItem
280+
}
281+
"93d05bf80e702fdf5d6924447c91a0ab5fb196251d5758e98c5b6a5f08f0e960" => {
282+
Self::TahoeDragCopy
283+
}
284+
"00cdb9c59246bf98172a027a94b323498bf8d82c701c4d0d85c6e452549fa351" => {
285+
Self::TahoeDragLink
286+
}
273287
"3de4a52b22f76f28db5206dc4c2219dff28a6ee5abfb9c5656a469f2140f7eaa" => Self::TahoeIBeam,
274-
"a6f87e2749a5a6799c04ca8e1782194b770a2b5f966e70b79c7c245222176ec5" => Self::TahoeOpenHand,
275-
"48941d14eefe97e53fe38531c0f927d71fbd3e63b32e1e10e0a4ff729d64e320" => Self::TahoeOperationNotAllowed,
276-
"cb0277925fa3ecca8bc54bc98b3ef1d5c08cfd4c6086733f4d849c675f68bf6f" => Self::TahoePointingHand,
277-
"825236ff95d98fd49868da5a588ad7077ea507e15ad0a4924495511d05c1bc35" => Self::TahoeResizeDown,
278-
"8a8608a42590e7c518f410aa0750894d2296c7a72e74e3a9dcceb72bc3bc2daf" => Self::TahoeResizeLeft,
279-
"1db16810eb4c14a9c86807b15633d891298e4decd22ed650d8d5d2375f94d27e" => Self::TahoeResizeLeftRight,
280-
"426e4d72be3d8b97fadca5e1067c5a5c2c939e0bbe9c686947c60e3350f386cb" => Self::TahoeResizeRight,
281-
"95b05d0dd57d3a5c7198c7e8fbcf001c316530dd65de9ec26dde42ba9922e11b" => Self::TahoeResizeUp,
282-
"f919de8ef1e36cd95ec8805f6731e831cb5996a4e4403f7c62b6ff994d429451" => Self::TahoeResizeUpDown,
283-
"5113d2b572347a56228457ca3e96102934eb394c7d26c3d985d4ee146959d34a" => Self::TahoeIBeamVerticalForVerticalLayout,
288+
"a6f87e2749a5a6799c04ca8e1782194b770a2b5f966e70b79c7c245222176ec5" => {
289+
Self::TahoeOpenHand
290+
}
291+
"48941d14eefe97e53fe38531c0f927d71fbd3e63b32e1e10e0a4ff729d64e320" => {
292+
Self::TahoeOperationNotAllowed
293+
}
294+
"cb0277925fa3ecca8bc54bc98b3ef1d5c08cfd4c6086733f4d849c675f68bf6f" => {
295+
Self::TahoePointingHand
296+
}
297+
"825236ff95d98fd49868da5a588ad7077ea507e15ad0a4924495511d05c1bc35" => {
298+
Self::TahoeResizeDown
299+
}
300+
"8a8608a42590e7c518f410aa0750894d2296c7a72e74e3a9dcceb72bc3bc2daf" => {
301+
Self::TahoeResizeLeft
302+
}
303+
"1db16810eb4c14a9c86807b15633d891298e4decd22ed650d8d5d2375f94d27e" => {
304+
Self::TahoeResizeLeftRight
305+
}
306+
"426e4d72be3d8b97fadca5e1067c5a5c2c939e0bbe9c686947c60e3350f386cb" => {
307+
Self::TahoeResizeRight
308+
}
309+
"95b05d0dd57d3a5c7198c7e8fbcf001c316530dd65de9ec26dde42ba9922e11b" => {
310+
Self::TahoeResizeUp
311+
}
312+
"f919de8ef1e36cd95ec8805f6731e831cb5996a4e4403f7c62b6ff994d429451" => {
313+
Self::TahoeResizeUpDown
314+
}
315+
"5113d2b572347a56228457ca3e96102934eb394c7d26c3d985d4ee146959d34a" => {
316+
Self::TahoeIBeamVerticalForVerticalLayout
317+
}
284318
"e539c32a13a6b2caf0e0a991a21d31f8d16cb9feee61fb4efc27a21d6dd6a177" => Self::TahoeZoomIn,
285-
"d2324ade560f68ce638bb2fd98e9ba2f08d219593afab6b94fb647b1c243d049" => Self::TahoeZoomOut,
319+
"d2324ade560f68ce638bb2fd98e9ba2f08d219593afab6b94fb647b1c243d049" => {
320+
Self::TahoeZoomOut
321+
}
286322
_ => return None,
287323
})
288324
}

0 commit comments

Comments
 (0)