2021-01-10 15:58:17 +01:00
|
|
|
package desktop
|
|
|
|
|
|
|
|
import (
|
2022-07-14 00:58:22 +02:00
|
|
|
"github.com/demodesk/neko/pkg/xevent"
|
2021-01-10 15:58:17 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func (manager *DesktopManagerCtx) OnCursorChanged(listener func(serial uint64)) {
|
2022-07-28 12:20:20 +02:00
|
|
|
xevent.Emmiter.On("cursor-changed", func(payload ...any) {
|
2021-02-28 17:22:55 +01:00
|
|
|
listener(payload[0].(uint64))
|
|
|
|
})
|
2021-01-10 15:58:17 +01:00
|
|
|
}
|
|
|
|
|
2021-01-11 15:30:53 +01:00
|
|
|
func (manager *DesktopManagerCtx) OnClipboardUpdated(listener func()) {
|
2022-07-28 12:20:20 +02:00
|
|
|
xevent.Emmiter.On("clipboard-updated", func(payload ...any) {
|
2021-02-28 17:22:55 +01:00
|
|
|
listener()
|
|
|
|
})
|
2021-01-11 15:30:53 +01:00
|
|
|
}
|
|
|
|
|
2021-01-19 21:01:31 +01:00
|
|
|
func (manager *DesktopManagerCtx) OnFileChooserDialogOpened(listener func()) {
|
2022-07-28 12:20:20 +02:00
|
|
|
xevent.Emmiter.On("file-chooser-dialog-opened", func(payload ...any) {
|
2021-02-28 17:22:55 +01:00
|
|
|
listener()
|
|
|
|
})
|
2021-01-12 00:09:43 +01:00
|
|
|
}
|
|
|
|
|
2021-01-19 21:01:31 +01:00
|
|
|
func (manager *DesktopManagerCtx) OnFileChooserDialogClosed(listener func()) {
|
2022-07-28 12:20:20 +02:00
|
|
|
xevent.Emmiter.On("file-chooser-dialog-closed", func(payload ...any) {
|
2021-02-28 17:22:55 +01:00
|
|
|
listener()
|
|
|
|
})
|
2021-01-18 21:40:57 +01:00
|
|
|
}
|
|
|
|
|
2021-01-10 15:58:17 +01:00
|
|
|
func (manager *DesktopManagerCtx) OnEventError(listener func(error_code uint8, message string, request_code uint8, minor_code uint8)) {
|
2022-07-28 12:20:20 +02:00
|
|
|
xevent.Emmiter.On("event-error", func(payload ...any) {
|
2021-02-28 17:22:55 +01:00
|
|
|
listener(payload[0].(uint8), payload[1].(string), payload[2].(uint8), payload[3].(uint8))
|
|
|
|
})
|
2021-01-10 15:58:17 +01:00
|
|
|
}
|