On 01-06-2019 02:14, Alex X wrote:

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.

I don't have this issue with the GtkD popup menu demo (demos/gtk/PopupMenu).

Some interesting things tough, if i change the swhowAll in the demo to
show like you are using, i get a popup without any menu items.

When passing 0 as the activateTime to the popup call i get the issue
in the entire window and not just close to the edge, the demo passes in
the time from the event. And according to the GTK documentation you
should always do this so it can resolve conflicts between concurrent
keyboard/mouse events.

I'm on Linux so that might explain the difference in behavior for the popup.