Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47ef5c44 authored by chaviw's avatar chaviw
Browse files

Include current position when setting position for magnified windows

The current code updates the windows position for windows that need to
be magnified using only the magnification spec. When the magnification
is cleared, the position to 0, 0. This isn't correct since the WC
itself may have a position set. Instead, set the window's position to be
the magnification spec + current position. When resetting, set the
position back to the original position and not 0,0

Test: Window that has position offset + magnify
Fixes: 229353818
Change-Id: I47fb447a5d2c44cfd130a05abb1ada1555a5ed5f
parent 75e25115
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2639,7 +2639,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    void applyMagnificationSpec(Transaction t, MagnificationSpec spec) {
        if (shouldMagnify()) {
            t.setMatrix(mSurfaceControl, spec.scale, 0, 0, spec.scale)
                    .setPosition(mSurfaceControl, spec.offsetX, spec.offsetY);
                    .setPosition(mSurfaceControl, spec.offsetX + mLastSurfacePosition.x,
                            spec.offsetY + mLastSurfacePosition.y);
            mLastMagnificationSpec = spec;
        } else {
            clearMagnificationSpec(t);
@@ -2652,7 +2653,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    void clearMagnificationSpec(Transaction t) {
        if (mLastMagnificationSpec != null) {
            t.setMatrix(mSurfaceControl, 1, 0, 0, 1)
                .setPosition(mSurfaceControl, 0, 0);
                .setPosition(mSurfaceControl, mLastSurfacePosition.x, mLastSurfacePosition.y);
        }
        mLastMagnificationSpec = null;
        for (int i = 0; i < mChildren.size(); i++) {