mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32: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 row = GET!<int32>(ptr);
|
||||||
int32 dy = GET!<int32>(ptr);
|
int32 dy = GET!<int32>(ptr);
|
||||||
mProvider.MouseWheel(col, row, dy);
|
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:
|
default:
|
||||||
}
|
}
|
||||||
case .Err(let err):
|
case .Err(let err):
|
||||||
|
@ -126,8 +132,6 @@ class Program
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
mProvider.Update();
|
|
||||||
|
|
||||||
var process = Platform.BfpProcess_GetById(null, mPid, null);
|
var process = Platform.BfpProcess_GetById(null, mPid, null);
|
||||||
if (process == 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)
|
if (mScrollableWidget.mVertScrollbar.mThumb.mMouseDown)
|
||||||
{
|
{
|
||||||
Paused = true;
|
Paused = true;
|
||||||
|
@ -425,11 +429,8 @@ class ConsolePanel : Panel
|
||||||
else
|
else
|
||||||
mPauseCB.Label = "Paused";
|
mPauseCB.Label = "Paused";
|
||||||
|
|
||||||
if (!Paused)
|
if (mConsoleProvider.Update(Paused) case .Dirty)
|
||||||
{
|
MarkDirty();
|
||||||
if (mConsoleProvider.Update() case .Dirty)
|
|
||||||
MarkDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if (mScreenInfo != null)
|
/*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;
|
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 .();
|
ScreenInfo newScreenInfo = new .();
|
||||||
if (GetScreenInfo(newScreenInfo))
|
if (GetScreenInfo(newScreenInfo))
|
||||||
{
|
{
|
||||||
|
@ -802,7 +805,9 @@ class BeefConConsoleProvider : ConsoleProvider
|
||||||
MouseDown,
|
MouseDown,
|
||||||
MouseMove,
|
MouseMove,
|
||||||
MouseUp,
|
MouseUp,
|
||||||
MouseWheel
|
MouseWheel,
|
||||||
|
ScrollTo,
|
||||||
|
Update
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Pipe
|
public class Pipe
|
||||||
|
@ -1070,7 +1075,7 @@ class BeefConConsoleProvider : ConsoleProvider
|
||||||
*((T*)(ptr += sizeof(T)) - 1)
|
*((T*)(ptr += sizeof(T)) - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UpdateState Update()
|
public override UpdateState Update(bool paused)
|
||||||
{
|
{
|
||||||
if (!mAttached)
|
if (!mAttached)
|
||||||
return .None;
|
return .None;
|
||||||
|
@ -1100,6 +1105,13 @@ class BeefConConsoleProvider : ConsoleProvider
|
||||||
Resize(mResizedWidth, mResizedHeight, false);
|
Resize(mResizedWidth, mResizedHeight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!paused)
|
||||||
|
{
|
||||||
|
mPipe.StartMessage(.Update);
|
||||||
|
mPipe.Stream.Write(paused);
|
||||||
|
mPipe.EndMessage();
|
||||||
|
}
|
||||||
|
|
||||||
mPipe.StartMessage(.GetData);
|
mPipe.StartMessage(.GetData);
|
||||||
mPipe.EndMessage();
|
mPipe.EndMessage();
|
||||||
|
|
||||||
|
@ -1171,6 +1183,16 @@ class BeefConConsoleProvider : ConsoleProvider
|
||||||
mPipe.EndMessage();
|
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)
|
public override void KeyDown(KeyCode keyCode, KeyFlags keyFlags)
|
||||||
{
|
{
|
||||||
mPipe.StartMessage(.KeyDown);
|
mPipe.StartMessage(.KeyDown);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue