Restrict position of popup window located in another window

Granted this forum post is there a way to restrict allowed position of a popup window?
Thank you!

At the moment, if I drag the pop-up window to the left side of the main window, it is impossible to click on it, so it becomes lost.

Is there a way to access the position of the window at the current time, and to alter it?

Can you not check if the position is out of bounds in OnGUI and clamp the position back into bounds if so?