Le 17/07/2014 23:24, Marcelo Galvão Póvoa a écrit :
I'm not sure how to easily get a pointer to the window containing the current workarea in every part of the code I need to use pixel_ratio. I could use the globally available qApp->activeWindow() macro, but what if the active window is a dialog window instead of the workarea?
This is why there is a method to set it on a QImage/QPixmap. One only needs to have the information when crating it.
Besides, I currently need the device_ratio in some parts outside the Qt frontend (for example, in src/insets/RenderGraphic.cpp), so I couldn't access the window from there.
You could add a method to WorkArea that provides this information (GuiWorkArea knows that). Would RenderImage be able to use it?
Having multiple pixel ratios can indeed be an issue. For example, if a GuiImage is created in a HiDPI screen, it would be assigned a 2x ratio during initialization. But if the window is moved to a LowDPI screen afterwards, the image ratio would need to be updated.
Or a given LyX instance could have one window on one screen and another window on another screen.
I suspect that "interesting" things will happen when a window with previews moves from on screen to another. Except if we already check the size of previews.
JMarc