1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-29 12:55:59 +02:00

Fix HoverWatch handling of multiple-monitors

Prior to this change, 'workspaceWidth' was not retrieved with screen
coordinates so the width was sometimes wrong depending on which monitor
of a virtual screen the window was on. Sometimes the 'maxWidth'
calculated from this was negative which led to a very bad place.
This commit is contained in:
Joseph Battelle 2021-02-03 00:11:12 -08:00
parent 76d997fca7
commit e9814ec527

View file

@ -1221,13 +1221,19 @@ namespace IDE.ui
int workspaceY;
int workspaceWidth;
int workspaceHeight;
BFApp.sApp.GetWorkspaceRectFrom((.)listView.mRequestPos.Value.x, (.)listView.mRequestPos.Value.y, 1, 1, out workspaceX, out workspaceY, out workspaceWidth, out workspaceHeight);
float popupX = listView.mRequestPos.Value.x;
float popupY = listView.mRequestPos.Value.y;
int screenX = (int)popupX + (int)mOrigScreenX;
int maxWidth = workspaceWidth - screenX - GS!(8);
// GetWorkspaceRectFrom expects virtual screen coordinates
int screenX = (.)(popupX + mOrigScreenX);
int screenY = (.)(popupY + mOrigScreenY);
BFApp.sApp.GetWorkspaceRectFrom(screenX, screenY, 1, 1,
out workspaceX, out workspaceY, out workspaceWidth, out workspaceHeight);
int maxWidth = workspaceWidth - screenX + workspaceX - GS!(8);
if (mTextPanel != null)
{
maxWidth = Math.Min(maxWidth, mTextPanel.mWidgetWindow.mWindowWidth);