After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705915 - Support high dpi displays
Support high dpi displays
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: x11
git master
Other Linux
: High enhancement
: ---
Assigned To: clutter-maint
clutter-maint
3.10.1
: 705298 723602 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-08-13 15:01 UTC by Emmanuele Bassi (:ebassi)
Modified: 2014-02-07 17:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
stage-window: Add scaling factor accessors (2.74 KB, patch)
2013-08-14 10:31 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
stage: Adjust drawing to include the window scaling factor (12.04 KB, patch)
2013-08-14 10:32 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
x11: Apply the window scaling factor (18.80 KB, patch)
2013-08-14 10:32 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
cogl: Compensate for window scaling (8.63 KB, patch)
2013-08-14 10:32 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
settings: Add window scaling related settings (6.36 KB, patch)
2013-08-14 10:32 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Check for cairo_surface_set_device_scale() (1.68 KB, patch)
2014-01-16 12:30 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
settings: Handle window scaling factor internally (2.99 KB, patch)
2014-01-16 12:30 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
x11/stage: Remove CLUTTER_SCALE handling (2.35 KB, patch)
2014-01-16 12:30 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
x11/stage: Resize on window-scaling-factor changes (2.67 KB, patch)
2014-01-16 12:30 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
settings: Remove explicit stage scaling factor update (1.61 KB, patch)
2014-01-16 12:30 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
canvas: Use the window-scaling-factor setting (3.99 KB, patch)
2014-01-16 12:30 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
canvas: Add scale-factor property (8.24 KB, patch)
2014-01-17 11:06 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Emmanuele Bassi (:ebassi) 2013-08-13 15:01:16 UTC
similar to the hidpi work done in GTK, Clutter needs to support scaling the UI by a known factor transparently to the application developer.

this bug is for supporting scaling the UI in the X11 backend; the Wayland and GDK backends will have to follow suit separately.
Comment 1 Emmanuele Bassi (:ebassi) 2013-08-14 10:31:57 UTC
Created attachment 251595 [details] [review]
stage-window: Add scaling factor accessors

We'll need to set and get the scaling factor of a ClutterStage from its
StageWindow implementation.
Comment 2 Emmanuele Bassi (:ebassi) 2013-08-14 10:32:11 UTC
Created attachment 251596 [details] [review]
stage: Adjust drawing to include the window scaling factor

In order to transparently support high DPI density displays, we must
maintain all coordinates and sizes exactly as they are now — but draw
them on a surface that is scaled up by a certain factor. In order to
do that we have to change the viewport and initial transformation
matrix so that they are scaled up by the same factor.
Comment 3 Emmanuele Bassi (:ebassi) 2013-08-14 10:32:20 UTC
Created attachment 251597 [details] [review]
x11: Apply the window scaling factor

On high DPI density displays we create surfaces with a size scaled up by
a certain factor. Even if the contents stay at the same relative size
and position, we need to compensate the scaling both when changing the
surface size, and when dealing with input.
Comment 4 Emmanuele Bassi (:ebassi) 2013-08-14 10:32:29 UTC
Created attachment 251598 [details] [review]
cogl: Compensate for window scaling

The common stage window code that we share on Cogl-based backends should
also use the scaling factor.
Comment 5 Emmanuele Bassi (:ebassi) 2013-08-14 10:32:38 UTC
Created attachment 251599 [details] [review]
settings: Add window scaling related settings

We share two settings with GDK, so we can pick the window scaling factor
and the unscaled font resolution when we initialize Clutter.
Comment 6 Emmanuele Bassi (:ebassi) 2013-09-15 09:52:36 UTC
*** Bug 705298 has been marked as a duplicate of this bug. ***
Comment 7 Emmanuele Bassi (:ebassi) 2013-09-19 22:12:14 UTC
Attachment 251595 [details] pushed as b9072a5 - stage-window: Add scaling factor accessors
Attachment 251596 [details] pushed as 0d0cb13 - stage: Adjust drawing to include the window scaling factor
Attachment 251597 [details] pushed as 75f81fe - x11: Apply the window scaling factor
Attachment 251598 [details] pushed as a26690a - cogl: Compensate for window scaling
Comment 8 Emmanuele Bassi (:ebassi) 2014-01-16 12:30:05 UTC
Created attachment 266449 [details] [review]
Check for cairo_surface_set_device_scale()

Like gtk+, we don't want to bump the dependency of Clutter for that
function alone.
Comment 9 Emmanuele Bassi (:ebassi) 2014-01-16 12:30:15 UTC
Created attachment 266450 [details] [review]
settings: Handle window scaling factor internally

We want the settings object to handle setting and getting the
window scaling factor value, both through backend-specific settings and
through the CLUTTER_SCALE environment variable. This means turning the
ClutterSettings:window-scaling-factor property into a readwrite one,
instead of write-only, so that ClutterStage implementations will be able
to query the window scaling factor on construction.
Comment 10 Emmanuele Bassi (:ebassi) 2014-01-16 12:30:24 UTC
Created attachment 266451 [details] [review]
x11/stage: Remove CLUTTER_SCALE handling

Use the ClutterSettings:window-scaling-factor property instead.
Comment 11 Emmanuele Bassi (:ebassi) 2014-01-16 12:30:32 UTC
Created attachment 266452 [details] [review]
x11/stage: Resize on window-scaling-factor changes

If we get a change in the window scaling factor we want to resize the
backing store of each stage, so we use the notification on the
ClutterSettings:window-scaling-factor property to do so.
Comment 12 Emmanuele Bassi (:ebassi) 2014-01-16 12:30:41 UTC
Created attachment 266453 [details] [review]
settings: Remove explicit stage scaling factor update

We can rely on the window-scaling-factor property notification instead.
Comment 13 Emmanuele Bassi (:ebassi) 2014-01-16 12:30:50 UTC
Created attachment 266454 [details] [review]
canvas: Use the window-scaling-factor setting

ClutterCanvas is a ClutterContent interface implementation; this means
that it can be created and modified regardless of whether it is
associated to a specific actor or a stage. For this reason, we cannot
walk the hierarchy and get the window scaling factor for high DPI
density displays out of the ClutterStage when we create the Cairo
surface that we will use to draw the canvas contents on.

We can use ClutterSettings:window-scaling-factor instead, since it's
what each ClutterStage will use anyway.

This will get slightly more complicated when we support per-output
window scaling factors (like on Wayland), but that will require changes
in the entire settings architecture anyway.
Comment 14 Emmanuele Bassi (:ebassi) 2014-01-16 12:34:35 UTC
with the last batch of commits I'm able to get ClutterCanvas with proper scaling.

this does not help the Shell, because they are using StDrawingArea, which is a reimplementation of ClutterCairoTexture, so we'll need to patch that to use the window scaling factor explicitly — or to use ClutterCanvas internally.
Comment 15 Emmanuele Bassi (:ebassi) 2014-01-17 11:06:06 UTC
Created attachment 266542 [details] [review]
canvas: Add scale-factor property

We need to provide an escape hatch to ClutterCanvas so that it's
possible to override the window-scaling-factor ClutterSetting. This is
going to be useful in the future in case the user has better knowledge
of the window scaling factor that is going to be used with a specific
set of ClutterCanvas contents (e.g. on different outputs or stages).
Comment 16 Emmanuele Bassi (:ebassi) 2014-01-23 12:54:58 UTC
pushed the additional commits, alongside with a couple of fixes for ClutterSettings and ClutterStageX11.
Comment 17 Florian Müllner 2014-02-07 17:32:58 UTC
*** Bug 723602 has been marked as a duplicate of this bug. ***