Druid: X11 shell does not handle DPI scaling.

Created on 15 May 2020  路  5Comments  路  Source: linebender/druid

This should be done after #904 is merged.

help wanted missing shelx11

All 5 comments

Note: from further experimentation, we've come up with these two functions, which works well at least on my system. Feel free to re-use if it's useful.

It appears to me that the window gets created with the correct (scaled) size and contents are scaled correctly, yet the draw buffer is not scaled (with scale factor 2, only the top-left quarter gets drawn).

Given a couple of hints I could probably make a PR.

Probably the invalidation/presentation region is not being scaled. Look at the PresentData::present function: the region it gets is in druid coordinates, and you'll need to put the x_rects in pixel coordinates. You'll also need to handle the scaling for the expose event in handle_expose (that one at least has a TODO comment).

Note that we also have a fallback drawing method in case the present extension isn't available; that one will need to handle scaling too, and the relevant code is near the end of Window::render. To test that fallback code, set the DRUID_SHELL_DISABLE_X11_PRESENT environment variable.

I was wrong: the behaviour mentioned happens with the GTK backend; with X11 there is no scaling. I have a fix that seems to work for GTK.

No github, this isn't fixed yet.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmyr picture cmyr  路  3Comments

mrandri19 picture mrandri19  路  4Comments

timothyhollabaugh picture timothyhollabaugh  路  3Comments

bheisler picture bheisler  路  5Comments

MGlolenstine picture MGlolenstine  路  3Comments