Make sure the popup menu is created within the viewport, even though
the mouse cursor is in the lower, right corner.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@144 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer_unix/CConn.cxx b/vncviewer_unix/CConn.cxx
index c0f7b8a..c618b93 100644
--- a/vncviewer_unix/CConn.cxx
+++ b/vncviewer_unix/CConn.cxx
@@ -365,6 +365,10 @@
void CConn::showMenu(int x, int y) {
menu.check(ID_FULLSCREEN, fullScreen);
+ if (x + menu.width() > viewport->width())
+ x = viewport->width() - menu.width();
+ if (y + menu.height() > viewport->height())
+ y = viewport->height() - menu.height();
menu.move(x, y);
menu.raise();
menu.map();