1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Multi-monitor fixes

This commit is contained in:
Brian Fiete 2020-05-07 08:39:40 -07:00
parent 7f0a81b5b3
commit 26604017f8
8 changed files with 133 additions and 32 deletions

View file

@ -81,6 +81,9 @@ namespace Beefy
[StdCall, CLink]
static extern void BFApp_GetWorkspaceRect(out int32 x, out int32 y, out int32 width, out int32 height);
[StdCall, CLink]
static extern void BFApp_GetWorkspaceRectFrom(int32 x, int32 y, int32 width, int32 height, out int32 outX, out int32 outY, out int32 outWidth, out int32 outHeight);
[StdCall, CLink]
static extern void BFApp_Create();
@ -447,6 +450,19 @@ namespace Beefy
height = heightOut;
}
public void GetWorkspaceRectFrom(int fromX, int fromY, int fromWidth, int fromHeight, out int outX, out int outY, out int outWidth, out int outHeight)
{
int32 xOut;
int32 yOut;
int32 widthOut;
int32 heightOut;
BFApp_GetWorkspaceRectFrom((.)fromX, (.)fromY, (.)fromWidth, (.)fromHeight, out xOut, out yOut, out widthOut, out heightOut);
outX = xOut;
outY = yOut;
outWidth = widthOut;
outHeight = heightOut;
}
public bool HasModalDialogs()
{
for (var window in mWindows)

View file

@ -51,7 +51,7 @@ namespace Beefy.theme.dark
mText = new String(text);
mAllowResize = allowResize;
BFApp.sApp.GetWorkspaceRect(var workspaceX, var workspaceY, var workspaceWidth, var workspaceHeight);
BFApp.sApp.GetWorkspaceRectFrom((.)x, (.)y, 0, 0, var workspaceX, var workspaceY, var workspaceWidth, var workspaceHeight);
float maxWidth = workspaceWidth - GS!(32);
FontMetrics fontMetrics = .();

View file

@ -178,7 +178,7 @@ namespace Beefy.widgets
base.Resize(x, y, width, height);
}
public virtual void CalcContainerSize(MenuContainer menuContainer, bool allowScrollable, ref float screenX, ref float screenY, out float width, out float height)
public virtual void CalcContainerSize(float x, float y, MenuContainer menuContainer, bool allowScrollable, ref float screenX, ref float screenY, out float width, out float height)
{
Rect menuRect = menuContainer.CalcRectFromContent();
width = Math.Min(mMaxContainerWidth, Math.Max(mMinContainerWidth, menuRect.mWidth));
@ -188,7 +188,7 @@ namespace Beefy.widgets
int workspaceY;
int workspaceWidth;
int workspaceHeight;
BFApp.sApp.GetWorkspaceRect(out workspaceX, out workspaceY, out workspaceWidth, out workspaceHeight);
BFApp.sApp.GetWorkspaceRectFrom((.)x, (.)y, 0, 0, out workspaceX, out workspaceY, out workspaceWidth, out workspaceHeight);
float maxY = workspaceY + workspaceHeight;
@ -250,13 +250,14 @@ namespace Beefy.widgets
float screenX;
float screenY;
relativeWidget.SelfToRootTranslate(0, curY, out screenX, out screenY);
screenX += relativeWidget.mWidgetWindow.mClientX;
screenY += relativeWidget.mWidgetWindow.mClientY;
int wsX;
int wsY;
int wsWidth;
int wsHeight;
BFApp.sApp.GetWorkspaceRect(out wsX, out wsY, out wsWidth, out wsHeight);
BFApp.sApp.GetWorkspaceRectFrom((.)screenX, (.)screenY, 0, 0, out wsX, out wsY, out wsWidth, out wsHeight);
float spaceLeft = (wsY + wsHeight) - (screenY);
if (spaceLeft < minHeight)
{
@ -299,7 +300,10 @@ namespace Beefy.widgets
float screenWidth;
float screenHeight;
CalcContainerSize(menuContainer, allowScrollable, ref screenX, ref screenY, out screenWidth, out screenHeight);
CalcContainerSize(screenX, screenY, menuContainer, allowScrollable, ref screenX, ref screenY, out screenWidth, out screenHeight);
screenWidth = Math.Max(screenWidth, 32);
screenHeight = Math.Max(screenHeight, 32);
WidgetWindow parentWindow = (relativeWidget != null) ? relativeWidget.mWidgetWindow : null;
curWidgetWindow = new WidgetWindow(parentWindow,
@ -332,7 +336,7 @@ namespace Beefy.widgets
float screenWidth;
float screenHeight;
CalcContainerSize(menuContainer, allowScrollable, ref screenX, ref screenY, out screenWidth, out screenHeight);
CalcContainerSize(x, y, menuContainer, allowScrollable, ref screenX, ref screenY, out screenWidth, out screenHeight);
curWidgetWindow.Resize((int32)(screenX), (int32)(screenY),
(int32)screenWidth, (int32)screenHeight);