I have a popup menu that pops up when the right mouse button is used.

I use

Popup.popup(3,0);
Popup.show();

Now, it all works fine EXCEPT when the window's edge is near the desktop edge and the RMB is used near the edge of the window. In this case the popup shows up(to the left of the mouse) and then disappears immediately(making it useless to use near the edge of the window when it is close to the desktop edge).

It seems there is a bug in the code that detects if it is close to the window to pop it up on the left.

If, for example, I scale down the window and move it to so it is not near the desktop edge then it works fine(but it pops up to the right).

I imagine this is a bug with gtk itself. It seems it does this when the popup width and position would extend outside the desktop window... it then positions it to the left of the mouse instead but for some bizarre reason it closes the popup soon after it is shown.