Panel positioning on multi-monitor setup

I’m trying to port my dict.cc add-on from XUL to the new SDK.
In my add-on I’m showing a small panel at the position of the mouse when alt-clicking on text in a page.

The problem is, that positioning it with a json object causes weird re-positioning on a multi-monitor setup:
I have 2 Full HD Monitors, the left one in landscape mode and the right one in portrait mode.
The panel is about 250px wide and 30px high in this case.

When the browser is maximized and panel is completely inside of the left half of the window/monitor, everything is fine. But once it has a few pixels in the right half of the window, it will be moved to the second monitor.

If the window is not maximized, the behavior is a bit different, but it still seems to have something to do with half the browser size and/or half the monitor size.
It seems the smaller the width of the window, the more to the right (of the first monitor) I can open the panel.

Is there any way to disable this re-positioning? I can live with the panel being only half on a monitor.

While browsing the forum I stumbled over getActiveView(panel);
I noticed that the view had a moveTo(x,y) which took screen coordinates.
So after calling panel.show(), I can use panelView.moveTo(screenX, screenY) and everything works nicely.

Horray for rubber ducking.

What’s rubber ducking by the way? New word for me :slightly_smiling:

Explained here, among other programming jargon:
http://blog.codinghorror.com/new-programming-jargon/

1 Like

Hahaha superb!