From e414e20215db3a80bb1cf511390406324e742ebf Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 24 Mar 2018 22:14:17 +0200 Subject: Add mouse handler stub and keep track of focus --- ui/widget/room-view.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ui/widget/room-view.go') diff --git a/ui/widget/room-view.go b/ui/widget/room-view.go index 2e82a2d..2da3023 100644 --- a/ui/widget/room-view.go +++ b/ui/widget/room-view.go @@ -95,6 +95,13 @@ func (view *RoomView) SetInputCapture(fn func(room *RoomView, event *tcell.Event return view } +func (view *RoomView) SetMouseCapture(fn func(room *RoomView, event *tcell.EventMouse) *tcell.EventMouse) *RoomView { + view.input.SetMouseCapture(func(event *tcell.EventMouse) *tcell.EventMouse { + return fn(view, event) + }) + return view +} + func (view *RoomView) SetInputSubmitFunc(fn func(room *RoomView, text string)) *RoomView { view.input.SetDoneFunc(func(key tcell.Key) { if key == tcell.KeyEnter { -- cgit v1.2.3