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

Commit df3e0b93 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

fix [2152247] Windows sometimes drawn scaled up.

parent 6656dbc8
Loading
Loading
Loading
Loading
+34 −4
Original line number Diff line number Diff line
@@ -342,6 +342,12 @@ uint32_t Layer::doTransaction(uint32_t flags)
            }
        }

        // this will make sure LayerBase::doTransaction doesn't update
        // the drawing state's size
        Layer::State& editDraw(mDrawingState);
        editDraw.requested_w = temp.requested_w;
        editDraw.requested_h = temp.requested_h;

        // record the new size, form this point on, when the client request a
        // buffer, it'll get the new size.
        setDrawingSize(temp.requested_w, temp.requested_h);
@@ -389,12 +395,36 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
    const Region dirty(lcblk->getDirtyRegion(buf));
    mPostedDirtyRegion = dirty.intersect( newFrontBuffer->getBounds() );


    const Layer::State& front(drawingState());
    if (newFrontBuffer->getWidth() == front.w &&
        newFrontBuffer->getHeight() ==front.h) {
    if (newFrontBuffer->getWidth()  == front.requested_w &&
        newFrontBuffer->getHeight() == front.requested_h)
    {
        if ((front.w != front.requested_w) ||
            (front.h != front.requested_h))
        {
            // Here we pretend the transaction happened by updating the
            // current and drawing states. Drawing state is only accessed
            // in this thread, no need to have it locked
            Layer::State& editDraw(mDrawingState);
            editDraw.w = editDraw.requested_w;
            editDraw.h = editDraw.requested_h;

            // We also need to update the current state so that we don't
            // end-up doing too much work during the next transaction.
            // NOTE: We actually don't need hold the transaction lock here
            // because State::w and State::h are only accessed from
            // this thread
            Layer::State& editTemp(currentState());
            editTemp.w = editDraw.w;
            editTemp.h = editDraw.h;

            // recompute visible region
            recomputeVisibleRegions = true;

            // we now have the correct size, unfreeze the screen
            mFreezeLock.clear();
        }
    }

    // FIXME: signal an event if we have more buffers waiting
    // mFlinger->signalEvent();