1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-13 07:42:46 -04:00

Compare commits

...

2 Commits

Author SHA1 Message Date
bbedward 75fd62865b core/dbus: fix arg types in calls 2026-01-28 15:25:16 -05:00
bbedward 757054e140 core/dbus: support Normalize for more dbus types 2026-01-28 13:28:13 -05:00
3 changed files with 70 additions and 9 deletions
+34 -2
View File
@@ -60,12 +60,44 @@ func (m *Manager) Call(bus, dest, path, iface, method string, args []any) (*Call
obj := conn.Object(dest, dbus.ObjectPath(path))
fullMethod := iface + "." + method
call := obj.Call(fullMethod, 0, args...)
convertedArgs := convertArgs(args)
call := obj.Call(fullMethod, 0, convertedArgs...)
if call.Err != nil {
return nil, fmt.Errorf("dbus call failed: %w", call.Err)
}
return &CallResult{Values: call.Body}, nil
return &CallResult{Values: dbusutil.NormalizeSlice(call.Body)}, nil
}
func convertArgs(args []any) []any {
result := make([]any, len(args))
for i, arg := range args {
result[i] = convertArg(arg)
}
return result
}
func convertArg(arg any) any {
switch v := arg.(type) {
case float64:
if v == float64(uint32(v)) && v >= 0 && v <= float64(^uint32(0)) {
return uint32(v)
}
if v == float64(int32(v)) {
return int32(v)
}
return v
case []any:
return convertArgs(v)
case map[string]any:
result := make(map[string]any)
for k, val := range v {
result[k] = convertArg(val)
}
return result
default:
return arg
}
}
func (m *Manager) GetProperty(bus, dest, path, iface, property string) (*PropertyResult, error) {
+26
View File
@@ -49,12 +49,38 @@ func Normalize(v any) any {
result[k] = Normalize(vv.Value())
}
return result
case map[string]any:
result := make(map[string]any)
for k, vv := range val {
result[k] = Normalize(vv)
}
return result
case map[dbus.ObjectPath]map[string]map[string]dbus.Variant:
result := make(map[string]any)
for path, ifaces := range val {
ifaceMap := make(map[string]any)
for ifaceName, props := range ifaces {
propMap := make(map[string]any)
for propName, propVal := range props {
propMap[propName] = Normalize(propVal.Value())
}
ifaceMap[ifaceName] = propMap
}
result[string(path)] = ifaceMap
}
return result
case []any:
result := make([]any, len(val))
for i, item := range val {
result[i] = Normalize(item)
}
return result
case []dbus.Variant:
result := make([]any, len(val))
for i, item := range val {
result[i] = Normalize(item.Value())
}
return result
default:
return v
}
+10 -7
View File
@@ -445,6 +445,15 @@ Item {
}
}
Rectangle {
id: maskRect
width: thumbnailImage.width
height: thumbnailImage.height
radius: Theme.cornerRadius
visible: false
layer.enabled: true
}
CachingImage {
id: thumbnailImage
anchors.fill: parent
@@ -456,13 +465,7 @@ Item {
maskEnabled: true
maskThresholdMin: 0.5
maskSpreadAtMin: 1.0
maskSource: ShaderEffectSource {
sourceItem: Rectangle {
width: thumbnailImage.width
height: thumbnailImage.height
radius: Theme.cornerRadius
}
}
maskSource: maskRect
}
}