Detect drag to secondary monitor

Is there a way to detect dragging of the plugin editor from one monitor to another ?

you could look at getScreenPosition of the cursor and track if it went into sort of the next sector of each dimension. like width could be 1280pxl and now the cursor was between 0 and 1280, but is now on -1 or 1281, you know it must be a new screen

1 Like

Have a look at the Displays class.

The instance of the class to work with is obtained with:

const juce::Displays& displays = juce::Desktop::getInstance().getDisplays()

During your drag operation, you can always find out which display contains the screen bounds of your editor, for example caling getDisplayForRect() , and react if you see that the display changed since the previous callback

4 Likes