mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Fixed console scrolling
This commit is contained in:
parent
b0b85b7b43
commit
2250411276
3 changed files with 38 additions and 11 deletions
|
@ -99,6 +99,12 @@ class Program
|
|||
int32 row = GET!<int32>(ptr);
|
||||
int32 dy = GET!<int32>(ptr);
|
||||
mProvider.MouseWheel(col, row, dy);
|
||||
case .ScrollTo:
|
||||
int32 row = GET!<int32>(ptr);
|
||||
mProvider.ScrollTo(row);
|
||||
case .Update:
|
||||
bool paused = GET!<bool>(ptr);
|
||||
mProvider.Update(paused);
|
||||
default:
|
||||
}
|
||||
case .Err(let err):
|
||||
|
@ -126,8 +132,6 @@ class Program
|
|||
|
||||
while (true)
|
||||
{
|
||||
mProvider.Update();
|
||||
|
||||
var process = Platform.BfpProcess_GetById(null, mPid, null);
|
||||
if (process == null)
|
||||
{
|
||||
|
|
|
@ -406,6 +406,10 @@ class ConsolePanel : Panel
|
|||
}
|
||||
}
|
||||
|
||||
float wantViewSize = Math.Max(mConsoleProvider.BufferHeight * mCellHeight, mHeight);
|
||||
if (mView.mHeight != wantViewSize)
|
||||
ResizeComponents();
|
||||
|
||||
if (mScrollableWidget.mVertScrollbar.mThumb.mMouseDown)
|
||||
{
|
||||
Paused = true;
|
||||
|
@ -425,11 +429,8 @@ class ConsolePanel : Panel
|
|||
else
|
||||
mPauseCB.Label = "Paused";
|
||||
|
||||
if (!Paused)
|
||||
{
|
||||
if (mConsoleProvider.Update() case .Dirty)
|
||||
MarkDirty();
|
||||
}
|
||||
if (mConsoleProvider.Update(Paused) case .Dirty)
|
||||
MarkDirty();
|
||||
|
||||
/*if (mScreenInfo != null)
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ class ConsoleProvider
|
|||
|
||||
}
|
||||
|
||||
public virtual UpdateState Update() => .None;
|
||||
public virtual UpdateState Update(bool paused) => .None;
|
||||
|
||||
public virtual uint32 GetColor(int i) => 0xFF000000;
|
||||
}
|
||||
|
@ -752,8 +752,11 @@ class WinNativeConsoleProvider : ConsoleProvider
|
|||
}
|
||||
}
|
||||
|
||||
public override UpdateState Update()
|
||||
public override UpdateState Update(bool paused)
|
||||
{
|
||||
if (paused)
|
||||
return .None;
|
||||
|
||||
ScreenInfo newScreenInfo = new .();
|
||||
if (GetScreenInfo(newScreenInfo))
|
||||
{
|
||||
|
@ -802,7 +805,9 @@ class BeefConConsoleProvider : ConsoleProvider
|
|||
MouseDown,
|
||||
MouseMove,
|
||||
MouseUp,
|
||||
MouseWheel
|
||||
MouseWheel,
|
||||
ScrollTo,
|
||||
Update
|
||||
}
|
||||
|
||||
public class Pipe
|
||||
|
@ -1070,7 +1075,7 @@ class BeefConConsoleProvider : ConsoleProvider
|
|||
*((T*)(ptr += sizeof(T)) - 1)
|
||||
}
|
||||
|
||||
public override UpdateState Update()
|
||||
public override UpdateState Update(bool paused)
|
||||
{
|
||||
if (!mAttached)
|
||||
return .None;
|
||||
|
@ -1100,6 +1105,13 @@ class BeefConConsoleProvider : ConsoleProvider
|
|||
Resize(mResizedWidth, mResizedHeight, false);
|
||||
}
|
||||
|
||||
if (!paused)
|
||||
{
|
||||
mPipe.StartMessage(.Update);
|
||||
mPipe.Stream.Write(paused);
|
||||
mPipe.EndMessage();
|
||||
}
|
||||
|
||||
mPipe.StartMessage(.GetData);
|
||||
mPipe.EndMessage();
|
||||
|
||||
|
@ -1171,6 +1183,16 @@ class BeefConConsoleProvider : ConsoleProvider
|
|||
mPipe.EndMessage();
|
||||
}
|
||||
|
||||
public override void ScrollTo(int row)
|
||||
{
|
||||
if (row == mScrollTop)
|
||||
return;
|
||||
mScrollTop = (.)row;
|
||||
mPipe.StartMessage(.ScrollTo);
|
||||
mPipe.Stream.Write((int32)row);
|
||||
mPipe.EndMessage();
|
||||
}
|
||||
|
||||
public override void KeyDown(KeyCode keyCode, KeyFlags keyFlags)
|
||||
{
|
||||
mPipe.StartMessage(.KeyDown);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue