neko/server/internal/desktop/xevent.go

36 lines
1.0 KiB
Go
Raw Normal View History

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