diff --git a/BeefLibs/Beefy2D/src/widgets/Dialog.bf b/BeefLibs/Beefy2D/src/widgets/Dialog.bf index 1dad129b..c1ce6ec1 100644 --- a/BeefLibs/Beefy2D/src/widgets/Dialog.bf +++ b/BeefLibs/Beefy2D/src/widgets/Dialog.bf @@ -20,7 +20,7 @@ namespace Beefy.widgets public String mTitle ~ delete _; public String mText ~ delete _; public Image mIcon; - public BFWindowBase.Flags mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Modal; + public BFWindowBase.Flags mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Modal | .PopupPosition; public List mButtons = new List() ~ delete _; public List mTabWidgets = new List() ~ delete _; public Dictionary mHandlers = new Dictionary() ~ delete _; diff --git a/BeefySysLib/platform/win/WinBFApp.cpp b/BeefySysLib/platform/win/WinBFApp.cpp index 65ddedd6..b5a19c7a 100644 --- a/BeefySysLib/platform/win/WinBFApp.cpp +++ b/BeefySysLib/platform/win/WinBFApp.cpp @@ -131,9 +131,14 @@ WinBFWindow::WinBFWindow(BFWindow* parent, const StringImpl& title, int x, int y RECT desktopRect; ::SystemParametersInfo(SPI_GETWORKAREA, NULL, &desktopRect, NULL); - if (x + width >= desktopRect.right) + if (x < desktopRect.left) + x = desktopRect.left; + else if (x + width >= desktopRect.right) x = BF_MAX((int)desktopRect.left, desktopRect.right - width); - if (y + height >= desktopRect.bottom) + + if (y < desktopRect.top) + y = desktopRect.top; + else if (y + height >= desktopRect.bottom) y = BF_MAX((int)desktopRect.top, desktopRect.bottom - height); } diff --git a/IDE/src/ui/AttachDialog.bf b/IDE/src/ui/AttachDialog.bf index 3ee51f0c..004507ea 100644 --- a/IDE/src/ui/AttachDialog.bf +++ b/IDE/src/ui/AttachDialog.bf @@ -28,7 +28,7 @@ namespace IDE.ui public this() { mWindowFlags = BFWindow.Flags.ClientSized | BFWindow.Flags.TopMost | BFWindow.Flags.Caption | - BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable; + BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable | .PopupPosition; AddOkCancelButtons(new (evt) => { Attach(); }, null, 0, 1); //mApplyButton = AddButton("Apply", (evt) => { evt.mCloseDialog = false; ApplyChanges(); }); diff --git a/IDE/src/ui/AutoComplete.bf b/IDE/src/ui/AutoComplete.bf index 247beee8..b47dbed3 100644 --- a/IDE/src/ui/AutoComplete.bf +++ b/IDE/src/ui/AutoComplete.bf @@ -1044,9 +1044,12 @@ namespace IDE.ui mTargetEditWidget.Content.GetTextCoordAtCursor(var cursorX, var cursorY); - if (!mInvokeWidget.mIsAboveText) + if (mInvokeWidget?.mIsAboveText != true) y = Math.Max(y, cursorY + gApp.mCodeFont.GetHeight() * 0.0f); + /*if (cursorY > y + gApp.mCodeFont.GetHeight() * 2.5f) + y = cursorY;*/ + float screenX; float screenY; mTargetEditWidget.Content.SelfToRootTranslate(x, y, out screenX, out screenY); diff --git a/IDE/src/ui/FindAndReplaceDialog.bf b/IDE/src/ui/FindAndReplaceDialog.bf index db0071d1..c2c106b4 100644 --- a/IDE/src/ui/FindAndReplaceDialog.bf +++ b/IDE/src/ui/FindAndReplaceDialog.bf @@ -28,7 +28,7 @@ namespace IDE.ui mIsReplace = isReplace; mWindowFlags = BFWindow.Flags.ClientSized | BFWindow.Flags.TopMost | BFWindow.Flags.Caption | - BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable; + BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable | .PopupPosition; AddOkCancelButtons(new (evt) => { DoFind(); }, null, 0, 1); diff --git a/IDE/src/ui/FindClassDialog.bf b/IDE/src/ui/FindClassDialog.bf index e390621e..dd1150c1 100644 --- a/IDE/src/ui/FindClassDialog.bf +++ b/IDE/src/ui/FindClassDialog.bf @@ -10,7 +10,7 @@ namespace IDE.ui public this() { - mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable; + mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition; AddOkCancelButtons(new (evt) => { GotoClass(); }, null, 0, 1); diff --git a/IDE/src/ui/InstalledProjectDialog.bf b/IDE/src/ui/InstalledProjectDialog.bf index a3791a1b..d8d1bb10 100644 --- a/IDE/src/ui/InstalledProjectDialog.bf +++ b/IDE/src/ui/InstalledProjectDialog.bf @@ -32,7 +32,7 @@ namespace IDE.ui public this() { - mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable; + mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition; AddOkCancelButtons(new (evt) => { DoImport(); }, null, 0, 1); //mApplyButton = AddButton("Apply", (evt) => { evt.mCloseDialog = false; ApplyChanges(); }); diff --git a/IDE/src/ui/LaunchDialog.bf b/IDE/src/ui/LaunchDialog.bf index c53630db..383e196c 100644 --- a/IDE/src/ui/LaunchDialog.bf +++ b/IDE/src/ui/LaunchDialog.bf @@ -31,7 +31,7 @@ namespace IDE.ui mSettingHistoryManager = gApp.mLaunchHistoryManager; mTitle = new .("Launch Executable"); - mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable; + mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition; AddOkCancelButtons(new (evt) => { evt.mCloseDialog = false; Launch(); }, null, 0, 1); diff --git a/IDE/src/ui/OpenFileInSolutionDialog.bf b/IDE/src/ui/OpenFileInSolutionDialog.bf index 678a0084..98bcdc0d 100644 --- a/IDE/src/ui/OpenFileInSolutionDialog.bf +++ b/IDE/src/ui/OpenFileInSolutionDialog.bf @@ -67,7 +67,7 @@ namespace IDE.ui public this() { - mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable; + mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition; AddOkCancelButtons(new (evt) => { GotoFile(); }, null, 0, 1); //mApplyButton = AddButton("Apply", (evt) => { evt.mCloseDialog = false; ApplyChanges(); }); diff --git a/IDE/src/ui/PanelPopup.bf b/IDE/src/ui/PanelPopup.bf index d0bf5c39..ba26b735 100644 --- a/IDE/src/ui/PanelPopup.bf +++ b/IDE/src/ui/PanelPopup.bf @@ -11,7 +11,7 @@ namespace IDE.ui class PanelPopup : Widget { public Panel mPanel; - public BFWindowBase.Flags mWindowFlags = .ClientSized | .NoActivate | .NoMouseActivate | .DestAlpha; + public BFWindowBase.Flags mWindowFlags = .ClientSized | .NoActivate | .NoMouseActivate | .DestAlpha | .PopupPosition; Widget mRelativeWidget; bool mReverse; float mMinContainerWidth = 32; diff --git a/IDE/src/ui/ProfileDialog.bf b/IDE/src/ui/ProfileDialog.bf index c3a4850f..e3224155 100644 --- a/IDE/src/ui/ProfileDialog.bf +++ b/IDE/src/ui/ProfileDialog.bf @@ -25,7 +25,7 @@ namespace IDE.ui AddDialogComponent(mThreadCombo); mWindowFlags = BFWindow.Flags.ClientSized | BFWindow.Flags.TopMost | BFWindow.Flags.Caption | - BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable; + BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable | .PopupPosition; mSampleRateEdit = AddEdit(scope String()..AppendF("{0}", gApp.mSettings.mDebuggerSettings.mProfileSampleRate)); diff --git a/IDE/src/ui/PropertiesDialog.bf b/IDE/src/ui/PropertiesDialog.bf index b63346a7..142c789c 100644 --- a/IDE/src/ui/PropertiesDialog.bf +++ b/IDE/src/ui/PropertiesDialog.bf @@ -497,7 +497,7 @@ namespace IDE.ui { //mMinWidth = GS!(320); - mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable; + mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition; mButtonBottomMargin = GS!(6); mButtonRightMargin = GS!(6);