mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
@@ -522,9 +522,9 @@ namespace Terminal.Gui {
|
||||
void WindowsInputHandler ()
|
||||
{
|
||||
while (true) {
|
||||
waitForProbe.Wait ();
|
||||
waitForProbe.Wait ();
|
||||
waitForProbe.Reset ();
|
||||
|
||||
|
||||
uint numberEventsRead = 0;
|
||||
|
||||
WindowsConsole.ReadConsoleInput (winConsole.InputHandle, records, 1, out numberEventsRead);
|
||||
@@ -568,8 +568,19 @@ namespace Terminal.Gui {
|
||||
waitForProbe.Set ();
|
||||
|
||||
try {
|
||||
if (!tokenSource.IsCancellationRequested)
|
||||
eventReady.Wait (waitTimeout, tokenSource.Token);
|
||||
while (result == null) {
|
||||
if (wait && waitTimeout == -1) {
|
||||
waitTimeout = 0;
|
||||
}
|
||||
if (!tokenSource.IsCancellationRequested)
|
||||
eventReady.Wait (waitTimeout, tokenSource.Token);
|
||||
if (result != null) {
|
||||
break;
|
||||
}
|
||||
if (mainLoop.timeouts.Count > 0 || mainLoop.idleHandlers.Count > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (OperationCanceledException) {
|
||||
return true;
|
||||
} finally {
|
||||
|
||||
@@ -214,7 +214,18 @@ namespace Mono.Terminal {
|
||||
|
||||
UpdatePollMap ();
|
||||
|
||||
n = poll (pollmap, (uint)pollmap.Length, pollTimeout);
|
||||
while (true) {
|
||||
if (wait && pollTimeout == -1) {
|
||||
pollTimeout = 0;
|
||||
}
|
||||
n = poll (pollmap, (uint)pollmap.Length, pollTimeout);
|
||||
if (pollmap != null) {
|
||||
break;
|
||||
}
|
||||
if (mainLoop.timeouts.Count > 0 || mainLoop.idleHandlers.Count > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
int ic;
|
||||
lock (mainLoop.idleHandlers)
|
||||
ic = mainLoop.idleHandlers.Count;
|
||||
@@ -454,7 +465,7 @@ namespace Mono.Terminal {
|
||||
running = false;
|
||||
driver.Wakeup ();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether there are pending events to be processed.
|
||||
/// </summary>
|
||||
|
||||
@@ -521,13 +521,19 @@ namespace Terminal.Gui {
|
||||
///<inheritdoc cref="MouseEvent(Gui.MouseEvent)"/>
|
||||
public override bool MouseEvent (MouseEvent me)
|
||||
{
|
||||
if (me.Flags != MouseFlags.WheeledDown && me.Flags != MouseFlags.WheeledUp)
|
||||
if (me.Flags != MouseFlags.WheeledDown && me.Flags != MouseFlags.WheeledUp &&
|
||||
me.Flags != MouseFlags.Button1Pressed && me.Flags != MouseFlags.Button1Clicked &&
|
||||
!me.Flags.HasFlag (MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition))
|
||||
return false;
|
||||
|
||||
if (me.Flags == MouseFlags.WheeledDown)
|
||||
ScrollDown (1);
|
||||
else if (me.Flags == MouseFlags.WheeledUp)
|
||||
ScrollUp (1);
|
||||
else if (me.X == vertical.Frame.X)
|
||||
vertical.MouseEvent (me);
|
||||
else if (me.Y == horizontal.Frame.Y)
|
||||
horizontal.MouseEvent (me);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using Terminal.Gui;
|
||||
|
||||
namespace UICatalog {
|
||||
/// <summary>
|
||||
/// Base class for each demo/scenario. To define a new sceanrio simply
|
||||
/// Base class for each demo/scenario. To define a new scenario simply
|
||||
///
|
||||
/// 1) declare a class derived from Scenario,
|
||||
/// 2) Set Name and Description as appropriate using [ScenarioMetadata] attribute
|
||||
@@ -14,8 +14,8 @@ namespace UICatalog {
|
||||
/// 4) Implement Setup.
|
||||
/// 5) Optionally, implement Run.
|
||||
///
|
||||
/// The Main program uses reflection to find all sceanarios and adds them to the
|
||||
/// ListViews. Press ENTER to run the selected sceanrio. Press CTRL-Q to exit it.
|
||||
/// The Main program uses reflection to find all scenarios and adds them to the
|
||||
/// ListViews. Press ENTER to run the selected scenario. Press CTRL-Q to exit it.
|
||||
/// </summary>
|
||||
public class Scenario : IDisposable {
|
||||
private bool _disposedValue;
|
||||
@@ -26,6 +26,7 @@ namespace UICatalog {
|
||||
public Toplevel Top { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Window for the Scenario. This should be set within the `Application.Top` in most cases.
|
||||
/// </summary>
|
||||
public Window Win { get; set; }
|
||||
|
||||
@@ -88,7 +89,7 @@ namespace UICatalog {
|
||||
public string GetName () => ScenarioMetadata.GetName (this.GetType ());
|
||||
|
||||
/// <summary>
|
||||
/// Helper to get the Scenario Descripiton
|
||||
/// Helper to get the Scenario Description
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetDescription () => ScenarioMetadata.GetDescription (this.GetType ());
|
||||
@@ -137,7 +138,7 @@ namespace UICatalog {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the scenario. Override to start the scearnio using a Top level different than `Top`.
|
||||
/// Runs the scenario. Override to start the scenario using a Top level different than `Top`.
|
||||
/// </summary>
|
||||
public virtual void Run ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user