D29705: Correctly align natural layout in present windows

Vlad Zahorodnii noreply at phabricator.kde.org
Wed May 13 14:25:35 BST 2020


zzag added a comment.


  Hmm, so we effectively deal with two coordinate spaces... `rect / scale` will map `rect` from the "area" coordinate space to the "bounds" coordinate space. `rect * scale` will map `rect` from the "bounds" coordinate space to "area" coordinate space.
  
  - `bounds.x()` is in the "bounds" coordinate space while `(area.width() - 20 - bounds.width() * scale) / 2` is in the "area" coordinate space
  - `bounds.y()` is in the "bounds" coordinate space while `(area.height() - 20 - bounds.height() * scale) / 2` is in the "area" coordinate space
  
  It seems like instead of multiplying `bounds.width()` and `bounds.height()` by `scale` we could instead divide `area.width()` and `area.height()` by scale to simply math, e.g.
  
    bounds.x() - (area.width() / scale - bounds.width()) / 2,
    bounds.y() - (area.height() / scale - bounds.height()) / 2,

REPOSITORY
  R108 KWin

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D29705

To: davidedmundson, #kwin, apol, broulik
Cc: zzag, apol, kwin, Orage, cacarry, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, mkulinski, ragreen, jackyalcine, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwin/attachments/20200513/c87e0124/attachment.htm>


More information about the kwin mailing list