[PATCH wlhax 1/2] wl_seat: show name
Export this patch
---
wl_seat.go | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/wl_seat.go b/wl_seat.go
index 3bc78f2bc3ab..1cf7bb6c1791 100644
--- a/wl_seat.go
+++ b/wl_seat.go
@@ -1,7 +1,12 @@
package main
+import (
+ "fmt"
+)
+
type WlSeat struct {
Object *WaylandObject
+ Name string
Children []*WaylandObject
}
@@ -14,7 +19,11 @@ func (*WlSeat) DashboardCategory() string {
}
func (seat *WlSeat) DashboardPrint(printer func(string, ...interface{})) error {
- printer("%s - %s", Indent(0), seat.Object)
+ s := seat.Object.String()
+ if seat.Name != "" {
+ s += fmt.Sprintf(" %q", seat.Name)
+ }
+ printer("%s - %s", Indent(0), s)
for _, child := range seat.Children {
if i, ok := child.Data.(interface {
dashboardPrint(func(string, ...interface{}), int) error
@@ -89,9 +98,16 @@ func (r *WlSeatImpl) Request(packet *WaylandPacket) error {
}
func (r *WlSeatImpl) Event(packet *WaylandPacket) error {
+ object := r.client.ObjectMap[packet.ObjectId]
+ seat := object.Data.(*WlSeat)
switch packet.Opcode {
case 0: // capabilities
case 1: // name
+ name, err := packet.ReadString()
+ if err != nil {
+ return err
+ }
+ seat.Name = name
}
return nil
}
base-commit: 74115383fe18b05a6be50a934b4a075d8e3d919c
--
2.44.0
[PATCH wlhax 2/2] wl_output: show name
Export this patch
---
wl_output.go | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/wl_output.go b/wl_output.go
index ac687eaf5292..fbd6482eb8ca 100644
--- a/wl_output.go
+++ b/wl_output.go
@@ -1,7 +1,12 @@
package main
+import (
+ "fmt"
+)
+
type WlOutput struct {
Object *WaylandObject
+ Name string
}
func (*WlOutput) DashboardShouldDisplay() bool {
@@ -13,7 +18,11 @@ func (*WlOutput) DashboardCategory() string {
}
func (output *WlOutput) DashboardPrint(printer func(string, ...interface{})) error {
- printer("%s - %s", Indent(0), output.Object)
+ s := output.Object.String()
+ if output.Name != "" {
+ s += fmt.Sprintf(" %q", output.Name)
+ }
+ printer("%s - %s", Indent(0), s)
return nil
}
@@ -46,11 +55,20 @@ func (r *WlOutputImpl) Request(packet *WaylandPacket) error {
}
func (r *WlOutputImpl) Event(packet *WaylandPacket) error {
+ object := r.client.ObjectMap[packet.ObjectId]
+ output := object.Data.(*WlOutput)
switch packet.Opcode {
case 0: // geometry
case 1: // mode
case 2: // done
case 3: // scale
+ case 4: // name
+ name, err := packet.ReadString()
+ if err != nil {
+ return err
+ }
+ output.Name = name
+ case 5: // description
}
return nil
}
--
2.44.0
Applied, thanks!