Fix some misbehaviour with the scroll widget caused by the popup menu.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4458 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 91daf9e..3dd53e2 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -82,6 +82,12 @@
   // button component (which we don't want)
   contextMenu->box(FL_NO_BOX);
 
+  // The (invisible) button associated with this widget can mess with
+  // things like Fl_Scroll so we need to get rid of any parents.
+  // Unfortunately that's not possible because of STR #2654, but
+  // reparenting to the current window works for most cases.
+  window()->add(contextMenu);
+
   initContextMenu();
 
   setMenuKey();
@@ -617,8 +623,6 @@
   if (window()->contains(Fl::focus()))
     Fl::focus(NULL);
 
-  contextMenu->position(Fl::event_x(), Fl::event_y());
-
   m = contextMenu->popup();
   if (m == NULL)
     return;