feat: add custom cursor support for classic skins

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-08-10 09:41:21 +02:00
parent b9089212be
commit f338752e75
14 changed files with 383 additions and 34 deletions
+22
View File
@@ -53,6 +53,9 @@ class AppDelegate: FlutterAppDelegate {
private var _winampChannel: FlutterMethodChannel?
/// Custom cursors registered by the Dart side, keyed by skin cursor name.
private var cursors: [String: NSCursor] = [:]
private func handleMethodCall(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "setAlwaysOnTop":
@@ -81,6 +84,25 @@ class AppDelegate: FlutterAppDelegate {
setUiScaleMenuState(scale)
}
result(nil)
case "registerCursor":
if let args = call.arguments as? [String: Any],
let name = args["name"] as? String,
let pngData = (args["png"] as? FlutterStandardTypedData)?.data,
let image = NSImage(data: pngData) {
let hotX = args["hotspotX"] as? Int ?? 0
let hotY = args["hotspotY"] as? Int ?? 0
cursors[name] = NSCursor(image: image, hotSpot: NSPoint(x: hotX, y: hotY))
}
result(nil)
case "setCursor":
if let args = call.arguments as? [String: Any], let name = args["name"] as? String {
if let cursor = cursors[name] {
cursor.set()
} else {
NSCursor.arrow.set()
}
}
result(nil)
default:
result(FlutterMethodNotImplemented)
}