Best Practice for handling different dpi scaling values


I am running into some troubles making my application support different dpi scaling factors. 

Eg. the isInterestedInFileDrag() method is not called for the correct component because getComponentAt() in ComponentPeer::handleDragMove() only uses the scaling factor if the parent component is on the desktop itself (if I read the internals of this method correctly).

Do I miss something trivial here (calling something like setGlobalScaleFactor() on the main component of the application), or what are the best practices to support multiple scaling factors?

Possible drag drop bug on scaled windows

In my opinion the dpi & scaling information is just there to allow you estimating the real size of items on the screen.

I wrote a cross-platform app recently, working on computer, iOS & Android devices. I coded a layout engine to position and size items on the screen depending on the resolution, scaling and dpi in order to get a similar GUI appearance on any kind of device. Scaling & dpi are just used to know how many pixels are needed to get a specific size in inch. It is useful to ensure having a correct touch area size on touch-screen devices with high dpi. In my case, I determine a cell size (0.5 inch) which is the minimum touch sensitive area dimension. Then the whole component size & location is calculated from this cell size.

The mouse & component information & methods are always talking in pixel unit, independently of the dpi & scaling.



We weren't aware of any bugs in the drag-and-drop functionality - what platform are you using, and how could we reproduce this? Does it happen in the juce demo app on your machine?