-
Notifications
You must be signed in to change notification settings - Fork 715
Fixes #4172 Timeout revamp and remove continuous mouse #4173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2_develop
Are you sure you want to change the base?
Conversation
…(old implementation of WantContinuousButtonPressed)
…on firing twice immediately as mouse is pressed down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is awesome.
I'm thinking about it. Makes me wonder if my naming of MouseState makes sense.
Perhaps it should'v been MousePressStates as it really only is relevenant when the mouse is pressed???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am so in love with this PR.
Please see my comments. Mostly about naming stuff.
I made some signifcant changes to the mouse event handling in
to address related bugs that may or may not make merging this difficult.
I'm more than happy to try to deal with that. Or, if you are motivated, please merge #4165 into this first. Just let me know your preference.
Thanks.
public View? MouseGrabView { get; } | ||
|
||
/// <summary>Invoked when a view wants to grab the mouse; can be canceled.</summary> | ||
public event EventHandler<GrabMouseEventArgs>? GrabbingMouse; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these events should be "MouseGrabViewChanging" and "MouseGrabViewChanged".
No need for the "Un" versions (if MouseGrabView
is null...).
What do you think?
/// is called. | ||
/// </summary> | ||
/// <param name="view">View that will receive all mouse events until <see cref="UngrabMouse"/> is invoked.</param> | ||
public void GrabMouse (View? view); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this were Set (View? view)
we could nuke the UnGrab()
method, simplifying the surface area?
/// Runs all idle hooks | ||
/// </summary> | ||
void LockAndRunIdles (); | ||
|
||
/// <summary> | ||
/// Runs all timeouts that are due | ||
/// </summary> | ||
void LockAndRunTimers (); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "Lock" really needed in the name of this function?
@@ -44,6 +21,9 @@ public interface ITimedEvents | |||
/// </remarks> | |||
object AddTimeout (TimeSpan time, Func<bool> callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Timeout" in AddTimeout
is superfluous, now right? This and RemoveTimeout
can be just Add
and Remove
?
/// <see langword="false"/> | ||
/// if the idle handler is not found.</returns> | ||
bool RemoveIdle (Func<bool> fnTrue); | ||
|
||
/// <summary> | ||
/// Invoked when a new timeout is added. To be used in the case when | ||
/// <see cref="Application.EndAfterFirstIteration"/> is <see langword="true"/>. | ||
/// </summary> | ||
event EventHandler<TimeoutEventArgs>? TimeoutAdded; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
?
/// there are no active timers. | ||
/// </param> | ||
/// <returns><see langword="true"/> if there is a timer active.</returns> | ||
bool CheckTimers (out int waitTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check
?
@@ -32,15 +32,15 @@ internal interface IMainLoopDriver | |||
void Wakeup (); | |||
} | |||
|
|||
/// <summary>The MainLoop monitors timers and idle handlers.</summary> | |||
/// <summary>The MainLoop monitors timers handlers.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timers->timer
@@ -32,15 +32,15 @@ internal interface IMainLoopDriver | |||
void Wakeup (); | |||
} | |||
|
|||
/// <summary>The MainLoop monitors timers and idle handlers.</summary> | |||
/// <summary>The MainLoop monitors timers handlers.</summary> | |||
/// <remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This remarks i no longer needed.
/// <summary> | ||
/// <para> | ||
/// Handler for raising periodic events while the mouse is held down. | ||
/// Typically, mouse pointer only needs to be pressed down in a view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pointer->button
I didn't realize it was still failing, because it never failed me again. |
This is super set of #4172 and #4123 it adds also the smooth timeout class
Fixes
v2win/v2net
-WantContinuousButtonPressed
does not repeat. #4101Proposed Changes/Todos
Pull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)