You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
There are 2 global 'pre' handlers that fire before events get passed to any Views. These are:
Application.RootKeyEvent
Application.RootMouseEvent
RootKeyEvent is a Func<KeyEvent,bool> which allows callback to return true to cancel the event. But RootMouseEvent is Action<MouseEvent> and there is no Handled property on MouseEvent for cancelling (or any other way I could see to cancel).
My primary use case for cancellation is in TerminalGuiDesigner where you don't want right clicking in controls such as TextField to throw up the context menu - Instead the designer wants to show its own context menu and suppress right click events).
Also for consistency with RootKeyEvent.
Also handy if events are being misreported in an environment e.g. like #1617 . A developer could add a global event handler that turned off the mouse completely by just returning true.
Describe the solution you'd like
Change RootMouseEvent to Func<MouseEvent,bool> so that it works like keyboard one.
The code change to achieve this is quite small but it is a breaking change for anyone subscribing to this event. The current docs for this event are:
Is your feature request related to a problem? Please describe.
There are 2 global 'pre' handlers that fire before events get passed to any Views. These are:
RootKeyEvent
is aFunc<KeyEvent,bool>
which allows callback to return true to cancel the event. ButRootMouseEvent
isAction<MouseEvent>
and there is noHandled
property onMouseEvent
for cancelling (or any other way I could see to cancel).My primary use case for cancellation is in TerminalGuiDesigner where you don't want right clicking in controls such as TextField to throw up the context menu - Instead the designer wants to show its own context menu and suppress right click events).
Also for consistency with RootKeyEvent.
Also handy if events are being misreported in an environment e.g. like #1617 . A developer could add a global event handler that turned off the mouse completely by just returning
true
.Describe the solution you'd like
Change
RootMouseEvent
toFunc<MouseEvent,bool>
so that it works like keyboard one.The code change to achieve this is quite small but it is a breaking change for anyone subscribing to this event. The current docs for this event are:
Terminal.Gui/Terminal.Gui/Core/Application.cs
Lines 641 to 644 in 32e7b63
So I don't think there will be that many users of this bit of the system so the breakage is limited.
The text was updated successfully, but these errors were encountered: